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