]> git.proxmox.com Git - mirror_edk2.git/blame - MdeModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompressLibInternal.h
MdeModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / MdeModulePkg / Library / LzmaCustomDecompressLib / LzmaDecompressLibInternal.h
CommitLineData
11ff2c71
LG
1/** @file\r
2 LZMA Decompress Library internal header file declares Lzma decompress interfaces.\r
3\r
d1102dba 4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
9d510e61 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
11ff2c71
LG
6\r
7**/\r
8\r
9#ifndef __LZMADECOMPRESSLIB_INTERNAL_H__\r
10#define __LZMADECOMPRESSLIB_INTERNAL_H__\r
11\r
12#include <PiPei.h>\r
13#include <Library/BaseLib.h>\r
14#include <Library/BaseMemoryLib.h>\r
15#include <Library/DebugLib.h>\r
16#include <Library/ExtractGuidedSectionLib.h>\r
17#include <Guid/LzmaDecompress.h>\r
18\r
19/**\r
d1102dba
LG
20 Given a Lzma compressed source buffer, this function retrieves the size of\r
21 the uncompressed buffer and the size of the scratch buffer required\r
11ff2c71
LG
22 to decompress the compressed source buffer.\r
23\r
d1102dba 24 Retrieves the size of the uncompressed buffer and the temporary scratch buffer\r
11ff2c71 25 required to decompress the buffer specified by Source and SourceSize.\r
d1102dba 26 The size of the uncompressed buffer is returned in DestinationSize,\r
11ff2c71 27 the size of the scratch buffer is returned in ScratchSize, and RETURN_SUCCESS is returned.\r
d1102dba 28 This function does not have scratch buffer available to perform a thorough\r
11ff2c71
LG
29 checking of the validity of the source data. It just retrieves the "Original Size"\r
30 field from the LZMA_HEADER_SIZE beginning bytes of the source data and output it as DestinationSize.\r
31 And ScratchSize is specific to the decompression implementation.\r
32\r
33 If SourceSize is less than LZMA_HEADER_SIZE, then ASSERT().\r
34\r
35 @param Source The source buffer containing the compressed data.\r
36 @param SourceSize The size, in bytes, of the source buffer.\r
37 @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer\r
38 that will be generated when the compressed buffer specified\r
39 by Source and SourceSize is decompressed.\r
40 @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that\r
d1102dba 41 is required to decompress the compressed buffer specified\r
11ff2c71
LG
42 by Source and SourceSize.\r
43\r
d1102dba
LG
44 @retval RETURN_SUCCESS The size of the uncompressed data was returned\r
45 in DestinationSize and the size of the scratch\r
11ff2c71
LG
46 buffer was returned in ScratchSize.\r
47\r
48**/\r
49RETURN_STATUS\r
50EFIAPI\r
51LzmaUefiDecompressGetInfo (\r
52 IN CONST VOID *Source,\r
53 IN UINT32 SourceSize,\r
54 OUT UINT32 *DestinationSize,\r
55 OUT UINT32 *ScratchSize\r
56 );\r
57\r
58/**\r
59 Decompresses a Lzma compressed source buffer.\r
60\r
61 Extracts decompressed data to its original form.\r
d1102dba
LG
62 If the compressed source data specified by Source is successfully decompressed\r
63 into Destination, then RETURN_SUCCESS is returned. If the compressed source data\r
11ff2c71
LG
64 specified by Source is not in a valid compressed data format,\r
65 then RETURN_INVALID_PARAMETER is returned.\r
66\r
67 @param Source The source buffer containing the compressed data.\r
68 @param SourceSize The size of source buffer.\r
69 @param Destination The destination buffer to store the decompressed data\r
70 @param Scratch A temporary scratch buffer that is used to perform the decompression.\r
d1102dba 71 This is an optional parameter that may be NULL if the\r
11ff2c71 72 required scratch buffer size is 0.\r
d1102dba
LG
73\r
74 @retval RETURN_SUCCESS Decompression completed successfully, and\r
11ff2c71 75 the uncompressed buffer is returned in Destination.\r
d1102dba
LG
76 @retval RETURN_INVALID_PARAMETER\r
77 The source buffer specified by Source is corrupted\r
11ff2c71
LG
78 (not in a valid compressed format).\r
79**/\r
80RETURN_STATUS\r
81EFIAPI\r
82LzmaUefiDecompress (\r
83 IN CONST VOID *Source,\r
84 IN UINTN SourceSize,\r
85 IN OUT VOID *Destination,\r
86 IN OUT VOID *Scratch\r
87 );\r
88\r
89#endif\r
90\r