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