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