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