]>
Commit | Line | Data |
---|---|---|
cc1d13c9 MK |
1 | /** @file\r |
2 | Implements the EDK II Crypto Protocol/PPI services using the library services\r | |
3 | from BaseCryptLib and TlsLib.\r | |
4 | \r | |
5 | Copyright (C) Microsoft Corporation. All rights reserved.\r | |
6 | Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>\r | |
7 | SPDX-License-Identifier: BSD-2-Clause-Patent\r | |
8 | \r | |
9 | **/\r | |
10 | #include <Base.h>\r | |
11 | #include <Library/DebugLib.h>\r | |
12 | #include <Library/BaseCryptLib.h>\r | |
13 | #include <Library/TlsLib.h>\r | |
14 | #include <Protocol/Crypto.h>\r | |
15 | #include <Pcd/PcdCryptoServiceFamilyEnable.h>\r | |
16 | \r | |
17 | /**\r | |
18 | A macro used to retrieve the FixedAtBuild PcdCryptoServiceFamilyEnable with a\r | |
19 | typecast to its associcted structure type PCD_CRYPTO_SERVICE_FAMILY_ENABLE.\r | |
20 | **/\r | |
21 | #define EDKII_CRYPTO_PCD ((const PCD_CRYPTO_SERVICE_FAMILY_ENABLE *) \\r | |
22 | (FixedPcdGetPtr (PcdCryptoServiceFamilyEnable)))\r | |
23 | \r | |
24 | /**\r | |
25 | A macro used to call a non-void BaseCryptLib function if it is enabled.\r | |
26 | \r | |
27 | If a BaseCryptLib function is not enabled, there will be no references to it\r | |
28 | from this module and will be optimized away reducing the size of this module.\r | |
29 | \r | |
30 | @param Enable The name of the enable field in PCD\r | |
31 | PcdCryptoServiceFamilyEnable for the BaseCryptLib\r | |
32 | function being called. If the value of this field\r | |
33 | is non-zero, then the BaseCryptLib function is\r | |
34 | enabled.\r | |
35 | @param Function The name of the BaseCryptLib function.\r | |
36 | @param Args The argument list to pass to Function.\r | |
37 | @param ErrorReturnValue The value to return if the BaseCryptLib function is\r | |
38 | not enabled.\r | |
39 | \r | |
40 | **/\r | |
41 | #define CALL_BASECRYPTLIB(Enable, Function, Args, ErrorReturnValue) \\r | |
42 | EDKII_CRYPTO_PCD->Enable \\r | |
43 | ? Function Args \\r | |
aaa90aac | 44 | : (BaseCryptLibServiceNotEnabled (#Function), ErrorReturnValue)\r |
cc1d13c9 MK |
45 | \r |
46 | /**\r | |
47 | A macro used to call a void BaseCryptLib function if it is enabled.\r | |
48 | \r | |
49 | If a BaseCryptLib function is not enabled, there will be no references to it\r | |
50 | from this module and will be optimized away reducing the size of this module.\r | |
51 | \r | |
52 | @param Enable The name of the enable field in PCD\r | |
53 | PcdCryptoServiceFamilyEnable for the BaseCryptLib\r | |
54 | function being called. If the value of this field\r | |
55 | is non-zero, then the BaseCryptLib function is\r | |
56 | enabled.\r | |
57 | @param Function The name of the BaseCryptLib function.\r | |
58 | @param Args The argument list to pass to Function.\r | |
59 | \r | |
60 | **/\r | |
61 | #define CALL_VOID_BASECRYPTLIB(Enable, Function, Args) \\r | |
62 | EDKII_CRYPTO_PCD->Enable \\r | |
63 | ? Function Args \\r | |
aaa90aac | 64 | : BaseCryptLibServiceNotEnabled (#Function)\r |
cc1d13c9 MK |
65 | \r |
66 | /**\r | |
67 | Internal worker function that prints a debug message and asserts if a call is\r | |
68 | made to a BaseCryptLib function that is not enabled in the EDK II Crypto\r | |
69 | Protocol/PPI.\r | |
70 | \r | |
71 | If this debug message and assert are observed, then a module is using\r | |
72 | BaseCryptLib function that is not enabled in a Crypto driver. The\r | |
73 | PcdCryptoServiceFamilyEnable should be updated to enable the missing service.\r | |
74 | \r | |
75 | @param[in] FunctionName Null-terminated ASCII string that is the name of an\r | |
76 | EDK II Crypto service.\r | |
77 | \r | |
78 | **/\r | |
79 | static\r | |
80 | VOID\r | |
aaa90aac | 81 | BaseCryptLibServiceNotEnabled (\r |
cc1d13c9 MK |
82 | IN CONST CHAR8 *FunctionName\r |
83 | )\r | |
84 | {\r | |
85 | DEBUG ((DEBUG_ERROR, "[%a] Function %a() is not enabled\n", gEfiCallerBaseName, FunctionName));\r | |
86 | ASSERT_EFI_ERROR (EFI_UNSUPPORTED);\r | |
87 | }\r | |
88 | \r | |
aaa90aac ZG |
89 | /**\r |
90 | Internal worker function that prints a debug message and asserts if a call is\r | |
91 | made to a BaseCryptLib function that is deprecated and unsupported any longer.\r | |
92 | \r | |
93 | @param[in] FunctionName Null-terminated ASCII string that is the name of an\r | |
94 | EDK II Crypto service.\r | |
95 | \r | |
96 | **/\r | |
97 | static\r | |
98 | VOID\r | |
99 | BaseCryptLibServiceDeprecated (\r | |
100 | IN CONST CHAR8 *FunctionName\r | |
101 | )\r | |
102 | {\r | |
103 | DEBUG ((DEBUG_ERROR, "[%a] Function %a() is deprecated and unsupported any longer\n", gEfiCallerBaseName, FunctionName));\r | |
104 | ASSERT_EFI_ERROR (EFI_UNSUPPORTED);\r | |
105 | }\r | |
106 | \r | |
cc1d13c9 MK |
107 | /**\r |
108 | Returns the version of the EDK II Crypto Protocol.\r | |
109 | \r | |
110 | @return The version of the EDK II Crypto Protocol.\r | |
111 | \r | |
112 | **/\r | |
113 | UINTN\r | |
114 | EFIAPI\r | |
115 | CryptoServiceGetCryptoVersion (\r | |
116 | VOID\r | |
117 | )\r | |
118 | {\r | |
119 | return EDKII_CRYPTO_VERSION;\r | |
120 | }\r | |
121 | \r | |
122 | //=====================================================================================\r | |
123 | // One-Way Cryptographic Hash Primitives\r | |
124 | //=====================================================================================\r | |
125 | \r | |
126 | /**\r | |
0a6fc3d0 ZG |
127 | MD4 is deprecated and unsupported any longer.\r |
128 | Keep the function field for binary compability.\r | |
cc1d13c9 | 129 | \r |
cc1d13c9 MK |
130 | @retval 0 This interface is not supported.\r |
131 | \r | |
132 | **/\r | |
133 | UINTN\r | |
134 | EFIAPI\r | |
0a6fc3d0 | 135 | DeprecatedCryptoServiceMd4GetContextSize (\r |
cc1d13c9 MK |
136 | VOID\r |
137 | )\r | |
138 | {\r | |
0a6fc3d0 | 139 | return BaseCryptLibServiceDeprecated ("Md4GetContextSize"), 0;\r |
cc1d13c9 MK |
140 | }\r |
141 | \r | |
142 | /**\r | |
0a6fc3d0 ZG |
143 | MD4 is deprecated and unsupported any longer.\r |
144 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
145 | \r |
146 | @param[out] Md4Context Pointer to MD4 context being initialized.\r | |
147 | \r | |
cc1d13c9 MK |
148 | @retval FALSE This interface is not supported.\r |
149 | \r | |
150 | **/\r | |
151 | BOOLEAN\r | |
152 | EFIAPI\r | |
0a6fc3d0 | 153 | DeprecatedCryptoServiceMd4Init (\r |
cc1d13c9 MK |
154 | OUT VOID *Md4Context\r |
155 | )\r | |
156 | {\r | |
0a6fc3d0 | 157 | return BaseCryptLibServiceDeprecated ("Md4Init"), FALSE;\r |
cc1d13c9 MK |
158 | }\r |
159 | \r | |
160 | /**\r | |
0a6fc3d0 ZG |
161 | MD4 is deprecated and unsupported any longer.\r |
162 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
163 | \r |
164 | @param[in] Md4Context Pointer to MD4 context being copied.\r | |
165 | @param[out] NewMd4Context Pointer to new MD4 context.\r | |
166 | \r | |
cc1d13c9 MK |
167 | @retval FALSE This interface is not supported.\r |
168 | \r | |
169 | **/\r | |
170 | BOOLEAN\r | |
171 | EFIAPI\r | |
0a6fc3d0 | 172 | DeprecatedCryptoServiceMd4Duplicate (\r |
cc1d13c9 MK |
173 | IN CONST VOID *Md4Context,\r |
174 | OUT VOID *NewMd4Context\r | |
175 | )\r | |
176 | {\r | |
0a6fc3d0 | 177 | return BaseCryptLibServiceDeprecated ("Md4Duplicate"), FALSE;\r |
cc1d13c9 MK |
178 | }\r |
179 | \r | |
180 | /**\r | |
0a6fc3d0 ZG |
181 | MD4 is deprecated and unsupported any longer.\r |
182 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
183 | \r |
184 | @param[in, out] Md4Context Pointer to the MD4 context.\r | |
185 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
186 | @param[in] DataSize Size of Data buffer in bytes.\r | |
187 | \r | |
cc1d13c9 MK |
188 | @retval FALSE This interface is not supported.\r |
189 | \r | |
190 | **/\r | |
191 | BOOLEAN\r | |
192 | EFIAPI\r | |
0a6fc3d0 | 193 | DeprecatedCryptoServiceMd4Update (\r |
cc1d13c9 MK |
194 | IN OUT VOID *Md4Context,\r |
195 | IN CONST VOID *Data,\r | |
196 | IN UINTN DataSize\r | |
197 | )\r | |
198 | {\r | |
0a6fc3d0 | 199 | return BaseCryptLibServiceDeprecated ("Md4Update"), FALSE;\r |
cc1d13c9 MK |
200 | }\r |
201 | \r | |
202 | /**\r | |
0a6fc3d0 ZG |
203 | MD4 is deprecated and unsupported any longer.\r |
204 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
205 | \r |
206 | @param[in, out] Md4Context Pointer to the MD4 context.\r | |
207 | @param[out] HashValue Pointer to a buffer that receives the MD4 digest\r | |
208 | value (16 bytes).\r | |
209 | \r | |
cc1d13c9 MK |
210 | @retval FALSE This interface is not supported.\r |
211 | \r | |
212 | **/\r | |
213 | BOOLEAN\r | |
214 | EFIAPI\r | |
0a6fc3d0 | 215 | DeprecatedCryptoServiceMd4Final (\r |
cc1d13c9 MK |
216 | IN OUT VOID *Md4Context,\r |
217 | OUT UINT8 *HashValue\r | |
218 | )\r | |
219 | {\r | |
0a6fc3d0 | 220 | return BaseCryptLibServiceDeprecated ("Md4Final"), FALSE;\r |
cc1d13c9 MK |
221 | }\r |
222 | \r | |
223 | /**\r | |
0a6fc3d0 ZG |
224 | MD4 is deprecated and unsupported any longer.\r |
225 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
226 | \r |
227 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
228 | @param[in] DataSize Size of Data buffer in bytes.\r | |
229 | @param[out] HashValue Pointer to a buffer that receives the MD4 digest\r | |
230 | value (16 bytes).\r | |
231 | \r | |
cc1d13c9 MK |
232 | @retval FALSE This interface is not supported.\r |
233 | \r | |
234 | **/\r | |
235 | BOOLEAN\r | |
236 | EFIAPI\r | |
0a6fc3d0 | 237 | DeprecatedCryptoServiceMd4HashAll (\r |
cc1d13c9 MK |
238 | IN CONST VOID *Data,\r |
239 | IN UINTN DataSize,\r | |
240 | OUT UINT8 *HashValue\r | |
241 | )\r | |
242 | {\r | |
0a6fc3d0 | 243 | return BaseCryptLibServiceDeprecated ("Md4HashAll"), FALSE;\r |
cc1d13c9 MK |
244 | }\r |
245 | \r | |
246 | /**\r | |
247 | Retrieves the size, in bytes, of the context buffer required for MD5 hash operations.\r | |
248 | \r | |
249 | If this interface is not supported, then return zero.\r | |
250 | \r | |
251 | @return The size, in bytes, of the context buffer required for MD5 hash operations.\r | |
252 | @retval 0 This interface is not supported.\r | |
253 | \r | |
254 | **/\r | |
255 | UINTN\r | |
256 | EFIAPI\r | |
257 | CryptoServiceMd5GetContextSize (\r | |
258 | VOID\r | |
259 | )\r | |
260 | {\r | |
261 | return CALL_BASECRYPTLIB (Md5.Services.GetContextSize, Md5GetContextSize, (), 0);\r | |
262 | }\r | |
263 | \r | |
264 | /**\r | |
265 | Initializes user-supplied memory pointed by Md5Context as MD5 hash context for\r | |
266 | subsequent use.\r | |
267 | \r | |
268 | If Md5Context is NULL, then return FALSE.\r | |
269 | If this interface is not supported, then return FALSE.\r | |
270 | \r | |
271 | @param[out] Md5Context Pointer to MD5 context being initialized.\r | |
272 | \r | |
273 | @retval TRUE MD5 context initialization succeeded.\r | |
274 | @retval FALSE MD5 context initialization failed.\r | |
275 | @retval FALSE This interface is not supported.\r | |
276 | \r | |
277 | **/\r | |
278 | BOOLEAN\r | |
279 | EFIAPI\r | |
280 | CryptoServiceMd5Init (\r | |
281 | OUT VOID *Md5Context\r | |
282 | )\r | |
283 | {\r | |
284 | return CALL_BASECRYPTLIB (Md5.Services.Init, Md5Init, (Md5Context), FALSE);\r | |
285 | }\r | |
286 | \r | |
287 | /**\r | |
288 | Makes a copy of an existing MD5 context.\r | |
289 | \r | |
290 | If Md5Context is NULL, then return FALSE.\r | |
291 | If NewMd5Context is NULL, then return FALSE.\r | |
292 | If this interface is not supported, then return FALSE.\r | |
293 | \r | |
294 | @param[in] Md5Context Pointer to MD5 context being copied.\r | |
295 | @param[out] NewMd5Context Pointer to new MD5 context.\r | |
296 | \r | |
297 | @retval TRUE MD5 context copy succeeded.\r | |
298 | @retval FALSE MD5 context copy failed.\r | |
299 | @retval FALSE This interface is not supported.\r | |
300 | \r | |
301 | **/\r | |
302 | BOOLEAN\r | |
303 | EFIAPI\r | |
304 | CryptoServiceMd5Duplicate (\r | |
305 | IN CONST VOID *Md5Context,\r | |
306 | OUT VOID *NewMd5Context\r | |
307 | )\r | |
308 | {\r | |
309 | return CALL_BASECRYPTLIB (Md5.Services.Duplicate, Md5Duplicate, (Md5Context, NewMd5Context), FALSE);\r | |
310 | }\r | |
311 | \r | |
312 | /**\r | |
313 | Digests the input data and updates MD5 context.\r | |
314 | \r | |
315 | This function performs MD5 digest on a data buffer of the specified size.\r | |
316 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
317 | MD5 context should be already correctly initialized by Md5Init(), and should not be finalized\r | |
318 | by Md5Final(). Behavior with invalid context is undefined.\r | |
319 | \r | |
320 | If Md5Context is NULL, then return FALSE.\r | |
321 | If this interface is not supported, then return FALSE.\r | |
322 | \r | |
323 | @param[in, out] Md5Context Pointer to the MD5 context.\r | |
324 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
325 | @param[in] DataSize Size of Data buffer in bytes.\r | |
326 | \r | |
327 | @retval TRUE MD5 data digest succeeded.\r | |
328 | @retval FALSE MD5 data digest failed.\r | |
329 | @retval FALSE This interface is not supported.\r | |
330 | \r | |
331 | **/\r | |
332 | BOOLEAN\r | |
333 | EFIAPI\r | |
334 | CryptoServiceMd5Update (\r | |
335 | IN OUT VOID *Md5Context,\r | |
336 | IN CONST VOID *Data,\r | |
337 | IN UINTN DataSize\r | |
338 | )\r | |
339 | {\r | |
340 | return CALL_BASECRYPTLIB (Md5.Services.Update, Md5Update, (Md5Context, Data, DataSize), FALSE);\r | |
341 | }\r | |
342 | \r | |
343 | /**\r | |
344 | Completes computation of the MD5 digest value.\r | |
345 | \r | |
346 | This function completes MD5 hash computation and retrieves the digest value into\r | |
347 | the specified memory. After this function has been called, the MD5 context cannot\r | |
348 | be used again.\r | |
349 | MD5 context should be already correctly initialized by Md5Init(), and should not be\r | |
350 | finalized by Md5Final(). Behavior with invalid MD5 context is undefined.\r | |
351 | \r | |
352 | If Md5Context is NULL, then return FALSE.\r | |
353 | If HashValue is NULL, then return FALSE.\r | |
354 | If this interface is not supported, then return FALSE.\r | |
355 | \r | |
356 | @param[in, out] Md5Context Pointer to the MD5 context.\r | |
357 | @param[out] HashValue Pointer to a buffer that receives the MD5 digest\r | |
358 | value (16 bytes).\r | |
359 | \r | |
360 | @retval TRUE MD5 digest computation succeeded.\r | |
361 | @retval FALSE MD5 digest computation failed.\r | |
362 | @retval FALSE This interface is not supported.\r | |
363 | \r | |
364 | **/\r | |
365 | BOOLEAN\r | |
366 | EFIAPI\r | |
367 | CryptoServiceMd5Final (\r | |
368 | IN OUT VOID *Md5Context,\r | |
369 | OUT UINT8 *HashValue\r | |
370 | )\r | |
371 | {\r | |
372 | return CALL_BASECRYPTLIB (Md5.Services.Final, Md5Final, (Md5Context, HashValue), FALSE);\r | |
373 | }\r | |
374 | \r | |
375 | /**\r | |
376 | Computes the MD5 message digest of a input data buffer.\r | |
377 | \r | |
378 | This function performs the MD5 message digest of a given data buffer, and places\r | |
379 | the digest value into the specified memory.\r | |
380 | \r | |
381 | If this interface is not supported, then return FALSE.\r | |
382 | \r | |
383 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
384 | @param[in] DataSize Size of Data buffer in bytes.\r | |
385 | @param[out] HashValue Pointer to a buffer that receives the MD5 digest\r | |
386 | value (16 bytes).\r | |
387 | \r | |
388 | @retval TRUE MD5 digest computation succeeded.\r | |
389 | @retval FALSE MD5 digest computation failed.\r | |
390 | @retval FALSE This interface is not supported.\r | |
391 | \r | |
392 | **/\r | |
393 | BOOLEAN\r | |
394 | EFIAPI\r | |
395 | CryptoServiceMd5HashAll (\r | |
396 | IN CONST VOID *Data,\r | |
397 | IN UINTN DataSize,\r | |
398 | OUT UINT8 *HashValue\r | |
399 | )\r | |
400 | {\r | |
401 | return CALL_BASECRYPTLIB (Md5.Services.HashAll, Md5HashAll, (Data, DataSize, HashValue), FALSE);\r | |
402 | }\r | |
403 | \r | |
404 | /**\r | |
405 | Retrieves the size, in bytes, of the context buffer required for SHA-1 hash operations.\r | |
406 | \r | |
407 | If this interface is not supported, then return zero.\r | |
408 | \r | |
409 | @return The size, in bytes, of the context buffer required for SHA-1 hash operations.\r | |
410 | @retval 0 This interface is not supported.\r | |
411 | \r | |
412 | **/\r | |
413 | UINTN\r | |
414 | EFIAPI\r | |
415 | CryptoServiceSha1GetContextSize (\r | |
416 | VOID\r | |
417 | )\r | |
418 | {\r | |
419 | return CALL_BASECRYPTLIB (Sha1.Services.GetContextSize, Sha1GetContextSize, (), 0);\r | |
420 | }\r | |
421 | \r | |
422 | /**\r | |
423 | Initializes user-supplied memory pointed by Sha1Context as SHA-1 hash context for\r | |
424 | subsequent use.\r | |
425 | \r | |
426 | If Sha1Context is NULL, then return FALSE.\r | |
427 | If this interface is not supported, then return FALSE.\r | |
428 | \r | |
429 | @param[out] Sha1Context Pointer to SHA-1 context being initialized.\r | |
430 | \r | |
431 | @retval TRUE SHA-1 context initialization succeeded.\r | |
432 | @retval FALSE SHA-1 context initialization failed.\r | |
433 | @retval FALSE This interface is not supported.\r | |
434 | \r | |
435 | **/\r | |
436 | BOOLEAN\r | |
437 | EFIAPI\r | |
438 | CryptoServiceSha1Init (\r | |
439 | OUT VOID *Sha1Context\r | |
440 | )\r | |
441 | {\r | |
442 | return CALL_BASECRYPTLIB (Sha1.Services.Init, Sha1Init, (Sha1Context), FALSE);\r | |
443 | }\r | |
444 | \r | |
445 | /**\r | |
446 | Makes a copy of an existing SHA-1 context.\r | |
447 | \r | |
448 | If Sha1Context is NULL, then return FALSE.\r | |
449 | If NewSha1Context is NULL, then return FALSE.\r | |
450 | If this interface is not supported, then return FALSE.\r | |
451 | \r | |
452 | @param[in] Sha1Context Pointer to SHA-1 context being copied.\r | |
453 | @param[out] NewSha1Context Pointer to new SHA-1 context.\r | |
454 | \r | |
455 | @retval TRUE SHA-1 context copy succeeded.\r | |
456 | @retval FALSE SHA-1 context copy failed.\r | |
457 | @retval FALSE This interface is not supported.\r | |
458 | \r | |
459 | **/\r | |
460 | BOOLEAN\r | |
461 | EFIAPI\r | |
462 | CryptoServiceSha1Duplicate (\r | |
463 | IN CONST VOID *Sha1Context,\r | |
464 | OUT VOID *NewSha1Context\r | |
465 | )\r | |
466 | {\r | |
467 | return CALL_BASECRYPTLIB (Sha1.Services.Duplicate, Sha1Duplicate, (Sha1Context, NewSha1Context), FALSE);\r | |
468 | }\r | |
469 | \r | |
470 | /**\r | |
471 | Digests the input data and updates SHA-1 context.\r | |
472 | \r | |
473 | This function performs SHA-1 digest on a data buffer of the specified size.\r | |
474 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
475 | SHA-1 context should be already correctly initialized by Sha1Init(), and should not be finalized\r | |
476 | by Sha1Final(). Behavior with invalid context is undefined.\r | |
477 | \r | |
478 | If Sha1Context is NULL, then return FALSE.\r | |
479 | If this interface is not supported, then return FALSE.\r | |
480 | \r | |
481 | @param[in, out] Sha1Context Pointer to the SHA-1 context.\r | |
482 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
483 | @param[in] DataSize Size of Data buffer in bytes.\r | |
484 | \r | |
485 | @retval TRUE SHA-1 data digest succeeded.\r | |
486 | @retval FALSE SHA-1 data digest failed.\r | |
487 | @retval FALSE This interface is not supported.\r | |
488 | \r | |
489 | **/\r | |
490 | BOOLEAN\r | |
491 | EFIAPI\r | |
492 | CryptoServiceSha1Update (\r | |
493 | IN OUT VOID *Sha1Context,\r | |
494 | IN CONST VOID *Data,\r | |
495 | IN UINTN DataSize\r | |
496 | )\r | |
497 | {\r | |
498 | return CALL_BASECRYPTLIB (Sha1.Services.Update, Sha1Update, (Sha1Context, Data, DataSize), FALSE);\r | |
499 | }\r | |
500 | \r | |
501 | /**\r | |
502 | Completes computation of the SHA-1 digest value.\r | |
503 | \r | |
504 | This function completes SHA-1 hash computation and retrieves the digest value into\r | |
505 | the specified memory. After this function has been called, the SHA-1 context cannot\r | |
506 | be used again.\r | |
507 | SHA-1 context should be already correctly initialized by Sha1Init(), and should not be\r | |
508 | finalized by Sha1Final(). Behavior with invalid SHA-1 context is undefined.\r | |
509 | \r | |
510 | If Sha1Context is NULL, then return FALSE.\r | |
511 | If HashValue is NULL, then return FALSE.\r | |
512 | If this interface is not supported, then return FALSE.\r | |
513 | \r | |
514 | @param[in, out] Sha1Context Pointer to the SHA-1 context.\r | |
515 | @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest\r | |
516 | value (20 bytes).\r | |
517 | \r | |
518 | @retval TRUE SHA-1 digest computation succeeded.\r | |
519 | @retval FALSE SHA-1 digest computation failed.\r | |
520 | @retval FALSE This interface is not supported.\r | |
521 | \r | |
522 | **/\r | |
523 | BOOLEAN\r | |
524 | EFIAPI\r | |
525 | CryptoServiceSha1Final (\r | |
526 | IN OUT VOID *Sha1Context,\r | |
527 | OUT UINT8 *HashValue\r | |
528 | )\r | |
529 | {\r | |
530 | return CALL_BASECRYPTLIB (Sha1.Services.Final, Sha1Final, (Sha1Context, HashValue), FALSE);\r | |
531 | }\r | |
532 | \r | |
533 | /**\r | |
534 | Computes the SHA-1 message digest of a input data buffer.\r | |
535 | \r | |
536 | This function performs the SHA-1 message digest of a given data buffer, and places\r | |
537 | the digest value into the specified memory.\r | |
538 | \r | |
539 | If this interface is not supported, then return FALSE.\r | |
540 | \r | |
541 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
542 | @param[in] DataSize Size of Data buffer in bytes.\r | |
543 | @param[out] HashValue Pointer to a buffer that receives the SHA-1 digest\r | |
544 | value (20 bytes).\r | |
545 | \r | |
546 | @retval TRUE SHA-1 digest computation succeeded.\r | |
547 | @retval FALSE SHA-1 digest computation failed.\r | |
548 | @retval FALSE This interface is not supported.\r | |
549 | \r | |
550 | **/\r | |
551 | BOOLEAN\r | |
552 | EFIAPI\r | |
553 | CryptoServiceSha1HashAll (\r | |
554 | IN CONST VOID *Data,\r | |
555 | IN UINTN DataSize,\r | |
556 | OUT UINT8 *HashValue\r | |
557 | )\r | |
558 | {\r | |
559 | return CALL_BASECRYPTLIB (Sha1.Services.HashAll, Sha1HashAll, (Data, DataSize, HashValue), FALSE);\r | |
560 | }\r | |
561 | \r | |
562 | /**\r | |
563 | Retrieves the size, in bytes, of the context buffer required for SHA-256 hash operations.\r | |
564 | \r | |
565 | @return The size, in bytes, of the context buffer required for SHA-256 hash operations.\r | |
566 | \r | |
567 | **/\r | |
568 | UINTN\r | |
569 | EFIAPI\r | |
570 | CryptoServiceSha256GetContextSize (\r | |
571 | VOID\r | |
572 | )\r | |
573 | {\r | |
574 | return CALL_BASECRYPTLIB (Sha256.Services.GetContextSize, Sha256GetContextSize, (), 0);\r | |
575 | }\r | |
576 | \r | |
577 | /**\r | |
578 | Initializes user-supplied memory pointed by Sha256Context as SHA-256 hash context for\r | |
579 | subsequent use.\r | |
580 | \r | |
581 | If Sha256Context is NULL, then return FALSE.\r | |
582 | \r | |
583 | @param[out] Sha256Context Pointer to SHA-256 context being initialized.\r | |
584 | \r | |
585 | @retval TRUE SHA-256 context initialization succeeded.\r | |
586 | @retval FALSE SHA-256 context initialization failed.\r | |
587 | \r | |
588 | **/\r | |
589 | BOOLEAN\r | |
590 | EFIAPI\r | |
591 | CryptoServiceSha256Init (\r | |
592 | OUT VOID *Sha256Context\r | |
593 | )\r | |
594 | {\r | |
595 | return CALL_BASECRYPTLIB (Sha256.Services.Init, Sha256Init, (Sha256Context), FALSE);\r | |
596 | }\r | |
597 | \r | |
598 | /**\r | |
599 | Makes a copy of an existing SHA-256 context.\r | |
600 | \r | |
601 | If Sha256Context is NULL, then return FALSE.\r | |
602 | If NewSha256Context is NULL, then return FALSE.\r | |
603 | If this interface is not supported, then return FALSE.\r | |
604 | \r | |
605 | @param[in] Sha256Context Pointer to SHA-256 context being copied.\r | |
606 | @param[out] NewSha256Context Pointer to new SHA-256 context.\r | |
607 | \r | |
608 | @retval TRUE SHA-256 context copy succeeded.\r | |
609 | @retval FALSE SHA-256 context copy failed.\r | |
610 | @retval FALSE This interface is not supported.\r | |
611 | \r | |
612 | **/\r | |
613 | BOOLEAN\r | |
614 | EFIAPI\r | |
615 | CryptoServiceSha256Duplicate (\r | |
616 | IN CONST VOID *Sha256Context,\r | |
617 | OUT VOID *NewSha256Context\r | |
618 | )\r | |
619 | {\r | |
620 | return CALL_BASECRYPTLIB (Sha256.Services.Duplicate, Sha256Duplicate, (Sha256Context, NewSha256Context), FALSE);\r | |
621 | }\r | |
622 | \r | |
623 | /**\r | |
624 | Digests the input data and updates SHA-256 context.\r | |
625 | \r | |
626 | This function performs SHA-256 digest on a data buffer of the specified size.\r | |
627 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
628 | SHA-256 context should be already correctly initialized by Sha256Init(), and should not be finalized\r | |
629 | by Sha256Final(). Behavior with invalid context is undefined.\r | |
630 | \r | |
631 | If Sha256Context is NULL, then return FALSE.\r | |
632 | \r | |
633 | @param[in, out] Sha256Context Pointer to the SHA-256 context.\r | |
634 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
635 | @param[in] DataSize Size of Data buffer in bytes.\r | |
636 | \r | |
637 | @retval TRUE SHA-256 data digest succeeded.\r | |
638 | @retval FALSE SHA-256 data digest failed.\r | |
639 | \r | |
640 | **/\r | |
641 | BOOLEAN\r | |
642 | EFIAPI\r | |
643 | CryptoServiceSha256Update (\r | |
644 | IN OUT VOID *Sha256Context,\r | |
645 | IN CONST VOID *Data,\r | |
646 | IN UINTN DataSize\r | |
647 | )\r | |
648 | {\r | |
649 | return CALL_BASECRYPTLIB (Sha256.Services.Update, Sha256Update, (Sha256Context, Data, DataSize), FALSE);\r | |
650 | }\r | |
651 | \r | |
652 | /**\r | |
653 | Completes computation of the SHA-256 digest value.\r | |
654 | \r | |
655 | This function completes SHA-256 hash computation and retrieves the digest value into\r | |
656 | the specified memory. After this function has been called, the SHA-256 context cannot\r | |
657 | be used again.\r | |
658 | SHA-256 context should be already correctly initialized by Sha256Init(), and should not be\r | |
659 | finalized by Sha256Final(). Behavior with invalid SHA-256 context is undefined.\r | |
660 | \r | |
661 | If Sha256Context is NULL, then return FALSE.\r | |
662 | If HashValue is NULL, then return FALSE.\r | |
663 | \r | |
664 | @param[in, out] Sha256Context Pointer to the SHA-256 context.\r | |
665 | @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest\r | |
666 | value (32 bytes).\r | |
667 | \r | |
668 | @retval TRUE SHA-256 digest computation succeeded.\r | |
669 | @retval FALSE SHA-256 digest computation failed.\r | |
670 | \r | |
671 | **/\r | |
672 | BOOLEAN\r | |
673 | EFIAPI\r | |
674 | CryptoServiceSha256Final (\r | |
675 | IN OUT VOID *Sha256Context,\r | |
676 | OUT UINT8 *HashValue\r | |
677 | )\r | |
678 | {\r | |
679 | return CALL_BASECRYPTLIB (Sha256.Services.Final, Sha256Final, (Sha256Context, HashValue), FALSE);\r | |
680 | }\r | |
681 | \r | |
682 | /**\r | |
683 | Computes the SHA-256 message digest of a input data buffer.\r | |
684 | \r | |
685 | This function performs the SHA-256 message digest of a given data buffer, and places\r | |
686 | the digest value into the specified memory.\r | |
687 | \r | |
688 | If this interface is not supported, then return FALSE.\r | |
689 | \r | |
690 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
691 | @param[in] DataSize Size of Data buffer in bytes.\r | |
692 | @param[out] HashValue Pointer to a buffer that receives the SHA-256 digest\r | |
693 | value (32 bytes).\r | |
694 | \r | |
695 | @retval TRUE SHA-256 digest computation succeeded.\r | |
696 | @retval FALSE SHA-256 digest computation failed.\r | |
697 | @retval FALSE This interface is not supported.\r | |
698 | \r | |
699 | **/\r | |
700 | BOOLEAN\r | |
701 | EFIAPI\r | |
702 | CryptoServiceSha256HashAll (\r | |
703 | IN CONST VOID *Data,\r | |
704 | IN UINTN DataSize,\r | |
705 | OUT UINT8 *HashValue\r | |
706 | )\r | |
707 | {\r | |
708 | return CALL_BASECRYPTLIB (Sha256.Services.HashAll, Sha256HashAll, (Data, DataSize, HashValue), FALSE);\r | |
709 | }\r | |
710 | \r | |
711 | /**\r | |
712 | Retrieves the size, in bytes, of the context buffer required for SHA-384 hash operations.\r | |
713 | \r | |
714 | @return The size, in bytes, of the context buffer required for SHA-384 hash operations.\r | |
715 | \r | |
716 | **/\r | |
717 | UINTN\r | |
718 | EFIAPI\r | |
719 | CryptoServiceSha384GetContextSize (\r | |
720 | VOID\r | |
721 | )\r | |
722 | {\r | |
723 | return CALL_BASECRYPTLIB (Sha384.Services.GetContextSize, Sha384GetContextSize, (), 0);\r | |
724 | }\r | |
725 | \r | |
726 | /**\r | |
727 | Initializes user-supplied memory pointed by Sha384Context as SHA-384 hash context for\r | |
728 | subsequent use.\r | |
729 | \r | |
730 | If Sha384Context is NULL, then return FALSE.\r | |
731 | \r | |
732 | @param[out] Sha384Context Pointer to SHA-384 context being initialized.\r | |
733 | \r | |
734 | @retval TRUE SHA-384 context initialization succeeded.\r | |
735 | @retval FALSE SHA-384 context initialization failed.\r | |
736 | \r | |
737 | **/\r | |
738 | BOOLEAN\r | |
739 | EFIAPI\r | |
740 | CryptoServiceSha384Init (\r | |
741 | OUT VOID *Sha384Context\r | |
742 | )\r | |
743 | {\r | |
744 | return CALL_BASECRYPTLIB (Sha384.Services.Init, Sha384Init, (Sha384Context), FALSE);\r | |
745 | }\r | |
746 | \r | |
747 | /**\r | |
748 | Makes a copy of an existing SHA-384 context.\r | |
749 | \r | |
750 | If Sha384Context is NULL, then return FALSE.\r | |
751 | If NewSha384Context is NULL, then return FALSE.\r | |
752 | If this interface is not supported, then return FALSE.\r | |
753 | \r | |
754 | @param[in] Sha384Context Pointer to SHA-384 context being copied.\r | |
755 | @param[out] NewSha384Context Pointer to new SHA-384 context.\r | |
756 | \r | |
757 | @retval TRUE SHA-384 context copy succeeded.\r | |
758 | @retval FALSE SHA-384 context copy failed.\r | |
759 | @retval FALSE This interface is not supported.\r | |
760 | \r | |
761 | **/\r | |
762 | BOOLEAN\r | |
763 | EFIAPI\r | |
764 | CryptoServiceSha384Duplicate (\r | |
765 | IN CONST VOID *Sha384Context,\r | |
766 | OUT VOID *NewSha384Context\r | |
767 | )\r | |
768 | {\r | |
769 | return CALL_BASECRYPTLIB (Sha384.Services.Duplicate, Sha384Duplicate, (Sha384Context, NewSha384Context), FALSE);\r | |
770 | }\r | |
771 | \r | |
772 | /**\r | |
773 | Digests the input data and updates SHA-384 context.\r | |
774 | \r | |
775 | This function performs SHA-384 digest on a data buffer of the specified size.\r | |
776 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
777 | SHA-384 context should be already correctly initialized by Sha384Init(), and should not be finalized\r | |
778 | by Sha384Final(). Behavior with invalid context is undefined.\r | |
779 | \r | |
780 | If Sha384Context is NULL, then return FALSE.\r | |
781 | \r | |
782 | @param[in, out] Sha384Context Pointer to the SHA-384 context.\r | |
783 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
784 | @param[in] DataSize Size of Data buffer in bytes.\r | |
785 | \r | |
786 | @retval TRUE SHA-384 data digest succeeded.\r | |
787 | @retval FALSE SHA-384 data digest failed.\r | |
788 | \r | |
789 | **/\r | |
790 | BOOLEAN\r | |
791 | EFIAPI\r | |
792 | CryptoServiceSha384Update (\r | |
793 | IN OUT VOID *Sha384Context,\r | |
794 | IN CONST VOID *Data,\r | |
795 | IN UINTN DataSize\r | |
796 | )\r | |
797 | {\r | |
798 | return CALL_BASECRYPTLIB (Sha384.Services.Update, Sha384Update, (Sha384Context, Data, DataSize), FALSE);\r | |
799 | }\r | |
800 | \r | |
801 | /**\r | |
802 | Completes computation of the SHA-384 digest value.\r | |
803 | \r | |
804 | This function completes SHA-384 hash computation and retrieves the digest value into\r | |
805 | the specified memory. After this function has been called, the SHA-384 context cannot\r | |
806 | be used again.\r | |
807 | SHA-384 context should be already correctly initialized by Sha384Init(), and should not be\r | |
808 | finalized by Sha384Final(). Behavior with invalid SHA-384 context is undefined.\r | |
809 | \r | |
810 | If Sha384Context is NULL, then return FALSE.\r | |
811 | If HashValue is NULL, then return FALSE.\r | |
812 | \r | |
813 | @param[in, out] Sha384Context Pointer to the SHA-384 context.\r | |
814 | @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest\r | |
815 | value (48 bytes).\r | |
816 | \r | |
817 | @retval TRUE SHA-384 digest computation succeeded.\r | |
818 | @retval FALSE SHA-384 digest computation failed.\r | |
819 | \r | |
820 | **/\r | |
821 | BOOLEAN\r | |
822 | EFIAPI\r | |
823 | CryptoServiceSha384Final (\r | |
824 | IN OUT VOID *Sha384Context,\r | |
825 | OUT UINT8 *HashValue\r | |
826 | )\r | |
827 | {\r | |
828 | return CALL_BASECRYPTLIB (Sha384.Services.Final, Sha384Final, (Sha384Context, HashValue), FALSE);\r | |
829 | }\r | |
830 | \r | |
831 | /**\r | |
832 | Computes the SHA-384 message digest of a input data buffer.\r | |
833 | \r | |
834 | This function performs the SHA-384 message digest of a given data buffer, and places\r | |
835 | the digest value into the specified memory.\r | |
836 | \r | |
837 | If this interface is not supported, then return FALSE.\r | |
838 | \r | |
839 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
840 | @param[in] DataSize Size of Data buffer in bytes.\r | |
841 | @param[out] HashValue Pointer to a buffer that receives the SHA-384 digest\r | |
842 | value (48 bytes).\r | |
843 | \r | |
844 | @retval TRUE SHA-384 digest computation succeeded.\r | |
845 | @retval FALSE SHA-384 digest computation failed.\r | |
846 | @retval FALSE This interface is not supported.\r | |
847 | \r | |
848 | **/\r | |
849 | BOOLEAN\r | |
850 | EFIAPI\r | |
851 | CryptoServiceSha384HashAll (\r | |
852 | IN CONST VOID *Data,\r | |
853 | IN UINTN DataSize,\r | |
854 | OUT UINT8 *HashValue\r | |
855 | )\r | |
856 | {\r | |
857 | return CALL_BASECRYPTLIB (Sha384.Services.HashAll, Sha384HashAll, (Data, DataSize, HashValue), FALSE);\r | |
858 | }\r | |
859 | \r | |
860 | /**\r | |
861 | Retrieves the size, in bytes, of the context buffer required for SHA-512 hash operations.\r | |
862 | \r | |
863 | @return The size, in bytes, of the context buffer required for SHA-512 hash operations.\r | |
864 | \r | |
865 | **/\r | |
866 | UINTN\r | |
867 | EFIAPI\r | |
868 | CryptoServiceSha512GetContextSize (\r | |
869 | VOID\r | |
870 | )\r | |
871 | {\r | |
872 | return CALL_BASECRYPTLIB (Sha512.Services.GetContextSize, Sha512GetContextSize, (), 0);\r | |
873 | }\r | |
874 | \r | |
875 | /**\r | |
876 | Initializes user-supplied memory pointed by Sha512Context as SHA-512 hash context for\r | |
877 | subsequent use.\r | |
878 | \r | |
879 | If Sha512Context is NULL, then return FALSE.\r | |
880 | \r | |
881 | @param[out] Sha512Context Pointer to SHA-512 context being initialized.\r | |
882 | \r | |
883 | @retval TRUE SHA-512 context initialization succeeded.\r | |
884 | @retval FALSE SHA-512 context initialization failed.\r | |
885 | \r | |
886 | **/\r | |
887 | BOOLEAN\r | |
888 | EFIAPI\r | |
889 | CryptoServiceSha512Init (\r | |
890 | OUT VOID *Sha512Context\r | |
891 | )\r | |
892 | {\r | |
893 | return CALL_BASECRYPTLIB (Sha512.Services.Init, Sha512Init, (Sha512Context), FALSE);\r | |
894 | }\r | |
895 | \r | |
896 | /**\r | |
897 | Makes a copy of an existing SHA-512 context.\r | |
898 | \r | |
899 | If Sha512Context is NULL, then return FALSE.\r | |
900 | If NewSha512Context is NULL, then return FALSE.\r | |
901 | If this interface is not supported, then return FALSE.\r | |
902 | \r | |
903 | @param[in] Sha512Context Pointer to SHA-512 context being copied.\r | |
904 | @param[out] NewSha512Context Pointer to new SHA-512 context.\r | |
905 | \r | |
906 | @retval TRUE SHA-512 context copy succeeded.\r | |
907 | @retval FALSE SHA-512 context copy failed.\r | |
908 | @retval FALSE This interface is not supported.\r | |
909 | \r | |
910 | **/\r | |
911 | BOOLEAN\r | |
912 | EFIAPI\r | |
913 | CryptoServiceSha512Duplicate (\r | |
914 | IN CONST VOID *Sha512Context,\r | |
915 | OUT VOID *NewSha512Context\r | |
916 | )\r | |
917 | {\r | |
918 | return CALL_BASECRYPTLIB (Sha512.Services.Duplicate, Sha512Duplicate, (Sha512Context, NewSha512Context), FALSE);\r | |
919 | }\r | |
920 | \r | |
921 | /**\r | |
922 | Digests the input data and updates SHA-512 context.\r | |
923 | \r | |
924 | This function performs SHA-512 digest on a data buffer of the specified size.\r | |
925 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
926 | SHA-512 context should be already correctly initialized by Sha512Init(), and should not be finalized\r | |
927 | by Sha512Final(). Behavior with invalid context is undefined.\r | |
928 | \r | |
929 | If Sha512Context is NULL, then return FALSE.\r | |
930 | \r | |
931 | @param[in, out] Sha512Context Pointer to the SHA-512 context.\r | |
932 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
933 | @param[in] DataSize Size of Data buffer in bytes.\r | |
934 | \r | |
935 | @retval TRUE SHA-512 data digest succeeded.\r | |
936 | @retval FALSE SHA-512 data digest failed.\r | |
937 | \r | |
938 | **/\r | |
939 | BOOLEAN\r | |
940 | EFIAPI\r | |
941 | CryptoServiceSha512Update (\r | |
942 | IN OUT VOID *Sha512Context,\r | |
943 | IN CONST VOID *Data,\r | |
944 | IN UINTN DataSize\r | |
945 | )\r | |
946 | {\r | |
947 | return CALL_BASECRYPTLIB (Sha512.Services.Update, Sha512Update, (Sha512Context, Data, DataSize), FALSE);\r | |
948 | }\r | |
949 | \r | |
950 | /**\r | |
951 | Completes computation of the SHA-512 digest value.\r | |
952 | \r | |
953 | This function completes SHA-512 hash computation and retrieves the digest value into\r | |
954 | the specified memory. After this function has been called, the SHA-512 context cannot\r | |
955 | be used again.\r | |
956 | SHA-512 context should be already correctly initialized by Sha512Init(), and should not be\r | |
957 | finalized by Sha512Final(). Behavior with invalid SHA-512 context is undefined.\r | |
958 | \r | |
959 | If Sha512Context is NULL, then return FALSE.\r | |
960 | If HashValue is NULL, then return FALSE.\r | |
961 | \r | |
962 | @param[in, out] Sha512Context Pointer to the SHA-512 context.\r | |
963 | @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest\r | |
964 | value (64 bytes).\r | |
965 | \r | |
966 | @retval TRUE SHA-512 digest computation succeeded.\r | |
967 | @retval FALSE SHA-512 digest computation failed.\r | |
968 | \r | |
969 | **/\r | |
970 | BOOLEAN\r | |
971 | EFIAPI\r | |
972 | CryptoServiceSha512Final (\r | |
973 | IN OUT VOID *Sha512Context,\r | |
974 | OUT UINT8 *HashValue\r | |
975 | )\r | |
976 | {\r | |
977 | return CALL_BASECRYPTLIB (Sha512.Services.Final, Sha512Final, (Sha512Context, HashValue), FALSE);\r | |
978 | }\r | |
979 | \r | |
980 | /**\r | |
981 | Computes the SHA-512 message digest of a input data buffer.\r | |
982 | \r | |
983 | This function performs the SHA-512 message digest of a given data buffer, and places\r | |
984 | the digest value into the specified memory.\r | |
985 | \r | |
986 | If this interface is not supported, then return FALSE.\r | |
987 | \r | |
988 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
989 | @param[in] DataSize Size of Data buffer in bytes.\r | |
990 | @param[out] HashValue Pointer to a buffer that receives the SHA-512 digest\r | |
991 | value (64 bytes).\r | |
992 | \r | |
993 | @retval TRUE SHA-512 digest computation succeeded.\r | |
994 | @retval FALSE SHA-512 digest computation failed.\r | |
995 | @retval FALSE This interface is not supported.\r | |
996 | \r | |
997 | **/\r | |
998 | BOOLEAN\r | |
999 | EFIAPI\r | |
1000 | CryptoServiceSha512HashAll (\r | |
1001 | IN CONST VOID *Data,\r | |
1002 | IN UINTN DataSize,\r | |
1003 | OUT UINT8 *HashValue\r | |
1004 | )\r | |
1005 | {\r | |
1006 | return CALL_BASECRYPTLIB (Sha512.Services.HashAll, Sha512HashAll, (Data, DataSize, HashValue), FALSE);\r | |
1007 | }\r | |
1008 | \r | |
1009 | /**\r | |
1010 | Retrieves the size, in bytes, of the context buffer required for SM3 hash operations.\r | |
1011 | \r | |
1012 | @return The size, in bytes, of the context buffer required for SM3 hash operations.\r | |
1013 | \r | |
1014 | **/\r | |
1015 | UINTN\r | |
1016 | EFIAPI\r | |
1017 | CryptoServiceSm3GetContextSize (\r | |
1018 | VOID\r | |
1019 | )\r | |
1020 | {\r | |
1021 | return CALL_BASECRYPTLIB (Sm3.Services.GetContextSize, Sm3GetContextSize, (), 0);\r | |
1022 | }\r | |
1023 | \r | |
1024 | /**\r | |
1025 | Initializes user-supplied memory pointed by Sm3Context as SM3 hash context for\r | |
1026 | subsequent use.\r | |
1027 | \r | |
1028 | If Sm3Context is NULL, then return FALSE.\r | |
1029 | \r | |
1030 | @param[out] Sm3Context Pointer to SM3 context being initialized.\r | |
1031 | \r | |
1032 | @retval TRUE SM3 context initialization succeeded.\r | |
1033 | @retval FALSE SM3 context initialization failed.\r | |
1034 | \r | |
1035 | **/\r | |
1036 | BOOLEAN\r | |
1037 | EFIAPI\r | |
1038 | CryptoServiceSm3Init (\r | |
1039 | OUT VOID *Sm3Context\r | |
1040 | )\r | |
1041 | {\r | |
1042 | return CALL_BASECRYPTLIB (Sm3.Services.Init, Sm3Init, (Sm3Context), FALSE);\r | |
1043 | }\r | |
1044 | \r | |
1045 | /**\r | |
1046 | Makes a copy of an existing SM3 context.\r | |
1047 | \r | |
1048 | If Sm3Context is NULL, then return FALSE.\r | |
1049 | If NewSm3Context is NULL, then return FALSE.\r | |
1050 | If this interface is not supported, then return FALSE.\r | |
1051 | \r | |
1052 | @param[in] Sm3Context Pointer to SM3 context being copied.\r | |
1053 | @param[out] NewSm3Context Pointer to new SM3 context.\r | |
1054 | \r | |
1055 | @retval TRUE SM3 context copy succeeded.\r | |
1056 | @retval FALSE SM3 context copy failed.\r | |
1057 | @retval FALSE This interface is not supported.\r | |
1058 | \r | |
1059 | **/\r | |
1060 | BOOLEAN\r | |
1061 | EFIAPI\r | |
1062 | CryptoServiceSm3Duplicate (\r | |
1063 | IN CONST VOID *Sm3Context,\r | |
1064 | OUT VOID *NewSm3Context\r | |
1065 | )\r | |
1066 | {\r | |
1067 | return CALL_BASECRYPTLIB (Sm3.Services.Duplicate, Sm3Duplicate, (Sm3Context, NewSm3Context), FALSE);\r | |
1068 | }\r | |
1069 | \r | |
1070 | /**\r | |
1071 | Digests the input data and updates SM3 context.\r | |
1072 | \r | |
1073 | This function performs SM3 digest on a data buffer of the specified size.\r | |
1074 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
1075 | SM3 context should be already correctly initialized by Sm3Init(), and should not be finalized\r | |
1076 | by Sm3Final(). Behavior with invalid context is undefined.\r | |
1077 | \r | |
1078 | If Sm3Context is NULL, then return FALSE.\r | |
1079 | \r | |
1080 | @param[in, out] Sm3Context Pointer to the SM3 context.\r | |
1081 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
1082 | @param[in] DataSize Size of Data buffer in bytes.\r | |
1083 | \r | |
1084 | @retval TRUE SM3 data digest succeeded.\r | |
1085 | @retval FALSE SM3 data digest failed.\r | |
1086 | \r | |
1087 | **/\r | |
1088 | BOOLEAN\r | |
1089 | EFIAPI\r | |
1090 | CryptoServiceSm3Update (\r | |
1091 | IN OUT VOID *Sm3Context,\r | |
1092 | IN CONST VOID *Data,\r | |
1093 | IN UINTN DataSize\r | |
1094 | )\r | |
1095 | {\r | |
1096 | return CALL_BASECRYPTLIB (Sm3.Services.Update, Sm3Update, (Sm3Context, Data, DataSize), FALSE);\r | |
1097 | }\r | |
1098 | \r | |
1099 | /**\r | |
1100 | Completes computation of the SM3 digest value.\r | |
1101 | \r | |
1102 | This function completes SM3 hash computation and retrieves the digest value into\r | |
1103 | the specified memory. After this function has been called, the SM3 context cannot\r | |
1104 | be used again.\r | |
1105 | SM3 context should be already correctly initialized by Sm3Init(), and should not be\r | |
1106 | finalized by Sm3Final(). Behavior with invalid SM3 context is undefined.\r | |
1107 | \r | |
1108 | If Sm3Context is NULL, then return FALSE.\r | |
1109 | If HashValue is NULL, then return FALSE.\r | |
1110 | \r | |
1111 | @param[in, out] Sm3Context Pointer to the SM3 context.\r | |
1112 | @param[out] HashValue Pointer to a buffer that receives the SM3 digest\r | |
1113 | value (32 bytes).\r | |
1114 | \r | |
1115 | @retval TRUE SM3 digest computation succeeded.\r | |
1116 | @retval FALSE SM3 digest computation failed.\r | |
1117 | \r | |
1118 | **/\r | |
1119 | BOOLEAN\r | |
1120 | EFIAPI\r | |
1121 | CryptoServiceSm3Final (\r | |
1122 | IN OUT VOID *Sm3Context,\r | |
1123 | OUT UINT8 *HashValue\r | |
1124 | )\r | |
1125 | {\r | |
1126 | return CALL_BASECRYPTLIB (Sm3.Services.Final, Sm3Final, (Sm3Context, HashValue), FALSE);\r | |
1127 | }\r | |
1128 | \r | |
1129 | /**\r | |
1130 | Computes the SM3 message digest of a input data buffer.\r | |
1131 | \r | |
1132 | This function performs the SM3 message digest of a given data buffer, and places\r | |
1133 | the digest value into the specified memory.\r | |
1134 | \r | |
1135 | If this interface is not supported, then return FALSE.\r | |
1136 | \r | |
1137 | @param[in] Data Pointer to the buffer containing the data to be hashed.\r | |
1138 | @param[in] DataSize Size of Data buffer in bytes.\r | |
1139 | @param[out] HashValue Pointer to a buffer that receives the SM3 digest\r | |
1140 | value (32 bytes).\r | |
1141 | \r | |
1142 | @retval TRUE SM3 digest computation succeeded.\r | |
1143 | @retval FALSE SM3 digest computation failed.\r | |
1144 | @retval FALSE This interface is not supported.\r | |
1145 | \r | |
1146 | **/\r | |
1147 | BOOLEAN\r | |
1148 | EFIAPI\r | |
1149 | CryptoServiceSm3HashAll (\r | |
1150 | IN CONST VOID *Data,\r | |
1151 | IN UINTN DataSize,\r | |
1152 | OUT UINT8 *HashValue\r | |
1153 | )\r | |
1154 | {\r | |
1155 | return CALL_BASECRYPTLIB (Sm3.Services.HashAll, Sm3HashAll, (Data, DataSize, HashValue), FALSE);\r | |
1156 | }\r | |
1157 | \r | |
1158 | //=====================================================================================\r | |
1159 | // MAC (Message Authentication Code) Primitive\r | |
1160 | //=====================================================================================\r | |
1161 | \r | |
1162 | /**\r | |
b6174e2d ZG |
1163 | HMAC MD5 is deprecated and unsupported any longer.\r |
1164 | Keep the function field for binary compability.\r | |
cc1d13c9 | 1165 | \r |
cc1d13c9 MK |
1166 | @retval NULL This interface is not supported.\r |
1167 | \r | |
1168 | **/\r | |
1169 | VOID *\r | |
1170 | EFIAPI\r | |
b6174e2d | 1171 | DeprecatedCryptoServiceHmacMd5New (\r |
cc1d13c9 MK |
1172 | VOID\r |
1173 | )\r | |
1174 | {\r | |
b6174e2d | 1175 | return BaseCryptLibServiceDeprecated ("HmacMd5New"), NULL;\r |
cc1d13c9 MK |
1176 | }\r |
1177 | \r | |
1178 | /**\r | |
b6174e2d ZG |
1179 | HMAC MD5 is deprecated and unsupported any longer.\r |
1180 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1181 | \r |
1182 | @param[in] HmacMd5Ctx Pointer to the HMAC_CTX context to be released.\r | |
1183 | \r | |
1184 | **/\r | |
1185 | VOID\r | |
1186 | EFIAPI\r | |
b6174e2d | 1187 | DeprecatedCryptoServiceHmacMd5Free (\r |
cc1d13c9 MK |
1188 | IN VOID *HmacMd5Ctx\r |
1189 | )\r | |
1190 | {\r | |
b6174e2d | 1191 | BaseCryptLibServiceDeprecated ("HmacMd5Free");\r |
cc1d13c9 MK |
1192 | }\r |
1193 | \r | |
1194 | /**\r | |
b6174e2d ZG |
1195 | HMAC MD5 is deprecated and unsupported any longer.\r |
1196 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1197 | \r |
1198 | @param[out] HmacMd5Context Pointer to HMAC-MD5 context.\r | |
1199 | @param[in] Key Pointer to the user-supplied key.\r | |
1200 | @param[in] KeySize Key size in bytes.\r | |
1201 | \r | |
cc1d13c9 MK |
1202 | @retval FALSE This interface is not supported.\r |
1203 | \r | |
1204 | **/\r | |
1205 | BOOLEAN\r | |
1206 | EFIAPI\r | |
b6174e2d | 1207 | DeprecatedCryptoServiceHmacMd5SetKey (\r |
cc1d13c9 MK |
1208 | OUT VOID *HmacMd5Context,\r |
1209 | IN CONST UINT8 *Key,\r | |
1210 | IN UINTN KeySize\r | |
1211 | )\r | |
1212 | {\r | |
b6174e2d | 1213 | return BaseCryptLibServiceDeprecated ("HmacMd5SetKey"), FALSE;\r |
cc1d13c9 MK |
1214 | }\r |
1215 | \r | |
1216 | /**\r | |
b6174e2d ZG |
1217 | HMAC MD5 is deprecated and unsupported any longer.\r |
1218 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1219 | \r |
1220 | @param[in] HmacMd5Context Pointer to HMAC-MD5 context being copied.\r | |
1221 | @param[out] NewHmacMd5Context Pointer to new HMAC-MD5 context.\r | |
1222 | \r | |
cc1d13c9 MK |
1223 | @retval FALSE This interface is not supported.\r |
1224 | \r | |
1225 | **/\r | |
1226 | BOOLEAN\r | |
1227 | EFIAPI\r | |
b6174e2d | 1228 | DeprecatedCryptoServiceHmacMd5Duplicate (\r |
cc1d13c9 MK |
1229 | IN CONST VOID *HmacMd5Context,\r |
1230 | OUT VOID *NewHmacMd5Context\r | |
1231 | )\r | |
1232 | {\r | |
b6174e2d | 1233 | return BaseCryptLibServiceDeprecated ("HmacMd5Duplicate"), FALSE;\r |
cc1d13c9 MK |
1234 | }\r |
1235 | \r | |
1236 | /**\r | |
b6174e2d ZG |
1237 | HMAC MD5 is deprecated and unsupported any longer.\r |
1238 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1239 | \r |
1240 | @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.\r | |
1241 | @param[in] Data Pointer to the buffer containing the data to be digested.\r | |
1242 | @param[in] DataSize Size of Data buffer in bytes.\r | |
1243 | \r | |
cc1d13c9 MK |
1244 | @retval FALSE This interface is not supported.\r |
1245 | \r | |
1246 | **/\r | |
1247 | BOOLEAN\r | |
1248 | EFIAPI\r | |
b6174e2d | 1249 | DeprecatedCryptoServiceHmacMd5Update (\r |
cc1d13c9 MK |
1250 | IN OUT VOID *HmacMd5Context,\r |
1251 | IN CONST VOID *Data,\r | |
1252 | IN UINTN DataSize\r | |
1253 | )\r | |
1254 | {\r | |
b6174e2d | 1255 | return BaseCryptLibServiceDeprecated ("HmacMd5Update"), FALSE;\r |
cc1d13c9 MK |
1256 | }\r |
1257 | \r | |
1258 | /**\r | |
b6174e2d ZG |
1259 | HMAC MD5 is deprecated and unsupported any longer.\r |
1260 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1261 | \r |
1262 | @param[in, out] HmacMd5Context Pointer to the HMAC-MD5 context.\r | |
1263 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-MD5 digest\r | |
1264 | value (16 bytes).\r | |
1265 | \r | |
cc1d13c9 MK |
1266 | @retval FALSE This interface is not supported.\r |
1267 | \r | |
1268 | **/\r | |
1269 | BOOLEAN\r | |
1270 | EFIAPI\r | |
b6174e2d | 1271 | DeprecatedCryptoServiceHmacMd5Final (\r |
cc1d13c9 MK |
1272 | IN OUT VOID *HmacMd5Context,\r |
1273 | OUT UINT8 *HmacValue\r | |
1274 | )\r | |
1275 | {\r | |
b6174e2d | 1276 | return BaseCryptLibServiceDeprecated ("HmacMd5Final"), FALSE;\r |
cc1d13c9 MK |
1277 | }\r |
1278 | \r | |
1279 | /**\r | |
c812d320 ZG |
1280 | HMAC SHA1 is deprecated and unsupported any longer.\r |
1281 | Keep the function field for binary compability.\r | |
cc1d13c9 | 1282 | \r |
cc1d13c9 MK |
1283 | @return NULL This interface is not supported.\r |
1284 | \r | |
1285 | **/\r | |
1286 | VOID *\r | |
1287 | EFIAPI\r | |
c812d320 | 1288 | DeprecatedCryptoServiceHmacSha1New (\r |
cc1d13c9 MK |
1289 | VOID\r |
1290 | )\r | |
1291 | {\r | |
c812d320 | 1292 | return BaseCryptLibServiceDeprecated ("HmacSha1New"), NULL;\r |
cc1d13c9 MK |
1293 | }\r |
1294 | \r | |
1295 | /**\r | |
c812d320 ZG |
1296 | HMAC SHA1 is deprecated and unsupported any longer.\r |
1297 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1298 | \r |
1299 | @param[in] HmacSha1Ctx Pointer to the HMAC_CTX context to be released.\r | |
1300 | \r | |
1301 | **/\r | |
1302 | VOID\r | |
1303 | EFIAPI\r | |
c812d320 | 1304 | DeprecatedCryptoServiceHmacSha1Free (\r |
cc1d13c9 MK |
1305 | IN VOID *HmacSha1Ctx\r |
1306 | )\r | |
1307 | {\r | |
c812d320 | 1308 | BaseCryptLibServiceDeprecated ("HmacSha1Free");\r |
cc1d13c9 MK |
1309 | }\r |
1310 | \r | |
1311 | /**\r | |
c812d320 ZG |
1312 | HMAC SHA1 is deprecated and unsupported any longer.\r |
1313 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1314 | \r |
1315 | @param[out] HmacSha1Context Pointer to HMAC-SHA1 context.\r | |
1316 | @param[in] Key Pointer to the user-supplied key.\r | |
1317 | @param[in] KeySize Key size in bytes.\r | |
1318 | \r | |
cc1d13c9 MK |
1319 | @retval FALSE This interface is not supported.\r |
1320 | \r | |
1321 | **/\r | |
1322 | BOOLEAN\r | |
1323 | EFIAPI\r | |
c812d320 | 1324 | DeprecatedCryptoServiceHmacSha1SetKey (\r |
cc1d13c9 MK |
1325 | OUT VOID *HmacSha1Context,\r |
1326 | IN CONST UINT8 *Key,\r | |
1327 | IN UINTN KeySize\r | |
1328 | )\r | |
1329 | {\r | |
c812d320 | 1330 | return BaseCryptLibServiceDeprecated ("HmacSha1SetKey"), FALSE;\r |
cc1d13c9 MK |
1331 | }\r |
1332 | \r | |
1333 | /**\r | |
c812d320 ZG |
1334 | HMAC SHA1 is deprecated and unsupported any longer.\r |
1335 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1336 | \r |
1337 | @param[in] HmacSha1Context Pointer to HMAC-SHA1 context being copied.\r | |
1338 | @param[out] NewHmacSha1Context Pointer to new HMAC-SHA1 context.\r | |
1339 | \r | |
cc1d13c9 MK |
1340 | @retval FALSE This interface is not supported.\r |
1341 | \r | |
1342 | **/\r | |
1343 | BOOLEAN\r | |
1344 | EFIAPI\r | |
c812d320 | 1345 | DeprecatedCryptoServiceHmacSha1Duplicate (\r |
cc1d13c9 MK |
1346 | IN CONST VOID *HmacSha1Context,\r |
1347 | OUT VOID *NewHmacSha1Context\r | |
1348 | )\r | |
1349 | {\r | |
c812d320 | 1350 | return BaseCryptLibServiceDeprecated ("HmacSha1Duplicate"), FALSE;\r |
cc1d13c9 MK |
1351 | }\r |
1352 | \r | |
1353 | /**\r | |
c812d320 ZG |
1354 | HMAC SHA1 is deprecated and unsupported any longer.\r |
1355 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1356 | \r |
1357 | @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.\r | |
1358 | @param[in] Data Pointer to the buffer containing the data to be digested.\r | |
1359 | @param[in] DataSize Size of Data buffer in bytes.\r | |
1360 | \r | |
cc1d13c9 MK |
1361 | @retval FALSE This interface is not supported.\r |
1362 | \r | |
1363 | **/\r | |
1364 | BOOLEAN\r | |
1365 | EFIAPI\r | |
c812d320 | 1366 | DeprecatedCryptoServiceHmacSha1Update (\r |
cc1d13c9 MK |
1367 | IN OUT VOID *HmacSha1Context,\r |
1368 | IN CONST VOID *Data,\r | |
1369 | IN UINTN DataSize\r | |
1370 | )\r | |
1371 | {\r | |
c812d320 | 1372 | return BaseCryptLibServiceDeprecated ("HmacSha1Update"), FALSE;\r |
cc1d13c9 MK |
1373 | }\r |
1374 | \r | |
1375 | /**\r | |
c812d320 ZG |
1376 | HMAC SHA1 is deprecated and unsupported any longer.\r |
1377 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1378 | \r |
1379 | @param[in, out] HmacSha1Context Pointer to the HMAC-SHA1 context.\r | |
1380 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA1 digest\r | |
1381 | value (20 bytes).\r | |
1382 | \r | |
cc1d13c9 MK |
1383 | @retval FALSE This interface is not supported.\r |
1384 | \r | |
1385 | **/\r | |
1386 | BOOLEAN\r | |
1387 | EFIAPI\r | |
c812d320 | 1388 | DeprecatedCryptoServiceHmacSha1Final (\r |
cc1d13c9 MK |
1389 | IN OUT VOID *HmacSha1Context,\r |
1390 | OUT UINT8 *HmacValue\r | |
1391 | )\r | |
1392 | {\r | |
c812d320 | 1393 | return BaseCryptLibServiceDeprecated ("HmacSha1Final"), FALSE;\r |
cc1d13c9 MK |
1394 | }\r |
1395 | \r | |
1396 | /**\r | |
1397 | Allocates and initializes one HMAC_CTX context for subsequent HMAC-SHA256 use.\r | |
1398 | \r | |
1399 | @return Pointer to the HMAC_CTX context that has been initialized.\r | |
1400 | If the allocations fails, HmacSha256New() returns NULL.\r | |
1401 | \r | |
1402 | **/\r | |
1403 | VOID *\r | |
1404 | EFIAPI\r | |
1405 | CryptoServiceHmacSha256New (\r | |
1406 | VOID\r | |
1407 | )\r | |
1408 | {\r | |
1409 | return CALL_BASECRYPTLIB (HmacSha256.Services.New, HmacSha256New, (), NULL);\r | |
1410 | }\r | |
1411 | \r | |
1412 | /**\r | |
1413 | Release the specified HMAC_CTX context.\r | |
1414 | \r | |
1415 | @param[in] HmacSha256Ctx Pointer to the HMAC_CTX context to be released.\r | |
1416 | \r | |
1417 | **/\r | |
1418 | VOID\r | |
1419 | EFIAPI\r | |
1420 | CryptoServiceHmacSha256Free (\r | |
1421 | IN VOID *HmacSha256Ctx\r | |
1422 | )\r | |
1423 | {\r | |
1424 | CALL_VOID_BASECRYPTLIB (HmacSha256.Services.Free, HmacSha256Free, (HmacSha256Ctx));\r | |
1425 | }\r | |
1426 | \r | |
1427 | /**\r | |
1428 | Set user-supplied key for subsequent use. It must be done before any\r | |
1429 | calling to HmacSha256Update().\r | |
1430 | \r | |
1431 | If HmacSha256Context is NULL, then return FALSE.\r | |
1432 | If this interface is not supported, then return FALSE.\r | |
1433 | \r | |
1434 | @param[out] HmacSha256Context Pointer to HMAC-SHA256 context.\r | |
1435 | @param[in] Key Pointer to the user-supplied key.\r | |
1436 | @param[in] KeySize Key size in bytes.\r | |
1437 | \r | |
1438 | @retval TRUE The Key is set successfully.\r | |
1439 | @retval FALSE The Key is set unsuccessfully.\r | |
1440 | @retval FALSE This interface is not supported.\r | |
1441 | \r | |
1442 | **/\r | |
1443 | BOOLEAN\r | |
1444 | EFIAPI\r | |
1445 | CryptoServiceHmacSha256SetKey (\r | |
1446 | OUT VOID *HmacSha256Context,\r | |
1447 | IN CONST UINT8 *Key,\r | |
1448 | IN UINTN KeySize\r | |
1449 | )\r | |
1450 | {\r | |
1451 | return CALL_BASECRYPTLIB (HmacSha256.Services.SetKey, HmacSha256SetKey, (HmacSha256Context, Key, KeySize), FALSE);\r | |
1452 | }\r | |
1453 | \r | |
1454 | /**\r | |
1455 | Makes a copy of an existing HMAC-SHA256 context.\r | |
1456 | \r | |
1457 | If HmacSha256Context is NULL, then return FALSE.\r | |
1458 | If NewHmacSha256Context is NULL, then return FALSE.\r | |
1459 | If this interface is not supported, then return FALSE.\r | |
1460 | \r | |
1461 | @param[in] HmacSha256Context Pointer to HMAC-SHA256 context being copied.\r | |
1462 | @param[out] NewHmacSha256Context Pointer to new HMAC-SHA256 context.\r | |
1463 | \r | |
1464 | @retval TRUE HMAC-SHA256 context copy succeeded.\r | |
1465 | @retval FALSE HMAC-SHA256 context copy failed.\r | |
1466 | @retval FALSE This interface is not supported.\r | |
1467 | \r | |
1468 | **/\r | |
1469 | BOOLEAN\r | |
1470 | EFIAPI\r | |
1471 | CryptoServiceHmacSha256Duplicate (\r | |
1472 | IN CONST VOID *HmacSha256Context,\r | |
1473 | OUT VOID *NewHmacSha256Context\r | |
1474 | )\r | |
1475 | {\r | |
1476 | return CALL_BASECRYPTLIB (HmacSha256.Services.Duplicate, HmacSha256Duplicate, (HmacSha256Context, NewHmacSha256Context), FALSE);\r | |
1477 | }\r | |
1478 | \r | |
1479 | /**\r | |
1480 | Digests the input data and updates HMAC-SHA256 context.\r | |
1481 | \r | |
1482 | This function performs HMAC-SHA256 digest on a data buffer of the specified size.\r | |
1483 | It can be called multiple times to compute the digest of long or discontinuous data streams.\r | |
1484 | HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized\r | |
1485 | by HmacSha256Final(). Behavior with invalid context is undefined.\r | |
1486 | \r | |
1487 | If HmacSha256Context is NULL, then return FALSE.\r | |
1488 | If this interface is not supported, then return FALSE.\r | |
1489 | \r | |
1490 | @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.\r | |
1491 | @param[in] Data Pointer to the buffer containing the data to be digested.\r | |
1492 | @param[in] DataSize Size of Data buffer in bytes.\r | |
1493 | \r | |
1494 | @retval TRUE HMAC-SHA256 data digest succeeded.\r | |
1495 | @retval FALSE HMAC-SHA256 data digest failed.\r | |
1496 | @retval FALSE This interface is not supported.\r | |
1497 | \r | |
1498 | **/\r | |
1499 | BOOLEAN\r | |
1500 | EFIAPI\r | |
1501 | CryptoServiceHmacSha256Update (\r | |
1502 | IN OUT VOID *HmacSha256Context,\r | |
1503 | IN CONST VOID *Data,\r | |
1504 | IN UINTN DataSize\r | |
1505 | )\r | |
1506 | {\r | |
1507 | return CALL_BASECRYPTLIB (HmacSha256.Services.Update, HmacSha256Update, (HmacSha256Context, Data, DataSize), FALSE);\r | |
1508 | }\r | |
1509 | \r | |
1510 | /**\r | |
1511 | Completes computation of the HMAC-SHA256 digest value.\r | |
1512 | \r | |
1513 | This function completes HMAC-SHA256 hash computation and retrieves the digest value into\r | |
1514 | the specified memory. After this function has been called, the HMAC-SHA256 context cannot\r | |
1515 | be used again.\r | |
1516 | HMAC-SHA256 context should be initialized by HmacSha256New(), and should not be finalized\r | |
1517 | by HmacSha256Final(). Behavior with invalid HMAC-SHA256 context is undefined.\r | |
1518 | \r | |
1519 | If HmacSha256Context is NULL, then return FALSE.\r | |
1520 | If HmacValue is NULL, then return FALSE.\r | |
1521 | If this interface is not supported, then return FALSE.\r | |
1522 | \r | |
1523 | @param[in, out] HmacSha256Context Pointer to the HMAC-SHA256 context.\r | |
1524 | @param[out] HmacValue Pointer to a buffer that receives the HMAC-SHA256 digest\r | |
1525 | value (32 bytes).\r | |
1526 | \r | |
1527 | @retval TRUE HMAC-SHA256 digest computation succeeded.\r | |
1528 | @retval FALSE HMAC-SHA256 digest computation failed.\r | |
1529 | @retval FALSE This interface is not supported.\r | |
1530 | \r | |
1531 | **/\r | |
1532 | BOOLEAN\r | |
1533 | EFIAPI\r | |
1534 | CryptoServiceHmacSha256Final (\r | |
1535 | IN OUT VOID *HmacSha256Context,\r | |
1536 | OUT UINT8 *HmacValue\r | |
1537 | )\r | |
1538 | {\r | |
1539 | return CALL_BASECRYPTLIB (HmacSha256.Services.Final, HmacSha256Final, (HmacSha256Context, HmacValue), FALSE);\r | |
1540 | }\r | |
1541 | \r | |
1542 | //=====================================================================================\r | |
1543 | // Symmetric Cryptography Primitive\r | |
1544 | //=====================================================================================\r | |
1545 | \r | |
1546 | /**\r | |
b8af2c9e ZG |
1547 | TDES is deprecated and unsupported any longer.\r |
1548 | Keep the function field for binary compability.\r | |
cc1d13c9 | 1549 | \r |
cc1d13c9 MK |
1550 | @retval 0 This interface is not supported.\r |
1551 | \r | |
1552 | **/\r | |
1553 | UINTN\r | |
1554 | EFIAPI\r | |
b8af2c9e | 1555 | DeprecatedCryptoServiceTdesGetContextSize (\r |
cc1d13c9 MK |
1556 | VOID\r |
1557 | )\r | |
1558 | {\r | |
b8af2c9e | 1559 | return BaseCryptLibServiceDeprecated ("TdesGetContextSize"), 0;\r |
cc1d13c9 MK |
1560 | }\r |
1561 | \r | |
1562 | /**\r | |
b8af2c9e ZG |
1563 | TDES is deprecated and unsupported any longer.\r |
1564 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1565 | \r |
1566 | @param[out] TdesContext Pointer to TDES context being initialized.\r | |
1567 | @param[in] Key Pointer to the user-supplied TDES key.\r | |
1568 | @param[in] KeyLength Length of TDES key in bits.\r | |
1569 | \r | |
cc1d13c9 MK |
1570 | @retval FALSE This interface is not supported.\r |
1571 | \r | |
1572 | **/\r | |
1573 | BOOLEAN\r | |
1574 | EFIAPI\r | |
b8af2c9e | 1575 | DeprecatedCryptoServiceTdesInit (\r |
cc1d13c9 MK |
1576 | OUT VOID *TdesContext,\r |
1577 | IN CONST UINT8 *Key,\r | |
1578 | IN UINTN KeyLength\r | |
1579 | )\r | |
1580 | {\r | |
b8af2c9e | 1581 | return BaseCryptLibServiceDeprecated ("TdesInit"), FALSE;\r |
cc1d13c9 MK |
1582 | }\r |
1583 | \r | |
1584 | /**\r | |
b8af2c9e ZG |
1585 | TDES is deprecated and unsupported any longer.\r |
1586 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1587 | \r |
1588 | @param[in] TdesContext Pointer to the TDES context.\r | |
1589 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1590 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1591 | @param[out] Output Pointer to a buffer that receives the TDES encryption output.\r | |
1592 | \r | |
cc1d13c9 MK |
1593 | @retval FALSE This interface is not supported.\r |
1594 | \r | |
1595 | **/\r | |
1596 | BOOLEAN\r | |
1597 | EFIAPI\r | |
b8af2c9e | 1598 | DeprecatedCryptoServiceTdesEcbEncrypt (\r |
cc1d13c9 MK |
1599 | IN VOID *TdesContext,\r |
1600 | IN CONST UINT8 *Input,\r | |
1601 | IN UINTN InputSize,\r | |
1602 | OUT UINT8 *Output\r | |
1603 | )\r | |
1604 | {\r | |
b8af2c9e | 1605 | return BaseCryptLibServiceDeprecated ("TdesEcbEncrypt"), FALSE;\r |
cc1d13c9 MK |
1606 | }\r |
1607 | \r | |
1608 | /**\r | |
b8af2c9e ZG |
1609 | TDES is deprecated and unsupported any longer.\r |
1610 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1611 | \r |
1612 | @param[in] TdesContext Pointer to the TDES context.\r | |
1613 | @param[in] Input Pointer to the buffer containing the data to be decrypted.\r | |
1614 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1615 | @param[out] Output Pointer to a buffer that receives the TDES decryption output.\r | |
1616 | \r | |
cc1d13c9 MK |
1617 | @retval FALSE This interface is not supported.\r |
1618 | \r | |
1619 | **/\r | |
1620 | BOOLEAN\r | |
1621 | EFIAPI\r | |
b8af2c9e | 1622 | DeprecatedCryptoServiceTdesEcbDecrypt (\r |
cc1d13c9 MK |
1623 | IN VOID *TdesContext,\r |
1624 | IN CONST UINT8 *Input,\r | |
1625 | IN UINTN InputSize,\r | |
1626 | OUT UINT8 *Output\r | |
1627 | )\r | |
1628 | {\r | |
b8af2c9e | 1629 | return BaseCryptLibServiceDeprecated ("TdesEcbDecrypt"), FALSE;\r |
cc1d13c9 MK |
1630 | }\r |
1631 | \r | |
1632 | /**\r | |
b8af2c9e ZG |
1633 | TDES is deprecated and unsupported any longer.\r |
1634 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1635 | \r |
1636 | @param[in] TdesContext Pointer to the TDES context.\r | |
1637 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1638 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1639 | @param[in] Ivec Pointer to initialization vector.\r | |
1640 | @param[out] Output Pointer to a buffer that receives the TDES encryption output.\r | |
1641 | \r | |
cc1d13c9 MK |
1642 | @retval FALSE This interface is not supported.\r |
1643 | \r | |
1644 | **/\r | |
1645 | BOOLEAN\r | |
1646 | EFIAPI\r | |
b8af2c9e | 1647 | DeprecatedCryptoServiceTdesCbcEncrypt (\r |
cc1d13c9 MK |
1648 | IN VOID *TdesContext,\r |
1649 | IN CONST UINT8 *Input,\r | |
1650 | IN UINTN InputSize,\r | |
1651 | IN CONST UINT8 *Ivec,\r | |
1652 | OUT UINT8 *Output\r | |
1653 | )\r | |
1654 | {\r | |
b8af2c9e | 1655 | return BaseCryptLibServiceDeprecated ("TdesCbcEncrypt"), FALSE;\r |
cc1d13c9 MK |
1656 | }\r |
1657 | \r | |
1658 | /**\r | |
b8af2c9e ZG |
1659 | TDES is deprecated and unsupported any longer.\r |
1660 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1661 | \r |
1662 | @param[in] TdesContext Pointer to the TDES context.\r | |
1663 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1664 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1665 | @param[in] Ivec Pointer to initialization vector.\r | |
1666 | @param[out] Output Pointer to a buffer that receives the TDES encryption output.\r | |
1667 | \r | |
cc1d13c9 MK |
1668 | @retval FALSE This interface is not supported.\r |
1669 | \r | |
1670 | **/\r | |
1671 | BOOLEAN\r | |
1672 | EFIAPI\r | |
b8af2c9e | 1673 | DeprecatedCryptoServiceTdesCbcDecrypt (\r |
cc1d13c9 MK |
1674 | IN VOID *TdesContext,\r |
1675 | IN CONST UINT8 *Input,\r | |
1676 | IN UINTN InputSize,\r | |
1677 | IN CONST UINT8 *Ivec,\r | |
1678 | OUT UINT8 *Output\r | |
1679 | )\r | |
1680 | {\r | |
b8af2c9e | 1681 | return BaseCryptLibServiceDeprecated ("TdesCbcDecrypt"), FALSE;\r |
cc1d13c9 MK |
1682 | }\r |
1683 | \r | |
1684 | /**\r | |
1685 | Retrieves the size, in bytes, of the context buffer required for AES operations.\r | |
1686 | \r | |
1687 | If this interface is not supported, then return zero.\r | |
1688 | \r | |
1689 | @return The size, in bytes, of the context buffer required for AES operations.\r | |
1690 | @retval 0 This interface is not supported.\r | |
1691 | \r | |
1692 | **/\r | |
1693 | UINTN\r | |
1694 | EFIAPI\r | |
1695 | CryptoServiceAesGetContextSize (\r | |
1696 | VOID\r | |
1697 | )\r | |
1698 | {\r | |
1699 | return CALL_BASECRYPTLIB (Aes.Services.GetContextSize, AesGetContextSize, (), 0);\r | |
1700 | }\r | |
1701 | \r | |
1702 | /**\r | |
1703 | Initializes user-supplied memory as AES context for subsequent use.\r | |
1704 | \r | |
1705 | This function initializes user-supplied memory pointed by AesContext as AES context.\r | |
1706 | In addition, it sets up all AES key materials for subsequent encryption and decryption\r | |
1707 | operations.\r | |
1708 | There are 3 options for key length, 128 bits, 192 bits, and 256 bits.\r | |
1709 | \r | |
1710 | If AesContext is NULL, then return FALSE.\r | |
1711 | If Key is NULL, then return FALSE.\r | |
1712 | If KeyLength is not valid, then return FALSE.\r | |
1713 | If this interface is not supported, then return FALSE.\r | |
1714 | \r | |
1715 | @param[out] AesContext Pointer to AES context being initialized.\r | |
1716 | @param[in] Key Pointer to the user-supplied AES key.\r | |
1717 | @param[in] KeyLength Length of AES key in bits.\r | |
1718 | \r | |
1719 | @retval TRUE AES context initialization succeeded.\r | |
1720 | @retval FALSE AES context initialization failed.\r | |
1721 | @retval FALSE This interface is not supported.\r | |
1722 | \r | |
1723 | **/\r | |
1724 | BOOLEAN\r | |
1725 | EFIAPI\r | |
1726 | CryptoServiceAesInit (\r | |
1727 | OUT VOID *AesContext,\r | |
1728 | IN CONST UINT8 *Key,\r | |
1729 | IN UINTN KeyLength\r | |
1730 | )\r | |
1731 | {\r | |
1732 | return CALL_BASECRYPTLIB (Aes.Services.Init, AesInit, (AesContext, Key, KeyLength), FALSE);\r | |
1733 | }\r | |
1734 | \r | |
1735 | /**\r | |
80e28dce ZG |
1736 | AES ECB Mode is deprecated and unsupported any longer.\r |
1737 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1738 | \r |
1739 | @param[in] AesContext Pointer to the AES context.\r | |
1740 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1741 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1742 | @param[out] Output Pointer to a buffer that receives the AES encryption output.\r | |
1743 | \r | |
cc1d13c9 MK |
1744 | @retval FALSE This interface is not supported.\r |
1745 | \r | |
1746 | **/\r | |
1747 | BOOLEAN\r | |
1748 | EFIAPI\r | |
80e28dce | 1749 | DeprecatedCryptoServiceAesEcbEncrypt (\r |
cc1d13c9 MK |
1750 | IN VOID *AesContext,\r |
1751 | IN CONST UINT8 *Input,\r | |
1752 | IN UINTN InputSize,\r | |
1753 | OUT UINT8 *Output\r | |
1754 | )\r | |
1755 | {\r | |
80e28dce | 1756 | return BaseCryptLibServiceDeprecated ("AesEcbEncrypt"), FALSE;\r |
cc1d13c9 MK |
1757 | }\r |
1758 | \r | |
1759 | /**\r | |
80e28dce ZG |
1760 | AES ECB Mode is deprecated and unsupported any longer.\r |
1761 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1762 | \r |
1763 | @param[in] AesContext Pointer to the AES context.\r | |
1764 | @param[in] Input Pointer to the buffer containing the data to be decrypted.\r | |
1765 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1766 | @param[out] Output Pointer to a buffer that receives the AES decryption output.\r | |
1767 | \r | |
cc1d13c9 MK |
1768 | @retval FALSE This interface is not supported.\r |
1769 | \r | |
1770 | **/\r | |
1771 | BOOLEAN\r | |
1772 | EFIAPI\r | |
80e28dce | 1773 | DeprecatedCryptoServiceAesEcbDecrypt (\r |
cc1d13c9 MK |
1774 | IN VOID *AesContext,\r |
1775 | IN CONST UINT8 *Input,\r | |
1776 | IN UINTN InputSize,\r | |
1777 | OUT UINT8 *Output\r | |
1778 | )\r | |
1779 | {\r | |
80e28dce | 1780 | return BaseCryptLibServiceDeprecated ("AesEcbDecrypt"), FALSE;\r |
cc1d13c9 MK |
1781 | }\r |
1782 | \r | |
1783 | /**\r | |
1784 | Performs AES encryption on a data buffer of the specified size in CBC mode.\r | |
1785 | \r | |
1786 | This function performs AES encryption on data buffer pointed by Input, of specified\r | |
1787 | size of InputSize, in CBC mode.\r | |
1788 | InputSize must be multiple of block size (16 bytes). This function does not perform\r | |
1789 | padding. Caller must perform padding, if necessary, to ensure valid input data size.\r | |
1790 | Initialization vector should be one block size (16 bytes).\r | |
1791 | AesContext should be already correctly initialized by AesInit(). Behavior with\r | |
1792 | invalid AES context is undefined.\r | |
1793 | \r | |
1794 | If AesContext is NULL, then return FALSE.\r | |
1795 | If Input is NULL, then return FALSE.\r | |
1796 | If InputSize is not multiple of block size (16 bytes), then return FALSE.\r | |
1797 | If Ivec is NULL, then return FALSE.\r | |
1798 | If Output is NULL, then return FALSE.\r | |
1799 | If this interface is not supported, then return FALSE.\r | |
1800 | \r | |
1801 | @param[in] AesContext Pointer to the AES context.\r | |
1802 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1803 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1804 | @param[in] Ivec Pointer to initialization vector.\r | |
1805 | @param[out] Output Pointer to a buffer that receives the AES encryption output.\r | |
1806 | \r | |
1807 | @retval TRUE AES encryption succeeded.\r | |
1808 | @retval FALSE AES encryption failed.\r | |
1809 | @retval FALSE This interface is not supported.\r | |
1810 | \r | |
1811 | **/\r | |
1812 | BOOLEAN\r | |
1813 | EFIAPI\r | |
1814 | CryptoServiceAesCbcEncrypt (\r | |
1815 | IN VOID *AesContext,\r | |
1816 | IN CONST UINT8 *Input,\r | |
1817 | IN UINTN InputSize,\r | |
1818 | IN CONST UINT8 *Ivec,\r | |
1819 | OUT UINT8 *Output\r | |
1820 | )\r | |
1821 | {\r | |
1822 | return CALL_BASECRYPTLIB (Aes.Services.CbcEncrypt, AesCbcEncrypt, (AesContext, Input, InputSize, Ivec, Output), FALSE);\r | |
1823 | }\r | |
1824 | \r | |
1825 | /**\r | |
1826 | Performs AES decryption on a data buffer of the specified size in CBC mode.\r | |
1827 | \r | |
1828 | This function performs AES decryption on data buffer pointed by Input, of specified\r | |
1829 | size of InputSize, in CBC mode.\r | |
1830 | InputSize must be multiple of block size (16 bytes). This function does not perform\r | |
1831 | padding. Caller must perform padding, if necessary, to ensure valid input data size.\r | |
1832 | Initialization vector should be one block size (16 bytes).\r | |
1833 | AesContext should be already correctly initialized by AesInit(). Behavior with\r | |
1834 | invalid AES context is undefined.\r | |
1835 | \r | |
1836 | If AesContext is NULL, then return FALSE.\r | |
1837 | If Input is NULL, then return FALSE.\r | |
1838 | If InputSize is not multiple of block size (16 bytes), then return FALSE.\r | |
1839 | If Ivec is NULL, then return FALSE.\r | |
1840 | If Output is NULL, then return FALSE.\r | |
1841 | If this interface is not supported, then return FALSE.\r | |
1842 | \r | |
1843 | @param[in] AesContext Pointer to the AES context.\r | |
1844 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1845 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1846 | @param[in] Ivec Pointer to initialization vector.\r | |
1847 | @param[out] Output Pointer to a buffer that receives the AES encryption output.\r | |
1848 | \r | |
1849 | @retval TRUE AES decryption succeeded.\r | |
1850 | @retval FALSE AES decryption failed.\r | |
1851 | @retval FALSE This interface is not supported.\r | |
1852 | \r | |
1853 | **/\r | |
1854 | BOOLEAN\r | |
1855 | EFIAPI\r | |
1856 | CryptoServiceAesCbcDecrypt (\r | |
1857 | IN VOID *AesContext,\r | |
1858 | IN CONST UINT8 *Input,\r | |
1859 | IN UINTN InputSize,\r | |
1860 | IN CONST UINT8 *Ivec,\r | |
1861 | OUT UINT8 *Output\r | |
1862 | )\r | |
1863 | {\r | |
1864 | return CALL_BASECRYPTLIB (Aes.Services.CbcDecrypt, AesCbcDecrypt, (AesContext, Input, InputSize, Ivec, Output), FALSE);\r | |
1865 | }\r | |
1866 | \r | |
1867 | /**\r | |
c22a32e1 ZG |
1868 | ARC4 is deprecated and unsupported any longer.\r |
1869 | Keep the function field for binary compability.\r | |
cc1d13c9 | 1870 | \r |
cc1d13c9 MK |
1871 | @retval 0 This interface is not supported.\r |
1872 | \r | |
1873 | **/\r | |
1874 | UINTN\r | |
1875 | EFIAPI\r | |
c22a32e1 | 1876 | DeprecatedCryptoServiceArc4GetContextSize (\r |
cc1d13c9 MK |
1877 | VOID\r |
1878 | )\r | |
1879 | {\r | |
c22a32e1 | 1880 | return BaseCryptLibServiceDeprecated ("Arc4GetContextSize"), 0;\r |
cc1d13c9 MK |
1881 | }\r |
1882 | \r | |
1883 | /**\r | |
c22a32e1 ZG |
1884 | ARC4 is deprecated and unsupported any longer.\r |
1885 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1886 | \r |
1887 | @param[out] Arc4Context Pointer to ARC4 context being initialized.\r | |
1888 | @param[in] Key Pointer to the user-supplied ARC4 key.\r | |
1889 | @param[in] KeySize Size of ARC4 key in bytes.\r | |
1890 | \r | |
cc1d13c9 MK |
1891 | @retval FALSE This interface is not supported.\r |
1892 | \r | |
1893 | **/\r | |
1894 | BOOLEAN\r | |
1895 | EFIAPI\r | |
c22a32e1 | 1896 | DeprecatedCryptoServiceArc4Init (\r |
cc1d13c9 MK |
1897 | OUT VOID *Arc4Context,\r |
1898 | IN CONST UINT8 *Key,\r | |
1899 | IN UINTN KeySize\r | |
1900 | )\r | |
1901 | {\r | |
c22a32e1 | 1902 | return BaseCryptLibServiceDeprecated ("Arc4Init"), FALSE;\r |
cc1d13c9 MK |
1903 | }\r |
1904 | \r | |
1905 | /**\r | |
c22a32e1 ZG |
1906 | ARC4 is deprecated and unsupported any longer.\r |
1907 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1908 | \r |
1909 | @param[in, out] Arc4Context Pointer to the ARC4 context.\r | |
1910 | @param[in] Input Pointer to the buffer containing the data to be encrypted.\r | |
1911 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1912 | @param[out] Output Pointer to a buffer that receives the ARC4 encryption output.\r | |
1913 | \r | |
cc1d13c9 MK |
1914 | @retval FALSE This interface is not supported.\r |
1915 | \r | |
1916 | **/\r | |
1917 | BOOLEAN\r | |
1918 | EFIAPI\r | |
c22a32e1 | 1919 | DeprecatedCryptoServiceArc4Encrypt (\r |
cc1d13c9 MK |
1920 | IN OUT VOID *Arc4Context,\r |
1921 | IN CONST UINT8 *Input,\r | |
1922 | IN UINTN InputSize,\r | |
1923 | OUT UINT8 *Output\r | |
1924 | )\r | |
1925 | {\r | |
c22a32e1 | 1926 | return BaseCryptLibServiceDeprecated ("Arc4Encrypt"), FALSE;\r |
cc1d13c9 MK |
1927 | }\r |
1928 | \r | |
1929 | /**\r | |
c22a32e1 ZG |
1930 | ARC4 is deprecated and unsupported any longer.\r |
1931 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1932 | \r |
1933 | @param[in, out] Arc4Context Pointer to the ARC4 context.\r | |
1934 | @param[in] Input Pointer to the buffer containing the data to be decrypted.\r | |
1935 | @param[in] InputSize Size of the Input buffer in bytes.\r | |
1936 | @param[out] Output Pointer to a buffer that receives the ARC4 decryption output.\r | |
1937 | \r | |
cc1d13c9 MK |
1938 | @retval FALSE This interface is not supported.\r |
1939 | \r | |
1940 | **/\r | |
1941 | BOOLEAN\r | |
1942 | EFIAPI\r | |
c22a32e1 | 1943 | DeprecatedCryptoServiceArc4Decrypt (\r |
cc1d13c9 MK |
1944 | IN OUT VOID *Arc4Context,\r |
1945 | IN UINT8 *Input,\r | |
1946 | IN UINTN InputSize,\r | |
1947 | OUT UINT8 *Output\r | |
1948 | )\r | |
1949 | {\r | |
c22a32e1 | 1950 | return BaseCryptLibServiceDeprecated ("Arc4Decrypt"), FALSE;\r |
cc1d13c9 MK |
1951 | }\r |
1952 | \r | |
1953 | /**\r | |
c22a32e1 ZG |
1954 | ARC4 is deprecated and unsupported any longer.\r |
1955 | Keep the function field for binary compability.\r | |
cc1d13c9 MK |
1956 | \r |
1957 | @param[in, out] Arc4Context Pointer to the ARC4 context.\r | |
1958 | \r | |
cc1d13c9 MK |
1959 | @retval FALSE This interface is not supported.\r |
1960 | \r | |
1961 | **/\r | |
1962 | BOOLEAN\r | |
1963 | EFIAPI\r | |
c22a32e1 | 1964 | DeprecatedCryptoServiceArc4Reset (\r |
cc1d13c9 MK |
1965 | IN OUT VOID *Arc4Context\r |
1966 | )\r | |
1967 | {\r | |
c22a32e1 | 1968 | return BaseCryptLibServiceDeprecated ("Arc4Reset"), FALSE;\r |
cc1d13c9 MK |
1969 | }\r |
1970 | \r | |
1971 | //=====================================================================================\r | |
1972 | // Asymmetric Cryptography Primitive\r | |
1973 | //=====================================================================================\r | |
1974 | \r | |
1975 | /**\r | |
1976 | Allocates and initializes one RSA context for subsequent use.\r | |
1977 | \r | |
1978 | @return Pointer to the RSA context that has been initialized.\r | |
1979 | If the allocations fails, RsaNew() returns NULL.\r | |
1980 | \r | |
1981 | **/\r | |
1982 | VOID *\r | |
1983 | EFIAPI\r | |
1984 | CryptoServiceRsaNew (\r | |
1985 | VOID\r | |
1986 | )\r | |
1987 | {\r | |
1988 | return CALL_BASECRYPTLIB (Rsa.Services.New, RsaNew, (), NULL);\r | |
1989 | }\r | |
1990 | \r | |
1991 | /**\r | |
1992 | Release the specified RSA context.\r | |
1993 | \r | |
1994 | If RsaContext is NULL, then return FALSE.\r | |
1995 | \r | |
1996 | @param[in] RsaContext Pointer to the RSA context to be released.\r | |
1997 | \r | |
1998 | **/\r | |
1999 | VOID\r | |
2000 | EFIAPI\r | |
2001 | CryptoServiceRsaFree (\r | |
2002 | IN VOID *RsaContext\r | |
2003 | )\r | |
2004 | {\r | |
2005 | CALL_VOID_BASECRYPTLIB (Rsa.Services.Free, RsaFree, (RsaContext));\r | |
2006 | }\r | |
2007 | \r | |
2008 | /**\r | |
2009 | Sets the tag-designated key component into the established RSA context.\r | |
2010 | \r | |
2011 | This function sets the tag-designated RSA key component into the established\r | |
2012 | RSA context from the user-specified non-negative integer (octet string format\r | |
2013 | represented in RSA PKCS#1).\r | |
2014 | If BigNumber is NULL, then the specified key component in RSA context is cleared.\r | |
2015 | \r | |
2016 | If RsaContext is NULL, then return FALSE.\r | |
2017 | \r | |
2018 | @param[in, out] RsaContext Pointer to RSA context being set.\r | |
2019 | @param[in] KeyTag Tag of RSA key component being set.\r | |
2020 | @param[in] BigNumber Pointer to octet integer buffer.\r | |
2021 | If NULL, then the specified key component in RSA\r | |
2022 | context is cleared.\r | |
2023 | @param[in] BnSize Size of big number buffer in bytes.\r | |
2024 | If BigNumber is NULL, then it is ignored.\r | |
2025 | \r | |
2026 | @retval TRUE RSA key component was set successfully.\r | |
2027 | @retval FALSE Invalid RSA key component tag.\r | |
2028 | \r | |
2029 | **/\r | |
2030 | BOOLEAN\r | |
2031 | EFIAPI\r | |
2032 | CryptoServiceRsaSetKey (\r | |
2033 | IN OUT VOID *RsaContext,\r | |
2034 | IN RSA_KEY_TAG KeyTag,\r | |
2035 | IN CONST UINT8 *BigNumber,\r | |
2036 | IN UINTN BnSize\r | |
2037 | )\r | |
2038 | {\r | |
2039 | return CALL_BASECRYPTLIB (Rsa.Services.SetKey, RsaSetKey, (RsaContext, KeyTag, BigNumber, BnSize), FALSE);\r | |
2040 | }\r | |
2041 | \r | |
2042 | /**\r | |
2043 | Gets the tag-designated RSA key component from the established RSA context.\r | |
2044 | \r | |
2045 | This function retrieves the tag-designated RSA key component from the\r | |
2046 | established RSA context as a non-negative integer (octet string format\r | |
2047 | represented in RSA PKCS#1).\r | |
2048 | If specified key component has not been set or has been cleared, then returned\r | |
2049 | BnSize is set to 0.\r | |
2050 | If the BigNumber buffer is too small to hold the contents of the key, FALSE\r | |
2051 | is returned and BnSize is set to the required buffer size to obtain the key.\r | |
2052 | \r | |
2053 | If RsaContext is NULL, then return FALSE.\r | |
2054 | If BnSize is NULL, then return FALSE.\r | |
2055 | If BnSize is large enough but BigNumber is NULL, then return FALSE.\r | |
2056 | If this interface is not supported, then return FALSE.\r | |
2057 | \r | |
2058 | @param[in, out] RsaContext Pointer to RSA context being set.\r | |
2059 | @param[in] KeyTag Tag of RSA key component being set.\r | |
2060 | @param[out] BigNumber Pointer to octet integer buffer.\r | |
2061 | @param[in, out] BnSize On input, the size of big number buffer in bytes.\r | |
2062 | On output, the size of data returned in big number buffer in bytes.\r | |
2063 | \r | |
2064 | @retval TRUE RSA key component was retrieved successfully.\r | |
2065 | @retval FALSE Invalid RSA key component tag.\r | |
2066 | @retval FALSE BnSize is too small.\r | |
2067 | @retval FALSE This interface is not supported.\r | |
2068 | \r | |
2069 | **/\r | |
2070 | BOOLEAN\r | |
2071 | EFIAPI\r | |
2072 | CryptoServiceRsaGetKey (\r | |
2073 | IN OUT VOID *RsaContext,\r | |
2074 | IN RSA_KEY_TAG KeyTag,\r | |
2075 | OUT UINT8 *BigNumber,\r | |
2076 | IN OUT UINTN *BnSize\r | |
2077 | )\r | |
2078 | {\r | |
2079 | return CALL_BASECRYPTLIB (Rsa.Services.GetKey, RsaGetKey, (RsaContext, KeyTag, BigNumber, BnSize), FALSE);\r | |
2080 | }\r | |
2081 | \r | |
2082 | /**\r | |
2083 | Generates RSA key components.\r | |
2084 | \r | |
2085 | This function generates RSA key components. It takes RSA public exponent E and\r | |
2086 | length in bits of RSA modulus N as input, and generates all key components.\r | |
2087 | If PublicExponent is NULL, the default RSA public exponent (0x10001) will be used.\r | |
2088 | \r | |
2089 | Before this function can be invoked, pseudorandom number generator must be correctly\r | |
2090 | initialized by RandomSeed().\r | |
2091 | \r | |
2092 | If RsaContext is NULL, then return FALSE.\r | |
2093 | If this interface is not supported, then return FALSE.\r | |
2094 | \r | |
2095 | @param[in, out] RsaContext Pointer to RSA context being set.\r | |
2096 | @param[in] ModulusLength Length of RSA modulus N in bits.\r | |
2097 | @param[in] PublicExponent Pointer to RSA public exponent.\r | |
2098 | @param[in] PublicExponentSize Size of RSA public exponent buffer in bytes.\r | |
2099 | \r | |
2100 | @retval TRUE RSA key component was generated successfully.\r | |
2101 | @retval FALSE Invalid RSA key component tag.\r | |
2102 | @retval FALSE This interface is not supported.\r | |
2103 | \r | |
2104 | **/\r | |
2105 | BOOLEAN\r | |
2106 | EFIAPI\r | |
2107 | CryptoServiceRsaGenerateKey (\r | |
2108 | IN OUT VOID *RsaContext,\r | |
2109 | IN UINTN ModulusLength,\r | |
2110 | IN CONST UINT8 *PublicExponent,\r | |
2111 | IN UINTN PublicExponentSize\r | |
2112 | )\r | |
2113 | {\r | |
2114 | return CALL_BASECRYPTLIB (Rsa.Services.GenerateKey, RsaGenerateKey, (RsaContext, ModulusLength, PublicExponent, PublicExponentSize), FALSE);\r | |
2115 | }\r | |
2116 | \r | |
2117 | /**\r | |
2118 | Validates key components of RSA context.\r | |
2119 | NOTE: This function performs integrity checks on all the RSA key material, so\r | |
2120 | the RSA key structure must contain all the private key data.\r | |
2121 | \r | |
2122 | This function validates key components of RSA context in following aspects:\r | |
2123 | - Whether p is a prime\r | |
2124 | - Whether q is a prime\r | |
2125 | - Whether n = p * q\r | |
2126 | - Whether d*e = 1 mod lcm(p-1,q-1)\r | |
2127 | \r | |
2128 | If RsaContext is NULL, then return FALSE.\r | |
2129 | If this interface is not supported, then return FALSE.\r | |
2130 | \r | |
2131 | @param[in] RsaContext Pointer to RSA context to check.\r | |
2132 | \r | |
2133 | @retval TRUE RSA key components are valid.\r | |
2134 | @retval FALSE RSA key components are not valid.\r | |
2135 | @retval FALSE This interface is not supported.\r | |
2136 | \r | |
2137 | **/\r | |
2138 | BOOLEAN\r | |
2139 | EFIAPI\r | |
2140 | CryptoServiceRsaCheckKey (\r | |
2141 | IN VOID *RsaContext\r | |
2142 | )\r | |
2143 | {\r | |
2144 | return CALL_BASECRYPTLIB (Rsa.Services.CheckKey, RsaCheckKey, (RsaContext), FALSE);\r | |
2145 | }\r | |
2146 | \r | |
2147 | /**\r | |
2148 | Carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme.\r | |
2149 | \r | |
2150 | This function carries out the RSA-SSA signature generation with EMSA-PKCS1-v1_5 encoding scheme defined in\r | |
2151 | RSA PKCS#1.\r | |
2152 | If the Signature buffer is too small to hold the contents of signature, FALSE\r | |
2153 | is returned and SigSize is set to the required buffer size to obtain the signature.\r | |
2154 | \r | |
2155 | If RsaContext is NULL, then return FALSE.\r | |
2156 | If MessageHash is NULL, then return FALSE.\r | |
2157 | If HashSize is not equal to the size of MD5, SHA-1 or SHA-256 digest, then return FALSE.\r | |
2158 | If SigSize is large enough but Signature is NULL, then return FALSE.\r | |
2159 | If this interface is not supported, then return FALSE.\r | |
2160 | \r | |
2161 | @param[in] RsaContext Pointer to RSA context for signature generation.\r | |
2162 | @param[in] MessageHash Pointer to octet message hash to be signed.\r | |
2163 | @param[in] HashSize Size of the message hash in bytes.\r | |
2164 | @param[out] Signature Pointer to buffer to receive RSA PKCS1-v1_5 signature.\r | |
2165 | @param[in, out] SigSize On input, the size of Signature buffer in bytes.\r | |
2166 | On output, the size of data returned in Signature buffer in bytes.\r | |
2167 | \r | |
2168 | @retval TRUE Signature successfully generated in PKCS1-v1_5.\r | |
2169 | @retval FALSE Signature generation failed.\r | |
2170 | @retval FALSE SigSize is too small.\r | |
2171 | @retval FALSE This interface is not supported.\r | |
2172 | \r | |
2173 | **/\r | |
2174 | BOOLEAN\r | |
2175 | EFIAPI\r | |
2176 | CryptoServiceRsaPkcs1Sign (\r | |
2177 | IN VOID *RsaContext,\r | |
2178 | IN CONST UINT8 *MessageHash,\r | |
2179 | IN UINTN HashSize,\r | |
2180 | OUT UINT8 *Signature,\r | |
2181 | IN OUT UINTN *SigSize\r | |
2182 | )\r | |
2183 | {\r | |
2184 | return CALL_BASECRYPTLIB (Rsa.Services.Pkcs1Sign, RsaPkcs1Sign, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE);\r | |
2185 | }\r | |
2186 | \r | |
2187 | /**\r | |
2188 | Verifies the RSA-SSA signature with EMSA-PKCS1-v1_5 encoding scheme defined in\r | |
2189 | RSA PKCS#1.\r | |
2190 | \r | |
2191 | If RsaContext is NULL, then return FALSE.\r | |
2192 | If MessageHash is NULL, then return FALSE.\r | |
2193 | If Signature is NULL, then return FALSE.\r | |
2194 | If HashSize is not equal to the size of MD5, SHA-1, SHA-256 digest, then return FALSE.\r | |
2195 | \r | |
2196 | @param[in] RsaContext Pointer to RSA context for signature verification.\r | |
2197 | @param[in] MessageHash Pointer to octet message hash to be checked.\r | |
2198 | @param[in] HashSize Size of the message hash in bytes.\r | |
2199 | @param[in] Signature Pointer to RSA PKCS1-v1_5 signature to be verified.\r | |
2200 | @param[in] SigSize Size of signature in bytes.\r | |
2201 | \r | |
2202 | @retval TRUE Valid signature encoded in PKCS1-v1_5.\r | |
2203 | @retval FALSE Invalid signature or invalid RSA context.\r | |
2204 | \r | |
2205 | **/\r | |
2206 | BOOLEAN\r | |
2207 | EFIAPI\r | |
2208 | CryptoServiceRsaPkcs1Verify (\r | |
2209 | IN VOID *RsaContext,\r | |
2210 | IN CONST UINT8 *MessageHash,\r | |
2211 | IN UINTN HashSize,\r | |
2212 | IN CONST UINT8 *Signature,\r | |
2213 | IN UINTN SigSize\r | |
2214 | )\r | |
2215 | {\r | |
2216 | return CALL_BASECRYPTLIB (Rsa.Services.Pkcs1Verify, RsaPkcs1Verify, (RsaContext, MessageHash, HashSize, Signature, SigSize), FALSE);\r | |
2217 | }\r | |
2218 | \r | |
2219 | /**\r | |
2220 | Retrieve the RSA Private Key from the password-protected PEM key data.\r | |
2221 | \r | |
2222 | If PemData is NULL, then return FALSE.\r | |
2223 | If RsaContext is NULL, then return FALSE.\r | |
2224 | If this interface is not supported, then return FALSE.\r | |
2225 | \r | |
2226 | @param[in] PemData Pointer to the PEM-encoded key data to be retrieved.\r | |
2227 | @param[in] PemSize Size of the PEM key data in bytes.\r | |
2228 | @param[in] Password NULL-terminated passphrase used for encrypted PEM key data.\r | |
2229 | @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved\r | |
2230 | RSA private key component. Use RsaFree() function to free the\r | |
2231 | resource.\r | |
2232 | \r | |
2233 | @retval TRUE RSA Private Key was retrieved successfully.\r | |
2234 | @retval FALSE Invalid PEM key data or incorrect password.\r | |
2235 | @retval FALSE This interface is not supported.\r | |
2236 | \r | |
2237 | **/\r | |
2238 | BOOLEAN\r | |
2239 | EFIAPI\r | |
2240 | CryptoServiceRsaGetPrivateKeyFromPem (\r | |
2241 | IN CONST UINT8 *PemData,\r | |
2242 | IN UINTN PemSize,\r | |
2243 | IN CONST CHAR8 *Password,\r | |
2244 | OUT VOID **RsaContext\r | |
2245 | )\r | |
2246 | {\r | |
2247 | return CALL_BASECRYPTLIB (Rsa.Services.GetPrivateKeyFromPem, RsaGetPrivateKeyFromPem, (PemData, PemSize, Password, RsaContext), FALSE);\r | |
2248 | }\r | |
2249 | \r | |
2250 | /**\r | |
2251 | Retrieve the RSA Public Key from one DER-encoded X509 certificate.\r | |
2252 | \r | |
2253 | If Cert is NULL, then return FALSE.\r | |
2254 | If RsaContext is NULL, then return FALSE.\r | |
2255 | If this interface is not supported, then return FALSE.\r | |
2256 | \r | |
2257 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
2258 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
2259 | @param[out] RsaContext Pointer to new-generated RSA context which contain the retrieved\r | |
2260 | RSA public key component. Use RsaFree() function to free the\r | |
2261 | resource.\r | |
2262 | \r | |
2263 | @retval TRUE RSA Public Key was retrieved successfully.\r | |
2264 | @retval FALSE Fail to retrieve RSA public key from X509 certificate.\r | |
2265 | @retval FALSE This interface is not supported.\r | |
2266 | \r | |
2267 | **/\r | |
2268 | BOOLEAN\r | |
2269 | EFIAPI\r | |
2270 | CryptoServiceRsaGetPublicKeyFromX509 (\r | |
2271 | IN CONST UINT8 *Cert,\r | |
2272 | IN UINTN CertSize,\r | |
2273 | OUT VOID **RsaContext\r | |
2274 | )\r | |
2275 | {\r | |
2276 | return CALL_BASECRYPTLIB (Rsa.Services.GetPublicKeyFromX509, RsaGetPublicKeyFromX509, (Cert, CertSize, RsaContext), FALSE);\r | |
2277 | }\r | |
2278 | \r | |
2279 | /**\r | |
2280 | Retrieve the subject bytes from one X.509 certificate.\r | |
2281 | \r | |
2282 | If Cert is NULL, then return FALSE.\r | |
2283 | If SubjectSize is NULL, then return FALSE.\r | |
2284 | If this interface is not supported, then return FALSE.\r | |
2285 | \r | |
2286 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
2287 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
2288 | @param[out] CertSubject Pointer to the retrieved certificate subject bytes.\r | |
2289 | @param[in, out] SubjectSize The size in bytes of the CertSubject buffer on input,\r | |
2290 | and the size of buffer returned CertSubject on output.\r | |
2291 | \r | |
2292 | @retval TRUE The certificate subject retrieved successfully.\r | |
2293 | @retval FALSE Invalid certificate, or the SubjectSize is too small for the result.\r | |
2294 | The SubjectSize will be updated with the required size.\r | |
2295 | @retval FALSE This interface is not supported.\r | |
2296 | \r | |
2297 | **/\r | |
2298 | BOOLEAN\r | |
2299 | EFIAPI\r | |
2300 | CryptoServiceX509GetSubjectName (\r | |
2301 | IN CONST UINT8 *Cert,\r | |
2302 | IN UINTN CertSize,\r | |
2303 | OUT UINT8 *CertSubject,\r | |
2304 | IN OUT UINTN *SubjectSize\r | |
2305 | )\r | |
2306 | {\r | |
2307 | return CALL_BASECRYPTLIB (X509.Services.GetSubjectName, X509GetSubjectName, (Cert, CertSize, CertSubject, SubjectSize), FALSE);\r | |
2308 | }\r | |
2309 | \r | |
2310 | /**\r | |
2311 | Retrieve the common name (CN) string from one X.509 certificate.\r | |
2312 | \r | |
2313 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
2314 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
2315 | @param[out] CommonName Buffer to contain the retrieved certificate common\r | |
2316 | name string (UTF8). At most CommonNameSize bytes will be\r | |
2317 | written and the string will be null terminated. May be\r | |
2318 | NULL in order to determine the size buffer needed.\r | |
2319 | @param[in,out] CommonNameSize The size in bytes of the CommonName buffer on input,\r | |
2320 | and the size of buffer returned CommonName on output.\r | |
2321 | If CommonName is NULL then the amount of space needed\r | |
2322 | in buffer (including the final null) is returned.\r | |
2323 | \r | |
2324 | @retval RETURN_SUCCESS The certificate CommonName retrieved successfully.\r | |
2325 | @retval RETURN_INVALID_PARAMETER If Cert is NULL.\r | |
2326 | If CommonNameSize is NULL.\r | |
2327 | If CommonName is not NULL and *CommonNameSize is 0.\r | |
2328 | If Certificate is invalid.\r | |
2329 | @retval RETURN_NOT_FOUND If no CommonName entry exists.\r | |
2330 | @retval RETURN_BUFFER_TOO_SMALL If the CommonName is NULL. The required buffer size\r | |
2331 | (including the final null) is returned in the\r | |
2332 | CommonNameSize parameter.\r | |
2333 | @retval RETURN_UNSUPPORTED The operation is not supported.\r | |
2334 | \r | |
2335 | **/\r | |
2336 | RETURN_STATUS\r | |
2337 | EFIAPI\r | |
2338 | CryptoServiceX509GetCommonName (\r | |
2339 | IN CONST UINT8 *Cert,\r | |
2340 | IN UINTN CertSize,\r | |
2341 | OUT CHAR8 *CommonName, OPTIONAL\r | |
2342 | IN OUT UINTN *CommonNameSize\r | |
2343 | )\r | |
2344 | {\r | |
2345 | return CALL_BASECRYPTLIB (X509.Services.GetCommonName, X509GetCommonName, (Cert, CertSize, CommonName, CommonNameSize), RETURN_UNSUPPORTED);\r | |
2346 | }\r | |
2347 | \r | |
2348 | /**\r | |
2349 | Retrieve the organization name (O) string from one X.509 certificate.\r | |
2350 | \r | |
2351 | @param[in] Cert Pointer to the DER-encoded X509 certificate.\r | |
2352 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
2353 | @param[out] NameBuffer Buffer to contain the retrieved certificate organization\r | |
2354 | name string. At most NameBufferSize bytes will be\r | |
2355 | written and the string will be null terminated. May be\r | |
2356 | NULL in order to determine the size buffer needed.\r | |
2357 | @param[in,out] NameBufferSize The size in bytes of the Name buffer on input,\r | |
2358 | and the size of buffer returned Name on output.\r | |
2359 | If NameBuffer is NULL then the amount of space needed\r | |
2360 | in buffer (including the final null) is returned.\r | |
2361 | \r | |
2362 | @retval RETURN_SUCCESS The certificate Organization Name retrieved successfully.\r | |
2363 | @retval RETURN_INVALID_PARAMETER If Cert is NULL.\r | |
2364 | If NameBufferSize is NULL.\r | |
2365 | If NameBuffer is not NULL and *CommonNameSize is 0.\r | |
2366 | If Certificate is invalid.\r | |
2367 | @retval RETURN_NOT_FOUND If no Organization Name entry exists.\r | |
2368 | @retval RETURN_BUFFER_TOO_SMALL If the NameBuffer is NULL. The required buffer size\r | |
2369 | (including the final null) is returned in the\r | |
2370 | CommonNameSize parameter.\r | |
2371 | @retval RETURN_UNSUPPORTED The operation is not supported.\r | |
2372 | \r | |
2373 | **/\r | |
2374 | RETURN_STATUS\r | |
2375 | EFIAPI\r | |
2376 | CryptoServiceX509GetOrganizationName (\r | |
2377 | IN CONST UINT8 *Cert,\r | |
2378 | IN UINTN CertSize,\r | |
2379 | OUT CHAR8 *NameBuffer, OPTIONAL\r | |
2380 | IN OUT UINTN *NameBufferSize\r | |
2381 | )\r | |
2382 | {\r | |
2383 | return CALL_BASECRYPTLIB (X509.Services.GetOrganizationName, X509GetOrganizationName, (Cert, CertSize, NameBuffer, NameBufferSize), RETURN_UNSUPPORTED);\r | |
2384 | }\r | |
2385 | \r | |
2386 | /**\r | |
2387 | Verify one X509 certificate was issued by the trusted CA.\r | |
2388 | \r | |
2389 | If Cert is NULL, then return FALSE.\r | |
2390 | If CACert is NULL, then return FALSE.\r | |
2391 | If this interface is not supported, then return FALSE.\r | |
2392 | \r | |
2393 | @param[in] Cert Pointer to the DER-encoded X509 certificate to be verified.\r | |
2394 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
2395 | @param[in] CACert Pointer to the DER-encoded trusted CA certificate.\r | |
2396 | @param[in] CACertSize Size of the CA Certificate in bytes.\r | |
2397 | \r | |
2398 | @retval TRUE The certificate was issued by the trusted CA.\r | |
2399 | @retval FALSE Invalid certificate or the certificate was not issued by the given\r | |
2400 | trusted CA.\r | |
2401 | @retval FALSE This interface is not supported.\r | |
2402 | \r | |
2403 | **/\r | |
2404 | BOOLEAN\r | |
2405 | EFIAPI\r | |
2406 | CryptoServiceX509VerifyCert (\r | |
2407 | IN CONST UINT8 *Cert,\r | |
2408 | IN UINTN CertSize,\r | |
2409 | IN CONST UINT8 *CACert,\r | |
2410 | IN UINTN CACertSize\r | |
2411 | )\r | |
2412 | {\r | |
2413 | return CALL_BASECRYPTLIB (X509.Services.VerifyCert, X509VerifyCert, (Cert, CertSize, CACert, CACertSize), FALSE);\r | |
2414 | }\r | |
2415 | \r | |
2416 | /**\r | |
2417 | Construct a X509 object from DER-encoded certificate data.\r | |
2418 | \r | |
2419 | If Cert is NULL, then return FALSE.\r | |
2420 | If SingleX509Cert is NULL, then return FALSE.\r | |
2421 | If this interface is not supported, then return FALSE.\r | |
2422 | \r | |
2423 | @param[in] Cert Pointer to the DER-encoded certificate data.\r | |
2424 | @param[in] CertSize The size of certificate data in bytes.\r | |
2425 | @param[out] SingleX509Cert The generated X509 object.\r | |
2426 | \r | |
2427 | @retval TRUE The X509 object generation succeeded.\r | |
2428 | @retval FALSE The operation failed.\r | |
2429 | @retval FALSE This interface is not supported.\r | |
2430 | \r | |
2431 | **/\r | |
2432 | BOOLEAN\r | |
2433 | EFIAPI\r | |
2434 | CryptoServiceX509ConstructCertificate (\r | |
2435 | IN CONST UINT8 *Cert,\r | |
2436 | IN UINTN CertSize,\r | |
2437 | OUT UINT8 **SingleX509Cert\r | |
2438 | )\r | |
2439 | {\r | |
2440 | return CALL_BASECRYPTLIB (X509.Services.ConstructCertificate, X509ConstructCertificate, (Cert, CertSize, SingleX509Cert), FALSE);\r | |
2441 | }\r | |
2442 | \r | |
2443 | /**\r | |
2444 | Construct a X509 stack object from a list of DER-encoded certificate data.\r | |
2445 | \r | |
2446 | If X509Stack is NULL, then return FALSE.\r | |
2447 | If this interface is not supported, then return FALSE.\r | |
2448 | \r | |
2449 | @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.\r | |
2450 | On output, pointer to the X509 stack object with new\r | |
2451 | inserted X509 certificate.\r | |
2452 | @param[in] Args VA_LIST marker for the variable argument list.\r | |
2453 | A list of DER-encoded single certificate data followed\r | |
2454 | by certificate size. A NULL terminates the list. The\r | |
2455 | pairs are the arguments to X509ConstructCertificate().\r | |
2456 | \r | |
2457 | @retval TRUE The X509 stack construction succeeded.\r | |
2458 | @retval FALSE The construction operation failed.\r | |
2459 | @retval FALSE This interface is not supported.\r | |
2460 | \r | |
2461 | **/\r | |
2462 | BOOLEAN\r | |
2463 | EFIAPI\r | |
2464 | CryptoServiceX509ConstructCertificateStackV (\r | |
2465 | IN OUT UINT8 **X509Stack,\r | |
2466 | IN VA_LIST Args\r | |
2467 | )\r | |
2468 | {\r | |
2469 | return CALL_BASECRYPTLIB (X509.Services.ConstructCertificateStackV, X509ConstructCertificateStackV, (X509Stack, Args), FALSE);\r | |
2470 | }\r | |
2471 | \r | |
2472 | /**\r | |
2473 | Construct a X509 stack object from a list of DER-encoded certificate data.\r | |
2474 | \r | |
2475 | If X509Stack is NULL, then return FALSE.\r | |
2476 | If this interface is not supported, then return FALSE.\r | |
2477 | \r | |
2478 | @param[in, out] X509Stack On input, pointer to an existing or NULL X509 stack object.\r | |
2479 | On output, pointer to the X509 stack object with new\r | |
2480 | inserted X509 certificate.\r | |
2481 | @param ... A list of DER-encoded single certificate data followed\r | |
2482 | by certificate size. A NULL terminates the list. The\r | |
2483 | pairs are the arguments to X509ConstructCertificate().\r | |
2484 | \r | |
2485 | @retval TRUE The X509 stack construction succeeded.\r | |
2486 | @retval FALSE The construction operation failed.\r | |
2487 | @retval FALSE This interface is not supported.\r | |
2488 | \r | |
2489 | **/\r | |
2490 | BOOLEAN\r | |
2491 | EFIAPI\r | |
2492 | CryptoServiceX509ConstructCertificateStack (\r | |
2493 | IN OUT UINT8 **X509Stack,\r | |
2494 | ...\r | |
2495 | )\r | |
2496 | {\r | |
2497 | VA_LIST Args;\r | |
2498 | BOOLEAN Result;\r | |
2499 | \r | |
2500 | VA_START (Args, X509Stack);\r | |
2501 | Result = CryptoServiceX509ConstructCertificateStackV (X509Stack, Args);\r | |
2502 | VA_END (Args);\r | |
2503 | return Result;\r | |
2504 | }\r | |
2505 | \r | |
2506 | /**\r | |
2507 | Release the specified X509 object.\r | |
2508 | \r | |
2509 | If the interface is not supported, then ASSERT().\r | |
2510 | \r | |
2511 | @param[in] X509Cert Pointer to the X509 object to be released.\r | |
2512 | \r | |
2513 | **/\r | |
2514 | VOID\r | |
2515 | EFIAPI\r | |
2516 | CryptoServiceX509Free (\r | |
2517 | IN VOID *X509Cert\r | |
2518 | )\r | |
2519 | {\r | |
2520 | CALL_VOID_BASECRYPTLIB (X509.Services.Free, X509Free, (X509Cert));\r | |
2521 | }\r | |
2522 | \r | |
2523 | /**\r | |
2524 | Release the specified X509 stack object.\r | |
2525 | \r | |
2526 | If the interface is not supported, then ASSERT().\r | |
2527 | \r | |
2528 | @param[in] X509Stack Pointer to the X509 stack object to be released.\r | |
2529 | \r | |
2530 | **/\r | |
2531 | VOID\r | |
2532 | EFIAPI\r | |
2533 | CryptoServiceX509StackFree (\r | |
2534 | IN VOID *X509Stack\r | |
2535 | )\r | |
2536 | {\r | |
2537 | CALL_VOID_BASECRYPTLIB (X509.Services.StackFree, X509StackFree, (X509Stack));\r | |
2538 | }\r | |
2539 | \r | |
2540 | /**\r | |
2541 | Retrieve the TBSCertificate from one given X.509 certificate.\r | |
2542 | \r | |
2543 | @param[in] Cert Pointer to the given DER-encoded X509 certificate.\r | |
2544 | @param[in] CertSize Size of the X509 certificate in bytes.\r | |
2545 | @param[out] TBSCert DER-Encoded To-Be-Signed certificate.\r | |
2546 | @param[out] TBSCertSize Size of the TBS certificate in bytes.\r | |
2547 | \r | |
2548 | If Cert is NULL, then return FALSE.\r | |
2549 | If TBSCert is NULL, then return FALSE.\r | |
2550 | If TBSCertSize is NULL, then return FALSE.\r | |
2551 | If this interface is not supported, then return FALSE.\r | |
2552 | \r | |
2553 | @retval TRUE The TBSCertificate was retrieved successfully.\r | |
2554 | @retval FALSE Invalid X.509 certificate.\r | |
2555 | \r | |
2556 | **/\r | |
2557 | BOOLEAN\r | |
2558 | EFIAPI\r | |
2559 | CryptoServiceX509GetTBSCert (\r | |
2560 | IN CONST UINT8 *Cert,\r | |
2561 | IN UINTN CertSize,\r | |
2562 | OUT UINT8 **TBSCert,\r | |
2563 | OUT UINTN *TBSCertSize\r | |
2564 | )\r | |
2565 | {\r | |
2566 | return CALL_BASECRYPTLIB (X509.Services.GetTBSCert, X509GetTBSCert, (Cert, CertSize, TBSCert, TBSCertSize), FALSE);\r | |
2567 | }\r | |
2568 | \r | |
2569 | /**\r | |
2570 | Derives a key from a password using a salt and iteration count, based on PKCS#5 v2.0\r | |
2571 | password based encryption key derivation function PBKDF2, as specified in RFC 2898.\r | |
2572 | \r | |
2573 | If Password or Salt or OutKey is NULL, then return FALSE.\r | |
2574 | If the hash algorithm could not be determined, then return FALSE.\r | |
2575 | If this interface is not supported, then return FALSE.\r | |
2576 | \r | |
2577 | @param[in] PasswordLength Length of input password in bytes.\r | |
2578 | @param[in] Password Pointer to the array for the password.\r | |
2579 | @param[in] SaltLength Size of the Salt in bytes.\r | |
2580 | @param[in] Salt Pointer to the Salt.\r | |
2581 | @param[in] IterationCount Number of iterations to perform. Its value should be\r | |
2582 | greater than or equal to 1.\r | |
2583 | @param[in] DigestSize Size of the message digest to be used (eg. SHA256_DIGEST_SIZE).\r | |
2584 | NOTE: DigestSize will be used to determine the hash algorithm.\r | |
2585 | Only SHA1_DIGEST_SIZE or SHA256_DIGEST_SIZE is supported.\r | |
2586 | @param[in] KeyLength Size of the derived key buffer in bytes.\r | |
2587 | @param[out] OutKey Pointer to the output derived key buffer.\r | |
2588 | \r | |
2589 | @retval TRUE A key was derived successfully.\r | |
2590 | @retval FALSE One of the pointers was NULL or one of the sizes was too large.\r | |
2591 | @retval FALSE The hash algorithm could not be determined from the digest size.\r | |
2592 | @retval FALSE The key derivation operation failed.\r | |
2593 | @retval FALSE This interface is not supported.\r | |
2594 | \r | |
2595 | **/\r | |
2596 | BOOLEAN\r | |
2597 | EFIAPI\r | |
2598 | CryptoServicePkcs5HashPassword (\r | |
2599 | IN UINTN PasswordLength,\r | |
2600 | IN CONST CHAR8 *Password,\r | |
2601 | IN UINTN SaltLength,\r | |
2602 | IN CONST UINT8 *Salt,\r | |
2603 | IN UINTN IterationCount,\r | |
2604 | IN UINTN DigestSize,\r | |
2605 | IN UINTN KeyLength,\r | |
2606 | OUT UINT8 *OutKey\r | |
2607 | )\r | |
2608 | {\r | |
2609 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs5HashPassword, Pkcs5HashPassword, (PasswordLength, Password, SaltLength, Salt, IterationCount, DigestSize, KeyLength, OutKey), FALSE);\r | |
2610 | }\r | |
2611 | \r | |
2612 | /**\r | |
2613 | Encrypts a blob using PKCS1v2 (RSAES-OAEP) schema. On success, will return the\r | |
2614 | encrypted message in a newly allocated buffer.\r | |
2615 | \r | |
2616 | Things that can cause a failure include:\r | |
2617 | - X509 key size does not match any known key size.\r | |
2618 | - Fail to parse X509 certificate.\r | |
2619 | - Fail to allocate an intermediate buffer.\r | |
2620 | - Null pointer provided for a non-optional parameter.\r | |
2621 | - Data size is too large for the provided key size (max size is a function of key size\r | |
2622 | and hash digest size).\r | |
2623 | \r | |
2624 | @param[in] PublicKey A pointer to the DER-encoded X509 certificate that\r | |
2625 | will be used to encrypt the data.\r | |
2626 | @param[in] PublicKeySize Size of the X509 cert buffer.\r | |
2627 | @param[in] InData Data to be encrypted.\r | |
2628 | @param[in] InDataSize Size of the data buffer.\r | |
2629 | @param[in] PrngSeed [Optional] If provided, a pointer to a random seed buffer\r | |
2630 | to be used when initializing the PRNG. NULL otherwise.\r | |
2631 | @param[in] PrngSeedSize [Optional] If provided, size of the random seed buffer.\r | |
2632 | 0 otherwise.\r | |
2633 | @param[out] EncryptedData Pointer to an allocated buffer containing the encrypted\r | |
2634 | message.\r | |
2635 | @param[out] EncryptedDataSize Size of the encrypted message buffer.\r | |
2636 | \r | |
2637 | @retval TRUE Encryption was successful.\r | |
2638 | @retval FALSE Encryption failed.\r | |
2639 | \r | |
2640 | **/\r | |
2641 | BOOLEAN\r | |
2642 | EFIAPI\r | |
2643 | CryptoServicePkcs1v2Encrypt (\r | |
2644 | IN CONST UINT8 *PublicKey,\r | |
2645 | IN UINTN PublicKeySize,\r | |
2646 | IN UINT8 *InData,\r | |
2647 | IN UINTN InDataSize,\r | |
2648 | IN CONST UINT8 *PrngSeed, OPTIONAL\r | |
2649 | IN UINTN PrngSeedSize, OPTIONAL\r | |
2650 | OUT UINT8 **EncryptedData,\r | |
2651 | OUT UINTN *EncryptedDataSize\r | |
2652 | )\r | |
2653 | {\r | |
2654 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs1v2Encrypt, Pkcs1v2Encrypt, (PublicKey, PublicKeySize, InData, InDataSize, PrngSeed, PrngSeedSize, EncryptedData, EncryptedDataSize), FALSE);\r | |
2655 | }\r | |
2656 | \r | |
2657 | /**\r | |
2658 | Get the signer's certificates from PKCS#7 signed data as described in "PKCS #7:\r | |
2659 | Cryptographic Message Syntax Standard". The input signed data could be wrapped\r | |
2660 | in a ContentInfo structure.\r | |
2661 | \r | |
2662 | If P7Data, CertStack, StackLength, TrustedCert or CertLength is NULL, then\r | |
2663 | return FALSE. If P7Length overflow, then return FALSE.\r | |
2664 | If this interface is not supported, then return FALSE.\r | |
2665 | \r | |
2666 | @param[in] P7Data Pointer to the PKCS#7 message to verify.\r | |
2667 | @param[in] P7Length Length of the PKCS#7 message in bytes.\r | |
2668 | @param[out] CertStack Pointer to Signer's certificates retrieved from P7Data.\r | |
2669 | It's caller's responsibility to free the buffer with\r | |
2670 | Pkcs7FreeSigners().\r | |
2671 | This data structure is EFI_CERT_STACK type.\r | |
2672 | @param[out] StackLength Length of signer's certificates in bytes.\r | |
2673 | @param[out] TrustedCert Pointer to a trusted certificate from Signer's certificates.\r | |
2674 | It's caller's responsibility to free the buffer with\r | |
2675 | Pkcs7FreeSigners().\r | |
2676 | @param[out] CertLength Length of the trusted certificate in bytes.\r | |
2677 | \r | |
2678 | @retval TRUE The operation is finished successfully.\r | |
2679 | @retval FALSE Error occurs during the operation.\r | |
2680 | @retval FALSE This interface is not supported.\r | |
2681 | \r | |
2682 | **/\r | |
2683 | BOOLEAN\r | |
2684 | EFIAPI\r | |
2685 | CryptoServicePkcs7GetSigners (\r | |
2686 | IN CONST UINT8 *P7Data,\r | |
2687 | IN UINTN P7Length,\r | |
2688 | OUT UINT8 **CertStack,\r | |
2689 | OUT UINTN *StackLength,\r | |
2690 | OUT UINT8 **TrustedCert,\r | |
2691 | OUT UINTN *CertLength\r | |
2692 | )\r | |
2693 | {\r | |
2694 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7GetSigners, Pkcs7GetSigners, (P7Data, P7Length, CertStack, StackLength, TrustedCert, CertLength), FALSE);\r | |
2695 | }\r | |
2696 | \r | |
2697 | /**\r | |
2698 | Wrap function to use free() to free allocated memory for certificates.\r | |
2699 | \r | |
2700 | If this interface is not supported, then ASSERT().\r | |
2701 | \r | |
2702 | @param[in] Certs Pointer to the certificates to be freed.\r | |
2703 | \r | |
2704 | **/\r | |
2705 | VOID\r | |
2706 | EFIAPI\r | |
2707 | CryptoServicePkcs7FreeSigners (\r | |
2708 | IN UINT8 *Certs\r | |
2709 | )\r | |
2710 | {\r | |
2711 | CALL_VOID_BASECRYPTLIB (Pkcs.Services.Pkcs7FreeSigners, Pkcs7FreeSigners, (Certs));\r | |
2712 | }\r | |
2713 | \r | |
2714 | /**\r | |
2715 | Retrieves all embedded certificates from PKCS#7 signed data as described in "PKCS #7:\r | |
2716 | Cryptographic Message Syntax Standard", and outputs two certificate lists chained and\r | |
2717 | unchained to the signer's certificates.\r | |
2718 | The input signed data could be wrapped in a ContentInfo structure.\r | |
2719 | \r | |
2720 | @param[in] P7Data Pointer to the PKCS#7 message.\r | |
2721 | @param[in] P7Length Length of the PKCS#7 message in bytes.\r | |
2722 | @param[out] SignerChainCerts Pointer to the certificates list chained to signer's\r | |
2723 | certificate. It's caller's responsibility to free the buffer\r | |
2724 | with Pkcs7FreeSigners().\r | |
2725 | This data structure is EFI_CERT_STACK type.\r | |
2726 | @param[out] ChainLength Length of the chained certificates list buffer in bytes.\r | |
2727 | @param[out] UnchainCerts Pointer to the unchained certificates lists. It's caller's\r | |
2728 | responsibility to free the buffer with Pkcs7FreeSigners().\r | |
2729 | This data structure is EFI_CERT_STACK type.\r | |
2730 | @param[out] UnchainLength Length of the unchained certificates list buffer in bytes.\r | |
2731 | \r | |
2732 | @retval TRUE The operation is finished successfully.\r | |
2733 | @retval FALSE Error occurs during the operation.\r | |
2734 | \r | |
2735 | **/\r | |
2736 | BOOLEAN\r | |
2737 | EFIAPI\r | |
2738 | CryptoServicePkcs7GetCertificatesList (\r | |
2739 | IN CONST UINT8 *P7Data,\r | |
2740 | IN UINTN P7Length,\r | |
2741 | OUT UINT8 **SignerChainCerts,\r | |
2742 | OUT UINTN *ChainLength,\r | |
2743 | OUT UINT8 **UnchainCerts,\r | |
2744 | OUT UINTN *UnchainLength\r | |
2745 | )\r | |
2746 | {\r | |
2747 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7GetCertificatesList, Pkcs7GetCertificatesList, (P7Data, P7Length, SignerChainCerts, ChainLength, UnchainCerts, UnchainLength), FALSE);\r | |
2748 | }\r | |
2749 | \r | |
2750 | /**\r | |
2751 | Creates a PKCS#7 signedData as described in "PKCS #7: Cryptographic Message\r | |
2752 | Syntax Standard, version 1.5". This interface is only intended to be used for\r | |
2753 | application to perform PKCS#7 functionality validation.\r | |
2754 | \r | |
2755 | If this interface is not supported, then return FALSE.\r | |
2756 | \r | |
2757 | @param[in] PrivateKey Pointer to the PEM-formatted private key data for\r | |
2758 | data signing.\r | |
2759 | @param[in] PrivateKeySize Size of the PEM private key data in bytes.\r | |
2760 | @param[in] KeyPassword NULL-terminated passphrase used for encrypted PEM\r | |
2761 | key data.\r | |
2762 | @param[in] InData Pointer to the content to be signed.\r | |
2763 | @param[in] InDataSize Size of InData in bytes.\r | |
2764 | @param[in] SignCert Pointer to signer's DER-encoded certificate to sign with.\r | |
2765 | @param[in] OtherCerts Pointer to an optional additional set of certificates to\r | |
2766 | include in the PKCS#7 signedData (e.g. any intermediate\r | |
2767 | CAs in the chain).\r | |
2768 | @param[out] SignedData Pointer to output PKCS#7 signedData. It's caller's\r | |
2769 | responsibility to free the buffer with FreePool().\r | |
2770 | @param[out] SignedDataSize Size of SignedData in bytes.\r | |
2771 | \r | |
2772 | @retval TRUE PKCS#7 data signing succeeded.\r | |
2773 | @retval FALSE PKCS#7 data signing failed.\r | |
2774 | @retval FALSE This interface is not supported.\r | |
2775 | \r | |
2776 | **/\r | |
2777 | BOOLEAN\r | |
2778 | EFIAPI\r | |
2779 | CryptoServicePkcs7Sign (\r | |
2780 | IN CONST UINT8 *PrivateKey,\r | |
2781 | IN UINTN PrivateKeySize,\r | |
2782 | IN CONST UINT8 *KeyPassword,\r | |
2783 | IN UINT8 *InData,\r | |
2784 | IN UINTN InDataSize,\r | |
2785 | IN UINT8 *SignCert,\r | |
2786 | IN UINT8 *OtherCerts OPTIONAL,\r | |
2787 | OUT UINT8 **SignedData,\r | |
2788 | OUT UINTN *SignedDataSize\r | |
2789 | )\r | |
2790 | {\r | |
2791 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7Sign, Pkcs7Sign, (PrivateKey, PrivateKeySize, KeyPassword, InData, InDataSize, SignCert, OtherCerts, SignedData, SignedDataSize), FALSE);\r | |
2792 | }\r | |
2793 | \r | |
2794 | /**\r | |
2795 | Verifies the validity of a PKCS#7 signed data as described in "PKCS #7:\r | |
2796 | Cryptographic Message Syntax Standard". The input signed data could be wrapped\r | |
2797 | in a ContentInfo structure.\r | |
2798 | \r | |
2799 | If P7Data, TrustedCert or InData is NULL, then return FALSE.\r | |
2800 | If P7Length, CertLength or DataLength overflow, then return FALSE.\r | |
2801 | If this interface is not supported, then return FALSE.\r | |
2802 | \r | |
2803 | @param[in] P7Data Pointer to the PKCS#7 message to verify.\r | |
2804 | @param[in] P7Length Length of the PKCS#7 message in bytes.\r | |
2805 | @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which\r | |
2806 | is used for certificate chain verification.\r | |
2807 | @param[in] CertLength Length of the trusted certificate in bytes.\r | |
2808 | @param[in] InData Pointer to the content to be verified.\r | |
2809 | @param[in] DataLength Length of InData in bytes.\r | |
2810 | \r | |
2811 | @retval TRUE The specified PKCS#7 signed data is valid.\r | |
2812 | @retval FALSE Invalid PKCS#7 signed data.\r | |
2813 | @retval FALSE This interface is not supported.\r | |
2814 | \r | |
2815 | **/\r | |
2816 | BOOLEAN\r | |
2817 | EFIAPI\r | |
2818 | CryptoServicePkcs7Verify (\r | |
2819 | IN CONST UINT8 *P7Data,\r | |
2820 | IN UINTN P7Length,\r | |
2821 | IN CONST UINT8 *TrustedCert,\r | |
2822 | IN UINTN CertLength,\r | |
2823 | IN CONST UINT8 *InData,\r | |
2824 | IN UINTN DataLength\r | |
2825 | )\r | |
2826 | {\r | |
2827 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7Verify, Pkcs7Verify, (P7Data, P7Length, TrustedCert, CertLength, InData, DataLength), FALSE);\r | |
2828 | }\r | |
2829 | \r | |
2830 | /**\r | |
2831 | This function receives a PKCS7 formatted signature, and then verifies that\r | |
2832 | the specified Enhanced or Extended Key Usages (EKU's) are present in the end-entity\r | |
2833 | leaf signing certificate.\r | |
2834 | Note that this function does not validate the certificate chain.\r | |
2835 | \r | |
2836 | Applications for custom EKU's are quite flexible. For example, a policy EKU\r | |
2837 | may be present in an Issuing Certificate Authority (CA), and any sub-ordinate\r | |
2838 | certificate issued might also contain this EKU, thus constraining the\r | |
2839 | sub-ordinate certificate. Other applications might allow a certificate\r | |
2840 | embedded in a device to specify that other Object Identifiers (OIDs) are\r | |
2841 | present which contains binary data specifying custom capabilities that\r | |
2842 | the device is able to do.\r | |
2843 | \r | |
2844 | @param[in] Pkcs7Signature The PKCS#7 signed information content block. An array\r | |
2845 | containing the content block with both the signature,\r | |
2846 | the signer's certificate, and any necessary intermediate\r | |
2847 | certificates.\r | |
2848 | @param[in] Pkcs7SignatureSize Number of bytes in Pkcs7Signature.\r | |
2849 | @param[in] RequiredEKUs Array of null-terminated strings listing OIDs of\r | |
2850 | required EKUs that must be present in the signature.\r | |
2851 | @param[in] RequiredEKUsSize Number of elements in the RequiredEKUs string array.\r | |
2852 | @param[in] RequireAllPresent If this is TRUE, then all of the specified EKU's\r | |
2853 | must be present in the leaf signer. If it is\r | |
2854 | FALSE, then we will succeed if we find any\r | |
2855 | of the specified EKU's.\r | |
2856 | \r | |
2857 | @retval EFI_SUCCESS The required EKUs were found in the signature.\r | |
2858 | @retval EFI_INVALID_PARAMETER A parameter was invalid.\r | |
2859 | @retval EFI_NOT_FOUND One or more EKU's were not found in the signature.\r | |
2860 | \r | |
2861 | **/\r | |
2862 | RETURN_STATUS\r | |
2863 | EFIAPI\r | |
2864 | CryptoServiceVerifyEKUsInPkcs7Signature (\r | |
2865 | IN CONST UINT8 *Pkcs7Signature,\r | |
2866 | IN CONST UINT32 SignatureSize,\r | |
2867 | IN CONST CHAR8 *RequiredEKUs[],\r | |
2868 | IN CONST UINT32 RequiredEKUsSize,\r | |
2869 | IN BOOLEAN RequireAllPresent\r | |
2870 | )\r | |
2871 | {\r | |
2872 | return CALL_BASECRYPTLIB (Pkcs.Services.VerifyEKUsInPkcs7Signature, VerifyEKUsInPkcs7Signature, (Pkcs7Signature, SignatureSize, RequiredEKUs, RequiredEKUsSize, RequireAllPresent), FALSE);\r | |
2873 | }\r | |
2874 | \r | |
2875 | \r | |
2876 | /**\r | |
2877 | Extracts the attached content from a PKCS#7 signed data if existed. The input signed\r | |
2878 | data could be wrapped in a ContentInfo structure.\r | |
2879 | \r | |
2880 | If P7Data, Content, or ContentSize is NULL, then return FALSE. If P7Length overflow,\r | |
2881 | then return FALSE. If the P7Data is not correctly formatted, then return FALSE.\r | |
2882 | \r | |
2883 | Caution: This function may receive untrusted input. So this function will do\r | |
2884 | basic check for PKCS#7 data structure.\r | |
2885 | \r | |
2886 | @param[in] P7Data Pointer to the PKCS#7 signed data to process.\r | |
2887 | @param[in] P7Length Length of the PKCS#7 signed data in bytes.\r | |
2888 | @param[out] Content Pointer to the extracted content from the PKCS#7 signedData.\r | |
2889 | It's caller's responsibility to free the buffer with FreePool().\r | |
2890 | @param[out] ContentSize The size of the extracted content in bytes.\r | |
2891 | \r | |
2892 | @retval TRUE The P7Data was correctly formatted for processing.\r | |
2893 | @retval FALSE The P7Data was not correctly formatted for processing.\r | |
2894 | \r | |
2895 | **/\r | |
2896 | BOOLEAN\r | |
2897 | EFIAPI\r | |
2898 | CryptoServicePkcs7GetAttachedContent (\r | |
2899 | IN CONST UINT8 *P7Data,\r | |
2900 | IN UINTN P7Length,\r | |
2901 | OUT VOID **Content,\r | |
2902 | OUT UINTN *ContentSize\r | |
2903 | )\r | |
2904 | {\r | |
2905 | return CALL_BASECRYPTLIB (Pkcs.Services.Pkcs7GetAttachedContent, Pkcs7GetAttachedContent, (P7Data, P7Length, Content, ContentSize), FALSE);\r | |
2906 | }\r | |
2907 | \r | |
2908 | /**\r | |
2909 | Verifies the validity of a PE/COFF Authenticode Signature as described in "Windows\r | |
2910 | Authenticode Portable Executable Signature Format".\r | |
2911 | \r | |
2912 | If AuthData is NULL, then return FALSE.\r | |
2913 | If ImageHash is NULL, then return FALSE.\r | |
2914 | If this interface is not supported, then return FALSE.\r | |
2915 | \r | |
2916 | @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed\r | |
2917 | PE/COFF image to be verified.\r | |
2918 | @param[in] DataSize Size of the Authenticode Signature in bytes.\r | |
2919 | @param[in] TrustedCert Pointer to a trusted/root certificate encoded in DER, which\r | |
2920 | is used for certificate chain verification.\r | |
2921 | @param[in] CertSize Size of the trusted certificate in bytes.\r | |
2922 | @param[in] ImageHash Pointer to the original image file hash value. The procedure\r | |
2923 | for calculating the image hash value is described in Authenticode\r | |
2924 | specification.\r | |
2925 | @param[in] HashSize Size of Image hash value in bytes.\r | |
2926 | \r | |
2927 | @retval TRUE The specified Authenticode Signature is valid.\r | |
2928 | @retval FALSE Invalid Authenticode Signature.\r | |
2929 | @retval FALSE This interface is not supported.\r | |
2930 | \r | |
2931 | **/\r | |
2932 | BOOLEAN\r | |
2933 | EFIAPI\r | |
2934 | CryptoServiceAuthenticodeVerify (\r | |
2935 | IN CONST UINT8 *AuthData,\r | |
2936 | IN UINTN DataSize,\r | |
2937 | IN CONST UINT8 *TrustedCert,\r | |
2938 | IN UINTN CertSize,\r | |
2939 | IN CONST UINT8 *ImageHash,\r | |
2940 | IN UINTN HashSize\r | |
2941 | )\r | |
2942 | {\r | |
2943 | return CALL_BASECRYPTLIB (Pkcs.Services.AuthenticodeVerify, AuthenticodeVerify, (AuthData, DataSize, TrustedCert, CertSize, ImageHash, HashSize), FALSE);\r | |
2944 | }\r | |
2945 | \r | |
2946 | /**\r | |
2947 | Verifies the validity of a RFC3161 Timestamp CounterSignature embedded in PE/COFF Authenticode\r | |
2948 | signature.\r | |
2949 | \r | |
2950 | If AuthData is NULL, then return FALSE.\r | |
2951 | If this interface is not supported, then return FALSE.\r | |
2952 | \r | |
2953 | @param[in] AuthData Pointer to the Authenticode Signature retrieved from signed\r | |
2954 | PE/COFF image to be verified.\r | |
2955 | @param[in] DataSize Size of the Authenticode Signature in bytes.\r | |
2956 | @param[in] TsaCert Pointer to a trusted/root TSA certificate encoded in DER, which\r | |
2957 | is used for TSA certificate chain verification.\r | |
2958 | @param[in] CertSize Size of the trusted certificate in bytes.\r | |
2959 | @param[out] SigningTime Return the time of timestamp generation time if the timestamp\r | |
2960 | signature is valid.\r | |
2961 | \r | |
2962 | @retval TRUE The specified Authenticode includes a valid RFC3161 Timestamp CounterSignature.\r | |
2963 | @retval FALSE No valid RFC3161 Timestamp CounterSignature in the specified Authenticode data.\r | |
2964 | \r | |
2965 | **/\r | |
2966 | BOOLEAN\r | |
2967 | EFIAPI\r | |
2968 | CryptoServiceImageTimestampVerify (\r | |
2969 | IN CONST UINT8 *AuthData,\r | |
2970 | IN UINTN DataSize,\r | |
2971 | IN CONST UINT8 *TsaCert,\r | |
2972 | IN UINTN CertSize,\r | |
2973 | OUT EFI_TIME *SigningTime\r | |
2974 | )\r | |
2975 | {\r | |
2976 | return CALL_BASECRYPTLIB (Pkcs.Services.ImageTimestampVerify, ImageTimestampVerify, (AuthData, DataSize, TsaCert, CertSize, SigningTime), FALSE);\r | |
2977 | }\r | |
2978 | \r | |
2979 | //=====================================================================================\r | |
2980 | // DH Key Exchange Primitive\r | |
2981 | //=====================================================================================\r | |
2982 | \r | |
2983 | /**\r | |
2984 | Allocates and Initializes one Diffie-Hellman Context for subsequent use.\r | |
2985 | \r | |
2986 | @return Pointer to the Diffie-Hellman Context that has been initialized.\r | |
2987 | If the allocations fails, DhNew() returns NULL.\r | |
2988 | If the interface is not supported, DhNew() returns NULL.\r | |
2989 | \r | |
2990 | **/\r | |
2991 | VOID *\r | |
2992 | EFIAPI\r | |
2993 | CryptoServiceDhNew (\r | |
2994 | VOID\r | |
2995 | )\r | |
2996 | {\r | |
2997 | return CALL_BASECRYPTLIB (Dh.Services.New, DhNew, (), NULL);\r | |
2998 | }\r | |
2999 | \r | |
3000 | /**\r | |
3001 | Release the specified DH context.\r | |
3002 | \r | |
3003 | If the interface is not supported, then ASSERT().\r | |
3004 | \r | |
3005 | @param[in] DhContext Pointer to the DH context to be released.\r | |
3006 | \r | |
3007 | **/\r | |
3008 | VOID\r | |
3009 | EFIAPI\r | |
3010 | CryptoServiceDhFree (\r | |
3011 | IN VOID *DhContext\r | |
3012 | )\r | |
3013 | {\r | |
3014 | CALL_VOID_BASECRYPTLIB (Dh.Services.Free, DhFree, (DhContext));\r | |
3015 | }\r | |
3016 | \r | |
3017 | /**\r | |
3018 | Generates DH parameter.\r | |
3019 | \r | |
3020 | Given generator g, and length of prime number p in bits, this function generates p,\r | |
3021 | and sets DH context according to value of g and p.\r | |
3022 | \r | |
3023 | Before this function can be invoked, pseudorandom number generator must be correctly\r | |
3024 | initialized by RandomSeed().\r | |
3025 | \r | |
3026 | If DhContext is NULL, then return FALSE.\r | |
3027 | If Prime is NULL, then return FALSE.\r | |
3028 | If this interface is not supported, then return FALSE.\r | |
3029 | \r | |
3030 | @param[in, out] DhContext Pointer to the DH context.\r | |
3031 | @param[in] Generator Value of generator.\r | |
3032 | @param[in] PrimeLength Length in bits of prime to be generated.\r | |
3033 | @param[out] Prime Pointer to the buffer to receive the generated prime number.\r | |
3034 | \r | |
3035 | @retval TRUE DH parameter generation succeeded.\r | |
3036 | @retval FALSE Value of Generator is not supported.\r | |
3037 | @retval FALSE PRNG fails to generate random prime number with PrimeLength.\r | |
3038 | @retval FALSE This interface is not supported.\r | |
3039 | \r | |
3040 | **/\r | |
3041 | BOOLEAN\r | |
3042 | EFIAPI\r | |
3043 | CryptoServiceDhGenerateParameter (\r | |
3044 | IN OUT VOID *DhContext,\r | |
3045 | IN UINTN Generator,\r | |
3046 | IN UINTN PrimeLength,\r | |
3047 | OUT UINT8 *Prime\r | |
3048 | )\r | |
3049 | {\r | |
3050 | return CALL_BASECRYPTLIB (Dh.Services.GenerateParameter, DhGenerateParameter, (DhContext, Generator, PrimeLength, Prime), FALSE);\r | |
3051 | }\r | |
3052 | \r | |
3053 | /**\r | |
3054 | Sets generator and prime parameters for DH.\r | |
3055 | \r | |
3056 | Given generator g, and prime number p, this function and sets DH\r | |
3057 | context accordingly.\r | |
3058 | \r | |
3059 | If DhContext is NULL, then return FALSE.\r | |
3060 | If Prime is NULL, then return FALSE.\r | |
3061 | If this interface is not supported, then return FALSE.\r | |
3062 | \r | |
3063 | @param[in, out] DhContext Pointer to the DH context.\r | |
3064 | @param[in] Generator Value of generator.\r | |
3065 | @param[in] PrimeLength Length in bits of prime to be generated.\r | |
3066 | @param[in] Prime Pointer to the prime number.\r | |
3067 | \r | |
3068 | @retval TRUE DH parameter setting succeeded.\r | |
3069 | @retval FALSE Value of Generator is not supported.\r | |
3070 | @retval FALSE Value of Generator is not suitable for the Prime.\r | |
3071 | @retval FALSE Value of Prime is not a prime number.\r | |
3072 | @retval FALSE Value of Prime is not a safe prime number.\r | |
3073 | @retval FALSE This interface is not supported.\r | |
3074 | \r | |
3075 | **/\r | |
3076 | BOOLEAN\r | |
3077 | EFIAPI\r | |
3078 | CryptoServiceDhSetParameter (\r | |
3079 | IN OUT VOID *DhContext,\r | |
3080 | IN UINTN Generator,\r | |
3081 | IN UINTN PrimeLength,\r | |
3082 | IN CONST UINT8 *Prime\r | |
3083 | )\r | |
3084 | {\r | |
3085 | return CALL_BASECRYPTLIB (Dh.Services.SetParameter, DhSetParameter, (DhContext, Generator, PrimeLength, Prime), FALSE);\r | |
3086 | }\r | |
3087 | \r | |
3088 | /**\r | |
3089 | Generates DH public key.\r | |
3090 | \r | |
3091 | This function generates random secret exponent, and computes the public key, which is\r | |
3092 | returned via parameter PublicKey and PublicKeySize. DH context is updated accordingly.\r | |
3093 | If the PublicKey buffer is too small to hold the public key, FALSE is returned and\r | |
3094 | PublicKeySize is set to the required buffer size to obtain the public key.\r | |
3095 | \r | |
3096 | If DhContext is NULL, then return FALSE.\r | |
3097 | If PublicKeySize is NULL, then return FALSE.\r | |
3098 | If PublicKeySize is large enough but PublicKey is NULL, then return FALSE.\r | |
3099 | If this interface is not supported, then return FALSE.\r | |
3100 | \r | |
3101 | @param[in, out] DhContext Pointer to the DH context.\r | |
3102 | @param[out] PublicKey Pointer to the buffer to receive generated public key.\r | |
3103 | @param[in, out] PublicKeySize On input, the size of PublicKey buffer in bytes.\r | |
3104 | On output, the size of data returned in PublicKey buffer in bytes.\r | |
3105 | \r | |
3106 | @retval TRUE DH public key generation succeeded.\r | |
3107 | @retval FALSE DH public key generation failed.\r | |
3108 | @retval FALSE PublicKeySize is not large enough.\r | |
3109 | @retval FALSE This interface is not supported.\r | |
3110 | \r | |
3111 | **/\r | |
3112 | BOOLEAN\r | |
3113 | EFIAPI\r | |
3114 | CryptoServiceDhGenerateKey (\r | |
3115 | IN OUT VOID *DhContext,\r | |
3116 | OUT UINT8 *PublicKey,\r | |
3117 | IN OUT UINTN *PublicKeySize\r | |
3118 | )\r | |
3119 | {\r | |
3120 | return CALL_BASECRYPTLIB (Dh.Services.GenerateKey, DhGenerateKey, (DhContext, PublicKey, PublicKeySize), FALSE);\r | |
3121 | }\r | |
3122 | \r | |
3123 | /**\r | |
3124 | Computes exchanged common key.\r | |
3125 | \r | |
3126 | Given peer's public key, this function computes the exchanged common key, based on its own\r | |
3127 | context including value of prime modulus and random secret exponent.\r | |
3128 | \r | |
3129 | If DhContext is NULL, then return FALSE.\r | |
3130 | If PeerPublicKey is NULL, then return FALSE.\r | |
3131 | If KeySize is NULL, then return FALSE.\r | |
3132 | If Key is NULL, then return FALSE.\r | |
3133 | If KeySize is not large enough, then return FALSE.\r | |
3134 | If this interface is not supported, then return FALSE.\r | |
3135 | \r | |
3136 | @param[in, out] DhContext Pointer to the DH context.\r | |
3137 | @param[in] PeerPublicKey Pointer to the peer's public key.\r | |
3138 | @param[in] PeerPublicKeySize Size of peer's public key in bytes.\r | |
3139 | @param[out] Key Pointer to the buffer to receive generated key.\r | |
3140 | @param[in, out] KeySize On input, the size of Key buffer in bytes.\r | |
3141 | On output, the size of data returned in Key buffer in bytes.\r | |
3142 | \r | |
3143 | @retval TRUE DH exchanged key generation succeeded.\r | |
3144 | @retval FALSE DH exchanged key generation failed.\r | |
3145 | @retval FALSE KeySize is not large enough.\r | |
3146 | @retval FALSE This interface is not supported.\r | |
3147 | \r | |
3148 | **/\r | |
3149 | BOOLEAN\r | |
3150 | EFIAPI\r | |
3151 | CryptoServiceDhComputeKey (\r | |
3152 | IN OUT VOID *DhContext,\r | |
3153 | IN CONST UINT8 *PeerPublicKey,\r | |
3154 | IN UINTN PeerPublicKeySize,\r | |
3155 | OUT UINT8 *Key,\r | |
3156 | IN OUT UINTN *KeySize\r | |
3157 | )\r | |
3158 | {\r | |
3159 | return CALL_BASECRYPTLIB (Dh.Services.ComputeKey, DhComputeKey, (DhContext, PeerPublicKey, PeerPublicKeySize, Key, KeySize), FALSE);\r | |
3160 | }\r | |
3161 | \r | |
3162 | //=====================================================================================\r | |
3163 | // Pseudo-Random Generation Primitive\r | |
3164 | //=====================================================================================\r | |
3165 | \r | |
3166 | /**\r | |
3167 | Sets up the seed value for the pseudorandom number generator.\r | |
3168 | \r | |
3169 | This function sets up the seed value for the pseudorandom number generator.\r | |
3170 | If Seed is not NULL, then the seed passed in is used.\r | |
3171 | If Seed is NULL, then default seed is used.\r | |
3172 | If this interface is not supported, then return FALSE.\r | |
3173 | \r | |
3174 | @param[in] Seed Pointer to seed value.\r | |
3175 | If NULL, default seed is used.\r | |
3176 | @param[in] SeedSize Size of seed value.\r | |
3177 | If Seed is NULL, this parameter is ignored.\r | |
3178 | \r | |
3179 | @retval TRUE Pseudorandom number generator has enough entropy for random generation.\r | |
3180 | @retval FALSE Pseudorandom number generator does not have enough entropy for random generation.\r | |
3181 | @retval FALSE This interface is not supported.\r | |
3182 | \r | |
3183 | **/\r | |
3184 | BOOLEAN\r | |
3185 | EFIAPI\r | |
3186 | CryptoServiceRandomSeed (\r | |
3187 | IN CONST UINT8 *Seed OPTIONAL,\r | |
3188 | IN UINTN SeedSize\r | |
3189 | )\r | |
3190 | {\r | |
3191 | return CALL_BASECRYPTLIB (Random.Services.Seed, RandomSeed, (Seed, SeedSize), FALSE);\r | |
3192 | }\r | |
3193 | \r | |
3194 | /**\r | |
3195 | Generates a pseudorandom byte stream of the specified size.\r | |
3196 | \r | |
3197 | If Output is NULL, then return FALSE.\r | |
3198 | If this interface is not supported, then return FALSE.\r | |
3199 | \r | |
3200 | @param[out] Output Pointer to buffer to receive random value.\r | |
3201 | @param[in] Size Size of random bytes to generate.\r | |
3202 | \r | |
3203 | @retval TRUE Pseudorandom byte stream generated successfully.\r | |
3204 | @retval FALSE Pseudorandom number generator fails to generate due to lack of entropy.\r | |
3205 | @retval FALSE This interface is not supported.\r | |
3206 | \r | |
3207 | **/\r | |
3208 | BOOLEAN\r | |
3209 | EFIAPI\r | |
3210 | CryptoServiceRandomBytes (\r | |
3211 | OUT UINT8 *Output,\r | |
3212 | IN UINTN Size\r | |
3213 | )\r | |
3214 | {\r | |
3215 | return CALL_BASECRYPTLIB (Random.Services.Bytes, RandomBytes, (Output, Size), FALSE);\r | |
3216 | }\r | |
3217 | \r | |
3218 | //=====================================================================================\r | |
3219 | // Key Derivation Function Primitive\r | |
3220 | //=====================================================================================\r | |
3221 | \r | |
3222 | /**\r | |
3223 | Derive key data using HMAC-SHA256 based KDF.\r | |
3224 | \r | |
3225 | @param[in] Key Pointer to the user-supplied key.\r | |
3226 | @param[in] KeySize Key size in bytes.\r | |
3227 | @param[in] Salt Pointer to the salt(non-secret) value.\r | |
3228 | @param[in] SaltSize Salt size in bytes.\r | |
3229 | @param[in] Info Pointer to the application specific info.\r | |
3230 | @param[in] InfoSize Info size in bytes.\r | |
3231 | @param[out] Out Pointer to buffer to receive hkdf value.\r | |
3232 | @param[in] OutSize Size of hkdf bytes to generate.\r | |
3233 | \r | |
3234 | @retval TRUE Hkdf generated successfully.\r | |
3235 | @retval FALSE Hkdf generation failed.\r | |
3236 | \r | |
3237 | **/\r | |
3238 | BOOLEAN\r | |
3239 | EFIAPI\r | |
3240 | CryptoServiceHkdfSha256ExtractAndExpand (\r | |
3241 | IN CONST UINT8 *Key,\r | |
3242 | IN UINTN KeySize,\r | |
3243 | IN CONST UINT8 *Salt,\r | |
3244 | IN UINTN SaltSize,\r | |
3245 | IN CONST UINT8 *Info,\r | |
3246 | IN UINTN InfoSize,\r | |
3247 | OUT UINT8 *Out,\r | |
3248 | IN UINTN OutSize\r | |
3249 | )\r | |
3250 | {\r | |
3251 | return CALL_BASECRYPTLIB (Hkdf.Services.Sha256ExtractAndExpand, HkdfSha256ExtractAndExpand, (Key, KeySize, Salt, SaltSize, Info, InfoSize, Out, OutSize), FALSE);\r | |
3252 | }\r | |
3253 | \r | |
3254 | /**\r | |
3255 | Initializes the OpenSSL library.\r | |
3256 | \r | |
3257 | This function registers ciphers and digests used directly and indirectly\r | |
3258 | by SSL/TLS, and initializes the readable error messages.\r | |
3259 | This function must be called before any other action takes places.\r | |
3260 | \r | |
3261 | @retval TRUE The OpenSSL library has been initialized.\r | |
3262 | @retval FALSE Failed to initialize the OpenSSL library.\r | |
3263 | \r | |
3264 | **/\r | |
3265 | BOOLEAN\r | |
3266 | EFIAPI\r | |
3267 | CryptoServiceTlsInitialize (\r | |
3268 | VOID\r | |
3269 | )\r | |
3270 | {\r | |
3271 | return CALL_BASECRYPTLIB (Tls.Services.Initialize, TlsInitialize, (), FALSE);\r | |
3272 | }\r | |
3273 | \r | |
3274 | /**\r | |
3275 | Free an allocated SSL_CTX object.\r | |
3276 | \r | |
3277 | @param[in] TlsCtx Pointer to the SSL_CTX object to be released.\r | |
3278 | \r | |
3279 | **/\r | |
3280 | VOID\r | |
3281 | EFIAPI\r | |
3282 | CryptoServiceTlsCtxFree (\r | |
3283 | IN VOID *TlsCtx\r | |
3284 | )\r | |
3285 | {\r | |
3286 | CALL_VOID_BASECRYPTLIB (Tls.Services.CtxFree, TlsCtxFree, (TlsCtx));\r | |
3287 | }\r | |
3288 | \r | |
3289 | /**\r | |
3290 | Creates a new SSL_CTX object as framework to establish TLS/SSL enabled\r | |
3291 | connections.\r | |
3292 | \r | |
3293 | @param[in] MajorVer Major Version of TLS/SSL Protocol.\r | |
3294 | @param[in] MinorVer Minor Version of TLS/SSL Protocol.\r | |
3295 | \r | |
3296 | @return Pointer to an allocated SSL_CTX object.\r | |
3297 | If the creation failed, TlsCtxNew() returns NULL.\r | |
3298 | \r | |
3299 | **/\r | |
3300 | VOID *\r | |
3301 | EFIAPI\r | |
3302 | CryptoServiceTlsCtxNew (\r | |
3303 | IN UINT8 MajorVer,\r | |
3304 | IN UINT8 MinorVer\r | |
3305 | )\r | |
3306 | {\r | |
3307 | return CALL_BASECRYPTLIB (Tls.Services.CtxNew, TlsCtxNew, (MajorVer, MinorVer), NULL);\r | |
3308 | }\r | |
3309 | \r | |
3310 | /**\r | |
3311 | Free an allocated TLS object.\r | |
3312 | \r | |
3313 | This function removes the TLS object pointed to by Tls and frees up the\r | |
3314 | allocated memory. If Tls is NULL, nothing is done.\r | |
3315 | \r | |
3316 | @param[in] Tls Pointer to the TLS object to be freed.\r | |
3317 | \r | |
3318 | **/\r | |
3319 | VOID\r | |
3320 | EFIAPI\r | |
3321 | CryptoServiceTlsFree (\r | |
3322 | IN VOID *Tls\r | |
3323 | )\r | |
3324 | {\r | |
3325 | CALL_VOID_BASECRYPTLIB (Tls.Services.Free, TlsFree, (Tls));\r | |
3326 | }\r | |
3327 | \r | |
3328 | /**\r | |
3329 | Create a new TLS object for a connection.\r | |
3330 | \r | |
3331 | This function creates a new TLS object for a connection. The new object\r | |
3332 | inherits the setting of the underlying context TlsCtx: connection method,\r | |
3333 | options, verification setting.\r | |
3334 | \r | |
3335 | @param[in] TlsCtx Pointer to the SSL_CTX object.\r | |
3336 | \r | |
3337 | @return Pointer to an allocated SSL object.\r | |
3338 | If the creation failed, TlsNew() returns NULL.\r | |
3339 | \r | |
3340 | **/\r | |
3341 | VOID *\r | |
3342 | EFIAPI\r | |
3343 | CryptoServiceTlsNew (\r | |
3344 | IN VOID *TlsCtx\r | |
3345 | )\r | |
3346 | {\r | |
3347 | return CALL_BASECRYPTLIB (Tls.Services.New, TlsNew, (TlsCtx), NULL);\r | |
3348 | }\r | |
3349 | \r | |
3350 | /**\r | |
3351 | Checks if the TLS handshake was done.\r | |
3352 | \r | |
3353 | This function will check if the specified TLS handshake was done.\r | |
3354 | \r | |
3355 | @param[in] Tls Pointer to the TLS object for handshake state checking.\r | |
3356 | \r | |
3357 | @retval TRUE The TLS handshake was done.\r | |
3358 | @retval FALSE The TLS handshake was not done.\r | |
3359 | \r | |
3360 | **/\r | |
3361 | BOOLEAN\r | |
3362 | EFIAPI\r | |
3363 | CryptoServiceTlsInHandshake (\r | |
3364 | IN VOID *Tls\r | |
3365 | )\r | |
3366 | {\r | |
3367 | return CALL_BASECRYPTLIB (Tls.Services.InHandshake, TlsInHandshake, (Tls), FALSE);\r | |
3368 | }\r | |
3369 | \r | |
3370 | /**\r | |
3371 | Perform a TLS/SSL handshake.\r | |
3372 | \r | |
3373 | This function will perform a TLS/SSL handshake.\r | |
3374 | \r | |
3375 | @param[in] Tls Pointer to the TLS object for handshake operation.\r | |
3376 | @param[in] BufferIn Pointer to the most recently received TLS Handshake packet.\r | |
3377 | @param[in] BufferInSize Packet size in bytes for the most recently received TLS\r | |
3378 | Handshake packet.\r | |
3379 | @param[out] BufferOut Pointer to the buffer to hold the built packet.\r | |
3380 | @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is\r | |
3381 | the buffer size provided by the caller. On output, it\r | |
3382 | is the buffer size in fact needed to contain the\r | |
3383 | packet.\r | |
3384 | \r | |
3385 | @retval EFI_SUCCESS The required TLS packet is built successfully.\r | |
3386 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
3387 | Tls is NULL.\r | |
3388 | BufferIn is NULL but BufferInSize is NOT 0.\r | |
3389 | BufferInSize is 0 but BufferIn is NOT NULL.\r | |
3390 | BufferOutSize is NULL.\r | |
3391 | BufferOut is NULL if *BufferOutSize is not zero.\r | |
3392 | @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.\r | |
3393 | @retval EFI_ABORTED Something wrong during handshake.\r | |
3394 | \r | |
3395 | **/\r | |
3396 | EFI_STATUS\r | |
3397 | EFIAPI\r | |
3398 | CryptoServiceTlsDoHandshake (\r | |
3399 | IN VOID *Tls,\r | |
3400 | IN UINT8 *BufferIn, OPTIONAL\r | |
3401 | IN UINTN BufferInSize, OPTIONAL\r | |
3402 | OUT UINT8 *BufferOut, OPTIONAL\r | |
3403 | IN OUT UINTN *BufferOutSize\r | |
3404 | )\r | |
3405 | {\r | |
3406 | return CALL_BASECRYPTLIB (Tls.Services.DoHandshake, TlsDoHandshake, (Tls, BufferIn, BufferInSize, BufferOut, BufferOutSize), EFI_UNSUPPORTED);\r | |
3407 | }\r | |
3408 | \r | |
3409 | /**\r | |
3410 | Handle Alert message recorded in BufferIn. If BufferIn is NULL and BufferInSize is zero,\r | |
3411 | TLS session has errors and the response packet needs to be Alert message based on error type.\r | |
3412 | \r | |
3413 | @param[in] Tls Pointer to the TLS object for state checking.\r | |
3414 | @param[in] BufferIn Pointer to the most recently received TLS Alert packet.\r | |
3415 | @param[in] BufferInSize Packet size in bytes for the most recently received TLS\r | |
3416 | Alert packet.\r | |
3417 | @param[out] BufferOut Pointer to the buffer to hold the built packet.\r | |
3418 | @param[in, out] BufferOutSize Pointer to the buffer size in bytes. On input, it is\r | |
3419 | the buffer size provided by the caller. On output, it\r | |
3420 | is the buffer size in fact needed to contain the\r | |
3421 | packet.\r | |
3422 | \r | |
3423 | @retval EFI_SUCCESS The required TLS packet is built successfully.\r | |
3424 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
3425 | Tls is NULL.\r | |
3426 | BufferIn is NULL but BufferInSize is NOT 0.\r | |
3427 | BufferInSize is 0 but BufferIn is NOT NULL.\r | |
3428 | BufferOutSize is NULL.\r | |
3429 | BufferOut is NULL if *BufferOutSize is not zero.\r | |
3430 | @retval EFI_ABORTED An error occurred.\r | |
3431 | @retval EFI_BUFFER_TOO_SMALL BufferOutSize is too small to hold the response packet.\r | |
3432 | \r | |
3433 | **/\r | |
3434 | EFI_STATUS\r | |
3435 | EFIAPI\r | |
3436 | CryptoServiceTlsHandleAlert (\r | |
3437 | IN VOID *Tls,\r | |
3438 | IN UINT8 *BufferIn, OPTIONAL\r | |
3439 | IN UINTN BufferInSize, OPTIONAL\r | |
3440 | OUT UINT8 *BufferOut, OPTIONAL\r | |
3441 | IN OUT UINTN *BufferOutSize\r | |
3442 | )\r | |
3443 | {\r | |
3444 | return CALL_BASECRYPTLIB (Tls.Services.HandleAlert, TlsHandleAlert, (Tls, BufferIn, BufferInSize, BufferOut, BufferOutSize), EFI_UNSUPPORTED);\r | |
3445 | }\r | |
3446 | \r | |
3447 | /**\r | |
3448 | Build the CloseNotify packet.\r | |
3449 | \r | |
3450 | @param[in] Tls Pointer to the TLS object for state checking.\r | |
3451 | @param[in, out] Buffer Pointer to the buffer to hold the built packet.\r | |
3452 | @param[in, out] BufferSize Pointer to the buffer size in bytes. On input, it is\r | |
3453 | the buffer size provided by the caller. On output, it\r | |
3454 | is the buffer size in fact needed to contain the\r | |
3455 | packet.\r | |
3456 | \r | |
3457 | @retval EFI_SUCCESS The required TLS packet is built successfully.\r | |
3458 | @retval EFI_INVALID_PARAMETER One or more of the following conditions is TRUE:\r | |
3459 | Tls is NULL.\r | |
3460 | BufferSize is NULL.\r | |
3461 | Buffer is NULL if *BufferSize is not zero.\r | |
3462 | @retval EFI_BUFFER_TOO_SMALL BufferSize is too small to hold the response packet.\r | |
3463 | \r | |
3464 | **/\r | |
3465 | EFI_STATUS\r | |
3466 | EFIAPI\r | |
3467 | CryptoServiceTlsCloseNotify (\r | |
3468 | IN VOID *Tls,\r | |
3469 | IN OUT UINT8 *Buffer,\r | |
3470 | IN OUT UINTN *BufferSize\r | |
3471 | )\r | |
3472 | {\r | |
3473 | return CALL_BASECRYPTLIB (Tls.Services.CloseNotify, TlsCloseNotify, (Tls, Buffer, BufferSize), EFI_UNSUPPORTED);\r | |
3474 | }\r | |
3475 | \r | |
3476 | /**\r | |
3477 | Attempts to read bytes from one TLS object and places the data in Buffer.\r | |
3478 | \r | |
3479 | This function will attempt to read BufferSize bytes from the TLS object\r | |
3480 | and places the data in Buffer.\r | |
3481 | \r | |
3482 | @param[in] Tls Pointer to the TLS object.\r | |
3483 | @param[in,out] Buffer Pointer to the buffer to store the data.\r | |
3484 | @param[in] BufferSize The size of Buffer in bytes.\r | |
3485 | \r | |
3486 | @retval >0 The amount of data successfully read from the TLS object.\r | |
3487 | @retval <=0 No data was successfully read.\r | |
3488 | \r | |
3489 | **/\r | |
3490 | INTN\r | |
3491 | EFIAPI\r | |
3492 | CryptoServiceTlsCtrlTrafficOut (\r | |
3493 | IN VOID *Tls,\r | |
3494 | IN OUT VOID *Buffer,\r | |
3495 | IN UINTN BufferSize\r | |
3496 | )\r | |
3497 | {\r | |
3498 | return CALL_BASECRYPTLIB (Tls.Services.CtrlTrafficOut, TlsCtrlTrafficOut, (Tls, Buffer, BufferSize), 0);\r | |
3499 | }\r | |
3500 | \r | |
3501 | /**\r | |
3502 | Attempts to write data from the buffer to TLS object.\r | |
3503 | \r | |
3504 | This function will attempt to write BufferSize bytes data from the Buffer\r | |
3505 | to the TLS object.\r | |
3506 | \r | |
3507 | @param[in] Tls Pointer to the TLS object.\r | |
3508 | @param[in] Buffer Pointer to the data buffer.\r | |
3509 | @param[in] BufferSize The size of Buffer in bytes.\r | |
3510 | \r | |
3511 | @retval >0 The amount of data successfully written to the TLS object.\r | |
3512 | @retval <=0 No data was successfully written.\r | |
3513 | \r | |
3514 | **/\r | |
3515 | INTN\r | |
3516 | EFIAPI\r | |
3517 | CryptoServiceTlsCtrlTrafficIn (\r | |
3518 | IN VOID *Tls,\r | |
3519 | IN VOID *Buffer,\r | |
3520 | IN UINTN BufferSize\r | |
3521 | )\r | |
3522 | {\r | |
3523 | return CALL_BASECRYPTLIB (Tls.Services.CtrlTrafficIn, TlsCtrlTrafficIn, (Tls, Buffer, BufferSize), 0);\r | |
3524 | }\r | |
3525 | \r | |
3526 | /**\r | |
3527 | Attempts to read bytes from the specified TLS connection into the buffer.\r | |
3528 | \r | |
3529 | This function tries to read BufferSize bytes data from the specified TLS\r | |
3530 | connection into the Buffer.\r | |
3531 | \r | |
3532 | @param[in] Tls Pointer to the TLS connection for data reading.\r | |
3533 | @param[in,out] Buffer Pointer to the data buffer.\r | |
3534 | @param[in] BufferSize The size of Buffer in bytes.\r | |
3535 | \r | |
3536 | @retval >0 The read operation was successful, and return value is the\r | |
3537 | number of bytes actually read from the TLS connection.\r | |
3538 | @retval <=0 The read operation was not successful.\r | |
3539 | \r | |
3540 | **/\r | |
3541 | INTN\r | |
3542 | EFIAPI\r | |
3543 | CryptoServiceTlsRead (\r | |
3544 | IN VOID *Tls,\r | |
3545 | IN OUT VOID *Buffer,\r | |
3546 | IN UINTN BufferSize\r | |
3547 | )\r | |
3548 | {\r | |
3549 | return CALL_BASECRYPTLIB (Tls.Services.Read, TlsRead, (Tls, Buffer, BufferSize), 0);\r | |
3550 | }\r | |
3551 | \r | |
3552 | /**\r | |
3553 | Attempts to write data to a TLS connection.\r | |
3554 | \r | |
3555 | This function tries to write BufferSize bytes data from the Buffer into the\r | |
3556 | specified TLS connection.\r | |
3557 | \r | |
3558 | @param[in] Tls Pointer to the TLS connection for data writing.\r | |
3559 | @param[in] Buffer Pointer to the data buffer.\r | |
3560 | @param[in] BufferSize The size of Buffer in bytes.\r | |
3561 | \r | |
3562 | @retval >0 The write operation was successful, and return value is the\r | |
3563 | number of bytes actually written to the TLS connection.\r | |
3564 | @retval <=0 The write operation was not successful.\r | |
3565 | \r | |
3566 | **/\r | |
3567 | INTN\r | |
3568 | EFIAPI\r | |
3569 | CryptoServiceTlsWrite (\r | |
3570 | IN VOID *Tls,\r | |
3571 | IN VOID *Buffer,\r | |
3572 | IN UINTN BufferSize\r | |
3573 | )\r | |
3574 | {\r | |
3575 | return CALL_BASECRYPTLIB (Tls.Services.Write, TlsWrite, (Tls, Buffer, BufferSize), 0);\r | |
3576 | }\r | |
3577 | \r | |
3578 | /**\r | |
3579 | Set a new TLS/SSL method for a particular TLS object.\r | |
3580 | \r | |
3581 | This function sets a new TLS/SSL method for a particular TLS object.\r | |
3582 | \r | |
3583 | @param[in] Tls Pointer to a TLS object.\r | |
3584 | @param[in] MajorVer Major Version of TLS/SSL Protocol.\r | |
3585 | @param[in] MinorVer Minor Version of TLS/SSL Protocol.\r | |
3586 | \r | |
3587 | @retval EFI_SUCCESS The TLS/SSL method was set successfully.\r | |
3588 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3589 | @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.\r | |
3590 | \r | |
3591 | **/\r | |
3592 | EFI_STATUS\r | |
3593 | EFIAPI\r | |
3594 | CryptoServiceTlsSetVersion (\r | |
3595 | IN VOID *Tls,\r | |
3596 | IN UINT8 MajorVer,\r | |
3597 | IN UINT8 MinorVer\r | |
3598 | )\r | |
3599 | {\r | |
3600 | return CALL_BASECRYPTLIB (TlsSet.Services.Version, TlsSetVersion, (Tls, MajorVer, MinorVer), EFI_UNSUPPORTED);\r | |
3601 | }\r | |
3602 | \r | |
3603 | /**\r | |
3604 | Set TLS object to work in client or server mode.\r | |
3605 | \r | |
3606 | This function prepares a TLS object to work in client or server mode.\r | |
3607 | \r | |
3608 | @param[in] Tls Pointer to a TLS object.\r | |
3609 | @param[in] IsServer Work in server mode.\r | |
3610 | \r | |
3611 | @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.\r | |
3612 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3613 | @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.\r | |
3614 | \r | |
3615 | **/\r | |
3616 | EFI_STATUS\r | |
3617 | EFIAPI\r | |
3618 | CryptoServiceTlsSetConnectionEnd (\r | |
3619 | IN VOID *Tls,\r | |
3620 | IN BOOLEAN IsServer\r | |
3621 | )\r | |
3622 | {\r | |
3623 | return CALL_BASECRYPTLIB (TlsSet.Services.ConnectionEnd, TlsSetConnectionEnd, (Tls, IsServer), EFI_UNSUPPORTED);\r | |
3624 | }\r | |
3625 | \r | |
3626 | /**\r | |
3627 | Set the ciphers list to be used by the TLS object.\r | |
3628 | \r | |
3629 | This function sets the ciphers for use by a specified TLS object.\r | |
3630 | \r | |
3631 | @param[in] Tls Pointer to a TLS object.\r | |
3632 | @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16\r | |
3633 | cipher identifier comes from the TLS Cipher Suite\r | |
3634 | Registry of the IANA, interpreting Byte1 and Byte2\r | |
3635 | in network (big endian) byte order.\r | |
3636 | @param[in] CipherNum The number of cipher in the list.\r | |
3637 | \r | |
3638 | @retval EFI_SUCCESS The ciphers list was set successfully.\r | |
3639 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3640 | @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.\r | |
3641 | @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r | |
3642 | \r | |
3643 | **/\r | |
3644 | EFI_STATUS\r | |
3645 | EFIAPI\r | |
3646 | CryptoServiceTlsSetCipherList (\r | |
3647 | IN VOID *Tls,\r | |
3648 | IN UINT16 *CipherId,\r | |
3649 | IN UINTN CipherNum\r | |
3650 | )\r | |
3651 | {\r | |
3652 | return CALL_BASECRYPTLIB (TlsSet.Services.CipherList, TlsSetCipherList, (Tls, CipherId, CipherNum), EFI_UNSUPPORTED);\r | |
3653 | }\r | |
3654 | \r | |
3655 | /**\r | |
3656 | Set the compression method for TLS/SSL operations.\r | |
3657 | \r | |
3658 | This function handles TLS/SSL integrated compression methods.\r | |
3659 | \r | |
3660 | @param[in] CompMethod The compression method ID.\r | |
3661 | \r | |
3662 | @retval EFI_SUCCESS The compression method for the communication was\r | |
3663 | set successfully.\r | |
3664 | @retval EFI_UNSUPPORTED Unsupported compression method.\r | |
3665 | \r | |
3666 | **/\r | |
3667 | EFI_STATUS\r | |
3668 | EFIAPI\r | |
3669 | CryptoServiceTlsSetCompressionMethod (\r | |
3670 | IN UINT8 CompMethod\r | |
3671 | )\r | |
3672 | {\r | |
3673 | return CALL_BASECRYPTLIB (TlsSet.Services.CompressionMethod, TlsSetCompressionMethod, (CompMethod), EFI_UNSUPPORTED);\r | |
3674 | }\r | |
3675 | \r | |
3676 | /**\r | |
3677 | Set peer certificate verification mode for the TLS connection.\r | |
3678 | \r | |
3679 | This function sets the verification mode flags for the TLS connection.\r | |
3680 | \r | |
3681 | @param[in] Tls Pointer to the TLS object.\r | |
3682 | @param[in] VerifyMode A set of logically or'ed verification mode flags.\r | |
3683 | \r | |
3684 | **/\r | |
3685 | VOID\r | |
3686 | EFIAPI\r | |
3687 | CryptoServiceTlsSetVerify (\r | |
3688 | IN VOID *Tls,\r | |
3689 | IN UINT32 VerifyMode\r | |
3690 | )\r | |
3691 | {\r | |
3692 | CALL_VOID_BASECRYPTLIB (TlsSet.Services.Verify, TlsSetVerify, (Tls, VerifyMode));\r | |
3693 | }\r | |
3694 | \r | |
3695 | /**\r | |
3696 | Set the specified host name to be verified.\r | |
3697 | \r | |
3698 | @param[in] Tls Pointer to the TLS object.\r | |
3699 | @param[in] Flags The setting flags during the validation.\r | |
3700 | @param[in] HostName The specified host name to be verified.\r | |
3701 | \r | |
3702 | @retval EFI_SUCCESS The HostName setting was set successfully.\r | |
3703 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3704 | @retval EFI_ABORTED Invalid HostName setting.\r | |
3705 | \r | |
3706 | **/\r | |
3707 | EFI_STATUS\r | |
3708 | EFIAPI\r | |
3709 | CryptoServiceTlsSetVerifyHost (\r | |
3710 | IN VOID *Tls,\r | |
3711 | IN UINT32 Flags,\r | |
3712 | IN CHAR8 *HostName\r | |
3713 | )\r | |
3714 | {\r | |
3715 | return CALL_BASECRYPTLIB (TlsSet.Services.VerifyHost, TlsSetVerifyHost, (Tls, Flags, HostName), EFI_UNSUPPORTED);\r | |
3716 | }\r | |
3717 | \r | |
3718 | /**\r | |
3719 | Sets a TLS/SSL session ID to be used during TLS/SSL connect.\r | |
3720 | \r | |
3721 | This function sets a session ID to be used when the TLS/SSL connection is\r | |
3722 | to be established.\r | |
3723 | \r | |
3724 | @param[in] Tls Pointer to the TLS object.\r | |
3725 | @param[in] SessionId Session ID data used for session resumption.\r | |
3726 | @param[in] SessionIdLen Length of Session ID in bytes.\r | |
3727 | \r | |
3728 | @retval EFI_SUCCESS Session ID was set successfully.\r | |
3729 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3730 | @retval EFI_UNSUPPORTED No available session for ID setting.\r | |
3731 | \r | |
3732 | **/\r | |
3733 | EFI_STATUS\r | |
3734 | EFIAPI\r | |
3735 | CryptoServiceTlsSetSessionId (\r | |
3736 | IN VOID *Tls,\r | |
3737 | IN UINT8 *SessionId,\r | |
3738 | IN UINT16 SessionIdLen\r | |
3739 | )\r | |
3740 | {\r | |
3741 | return CALL_BASECRYPTLIB (TlsSet.Services.SessionId, TlsSetSessionId, (Tls, SessionId, SessionIdLen), EFI_UNSUPPORTED);\r | |
3742 | }\r | |
3743 | \r | |
3744 | /**\r | |
3745 | Adds the CA to the cert store when requesting Server or Client authentication.\r | |
3746 | \r | |
3747 | This function adds the CA certificate to the list of CAs when requesting\r | |
3748 | Server or Client authentication for the chosen TLS connection.\r | |
3749 | \r | |
3750 | @param[in] Tls Pointer to the TLS object.\r | |
3751 | @param[in] Data Pointer to the data buffer of a DER-encoded binary\r | |
3752 | X.509 certificate or PEM-encoded X.509 certificate.\r | |
3753 | @param[in] DataSize The size of data buffer in bytes.\r | |
3754 | \r | |
3755 | @retval EFI_SUCCESS The operation succeeded.\r | |
3756 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3757 | @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r | |
3758 | @retval EFI_ABORTED Invalid X.509 certificate.\r | |
3759 | \r | |
3760 | **/\r | |
3761 | EFI_STATUS\r | |
3762 | EFIAPI\r | |
3763 | CryptoServiceTlsSetCaCertificate (\r | |
3764 | IN VOID *Tls,\r | |
3765 | IN VOID *Data,\r | |
3766 | IN UINTN DataSize\r | |
3767 | )\r | |
3768 | {\r | |
3769 | return CALL_BASECRYPTLIB (TlsSet.Services.CaCertificate, TlsSetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED);\r | |
3770 | }\r | |
3771 | \r | |
3772 | /**\r | |
3773 | Loads the local public certificate into the specified TLS object.\r | |
3774 | \r | |
3775 | This function loads the X.509 certificate into the specified TLS object\r | |
3776 | for TLS negotiation.\r | |
3777 | \r | |
3778 | @param[in] Tls Pointer to the TLS object.\r | |
3779 | @param[in] Data Pointer to the data buffer of a DER-encoded binary\r | |
3780 | X.509 certificate or PEM-encoded X.509 certificate.\r | |
3781 | @param[in] DataSize The size of data buffer in bytes.\r | |
3782 | \r | |
3783 | @retval EFI_SUCCESS The operation succeeded.\r | |
3784 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3785 | @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r | |
3786 | @retval EFI_ABORTED Invalid X.509 certificate.\r | |
3787 | \r | |
3788 | **/\r | |
3789 | EFI_STATUS\r | |
3790 | EFIAPI\r | |
3791 | CryptoServiceTlsSetHostPublicCert (\r | |
3792 | IN VOID *Tls,\r | |
3793 | IN VOID *Data,\r | |
3794 | IN UINTN DataSize\r | |
3795 | )\r | |
3796 | {\r | |
3797 | return CALL_BASECRYPTLIB (TlsSet.Services.HostPublicCert, TlsSetHostPublicCert, (Tls, Data, DataSize), EFI_UNSUPPORTED);\r | |
3798 | }\r | |
3799 | \r | |
3800 | /**\r | |
3801 | Adds the local private key to the specified TLS object.\r | |
3802 | \r | |
3803 | This function adds the local private key (PEM-encoded RSA or PKCS#8 private\r | |
3804 | key) into the specified TLS object for TLS negotiation.\r | |
3805 | \r | |
3806 | @param[in] Tls Pointer to the TLS object.\r | |
3807 | @param[in] Data Pointer to the data buffer of a PEM-encoded RSA\r | |
3808 | or PKCS#8 private key.\r | |
3809 | @param[in] DataSize The size of data buffer in bytes.\r | |
3810 | \r | |
3811 | @retval EFI_SUCCESS The operation succeeded.\r | |
3812 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
3813 | @retval EFI_ABORTED Invalid private key data.\r | |
3814 | \r | |
3815 | **/\r | |
3816 | EFI_STATUS\r | |
3817 | EFIAPI\r | |
3818 | CryptoServiceTlsSetHostPrivateKey (\r | |
3819 | IN VOID *Tls,\r | |
3820 | IN VOID *Data,\r | |
3821 | IN UINTN DataSize\r | |
3822 | )\r | |
3823 | {\r | |
3824 | return CALL_BASECRYPTLIB (TlsSet.Services.HostPrivateKey, TlsSetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED);\r | |
3825 | }\r | |
3826 | \r | |
3827 | /**\r | |
3828 | Adds the CA-supplied certificate revocation list for certificate validation.\r | |
3829 | \r | |
3830 | This function adds the CA-supplied certificate revocation list data for\r | |
3831 | certificate validity checking.\r | |
3832 | \r | |
3833 | @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.\r | |
3834 | @param[in] DataSize The size of data buffer in bytes.\r | |
3835 | \r | |
3836 | @retval EFI_SUCCESS The operation succeeded.\r | |
3837 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
3838 | @retval EFI_ABORTED Invalid CRL data.\r | |
3839 | \r | |
3840 | **/\r | |
3841 | EFI_STATUS\r | |
3842 | EFIAPI\r | |
3843 | CryptoServiceTlsSetCertRevocationList (\r | |
3844 | IN VOID *Data,\r | |
3845 | IN UINTN DataSize\r | |
3846 | )\r | |
3847 | {\r | |
3848 | return CALL_BASECRYPTLIB (TlsSet.Services.CertRevocationList, TlsSetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);\r | |
3849 | }\r | |
3850 | \r | |
3851 | /**\r | |
3852 | Gets the protocol version used by the specified TLS connection.\r | |
3853 | \r | |
3854 | This function returns the protocol version used by the specified TLS\r | |
3855 | connection.\r | |
3856 | \r | |
3857 | If Tls is NULL, then ASSERT().\r | |
3858 | \r | |
3859 | @param[in] Tls Pointer to the TLS object.\r | |
3860 | \r | |
3861 | @return The protocol version of the specified TLS connection.\r | |
3862 | \r | |
3863 | **/\r | |
3864 | UINT16\r | |
3865 | EFIAPI\r | |
3866 | CryptoServiceTlsGetVersion (\r | |
3867 | IN VOID *Tls\r | |
3868 | )\r | |
3869 | {\r | |
3870 | return CALL_BASECRYPTLIB (TlsGet.Services.Version, TlsGetVersion, (Tls), 0);\r | |
3871 | }\r | |
3872 | \r | |
3873 | /**\r | |
3874 | Gets the connection end of the specified TLS connection.\r | |
3875 | \r | |
3876 | This function returns the connection end (as client or as server) used by\r | |
3877 | the specified TLS connection.\r | |
3878 | \r | |
3879 | If Tls is NULL, then ASSERT().\r | |
3880 | \r | |
3881 | @param[in] Tls Pointer to the TLS object.\r | |
3882 | \r | |
3883 | @return The connection end used by the specified TLS connection.\r | |
3884 | \r | |
3885 | **/\r | |
3886 | UINT8\r | |
3887 | EFIAPI\r | |
3888 | CryptoServiceTlsGetConnectionEnd (\r | |
3889 | IN VOID *Tls\r | |
3890 | )\r | |
3891 | {\r | |
3892 | return CALL_BASECRYPTLIB (TlsGet.Services.ConnectionEnd, TlsGetConnectionEnd, (Tls), 0);\r | |
3893 | }\r | |
3894 | \r | |
3895 | /**\r | |
3896 | Gets the cipher suite used by the specified TLS connection.\r | |
3897 | \r | |
3898 | This function returns current cipher suite used by the specified\r | |
3899 | TLS connection.\r | |
3900 | \r | |
3901 | @param[in] Tls Pointer to the TLS object.\r | |
3902 | @param[in,out] CipherId The cipher suite used by the TLS object.\r | |
3903 | \r | |
3904 | @retval EFI_SUCCESS The cipher suite was returned successfully.\r | |
3905 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3906 | @retval EFI_UNSUPPORTED Unsupported cipher suite.\r | |
3907 | \r | |
3908 | **/\r | |
3909 | EFI_STATUS\r | |
3910 | EFIAPI\r | |
3911 | CryptoServiceTlsGetCurrentCipher (\r | |
3912 | IN VOID *Tls,\r | |
3913 | IN OUT UINT16 *CipherId\r | |
3914 | )\r | |
3915 | {\r | |
3916 | return CALL_BASECRYPTLIB (TlsGet.Services.CurrentCipher, TlsGetCurrentCipher, (Tls, CipherId), EFI_UNSUPPORTED);\r | |
3917 | }\r | |
3918 | \r | |
3919 | /**\r | |
3920 | Gets the compression methods used by the specified TLS connection.\r | |
3921 | \r | |
3922 | This function returns current integrated compression methods used by\r | |
3923 | the specified TLS connection.\r | |
3924 | \r | |
3925 | @param[in] Tls Pointer to the TLS object.\r | |
3926 | @param[in,out] CompressionId The current compression method used by\r | |
3927 | the TLS object.\r | |
3928 | \r | |
3929 | @retval EFI_SUCCESS The compression method was returned successfully.\r | |
3930 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3931 | @retval EFI_ABORTED Invalid Compression method.\r | |
3932 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
3933 | \r | |
3934 | **/\r | |
3935 | EFI_STATUS\r | |
3936 | EFIAPI\r | |
3937 | CryptoServiceTlsGetCurrentCompressionId (\r | |
3938 | IN VOID *Tls,\r | |
3939 | IN OUT UINT8 *CompressionId\r | |
3940 | )\r | |
3941 | {\r | |
3942 | return CALL_BASECRYPTLIB (TlsGet.Services.CurrentCompressionId, TlsGetCurrentCompressionId, (Tls, CompressionId), EFI_UNSUPPORTED);\r | |
3943 | }\r | |
3944 | \r | |
3945 | /**\r | |
3946 | Gets the verification mode currently set in the TLS connection.\r | |
3947 | \r | |
3948 | This function returns the peer verification mode currently set in the\r | |
3949 | specified TLS connection.\r | |
3950 | \r | |
3951 | If Tls is NULL, then ASSERT().\r | |
3952 | \r | |
3953 | @param[in] Tls Pointer to the TLS object.\r | |
3954 | \r | |
3955 | @return The verification mode set in the specified TLS connection.\r | |
3956 | \r | |
3957 | **/\r | |
3958 | UINT32\r | |
3959 | EFIAPI\r | |
3960 | CryptoServiceTlsGetVerify (\r | |
3961 | IN VOID *Tls\r | |
3962 | )\r | |
3963 | {\r | |
3964 | return CALL_BASECRYPTLIB (TlsGet.Services.Verify, TlsGetVerify, (Tls), 0);\r | |
3965 | }\r | |
3966 | \r | |
3967 | /**\r | |
3968 | Gets the session ID used by the specified TLS connection.\r | |
3969 | \r | |
3970 | This function returns the TLS/SSL session ID currently used by the\r | |
3971 | specified TLS connection.\r | |
3972 | \r | |
3973 | @param[in] Tls Pointer to the TLS object.\r | |
3974 | @param[in,out] SessionId Buffer to contain the returned session ID.\r | |
3975 | @param[in,out] SessionIdLen The length of Session ID in bytes.\r | |
3976 | \r | |
3977 | @retval EFI_SUCCESS The Session ID was returned successfully.\r | |
3978 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
3979 | @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r | |
3980 | \r | |
3981 | **/\r | |
3982 | EFI_STATUS\r | |
3983 | EFIAPI\r | |
3984 | CryptoServiceTlsGetSessionId (\r | |
3985 | IN VOID *Tls,\r | |
3986 | IN OUT UINT8 *SessionId,\r | |
3987 | IN OUT UINT16 *SessionIdLen\r | |
3988 | )\r | |
3989 | {\r | |
3990 | return CALL_BASECRYPTLIB (TlsGet.Services.SessionId, TlsGetSessionId, (Tls, SessionId, SessionIdLen), EFI_UNSUPPORTED);\r | |
3991 | }\r | |
3992 | \r | |
3993 | /**\r | |
3994 | Gets the client random data used in the specified TLS connection.\r | |
3995 | \r | |
3996 | This function returns the TLS/SSL client random data currently used in\r | |
3997 | the specified TLS connection.\r | |
3998 | \r | |
3999 | @param[in] Tls Pointer to the TLS object.\r | |
4000 | @param[in,out] ClientRandom Buffer to contain the returned client\r | |
4001 | random data (32 bytes).\r | |
4002 | \r | |
4003 | **/\r | |
4004 | VOID\r | |
4005 | EFIAPI\r | |
4006 | CryptoServiceTlsGetClientRandom (\r | |
4007 | IN VOID *Tls,\r | |
4008 | IN OUT UINT8 *ClientRandom\r | |
4009 | )\r | |
4010 | {\r | |
4011 | CALL_VOID_BASECRYPTLIB (TlsGet.Services.ClientRandom, TlsGetClientRandom, (Tls, ClientRandom));\r | |
4012 | }\r | |
4013 | \r | |
4014 | /**\r | |
4015 | Gets the server random data used in the specified TLS connection.\r | |
4016 | \r | |
4017 | This function returns the TLS/SSL server random data currently used in\r | |
4018 | the specified TLS connection.\r | |
4019 | \r | |
4020 | @param[in] Tls Pointer to the TLS object.\r | |
4021 | @param[in,out] ServerRandom Buffer to contain the returned server\r | |
4022 | random data (32 bytes).\r | |
4023 | \r | |
4024 | **/\r | |
4025 | VOID\r | |
4026 | EFIAPI\r | |
4027 | CryptoServiceTlsGetServerRandom (\r | |
4028 | IN VOID *Tls,\r | |
4029 | IN OUT UINT8 *ServerRandom\r | |
4030 | )\r | |
4031 | {\r | |
4032 | CALL_VOID_BASECRYPTLIB (TlsGet.Services.ServerRandom, TlsGetServerRandom, (Tls, ServerRandom));\r | |
4033 | }\r | |
4034 | \r | |
4035 | /**\r | |
4036 | Gets the master key data used in the specified TLS connection.\r | |
4037 | \r | |
4038 | This function returns the TLS/SSL master key material currently used in\r | |
4039 | the specified TLS connection.\r | |
4040 | \r | |
4041 | @param[in] Tls Pointer to the TLS object.\r | |
4042 | @param[in,out] KeyMaterial Buffer to contain the returned key material.\r | |
4043 | \r | |
4044 | @retval EFI_SUCCESS Key material was returned successfully.\r | |
4045 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
4046 | @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r | |
4047 | \r | |
4048 | **/\r | |
4049 | EFI_STATUS\r | |
4050 | EFIAPI\r | |
4051 | CryptoServiceTlsGetKeyMaterial (\r | |
4052 | IN VOID *Tls,\r | |
4053 | IN OUT UINT8 *KeyMaterial\r | |
4054 | )\r | |
4055 | {\r | |
4056 | return CALL_BASECRYPTLIB (TlsGet.Services.KeyMaterial, TlsGetKeyMaterial, (Tls, KeyMaterial), EFI_UNSUPPORTED);\r | |
4057 | }\r | |
4058 | \r | |
4059 | /**\r | |
4060 | Gets the CA Certificate from the cert store.\r | |
4061 | \r | |
4062 | This function returns the CA certificate for the chosen\r | |
4063 | TLS connection.\r | |
4064 | \r | |
4065 | @param[in] Tls Pointer to the TLS object.\r | |
4066 | @param[out] Data Pointer to the data buffer to receive the CA\r | |
4067 | certificate data sent to the client.\r | |
4068 | @param[in,out] DataSize The size of data buffer in bytes.\r | |
4069 | \r | |
4070 | @retval EFI_SUCCESS The operation succeeded.\r | |
4071 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
4072 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r | |
4073 | \r | |
4074 | **/\r | |
4075 | EFI_STATUS\r | |
4076 | EFIAPI\r | |
4077 | CryptoServiceTlsGetCaCertificate (\r | |
4078 | IN VOID *Tls,\r | |
4079 | OUT VOID *Data,\r | |
4080 | IN OUT UINTN *DataSize\r | |
4081 | )\r | |
4082 | {\r | |
4083 | return CALL_BASECRYPTLIB (TlsGet.Services.CaCertificate, TlsGetCaCertificate, (Tls, Data, DataSize), EFI_UNSUPPORTED);\r | |
4084 | }\r | |
4085 | \r | |
4086 | /**\r | |
4087 | Gets the local public Certificate set in the specified TLS object.\r | |
4088 | \r | |
4089 | This function returns the local public certificate which was currently set\r | |
4090 | in the specified TLS object.\r | |
4091 | \r | |
4092 | @param[in] Tls Pointer to the TLS object.\r | |
4093 | @param[out] Data Pointer to the data buffer to receive the local\r | |
4094 | public certificate.\r | |
4095 | @param[in,out] DataSize The size of data buffer in bytes.\r | |
4096 | \r | |
4097 | @retval EFI_SUCCESS The operation succeeded.\r | |
4098 | @retval EFI_INVALID_PARAMETER The parameter is invalid.\r | |
4099 | @retval EFI_NOT_FOUND The certificate is not found.\r | |
4100 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r | |
4101 | \r | |
4102 | **/\r | |
4103 | EFI_STATUS\r | |
4104 | EFIAPI\r | |
4105 | CryptoServiceTlsGetHostPublicCert (\r | |
4106 | IN VOID *Tls,\r | |
4107 | OUT VOID *Data,\r | |
4108 | IN OUT UINTN *DataSize\r | |
4109 | )\r | |
4110 | {\r | |
4111 | return CALL_BASECRYPTLIB (TlsGet.Services.HostPublicCert, TlsGetHostPublicCert, (Tls, Data, DataSize), EFI_UNSUPPORTED);\r | |
4112 | }\r | |
4113 | \r | |
4114 | /**\r | |
4115 | Gets the local private key set in the specified TLS object.\r | |
4116 | \r | |
4117 | This function returns the local private key data which was currently set\r | |
4118 | in the specified TLS object.\r | |
4119 | \r | |
4120 | @param[in] Tls Pointer to the TLS object.\r | |
4121 | @param[out] Data Pointer to the data buffer to receive the local\r | |
4122 | private key data.\r | |
4123 | @param[in,out] DataSize The size of data buffer in bytes.\r | |
4124 | \r | |
4125 | @retval EFI_SUCCESS The operation succeeded.\r | |
4126 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
4127 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r | |
4128 | \r | |
4129 | **/\r | |
4130 | EFI_STATUS\r | |
4131 | EFIAPI\r | |
4132 | CryptoServiceTlsGetHostPrivateKey (\r | |
4133 | IN VOID *Tls,\r | |
4134 | OUT VOID *Data,\r | |
4135 | IN OUT UINTN *DataSize\r | |
4136 | )\r | |
4137 | {\r | |
4138 | return CALL_BASECRYPTLIB (TlsGet.Services.HostPrivateKey, TlsGetHostPrivateKey, (Tls, Data, DataSize), EFI_UNSUPPORTED);\r | |
4139 | }\r | |
4140 | \r | |
4141 | /**\r | |
4142 | Gets the CA-supplied certificate revocation list data set in the specified\r | |
4143 | TLS object.\r | |
4144 | \r | |
4145 | This function returns the CA-supplied certificate revocation list data which\r | |
4146 | was currently set in the specified TLS object.\r | |
4147 | \r | |
4148 | @param[out] Data Pointer to the data buffer to receive the CRL data.\r | |
4149 | @param[in,out] DataSize The size of data buffer in bytes.\r | |
4150 | \r | |
4151 | @retval EFI_SUCCESS The operation succeeded.\r | |
4152 | @retval EFI_UNSUPPORTED This function is not supported.\r | |
4153 | @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r | |
4154 | \r | |
4155 | **/\r | |
4156 | EFI_STATUS\r | |
4157 | EFIAPI\r | |
4158 | CryptoServiceTlsGetCertRevocationList (\r | |
4159 | OUT VOID *Data,\r | |
4160 | IN OUT UINTN *DataSize\r | |
4161 | )\r | |
4162 | {\r | |
4163 | return CALL_BASECRYPTLIB (TlsGet.Services.CertRevocationList, TlsGetCertRevocationList, (Data, DataSize), EFI_UNSUPPORTED);\r | |
4164 | }\r | |
4165 | \r | |
4166 | const EDKII_CRYPTO_PROTOCOL mEdkiiCrypto = {\r | |
4167 | /// Version\r | |
4168 | CryptoServiceGetCryptoVersion,\r | |
b6174e2d ZG |
4169 | /// HMAC MD5 - deprecated and unsupported\r |
4170 | DeprecatedCryptoServiceHmacMd5New,\r | |
4171 | DeprecatedCryptoServiceHmacMd5Free,\r | |
4172 | DeprecatedCryptoServiceHmacMd5SetKey,\r | |
4173 | DeprecatedCryptoServiceHmacMd5Duplicate,\r | |
4174 | DeprecatedCryptoServiceHmacMd5Update,\r | |
4175 | DeprecatedCryptoServiceHmacMd5Final,\r | |
c812d320 ZG |
4176 | /// HMAC SHA1 - deprecated and unsupported\r |
4177 | DeprecatedCryptoServiceHmacSha1New,\r | |
4178 | DeprecatedCryptoServiceHmacSha1Free,\r | |
4179 | DeprecatedCryptoServiceHmacSha1SetKey,\r | |
4180 | DeprecatedCryptoServiceHmacSha1Duplicate,\r | |
4181 | DeprecatedCryptoServiceHmacSha1Update,\r | |
4182 | DeprecatedCryptoServiceHmacSha1Final,\r | |
cc1d13c9 MK |
4183 | /// HMAC SHA256\r |
4184 | CryptoServiceHmacSha256New,\r | |
4185 | CryptoServiceHmacSha256Free,\r | |
4186 | CryptoServiceHmacSha256SetKey,\r | |
4187 | CryptoServiceHmacSha256Duplicate,\r | |
4188 | CryptoServiceHmacSha256Update,\r | |
4189 | CryptoServiceHmacSha256Final,\r | |
0a6fc3d0 ZG |
4190 | /// Md4 - deprecated and unsupported\r |
4191 | DeprecatedCryptoServiceMd4GetContextSize,\r | |
4192 | DeprecatedCryptoServiceMd4Init,\r | |
4193 | DeprecatedCryptoServiceMd4Duplicate,\r | |
4194 | DeprecatedCryptoServiceMd4Update,\r | |
4195 | DeprecatedCryptoServiceMd4Final,\r | |
4196 | DeprecatedCryptoServiceMd4HashAll,\r | |
cc1d13c9 MK |
4197 | /// Md5\r |
4198 | CryptoServiceMd5GetContextSize,\r | |
4199 | CryptoServiceMd5Init,\r | |
4200 | CryptoServiceMd5Duplicate,\r | |
4201 | CryptoServiceMd5Update,\r | |
4202 | CryptoServiceMd5Final,\r | |
4203 | CryptoServiceMd5HashAll,\r | |
4204 | /// Pkcs\r | |
4205 | CryptoServicePkcs1v2Encrypt,\r | |
4206 | CryptoServicePkcs5HashPassword,\r | |
4207 | CryptoServicePkcs7Verify,\r | |
4208 | CryptoServiceVerifyEKUsInPkcs7Signature,\r | |
4209 | CryptoServicePkcs7GetSigners,\r | |
4210 | CryptoServicePkcs7FreeSigners,\r | |
4211 | CryptoServicePkcs7Sign,\r | |
4212 | CryptoServicePkcs7GetAttachedContent,\r | |
4213 | CryptoServicePkcs7GetCertificatesList,\r | |
4214 | CryptoServiceAuthenticodeVerify,\r | |
4215 | CryptoServiceImageTimestampVerify,\r | |
4216 | /// DH\r | |
4217 | CryptoServiceDhNew,\r | |
4218 | CryptoServiceDhFree,\r | |
4219 | CryptoServiceDhGenerateParameter,\r | |
4220 | CryptoServiceDhSetParameter,\r | |
4221 | CryptoServiceDhGenerateKey,\r | |
4222 | CryptoServiceDhComputeKey,\r | |
4223 | /// Random\r | |
4224 | CryptoServiceRandomSeed,\r | |
4225 | CryptoServiceRandomBytes,\r | |
4226 | /// RSA\r | |
4227 | CryptoServiceRsaPkcs1Verify,\r | |
4228 | CryptoServiceRsaNew,\r | |
4229 | CryptoServiceRsaFree,\r | |
4230 | CryptoServiceRsaSetKey,\r | |
4231 | CryptoServiceRsaGetKey,\r | |
4232 | CryptoServiceRsaGenerateKey,\r | |
4233 | CryptoServiceRsaCheckKey,\r | |
4234 | CryptoServiceRsaPkcs1Sign,\r | |
4235 | CryptoServiceRsaPkcs1Verify,\r | |
4236 | CryptoServiceRsaGetPrivateKeyFromPem,\r | |
4237 | CryptoServiceRsaGetPublicKeyFromX509,\r | |
4238 | /// Sha1\r | |
4239 | CryptoServiceSha1GetContextSize,\r | |
4240 | CryptoServiceSha1Init,\r | |
4241 | CryptoServiceSha1Duplicate,\r | |
4242 | CryptoServiceSha1Update,\r | |
4243 | CryptoServiceSha1Final,\r | |
4244 | CryptoServiceSha1HashAll,\r | |
4245 | /// Sha256\r | |
4246 | CryptoServiceSha256GetContextSize,\r | |
4247 | CryptoServiceSha256Init,\r | |
4248 | CryptoServiceSha256Duplicate,\r | |
4249 | CryptoServiceSha256Update,\r | |
4250 | CryptoServiceSha256Final,\r | |
4251 | CryptoServiceSha256HashAll,\r | |
4252 | /// Sha384\r | |
4253 | CryptoServiceSha384GetContextSize,\r | |
4254 | CryptoServiceSha384Init,\r | |
4255 | CryptoServiceSha384Duplicate,\r | |
4256 | CryptoServiceSha384Update,\r | |
4257 | CryptoServiceSha384Final,\r | |
4258 | CryptoServiceSha384HashAll,\r | |
4259 | /// Sha512\r | |
4260 | CryptoServiceSha512GetContextSize,\r | |
4261 | CryptoServiceSha512Init,\r | |
4262 | CryptoServiceSha512Duplicate,\r | |
4263 | CryptoServiceSha512Update,\r | |
4264 | CryptoServiceSha512Final,\r | |
4265 | CryptoServiceSha512HashAll,\r | |
4266 | /// X509\r | |
4267 | CryptoServiceX509GetSubjectName,\r | |
4268 | CryptoServiceX509GetCommonName,\r | |
4269 | CryptoServiceX509GetOrganizationName,\r | |
4270 | CryptoServiceX509VerifyCert,\r | |
4271 | CryptoServiceX509ConstructCertificate,\r | |
4272 | CryptoServiceX509ConstructCertificateStack,\r | |
4273 | CryptoServiceX509Free,\r | |
4274 | CryptoServiceX509StackFree,\r | |
4275 | CryptoServiceX509GetTBSCert,\r | |
b8af2c9e ZG |
4276 | /// TDES - deprecated and unsupported\r |
4277 | DeprecatedCryptoServiceTdesGetContextSize,\r | |
4278 | DeprecatedCryptoServiceTdesInit,\r | |
4279 | DeprecatedCryptoServiceTdesEcbEncrypt,\r | |
4280 | DeprecatedCryptoServiceTdesEcbDecrypt,\r | |
4281 | DeprecatedCryptoServiceTdesCbcEncrypt,\r | |
4282 | DeprecatedCryptoServiceTdesCbcDecrypt,\r | |
80e28dce | 4283 | /// AES - ECB mode is deprecated and unsupported\r |
cc1d13c9 MK |
4284 | CryptoServiceAesGetContextSize,\r |
4285 | CryptoServiceAesInit,\r | |
80e28dce ZG |
4286 | DeprecatedCryptoServiceAesEcbEncrypt,\r |
4287 | DeprecatedCryptoServiceAesEcbDecrypt,\r | |
cc1d13c9 MK |
4288 | CryptoServiceAesCbcEncrypt,\r |
4289 | CryptoServiceAesCbcDecrypt,\r | |
c22a32e1 ZG |
4290 | /// Arc4 - deprecated and unsupported\r |
4291 | DeprecatedCryptoServiceArc4GetContextSize,\r | |
4292 | DeprecatedCryptoServiceArc4Init,\r | |
4293 | DeprecatedCryptoServiceArc4Encrypt,\r | |
4294 | DeprecatedCryptoServiceArc4Decrypt,\r | |
4295 | DeprecatedCryptoServiceArc4Reset,\r | |
cc1d13c9 MK |
4296 | /// SM3\r |
4297 | CryptoServiceSm3GetContextSize,\r | |
4298 | CryptoServiceSm3Init,\r | |
4299 | CryptoServiceSm3Duplicate,\r | |
4300 | CryptoServiceSm3Update,\r | |
4301 | CryptoServiceSm3Final,\r | |
4302 | CryptoServiceSm3HashAll,\r | |
4303 | /// HKDF\r | |
4304 | CryptoServiceHkdfSha256ExtractAndExpand,\r | |
4305 | /// X509 (Continued)\r | |
4306 | CryptoServiceX509ConstructCertificateStackV,\r | |
4307 | /// TLS\r | |
4308 | CryptoServiceTlsInitialize,\r | |
4309 | CryptoServiceTlsCtxFree,\r | |
4310 | CryptoServiceTlsCtxNew,\r | |
4311 | CryptoServiceTlsFree,\r | |
4312 | CryptoServiceTlsNew,\r | |
4313 | CryptoServiceTlsInHandshake,\r | |
4314 | CryptoServiceTlsDoHandshake,\r | |
4315 | CryptoServiceTlsHandleAlert,\r | |
4316 | CryptoServiceTlsCloseNotify,\r | |
4317 | CryptoServiceTlsCtrlTrafficOut,\r | |
4318 | CryptoServiceTlsCtrlTrafficIn,\r | |
4319 | CryptoServiceTlsRead,\r | |
4320 | CryptoServiceTlsWrite,\r | |
4321 | /// TLS Set\r | |
4322 | CryptoServiceTlsSetVersion,\r | |
4323 | CryptoServiceTlsSetConnectionEnd,\r | |
4324 | CryptoServiceTlsSetCipherList,\r | |
4325 | CryptoServiceTlsSetCompressionMethod,\r | |
4326 | CryptoServiceTlsSetVerify,\r | |
4327 | CryptoServiceTlsSetVerifyHost,\r | |
4328 | CryptoServiceTlsSetSessionId,\r | |
4329 | CryptoServiceTlsSetCaCertificate,\r | |
4330 | CryptoServiceTlsSetHostPublicCert,\r | |
4331 | CryptoServiceTlsSetHostPrivateKey,\r | |
4332 | CryptoServiceTlsSetCertRevocationList,\r | |
4333 | /// TLS Get\r | |
4334 | CryptoServiceTlsGetVersion,\r | |
4335 | CryptoServiceTlsGetConnectionEnd,\r | |
4336 | CryptoServiceTlsGetCurrentCipher,\r | |
4337 | CryptoServiceTlsGetCurrentCompressionId,\r | |
4338 | CryptoServiceTlsGetVerify,\r | |
4339 | CryptoServiceTlsGetSessionId,\r | |
4340 | CryptoServiceTlsGetClientRandom,\r | |
4341 | CryptoServiceTlsGetServerRandom,\r | |
4342 | CryptoServiceTlsGetKeyMaterial,\r | |
4343 | CryptoServiceTlsGetCaCertificate,\r | |
4344 | CryptoServiceTlsGetHostPublicCert,\r | |
4345 | CryptoServiceTlsGetHostPrivateKey,\r | |
4346 | CryptoServiceTlsGetCertRevocationList\r | |
4347 | };\r |