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