]> git.proxmox.com Git - mirror_edk2.git/blame - IntelFrameworkModulePkg/Library/LzmaCustomDecompressLib/LzmaDecompressLibInternal.h
IntelFrameworkModulePkg: Replace BSD License with BSD+Patent License
[mirror_edk2.git] / IntelFrameworkModulePkg / Library / LzmaCustomDecompressLib / LzmaDecompressLibInternal.h
CommitLineData
182b1d16
LG
1/** @file\r
2 LZMA Decompress Library internal header file declares Lzma decompress interfaces.\r
3\r
0a6f4824 4 Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>\r
c0a00b14 5 SPDX-License-Identifier: BSD-2-Clause-Patent\r
182b1d16
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
0a6f4824
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
182b1d16
LG
22 to decompress the compressed source buffer.\r
23\r
0a6f4824 24 Retrieves the size of the uncompressed buffer and the temporary scratch buffer\r
182b1d16 25 required to decompress the buffer specified by Source and SourceSize.\r
0a6f4824 26 The size of the uncompressed buffer is returned in DestinationSize,\r
182b1d16 27 the size of the scratch buffer is returned in ScratchSize, and RETURN_SUCCESS is returned.\r
0a6f4824 28 This function does not have scratch buffer available to perform a thorough\r
182b1d16
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
0a6f4824 41 is required to decompress the compressed buffer specified\r
182b1d16
LG
42 by Source and SourceSize.\r
43\r
0a6f4824
LG
44 @retval RETURN_SUCCESS The size of the uncompressed data was returned\r
45 in DestinationSize and the size of the scratch\r
182b1d16
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
0a6f4824
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
182b1d16
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
75a635ac 68 @param SourceSize The size of source buffer.\r
182b1d16
LG
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
0a6f4824 71 This is an optional parameter that may be NULL if the\r
182b1d16 72 required scratch buffer size is 0.\r
0a6f4824
LG
73\r
74 @retval RETURN_SUCCESS Decompression completed successfully, and\r
182b1d16 75 the uncompressed buffer is returned in Destination.\r
0a6f4824
LG
76 @retval RETURN_INVALID_PARAMETER\r
77 The source buffer specified by Source is corrupted\r
182b1d16
LG
78 (not in a valid compressed format).\r
79**/\r
80RETURN_STATUS\r
81EFIAPI\r
82LzmaUefiDecompress (\r
83 IN CONST VOID *Source,\r
090d3088 84 IN UINTN SourceSize,\r
182b1d16
LG
85 IN OUT VOID *Destination,\r
86 IN OUT VOID *Scratch\r
87 );\r
88\r
89#endif\r
90\r