]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/BaseCryptLibNull/Hash/CryptSha1Null.c
CryptoPkg: Add Null instance of the BaseCryptLib class
[mirror_edk2.git] / CryptoPkg / Library / BaseCryptLibNull / Hash / CryptSha1Null.c
CommitLineData
d95de082
SB
1/** @file\r
2 SHA-1 Digest Wrapper Null Implementation.\r
3\r
4Copyright (c) 2009 - 2016, Intel Corporation. All rights reserved.<BR>\r
5SPDX-License-Identifier: BSD-2-Clause-Patent\r
6\r
7**/\r
8\r
9#include "InternalCryptLib.h"\r
10\r
11\r
12/**\r
13 Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.\r
14\r
15 @return The size, in bytes, of the context buffer required for SHA-1 hash operations.\r
16\r
17**/\r
18UINTN\r
19EFIAPI\r
20Sha1GetContextSize (\r
21 VOID\r
22 )\r
23{\r
24 //\r
25 // Retrieves SHA Context Size\r
26 //\r
27 ASSERT (FALSE);\r
28 return 0;\r
29}\r
30\r
31/**\r
32 Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for\r
33 subsequent use.\r
34\r
35 If Sha1Context is NULL, then return FALSE.\r
36\r
37 @param[out] Sha1Context Pointer to SHA-1 context being initialized.\r
38\r
39 @retval TRUE SHA-1 context initialization succeeded.\r
40 @retval FALSE SHA-1 context initialization failed.\r
41\r
42**/\r
43BOOLEAN\r
44EFIAPI\r
45Sha1Init (\r
46 OUT VOID *Sha1Context\r
47 )\r
48{\r
49 ASSERT (FALSE);\r
50 return FALSE;\r
51}\r
52\r
53/**\r
54 Makes a copy of an existing SHA-1 context.\r
55\r
56 If Sha1Context is NULL, then return FALSE.\r
57 If NewSha1Context is NULL, then return FALSE.\r
58\r
59 @param[in] Sha1Context Pointer to SHA-1 context being copied.\r
60 @param[out] NewSha1Context Pointer to new SHA-1 context.\r
61\r
62 @retval TRUE SHA-1 context copy succeeded.\r
63 @retval FALSE SHA-1 context copy failed.\r
64\r
65**/\r
66BOOLEAN\r
67EFIAPI\r
68Sha1Duplicate (\r
69 IN CONST VOID *Sha1Context,\r
70 OUT VOID *NewSha1Context\r
71 )\r
72{\r
73 ASSERT (FALSE);\r
74\r
75 return FALSE;\r
76}\r
77\r
78/**\r
79 Digests the input data and updates SHA-1 context.\r
80\r
81 This function performs SHA-1 digest on a data buffer of the specified size.\r
82 It can be called multiple times to compute the digest of long or discontinuous data streams.\r
83 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized\r
84 by Sha1Final(). Behavior with invalid context is undefined.\r
85\r
86 If Sha1Context is NULL, then return FALSE.\r
87\r
88 @param[in, out] Sha1Context Pointer to the SHA-1 context.\r
89 @param[in] Data Pointer to the buffer containing the data to be hashed.\r
90 @param[in] DataSize Size of Data buffer in bytes.\r
91\r
92 @retval TRUE SHA-1 data digest succeeded.\r
93 @retval FALSE SHA-1 data digest failed.\r
94\r
95**/\r
96BOOLEAN\r
97EFIAPI\r
98Sha1Update (\r
99 IN OUT VOID *Sha1Context,\r
100 IN CONST VOID *Data,\r
101 IN UINTN DataSize\r
102 )\r
103{\r
104 ASSERT (FALSE);\r
105 return FALSE;\r
106}\r
107\r
108/**\r
109 Completes computation of the SHA-1 digest value.\r
110\r
111 This function completes SHA-1 hash computation and retrieves the digest value into\r
112 the specified memory. After this function has been called, the SHA-1 context cannot\r
113 be used again.\r
114 SHA-1 context should be already correctly initialized by Sha1Init(), and should not be\r
115 finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.\r
116\r
117 If Sha1Context is NULL, then return FALSE.\r
118 If HashValue is NULL, then return FALSE.\r
119\r
120 @param[in, out] Sha1Context Pointer to the SHA-1 context.\r
121 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest\r
122 value (20 bytes).\r
123\r
124 @retval TRUE SHA-1 digest computation succeeded.\r
125 @retval FALSE SHA-1 digest computation failed.\r
126\r
127**/\r
128BOOLEAN\r
129EFIAPI\r
130Sha1Final (\r
131 IN OUT VOID *Sha1Context,\r
132 OUT UINT8 *HashValue\r
133 )\r
134{\r
135 ASSERT (FALSE);\r
136 return FALSE;\r
137}\r
138\r
139/**\r
140 Computes the SHA-1 message digest of a input data buffer.\r
141\r
142 This function performs the SHA-1 message digest of a given data buffer, and places\r
143 the digest value into the specified memory.\r
144\r
145 If this interface is not supported, then return FALSE.\r
146\r
147 @param[in] Data Pointer to the buffer containing the data to be hashed.\r
148 @param[in] DataSize Size of Data buffer in bytes.\r
149 @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest\r
150 value (20 bytes).\r
151\r
152 @retval TRUE SHA-1 digest computation succeeded.\r
153 @retval FALSE SHA-1 digest computation failed.\r
154 @retval FALSE This interface is not supported.\r
155\r
156**/\r
157BOOLEAN\r
158EFIAPI\r
159Sha1HashAll (\r
160 IN CONST VOID *Data,\r
161 IN UINTN DataSize,\r
162 OUT UINT8 *HashValue\r
163 )\r
164{\r
165 ASSERT (FALSE);\r
166 return FALSE;\r
167}\r