]>
Commit | Line | Data |
---|---|---|
fb3df220 | 1 | /** @file\r |
50a64e5b | 2 | Provides services to decompress a buffer using the UEFI Decompress algorithm.\r |
fb3df220 | 3 | \r |
eceb3a4c LG |
4 | The UEFI Decompress Library enables the decompression of objects that \r |
5 | were compressed using the UEFI compression scheme. The UEFI Decompress \r | |
6 | Library is independent of environment and requires the caller to allocate \r | |
7 | all required memory buffers.\r | |
8 | \r | |
50a64e5b | 9 | Copyright (c) 2006 - 2008, Intel Corporation\r |
10 | All rights reserved. This program and the accompanying materials\r | |
11 | are licensed and made available under the terms and conditions of the BSD License\r | |
12 | which accompanies this distribution. The full text of the license may be found at\r | |
13 | http://opensource.org/licenses/bsd-license.php\r | |
fb3df220 | 14 | \r |
50a64e5b | 15 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
16 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
fb3df220 | 17 | \r |
fb3df220 | 18 | **/\r |
19 | \r | |
20 | #ifndef __UEFI_DECPOMPRESS_LIB_H__\r | |
21 | #define __UEFI_DECPOMPRESS_LIB_H__\r | |
22 | \r | |
23 | /**\r | |
eceb3a4c LG |
24 | Given a compressed source buffer, this function retrieves the size of \r |
25 | the uncompressed buffer and the size of the scratch buffer required \r | |
26 | to decompress the compressed source buffer.\r | |
fb3df220 | 27 | \r |
28 | Retrieves the size of the uncompressed buffer and the temporary scratch buffer \r | |
29 | required to decompress the buffer specified by Source and SourceSize.\r | |
30 | If the size of the uncompressed buffer or the size of the scratch buffer cannot\r | |
31 | be determined from the compressed data specified by Source and SourceData, \r | |
32 | then RETURN_INVALID_PARAMETER is returned. Otherwise, the size of the uncompressed\r | |
33 | buffer is returned in DestinationSize, the size of the scratch buffer is returned\r | |
34 | in ScratchSize, and RETURN_SUCCESS is returned.\r | |
35 | This function does not have scratch buffer available to perform a thorough \r | |
36 | checking of the validity of the source data. It just retrieves the "Original Size"\r | |
37 | field from the beginning bytes of the source data and output it as DestinationSize.\r | |
38 | And ScratchSize is specific to the decompression implementation.\r | |
39 | \r | |
40 | If Source is NULL, then ASSERT().\r | |
41 | If DestinationSize is NULL, then ASSERT().\r | |
42 | If ScratchSize is NULL, then ASSERT().\r | |
43 | \r | |
44 | @param Source The source buffer containing the compressed data.\r | |
45 | @param SourceSize The size, in bytes, of the source buffer.\r | |
46 | @param DestinationSize A pointer to the size, in bytes, of the uncompressed buffer\r | |
47 | that will be generated when the compressed buffer specified\r | |
1a2f870c | 48 | by Source and SourceSize is decompressed.\r |
fb3df220 | 49 | @param ScratchSize A pointer to the size, in bytes, of the scratch buffer that\r |
50 | is required to decompress the compressed buffer specified \r | |
51 | by Source and SourceSize.\r | |
52 | \r | |
eceb3a4c LG |
53 | @retval RETURN_SUCCESS The size of the uncompressed data was returned \r |
54 | in DestinationSize and the size of the scratch \r | |
55 | buffer was returned in ScratchSize.\r | |
56 | @retval RETURN_INVALID_PARAMETER \r | |
57 | The size of the uncompressed data or the size of \r | |
58 | the scratch buffer cannot be determined from \r | |
59 | the compressed data specified by Source \r | |
60 | and SourceSize.\r | |
fb3df220 | 61 | **/\r |
62 | RETURN_STATUS\r | |
63 | EFIAPI\r | |
64 | UefiDecompressGetInfo (\r | |
65 | IN CONST VOID *Source,\r | |
66 | IN UINT32 SourceSize,\r | |
67 | OUT UINT32 *DestinationSize,\r | |
68 | OUT UINT32 *ScratchSize\r | |
69 | );\r | |
70 | \r | |
71 | /**\r | |
72 | Decompresses a compressed source buffer.\r | |
73 | \r | |
eceb3a4c | 74 | Extracts decompressed data to its original form.\r |
fb3df220 | 75 | This function is designed so that the decompression algorithm can be implemented\r |
76 | without using any memory services. As a result, this function is not allowed to\r | |
28d3e14f | 77 | call any memory allocation services in its implementation. It is the caller's \r |
78 | responsibility to allocate and free the Destination and Scratch buffers.\r | |
79 | If the compressed source data specified by Source is successfully decompressed \r | |
fb3df220 | 80 | into Destination, then RETURN_SUCCESS is returned. If the compressed source data \r |
81 | specified by Source is not in a valid compressed data format,\r | |
82 | then RETURN_INVALID_PARAMETER is returned.\r | |
83 | \r | |
84 | If Source is NULL, then ASSERT().\r | |
85 | If Destination is NULL, then ASSERT().\r | |
86 | If the required scratch buffer size > 0 and Scratch is NULL, then ASSERT().\r | |
87 | \r | |
88 | @param Source The source buffer containing the compressed data.\r | |
89 | @param Destination The destination buffer to store the decompressed data\r | |
90 | @param Scratch A temporary scratch buffer that is used to perform the decompression.\r | |
91 | This is an optional parameter that may be NULL if the \r | |
92 | required scratch buffer size is 0.\r | |
93 | \r | |
eceb3a4c LG |
94 | @retval RETURN_SUCCESS Decompression completed successfully, and \r |
95 | the uncompressed buffer is returned in Destination.\r | |
96 | @retval RETURN_INVALID_PARAMETER \r | |
97 | The source buffer specified by Source is corrupted \r | |
98 | (not in a valid compressed format).\r | |
fb3df220 | 99 | **/\r |
100 | RETURN_STATUS\r | |
101 | EFIAPI\r | |
102 | UefiDecompress (\r | |
103 | IN CONST VOID *Source,\r | |
104 | IN OUT VOID *Destination,\r | |
6d6a1098 | 105 | IN OUT VOID *Scratch OPTIONAL\r |
fb3df220 | 106 | );\r |
107 | \r | |
108 | #endif\r |