]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/TlsLib/TlsConfig.c
CryptoPkg/TlsLib: Add the new API "TlsSetVerifyHost" (CVE-2019-14553)
[mirror_edk2.git] / CryptoPkg / Library / TlsLib / TlsConfig.c
CommitLineData
264702a0
HW
1/** @file\r
2 SSL/TLS Configuration Library Wrapper Implementation over OpenSSL.\r
3\r
2ca74e1a 4Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>\r
264702a0 5(C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>\r
2009f6b4 6SPDX-License-Identifier: BSD-2-Clause-Patent\r
264702a0
HW
7\r
8**/\r
9\r
10#include "InternalTlsLib.h"\r
11\r
12typedef struct {\r
13 //\r
14 // IANA/IETF defined Cipher Suite ID\r
15 //\r
16 UINT16 IanaCipher;\r
17 //\r
18 // OpenSSL-used Cipher Suite String\r
19 //\r
20 CONST CHAR8 *OpensslCipher;\r
96015d5f
LE
21 //\r
22 // Length of OpensslCipher\r
23 //\r
24 UINTN OpensslCipherLength;\r
ecfd37ba 25} TLS_CIPHER_MAPPING;\r
264702a0 26\r
96015d5f
LE
27//\r
28// Create a TLS_CIPHER_MAPPING initializer from IanaCipher and OpensslCipher so\r
29// that OpensslCipherLength is filled in automatically. IanaCipher must be an\r
30// integer constant expression, and OpensslCipher must be a string literal.\r
31//\r
32#define MAP(IanaCipher, OpensslCipher) \\r
33 { (IanaCipher), (OpensslCipher), sizeof (OpensslCipher) - 1 }\r
34\r
264702a0
HW
35//\r
36// The mapping table between IANA/IETF Cipher Suite definitions and\r
37// OpenSSL-used Cipher Suite name.\r
38//\r
5eadb54e
LE
39// Keep the table uniquely sorted by the IanaCipher field, in increasing order.\r
40//\r
ecfd37ba 41STATIC CONST TLS_CIPHER_MAPPING TlsCipherMappingTable[] = {\r
96015d5f
LE
42 MAP ( 0x0001, "NULL-MD5" ), /// TLS_RSA_WITH_NULL_MD5\r
43 MAP ( 0x0002, "NULL-SHA" ), /// TLS_RSA_WITH_NULL_SHA\r
44 MAP ( 0x0004, "RC4-MD5" ), /// TLS_RSA_WITH_RC4_128_MD5\r
45 MAP ( 0x0005, "RC4-SHA" ), /// TLS_RSA_WITH_RC4_128_SHA\r
46 MAP ( 0x000A, "DES-CBC3-SHA" ), /// TLS_RSA_WITH_3DES_EDE_CBC_SHA, mandatory TLS 1.1\r
47 MAP ( 0x0016, "DHE-RSA-DES-CBC3-SHA" ), /// TLS_DHE_RSA_WITH_3DES_EDE_CBC_SHA\r
48 MAP ( 0x002F, "AES128-SHA" ), /// TLS_RSA_WITH_AES_128_CBC_SHA, mandatory TLS 1.2\r
49 MAP ( 0x0030, "DH-DSS-AES128-SHA" ), /// TLS_DH_DSS_WITH_AES_128_CBC_SHA\r
50 MAP ( 0x0031, "DH-RSA-AES128-SHA" ), /// TLS_DH_RSA_WITH_AES_128_CBC_SHA\r
51 MAP ( 0x0033, "DHE-RSA-AES128-SHA" ), /// TLS_DHE_RSA_WITH_AES_128_CBC_SHA\r
52 MAP ( 0x0035, "AES256-SHA" ), /// TLS_RSA_WITH_AES_256_CBC_SHA\r
53 MAP ( 0x0036, "DH-DSS-AES256-SHA" ), /// TLS_DH_DSS_WITH_AES_256_CBC_SHA\r
54 MAP ( 0x0037, "DH-RSA-AES256-SHA" ), /// TLS_DH_RSA_WITH_AES_256_CBC_SHA\r
55 MAP ( 0x0039, "DHE-RSA-AES256-SHA" ), /// TLS_DHE_RSA_WITH_AES_256_CBC_SHA\r
56 MAP ( 0x003B, "NULL-SHA256" ), /// TLS_RSA_WITH_NULL_SHA256\r
57 MAP ( 0x003C, "AES128-SHA256" ), /// TLS_RSA_WITH_AES_128_CBC_SHA256\r
58 MAP ( 0x003D, "AES256-SHA256" ), /// TLS_RSA_WITH_AES_256_CBC_SHA256\r
59 MAP ( 0x003E, "DH-DSS-AES128-SHA256" ), /// TLS_DH_DSS_WITH_AES_128_CBC_SHA256\r
60 MAP ( 0x003F, "DH-RSA-AES128-SHA256" ), /// TLS_DH_RSA_WITH_AES_128_CBC_SHA256\r
61 MAP ( 0x0067, "DHE-RSA-AES128-SHA256" ), /// TLS_DHE_RSA_WITH_AES_128_CBC_SHA256\r
62 MAP ( 0x0068, "DH-DSS-AES256-SHA256" ), /// TLS_DH_DSS_WITH_AES_256_CBC_SHA256\r
63 MAP ( 0x0069, "DH-RSA-AES256-SHA256" ), /// TLS_DH_RSA_WITH_AES_256_CBC_SHA256\r
64 MAP ( 0x006B, "DHE-RSA-AES256-SHA256" ), /// TLS_DHE_RSA_WITH_AES_256_CBC_SHA256\r
264702a0
HW
65};\r
66\r
67/**\r
ecfd37ba 68 Gets the OpenSSL cipher suite mapping for the supplied IANA TLS cipher suite.\r
264702a0
HW
69\r
70 @param[in] CipherId The supplied IANA TLS cipher suite ID.\r
71\r
ecfd37ba 72 @return The corresponding OpenSSL cipher suite mapping if found,\r
264702a0
HW
73 NULL otherwise.\r
74\r
75**/\r
76STATIC\r
ecfd37ba
LE
77CONST TLS_CIPHER_MAPPING *\r
78TlsGetCipherMapping (\r
264702a0
HW
79 IN UINT16 CipherId\r
80 )\r
81{\r
5eadb54e
LE
82 INTN Left;\r
83 INTN Right;\r
84 INTN Middle;\r
264702a0
HW
85\r
86 //\r
5eadb54e 87 // Binary Search Cipher Mapping Table for IANA-OpenSSL Cipher Translation\r
264702a0 88 //\r
5eadb54e
LE
89 Left = 0;\r
90 Right = ARRAY_SIZE (TlsCipherMappingTable) - 1;\r
91\r
92 while (Right >= Left) {\r
93 Middle = (Left + Right) / 2;\r
94\r
95 if (CipherId == TlsCipherMappingTable[Middle].IanaCipher) {\r
96 //\r
97 // Translate IANA cipher suite ID to OpenSSL name.\r
98 //\r
99 return &TlsCipherMappingTable[Middle];\r
100 }\r
101\r
102 if (CipherId < TlsCipherMappingTable[Middle].IanaCipher) {\r
103 Right = Middle - 1;\r
104 } else {\r
105 Left = Middle + 1;\r
264702a0
HW
106 }\r
107 }\r
108\r
109 //\r
110 // No Cipher Mapping found, return NULL.\r
111 //\r
112 return NULL;\r
113}\r
114\r
115/**\r
116 Set a new TLS/SSL method for a particular TLS object.\r
117\r
118 This function sets a new TLS/SSL method for a particular TLS object.\r
119\r
120 @param[in] Tls Pointer to a TLS object.\r
121 @param[in] MajorVer Major Version of TLS/SSL Protocol.\r
122 @param[in] MinorVer Minor Version of TLS/SSL Protocol.\r
123\r
124 @retval EFI_SUCCESS The TLS/SSL method was set successfully.\r
125 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
126 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.\r
127\r
128**/\r
129EFI_STATUS\r
130EFIAPI\r
131TlsSetVersion (\r
132 IN VOID *Tls,\r
133 IN UINT8 MajorVer,\r
134 IN UINT8 MinorVer\r
135 )\r
136{\r
137 TLS_CONNECTION *TlsConn;\r
138 UINT16 ProtoVersion;\r
139\r
140 TlsConn = (TLS_CONNECTION *)Tls;\r
141 if (TlsConn == NULL || TlsConn->Ssl == NULL) {\r
142 return EFI_INVALID_PARAMETER;\r
143 }\r
144\r
145 ProtoVersion = (MajorVer << 8) | MinorVer;\r
146\r
147 //\r
148 // Bound TLS method to the particular specified version.\r
149 //\r
150 switch (ProtoVersion) {\r
151 case TLS1_VERSION:\r
152 //\r
153 // TLS 1.0\r
154 //\r
155 SSL_set_min_proto_version (TlsConn->Ssl, TLS1_VERSION);\r
156 SSL_set_max_proto_version (TlsConn->Ssl, TLS1_VERSION);\r
157 break;\r
158 case TLS1_1_VERSION:\r
159 //\r
160 // TLS 1.1\r
161 //\r
162 SSL_set_min_proto_version (TlsConn->Ssl, TLS1_1_VERSION);\r
163 SSL_set_max_proto_version (TlsConn->Ssl, TLS1_1_VERSION);\r
164 break;\r
165 case TLS1_2_VERSION:\r
166 //\r
167 // TLS 1.2\r
168 //\r
169 SSL_set_min_proto_version (TlsConn->Ssl, TLS1_2_VERSION);\r
170 SSL_set_max_proto_version (TlsConn->Ssl, TLS1_2_VERSION);\r
171 break;\r
172 default:\r
173 //\r
174 // Unsupported Protocol Version\r
175 //\r
176 return EFI_UNSUPPORTED;\r
177 }\r
178\r
179 return EFI_SUCCESS;;\r
180}\r
181\r
182/**\r
183 Set TLS object to work in client or server mode.\r
184\r
185 This function prepares a TLS object to work in client or server mode.\r
186\r
187 @param[in] Tls Pointer to a TLS object.\r
188 @param[in] IsServer Work in server mode.\r
189\r
190 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.\r
191 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
192 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.\r
193\r
194**/\r
195EFI_STATUS\r
196EFIAPI\r
197TlsSetConnectionEnd (\r
198 IN VOID *Tls,\r
199 IN BOOLEAN IsServer\r
200 )\r
201{\r
202 TLS_CONNECTION *TlsConn;\r
203\r
204 TlsConn = (TLS_CONNECTION *) Tls;\r
205 if (TlsConn == NULL || TlsConn->Ssl == NULL) {\r
206 return EFI_INVALID_PARAMETER;\r
207 }\r
208\r
209 if (!IsServer) {\r
210 //\r
211 // Set TLS to work in Client mode.\r
212 //\r
213 SSL_set_connect_state (TlsConn->Ssl);\r
214 } else {\r
215 //\r
216 // Set TLS to work in Server mode.\r
217 // It is unsupported for UEFI version currently.\r
218 //\r
219 //SSL_set_accept_state (TlsConn->Ssl);\r
220 return EFI_UNSUPPORTED;\r
221 }\r
222\r
223 return EFI_SUCCESS;\r
224}\r
225\r
226/**\r
227 Set the ciphers list to be used by the TLS object.\r
228\r
229 This function sets the ciphers for use by a specified TLS object.\r
230\r
231 @param[in] Tls Pointer to a TLS object.\r
2167c7f7
LE
232 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16\r
233 cipher identifier comes from the TLS Cipher Suite\r
234 Registry of the IANA, interpreting Byte1 and Byte2\r
235 in network (big endian) byte order.\r
264702a0
HW
236 @param[in] CipherNum The number of cipher in the list.\r
237\r
238 @retval EFI_SUCCESS The ciphers list was set successfully.\r
239 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
2167c7f7
LE
240 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.\r
241 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
264702a0
HW
242\r
243**/\r
244EFI_STATUS\r
245EFIAPI\r
246TlsSetCipherList (\r
247 IN VOID *Tls,\r
248 IN UINT16 *CipherId,\r
249 IN UINTN CipherNum\r
250 )\r
251{\r
ecfd37ba 252 TLS_CONNECTION *TlsConn;\r
2167c7f7
LE
253 EFI_STATUS Status;\r
254 CONST TLS_CIPHER_MAPPING **MappedCipher;\r
255 UINTN MappedCipherBytes;\r
256 UINTN MappedCipherCount;\r
257 UINTN CipherStringSize;\r
ecfd37ba
LE
258 UINTN Index;\r
259 CONST TLS_CIPHER_MAPPING *Mapping;\r
2167c7f7
LE
260 CHAR8 *CipherString;\r
261 CHAR8 *CipherStringPosition;\r
264702a0
HW
262\r
263 TlsConn = (TLS_CONNECTION *) Tls;\r
264 if (TlsConn == NULL || TlsConn->Ssl == NULL || CipherId == NULL) {\r
265 return EFI_INVALID_PARAMETER;\r
266 }\r
267\r
2167c7f7
LE
268 //\r
269 // Allocate the MappedCipher array for recording the mappings that we find\r
270 // for the input IANA identifiers in CipherId.\r
271 //\r
272 Status = SafeUintnMult (CipherNum, sizeof (*MappedCipher),\r
273 &MappedCipherBytes);\r
274 if (EFI_ERROR (Status)) {\r
275 return EFI_OUT_OF_RESOURCES;\r
276 }\r
277 MappedCipher = AllocatePool (MappedCipherBytes);\r
278 if (MappedCipher == NULL) {\r
279 return EFI_OUT_OF_RESOURCES;\r
280 }\r
264702a0 281\r
2167c7f7
LE
282 //\r
283 // Map the cipher IDs, and count the number of bytes for the full\r
284 // CipherString.\r
285 //\r
286 MappedCipherCount = 0;\r
287 CipherStringSize = 0;\r
264702a0
HW
288 for (Index = 0; Index < CipherNum; Index++) {\r
289 //\r
2167c7f7 290 // Look up the IANA-to-OpenSSL mapping.\r
264702a0 291 //\r
2167c7f7 292 Mapping = TlsGetCipherMapping (CipherId[Index]);\r
ecfd37ba 293 if (Mapping == NULL) {\r
2167c7f7
LE
294 DEBUG ((DEBUG_VERBOSE, "%a:%a: skipping CipherId=0x%04x\n",\r
295 gEfiCallerBaseName, __FUNCTION__, CipherId[Index]));\r
264702a0 296 //\r
2167c7f7
LE
297 // Skipping the cipher is valid because CipherId is an ordered\r
298 // preference list of ciphers, thus we can filter it as long as we\r
299 // don't change the relative order of elements on it.\r
264702a0 300 //\r
2167c7f7
LE
301 continue;\r
302 }\r
303 //\r
304 // Accumulate Mapping->OpensslCipherLength into CipherStringSize. If this\r
305 // is not the first successful mapping, account for a colon (":") prefix\r
306 // too.\r
307 //\r
308 if (MappedCipherCount > 0) {\r
309 Status = SafeUintnAdd (CipherStringSize, 1, &CipherStringSize);\r
310 if (EFI_ERROR (Status)) {\r
311 Status = EFI_OUT_OF_RESOURCES;\r
312 goto FreeMappedCipher;\r
313 }\r
314 }\r
315 Status = SafeUintnAdd (CipherStringSize, Mapping->OpensslCipherLength,\r
316 &CipherStringSize);\r
317 if (EFI_ERROR (Status)) {\r
318 Status = EFI_OUT_OF_RESOURCES;\r
319 goto FreeMappedCipher;\r
264702a0 320 }\r
2167c7f7
LE
321 //\r
322 // Record the mapping.\r
323 //\r
324 MappedCipher[MappedCipherCount++] = Mapping;\r
325 }\r
326\r
327 //\r
328 // Verify that at least one IANA cipher ID could be mapped; account for the\r
329 // terminating NUL character in CipherStringSize; allocate CipherString.\r
330 //\r
331 if (MappedCipherCount == 0) {\r
332 DEBUG ((DEBUG_ERROR, "%a:%a: no CipherId could be mapped\n",\r
333 gEfiCallerBaseName, __FUNCTION__));\r
334 Status = EFI_UNSUPPORTED;\r
335 goto FreeMappedCipher;\r
336 }\r
337 Status = SafeUintnAdd (CipherStringSize, 1, &CipherStringSize);\r
338 if (EFI_ERROR (Status)) {\r
339 Status = EFI_OUT_OF_RESOURCES;\r
340 goto FreeMappedCipher;\r
341 }\r
342 CipherString = AllocatePool (CipherStringSize);\r
343 if (CipherString == NULL) {\r
344 Status = EFI_OUT_OF_RESOURCES;\r
345 goto FreeMappedCipher;\r
346 }\r
264702a0 347\r
2167c7f7
LE
348 //\r
349 // Go over the collected mappings and populate CipherString.\r
350 //\r
351 CipherStringPosition = CipherString;\r
352 for (Index = 0; Index < MappedCipherCount; Index++) {\r
353 Mapping = MappedCipher[Index];\r
354 //\r
355 // Append the colon (":") prefix except for the first mapping, then append\r
356 // Mapping->OpensslCipher.\r
357 //\r
358 if (Index > 0) {\r
359 *(CipherStringPosition++) = ':';\r
360 }\r
361 CopyMem (CipherStringPosition, Mapping->OpensslCipher,\r
362 Mapping->OpensslCipherLength);\r
363 CipherStringPosition += Mapping->OpensslCipherLength;\r
264702a0
HW
364 }\r
365\r
2167c7f7
LE
366 //\r
367 // NUL-terminate CipherString.\r
368 //\r
369 *(CipherStringPosition++) = '\0';\r
370 ASSERT (CipherStringPosition == CipherString + CipherStringSize);\r
371\r
372 //\r
373 // Log CipherString for debugging. CipherString can be very long if the\r
374 // caller provided a large CipherId array, so log CipherString in segments of\r
375 // 79 non-newline characters. (MAX_DEBUG_MESSAGE_LENGTH is usually 0x100 in\r
376 // DebugLib instances.)\r
377 //\r
378 DEBUG_CODE (\r
379 UINTN FullLength;\r
380 UINTN SegmentLength;\r
381\r
382 FullLength = CipherStringSize - 1;\r
383 DEBUG ((DEBUG_VERBOSE, "%a:%a: CipherString={\n", gEfiCallerBaseName,\r
384 __FUNCTION__));\r
385 for (CipherStringPosition = CipherString;\r
386 CipherStringPosition < CipherString + FullLength;\r
387 CipherStringPosition += SegmentLength) {\r
388 SegmentLength = FullLength - (CipherStringPosition - CipherString);\r
389 if (SegmentLength > 79) {\r
390 SegmentLength = 79;\r
391 }\r
392 DEBUG ((DEBUG_VERBOSE, "%.*a\n", SegmentLength, CipherStringPosition));\r
393 }\r
394 DEBUG ((DEBUG_VERBOSE, "}\n"));\r
395 //\r
396 // Restore the pre-debug value of CipherStringPosition by skipping over the\r
397 // trailing NUL.\r
398 //\r
399 CipherStringPosition++;\r
400 ASSERT (CipherStringPosition == CipherString + CipherStringSize);\r
401 );\r
264702a0
HW
402\r
403 //\r
404 // Sets the ciphers for use by the Tls object.\r
405 //\r
406 if (SSL_set_cipher_list (TlsConn->Ssl, CipherString) <= 0) {\r
2167c7f7
LE
407 Status = EFI_UNSUPPORTED;\r
408 goto FreeCipherString;\r
264702a0
HW
409 }\r
410\r
2167c7f7
LE
411 Status = EFI_SUCCESS;\r
412\r
413FreeCipherString:\r
414 FreePool (CipherString);\r
415\r
416FreeMappedCipher:\r
417 FreePool (MappedCipher);\r
418\r
419 return Status;\r
264702a0
HW
420}\r
421\r
422/**\r
423 Set the compression method for TLS/SSL operations.\r
424\r
425 This function handles TLS/SSL integrated compression methods.\r
426\r
427 @param[in] CompMethod The compression method ID.\r
428\r
429 @retval EFI_SUCCESS The compression method for the communication was\r
430 set successfully.\r
431 @retval EFI_UNSUPPORTED Unsupported compression method.\r
432\r
433**/\r
434EFI_STATUS\r
435EFIAPI\r
436TlsSetCompressionMethod (\r
437 IN UINT8 CompMethod\r
438 )\r
439{\r
440 COMP_METHOD *Cm;\r
441 INTN Ret;\r
442\r
443 Cm = NULL;\r
444 Ret = 0;\r
445\r
446 if (CompMethod == 0) {\r
447 //\r
448 // TLS defines one standard compression method, CompressionMethod.null (0),\r
449 // which specifies that data exchanged via the record protocol will not be compressed.\r
450 // So, return EFI_SUCCESS directly (RFC 3749).\r
451 //\r
452 return EFI_SUCCESS;\r
453 } else if (CompMethod == 1) {\r
454 Cm = COMP_zlib();\r
455 } else {\r
456 return EFI_UNSUPPORTED;\r
457 }\r
458\r
459 //\r
460 // Adds the compression method to the list of available\r
461 // compression methods.\r
462 //\r
463 Ret = SSL_COMP_add_compression_method (CompMethod, Cm);\r
464 if (Ret != 0) {\r
465 return EFI_UNSUPPORTED;\r
466 }\r
467\r
468 return EFI_SUCCESS;\r
469}\r
470\r
471/**\r
472 Set peer certificate verification mode for the TLS connection.\r
473\r
474 This function sets the verification mode flags for the TLS connection.\r
475\r
476 @param[in] Tls Pointer to the TLS object.\r
477 @param[in] VerifyMode A set of logically or'ed verification mode flags.\r
478\r
479**/\r
480VOID\r
481EFIAPI\r
482TlsSetVerify (\r
483 IN VOID *Tls,\r
484 IN UINT32 VerifyMode\r
485 )\r
486{\r
487 TLS_CONNECTION *TlsConn;\r
488\r
489 TlsConn = (TLS_CONNECTION *) Tls;\r
490 if (TlsConn == NULL || TlsConn->Ssl == NULL) {\r
491 return;\r
492 }\r
493\r
494 //\r
495 // Set peer certificate verification parameters with NULL callback.\r
496 //\r
497 SSL_set_verify (TlsConn->Ssl, VerifyMode, NULL);\r
498}\r
499\r
2ca74e1a
WJ
500/**\r
501 Set the specified host name to be verified.\r
502\r
503 @param[in] Tls Pointer to the TLS object.\r
504 @param[in] Flags The setting flags during the validation.\r
505 @param[in] HostName The specified host name to be verified.\r
506\r
507 @retval EFI_SUCCESS The HostName setting was set successfully.\r
508 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
509 @retval EFI_ABORTED Invalid HostName setting.\r
510\r
511**/\r
512EFI_STATUS\r
513EFIAPI\r
514TlsSetVerifyHost (\r
515 IN VOID *Tls,\r
516 IN UINT32 Flags,\r
517 IN CHAR8 *HostName\r
518 )\r
519{\r
520 TLS_CONNECTION *TlsConn;\r
521\r
522 TlsConn = (TLS_CONNECTION *) Tls;\r
523 if (TlsConn == NULL || TlsConn->Ssl == NULL || HostName == NULL) {\r
524 return EFI_INVALID_PARAMETER;\r
525 }\r
526\r
527 SSL_set_hostflags(TlsConn->Ssl, Flags);\r
528\r
529 if (SSL_set1_host(TlsConn->Ssl, HostName) == 0) {\r
530 return EFI_ABORTED;\r
531 }\r
532\r
533 return EFI_SUCCESS;\r
534}\r
535\r
264702a0
HW
536/**\r
537 Sets a TLS/SSL session ID to be used during TLS/SSL connect.\r
538\r
539 This function sets a session ID to be used when the TLS/SSL connection is\r
540 to be established.\r
541\r
542 @param[in] Tls Pointer to the TLS object.\r
543 @param[in] SessionId Session ID data used for session resumption.\r
544 @param[in] SessionIdLen Length of Session ID in bytes.\r
545\r
546 @retval EFI_SUCCESS Session ID was set successfully.\r
547 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
548 @retval EFI_UNSUPPORTED No available session for ID setting.\r
549\r
550**/\r
551EFI_STATUS\r
552EFIAPI\r
553TlsSetSessionId (\r
554 IN VOID *Tls,\r
555 IN UINT8 *SessionId,\r
556 IN UINT16 SessionIdLen\r
557 )\r
558{\r
559 TLS_CONNECTION *TlsConn;\r
560 SSL_SESSION *Session;\r
561\r
562 TlsConn = (TLS_CONNECTION *) Tls;\r
563 Session = NULL;\r
564\r
565 if (TlsConn == NULL || TlsConn->Ssl == NULL || SessionId == NULL) {\r
566 return EFI_INVALID_PARAMETER;\r
567 }\r
568\r
569 Session = SSL_get_session (TlsConn->Ssl);\r
570 if (Session == NULL) {\r
571 return EFI_UNSUPPORTED;\r
572 }\r
573\r
574 SSL_SESSION_set1_id (Session, (const unsigned char *)SessionId, SessionIdLen);\r
575\r
576 return EFI_SUCCESS;\r
577}\r
578\r
579/**\r
580 Adds the CA to the cert store when requesting Server or Client authentication.\r
581\r
582 This function adds the CA certificate to the list of CAs when requesting\r
583 Server or Client authentication for the chosen TLS connection.\r
584\r
585 @param[in] Tls Pointer to the TLS object.\r
586 @param[in] Data Pointer to the data buffer of a DER-encoded binary\r
587 X.509 certificate or PEM-encoded X.509 certificate.\r
588 @param[in] DataSize The size of data buffer in bytes.\r
589\r
590 @retval EFI_SUCCESS The operation succeeded.\r
591 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
592 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
593 @retval EFI_ABORTED Invalid X.509 certificate.\r
594\r
595**/\r
596EFI_STATUS\r
597EFIAPI\r
598TlsSetCaCertificate (\r
599 IN VOID *Tls,\r
600 IN VOID *Data,\r
601 IN UINTN DataSize\r
602 )\r
603{\r
604 BIO *BioCert;\r
605 X509 *Cert;\r
606 X509_STORE *X509Store;\r
607 EFI_STATUS Status;\r
608 TLS_CONNECTION *TlsConn;\r
609 SSL_CTX *SslCtx;\r
610 INTN Ret;\r
611 UINTN ErrorCode;\r
612\r
613 BioCert = NULL;\r
614 Cert = NULL;\r
615 X509Store = NULL;\r
616 Status = EFI_SUCCESS;\r
617 TlsConn = (TLS_CONNECTION *) Tls;\r
618 Ret = 0;\r
619\r
620 if (TlsConn == NULL || TlsConn->Ssl == NULL || Data == NULL || DataSize == 0) {\r
621 return EFI_INVALID_PARAMETER;\r
622 }\r
623\r
624 //\r
625 // DER-encoded binary X.509 certificate or PEM-encoded X.509 certificate.\r
626 // Determine whether certificate is from DER encoding, if so, translate it to X509 structure.\r
627 //\r
628 Cert = d2i_X509 (NULL, (const unsigned char ** )&Data, (long) DataSize);\r
629 if (Cert == NULL) {\r
630 //\r
631 // Certificate is from PEM encoding.\r
632 //\r
633 BioCert = BIO_new (BIO_s_mem ());\r
634 if (BioCert == NULL) {\r
635 Status = EFI_OUT_OF_RESOURCES;\r
636 goto ON_EXIT;\r
637 }\r
638\r
639 if (BIO_write (BioCert, Data, (UINT32) DataSize) <= 0) {\r
640 Status = EFI_ABORTED;\r
641 goto ON_EXIT;\r
642 }\r
643\r
644 Cert = PEM_read_bio_X509 (BioCert, NULL, NULL, NULL);\r
645 if (Cert == NULL) {\r
646 Status = EFI_ABORTED;\r
647 goto ON_EXIT;\r
648 }\r
649 }\r
650\r
651 SslCtx = SSL_get_SSL_CTX (TlsConn->Ssl);\r
652 X509Store = SSL_CTX_get_cert_store (SslCtx);\r
653 if (X509Store == NULL) {\r
654 Status = EFI_ABORTED;\r
655 goto ON_EXIT;\r
656 }\r
657\r
658 //\r
659 // Add certificate to X509 store\r
660 //\r
661 Ret = X509_STORE_add_cert (X509Store, Cert);\r
662 if (Ret != 1) {\r
663 ErrorCode = ERR_peek_last_error ();\r
664 //\r
665 // Ignore "already in table" errors\r
666 //\r
667 if (!(ERR_GET_FUNC (ErrorCode) == X509_F_X509_STORE_ADD_CERT &&\r
668 ERR_GET_REASON (ErrorCode) == X509_R_CERT_ALREADY_IN_HASH_TABLE)) {\r
669 Status = EFI_ABORTED;\r
670 goto ON_EXIT;\r
671 }\r
672 }\r
673\r
674ON_EXIT:\r
675 if (BioCert != NULL) {\r
676 BIO_free (BioCert);\r
677 }\r
678\r
679 if (Cert != NULL) {\r
680 X509_free (Cert);\r
681 }\r
682\r
683 return Status;\r
684}\r
685\r
686/**\r
687 Loads the local public certificate into the specified TLS object.\r
688\r
689 This function loads the X.509 certificate into the specified TLS object\r
690 for TLS negotiation.\r
691\r
692 @param[in] Tls Pointer to the TLS object.\r
693 @param[in] Data Pointer to the data buffer of a DER-encoded binary\r
694 X.509 certificate or PEM-encoded X.509 certificate.\r
695 @param[in] DataSize The size of data buffer in bytes.\r
696\r
697 @retval EFI_SUCCESS The operation succeeded.\r
698 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
699 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
700 @retval EFI_ABORTED Invalid X.509 certificate.\r
701\r
702**/\r
703EFI_STATUS\r
704EFIAPI\r
705TlsSetHostPublicCert (\r
706 IN VOID *Tls,\r
707 IN VOID *Data,\r
708 IN UINTN DataSize\r
709 )\r
710{\r
711 BIO *BioCert;\r
712 X509 *Cert;\r
713 EFI_STATUS Status;\r
714 TLS_CONNECTION *TlsConn;\r
715\r
716 BioCert = NULL;\r
717 Cert = NULL;\r
718 Status = EFI_SUCCESS;\r
719 TlsConn = (TLS_CONNECTION *) Tls;\r
720\r
721 if (TlsConn == NULL || TlsConn->Ssl == NULL || Data == NULL || DataSize == 0) {\r
722 return EFI_INVALID_PARAMETER;\r
723 }\r
724\r
725 //\r
726 // DER-encoded binary X.509 certificate or PEM-encoded X.509 certificate.\r
727 // Determine whether certificate is from DER encoding, if so, translate it to X509 structure.\r
728 //\r
729 Cert = d2i_X509 (NULL, (const unsigned char ** )&Data, (long) DataSize);\r
730 if (Cert == NULL) {\r
731 //\r
732 // Certificate is from PEM encoding.\r
733 //\r
734 BioCert = BIO_new (BIO_s_mem ());\r
735 if (BioCert == NULL) {\r
736 Status = EFI_OUT_OF_RESOURCES;\r
737 goto ON_EXIT;\r
738 }\r
739\r
740 if (BIO_write (BioCert, Data, (UINT32) DataSize) <= 0) {\r
741 Status = EFI_ABORTED;\r
742 goto ON_EXIT;\r
743 }\r
744\r
745 Cert = PEM_read_bio_X509 (BioCert, NULL, NULL, NULL);\r
746 if (Cert == NULL) {\r
747 Status = EFI_ABORTED;\r
748 goto ON_EXIT;\r
749 }\r
750 }\r
751\r
752 if (SSL_use_certificate (TlsConn->Ssl, Cert) != 1) {\r
753 Status = EFI_ABORTED;\r
754 goto ON_EXIT;\r
755 }\r
756\r
757ON_EXIT:\r
758 if (BioCert != NULL) {\r
759 BIO_free (BioCert);\r
760 }\r
761\r
762 if (Cert != NULL) {\r
763 X509_free (Cert);\r
764 }\r
765\r
766 return Status;\r
767}\r
768\r
769/**\r
770 Adds the local private key to the specified TLS object.\r
771\r
772 This function adds the local private key (PEM-encoded RSA or PKCS#8 private\r
773 key) into the specified TLS object for TLS negotiation.\r
774\r
775 @param[in] Tls Pointer to the TLS object.\r
776 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA\r
777 or PKCS#8 private key.\r
778 @param[in] DataSize The size of data buffer in bytes.\r
779\r
780 @retval EFI_SUCCESS The operation succeeded.\r
781 @retval EFI_UNSUPPORTED This function is not supported.\r
782 @retval EFI_ABORTED Invalid private key data.\r
783\r
784**/\r
785EFI_STATUS\r
786EFIAPI\r
787TlsSetHostPrivateKey (\r
788 IN VOID *Tls,\r
789 IN VOID *Data,\r
790 IN UINTN DataSize\r
791 )\r
792{\r
793 return EFI_UNSUPPORTED;\r
794}\r
795\r
796/**\r
797 Adds the CA-supplied certificate revocation list for certificate validation.\r
798\r
799 This function adds the CA-supplied certificate revocation list data for\r
800 certificate validity checking.\r
801\r
802 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.\r
803 @param[in] DataSize The size of data buffer in bytes.\r
804\r
805 @retval EFI_SUCCESS The operation succeeded.\r
806 @retval EFI_UNSUPPORTED This function is not supported.\r
807 @retval EFI_ABORTED Invalid CRL data.\r
808\r
809**/\r
810EFI_STATUS\r
811EFIAPI\r
812TlsSetCertRevocationList (\r
813 IN VOID *Data,\r
814 IN UINTN DataSize\r
815 )\r
816{\r
817 return EFI_UNSUPPORTED;\r
818}\r
819\r
820/**\r
821 Gets the protocol version used by the specified TLS connection.\r
822\r
823 This function returns the protocol version used by the specified TLS\r
824 connection.\r
825\r
9c14f76b
JW
826 If Tls is NULL, then ASSERT().\r
827\r
264702a0
HW
828 @param[in] Tls Pointer to the TLS object.\r
829\r
830 @return The protocol version of the specified TLS connection.\r
831\r
832**/\r
833UINT16\r
834EFIAPI\r
835TlsGetVersion (\r
836 IN VOID *Tls\r
837 )\r
838{\r
839 TLS_CONNECTION *TlsConn;\r
840\r
841 TlsConn = (TLS_CONNECTION *) Tls;\r
842\r
843 ASSERT (TlsConn != NULL);\r
844\r
845 return (UINT16)(SSL_version (TlsConn->Ssl));\r
846}\r
847\r
848/**\r
849 Gets the connection end of the specified TLS connection.\r
850\r
851 This function returns the connection end (as client or as server) used by\r
852 the specified TLS connection.\r
853\r
9c14f76b
JW
854 If Tls is NULL, then ASSERT().\r
855\r
264702a0
HW
856 @param[in] Tls Pointer to the TLS object.\r
857\r
858 @return The connection end used by the specified TLS connection.\r
859\r
860**/\r
861UINT8\r
862EFIAPI\r
863TlsGetConnectionEnd (\r
864 IN VOID *Tls\r
865 )\r
866{\r
867 TLS_CONNECTION *TlsConn;\r
868\r
869 TlsConn = (TLS_CONNECTION *) Tls;\r
870\r
871 ASSERT (TlsConn != NULL);\r
872\r
873 return (UINT8)SSL_is_server (TlsConn->Ssl);\r
874}\r
875\r
876/**\r
877 Gets the cipher suite used by the specified TLS connection.\r
878\r
879 This function returns current cipher suite used by the specified\r
880 TLS connection.\r
881\r
882 @param[in] Tls Pointer to the TLS object.\r
883 @param[in,out] CipherId The cipher suite used by the TLS object.\r
884\r
885 @retval EFI_SUCCESS The cipher suite was returned successfully.\r
886 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
887 @retval EFI_UNSUPPORTED Unsupported cipher suite.\r
888\r
889**/\r
890EFI_STATUS\r
891EFIAPI\r
892TlsGetCurrentCipher (\r
893 IN VOID *Tls,\r
894 IN OUT UINT16 *CipherId\r
895 )\r
896{\r
897 TLS_CONNECTION *TlsConn;\r
898 CONST SSL_CIPHER *Cipher;\r
899\r
900 TlsConn = (TLS_CONNECTION *) Tls;\r
901 Cipher = NULL;\r
902\r
903 if (TlsConn == NULL || TlsConn->Ssl == NULL || CipherId == NULL) {\r
904 return EFI_INVALID_PARAMETER;\r
905 }\r
906\r
907 Cipher = SSL_get_current_cipher (TlsConn->Ssl);\r
908 if (Cipher == NULL) {\r
909 return EFI_UNSUPPORTED;\r
910 }\r
911\r
912 *CipherId = (SSL_CIPHER_get_id (Cipher)) & 0xFFFF;\r
913\r
914 return EFI_SUCCESS;\r
915}\r
916\r
917/**\r
918 Gets the compression methods used by the specified TLS connection.\r
919\r
920 This function returns current integrated compression methods used by\r
921 the specified TLS connection.\r
922\r
923 @param[in] Tls Pointer to the TLS object.\r
924 @param[in,out] CompressionId The current compression method used by\r
925 the TLS object.\r
926\r
927 @retval EFI_SUCCESS The compression method was returned successfully.\r
928 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
929 @retval EFI_ABORTED Invalid Compression method.\r
930 @retval EFI_UNSUPPORTED This function is not supported.\r
931\r
932**/\r
933EFI_STATUS\r
934EFIAPI\r
935TlsGetCurrentCompressionId (\r
936 IN VOID *Tls,\r
937 IN OUT UINT8 *CompressionId\r
938 )\r
939{\r
940 return EFI_UNSUPPORTED;\r
941}\r
942\r
943/**\r
944 Gets the verification mode currently set in the TLS connection.\r
945\r
946 This function returns the peer verification mode currently set in the\r
947 specified TLS connection.\r
948\r
9c14f76b
JW
949 If Tls is NULL, then ASSERT().\r
950\r
264702a0
HW
951 @param[in] Tls Pointer to the TLS object.\r
952\r
953 @return The verification mode set in the specified TLS connection.\r
954\r
955**/\r
956UINT32\r
957EFIAPI\r
958TlsGetVerify (\r
959 IN VOID *Tls\r
960 )\r
961{\r
962 TLS_CONNECTION *TlsConn;\r
963\r
964 TlsConn = (TLS_CONNECTION *) Tls;\r
965\r
966 ASSERT (TlsConn != NULL);\r
967\r
968 return SSL_get_verify_mode (TlsConn->Ssl);\r
969}\r
970\r
971/**\r
972 Gets the session ID used by the specified TLS connection.\r
973\r
974 This function returns the TLS/SSL session ID currently used by the\r
975 specified TLS connection.\r
976\r
977 @param[in] Tls Pointer to the TLS object.\r
978 @param[in,out] SessionId Buffer to contain the returned session ID.\r
979 @param[in,out] SessionIdLen The length of Session ID in bytes.\r
980\r
981 @retval EFI_SUCCESS The Session ID was returned successfully.\r
982 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
983 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r
984\r
985**/\r
986EFI_STATUS\r
987EFIAPI\r
988TlsGetSessionId (\r
989 IN VOID *Tls,\r
990 IN OUT UINT8 *SessionId,\r
991 IN OUT UINT16 *SessionIdLen\r
992 )\r
993{\r
994 TLS_CONNECTION *TlsConn;\r
995 SSL_SESSION *Session;\r
996 CONST UINT8 *SslSessionId;\r
997\r
998 TlsConn = (TLS_CONNECTION *) Tls;\r
999 Session = NULL;\r
1000\r
1001 if (TlsConn == NULL || TlsConn->Ssl == NULL || SessionId == NULL || SessionIdLen == NULL) {\r
1002 return EFI_INVALID_PARAMETER;\r
1003 }\r
1004\r
1005 Session = SSL_get_session (TlsConn->Ssl);\r
1006 if (Session == NULL) {\r
1007 return EFI_UNSUPPORTED;\r
1008 }\r
1009\r
1010 SslSessionId = SSL_SESSION_get_id (Session, (unsigned int *)SessionIdLen);\r
1011 CopyMem (SessionId, SslSessionId, *SessionIdLen);\r
1012\r
1013 return EFI_SUCCESS;\r
1014}\r
1015\r
1016/**\r
1017 Gets the client random data used in the specified TLS connection.\r
1018\r
1019 This function returns the TLS/SSL client random data currently used in\r
1020 the specified TLS connection.\r
1021\r
1022 @param[in] Tls Pointer to the TLS object.\r
1023 @param[in,out] ClientRandom Buffer to contain the returned client\r
1024 random data (32 bytes).\r
1025\r
1026**/\r
1027VOID\r
1028EFIAPI\r
1029TlsGetClientRandom (\r
1030 IN VOID *Tls,\r
1031 IN OUT UINT8 *ClientRandom\r
1032 )\r
1033{\r
1034 TLS_CONNECTION *TlsConn;\r
1035\r
1036 TlsConn = (TLS_CONNECTION *) Tls;\r
1037\r
1038 if (TlsConn == NULL || TlsConn->Ssl == NULL || ClientRandom == NULL) {\r
1039 return;\r
1040 }\r
1041\r
1042 SSL_get_client_random (TlsConn->Ssl, ClientRandom, SSL3_RANDOM_SIZE);\r
1043}\r
1044\r
1045/**\r
1046 Gets the server random data used in the specified TLS connection.\r
1047\r
1048 This function returns the TLS/SSL server random data currently used in\r
1049 the specified TLS connection.\r
1050\r
1051 @param[in] Tls Pointer to the TLS object.\r
1052 @param[in,out] ServerRandom Buffer to contain the returned server\r
1053 random data (32 bytes).\r
1054\r
1055**/\r
1056VOID\r
1057EFIAPI\r
1058TlsGetServerRandom (\r
1059 IN VOID *Tls,\r
1060 IN OUT UINT8 *ServerRandom\r
1061 )\r
1062{\r
1063 TLS_CONNECTION *TlsConn;\r
1064\r
1065 TlsConn = (TLS_CONNECTION *) Tls;\r
1066\r
1067 if (TlsConn == NULL || TlsConn->Ssl == NULL || ServerRandom == NULL) {\r
1068 return;\r
1069 }\r
1070\r
1071 SSL_get_server_random (TlsConn->Ssl, ServerRandom, SSL3_RANDOM_SIZE);\r
1072}\r
1073\r
1074/**\r
1075 Gets the master key data used in the specified TLS connection.\r
1076\r
1077 This function returns the TLS/SSL master key material currently used in\r
1078 the specified TLS connection.\r
1079\r
1080 @param[in] Tls Pointer to the TLS object.\r
1081 @param[in,out] KeyMaterial Buffer to contain the returned key material.\r
1082\r
1083 @retval EFI_SUCCESS Key material was returned successfully.\r
1084 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
1085 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r
1086\r
1087**/\r
1088EFI_STATUS\r
1089EFIAPI\r
1090TlsGetKeyMaterial (\r
1091 IN VOID *Tls,\r
1092 IN OUT UINT8 *KeyMaterial\r
1093 )\r
1094{\r
1095 TLS_CONNECTION *TlsConn;\r
1096 SSL_SESSION *Session;\r
1097\r
1098 TlsConn = (TLS_CONNECTION *) Tls;\r
1099 Session = NULL;\r
1100\r
1101 if (TlsConn == NULL || TlsConn->Ssl == NULL || KeyMaterial == NULL) {\r
1102 return EFI_INVALID_PARAMETER;\r
1103 }\r
1104\r
1105 Session = SSL_get_session (TlsConn->Ssl);\r
1106\r
1107 if (Session == NULL) {\r
1108 return EFI_UNSUPPORTED;\r
1109 }\r
1110\r
1111 SSL_SESSION_get_master_key (Session, KeyMaterial, SSL3_MASTER_SECRET_SIZE);\r
1112\r
1113 return EFI_SUCCESS;\r
1114}\r
1115\r
1116/**\r
1117 Gets the CA Certificate from the cert store.\r
1118\r
1119 This function returns the CA certificate for the chosen\r
1120 TLS connection.\r
1121\r
1122 @param[in] Tls Pointer to the TLS object.\r
1123 @param[out] Data Pointer to the data buffer to receive the CA\r
1124 certificate data sent to the client.\r
1125 @param[in,out] DataSize The size of data buffer in bytes.\r
1126\r
1127 @retval EFI_SUCCESS The operation succeeded.\r
1128 @retval EFI_UNSUPPORTED This function is not supported.\r
1129 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
1130\r
1131**/\r
1132EFI_STATUS\r
1133EFIAPI\r
1134TlsGetCaCertificate (\r
1135 IN VOID *Tls,\r
1136 OUT VOID *Data,\r
1137 IN OUT UINTN *DataSize\r
1138 )\r
1139{\r
1140 return EFI_UNSUPPORTED;\r
1141}\r
1142\r
1143/**\r
1144 Gets the local public Certificate set in the specified TLS object.\r
1145\r
1146 This function returns the local public certificate which was currently set\r
1147 in the specified TLS object.\r
1148\r
1149 @param[in] Tls Pointer to the TLS object.\r
1150 @param[out] Data Pointer to the data buffer to receive the local\r
1151 public certificate.\r
1152 @param[in,out] DataSize The size of data buffer in bytes.\r
1153\r
1154 @retval EFI_SUCCESS The operation succeeded.\r
1155 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
1156 @retval EFI_NOT_FOUND The certificate is not found.\r
1157 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
1158\r
1159**/\r
1160EFI_STATUS\r
1161EFIAPI\r
1162TlsGetHostPublicCert (\r
1163 IN VOID *Tls,\r
1164 OUT VOID *Data,\r
1165 IN OUT UINTN *DataSize\r
1166 )\r
1167{\r
1168 X509 *Cert;\r
1169 TLS_CONNECTION *TlsConn;\r
1170\r
1171 Cert = NULL;\r
1172 TlsConn = (TLS_CONNECTION *) Tls;\r
1173\r
9c14f76b 1174 if (TlsConn == NULL || TlsConn->Ssl == NULL || DataSize == NULL || (*DataSize != 0 && Data == NULL)) {\r
264702a0
HW
1175 return EFI_INVALID_PARAMETER;\r
1176 }\r
1177\r
1178 Cert = SSL_get_certificate(TlsConn->Ssl);\r
1179 if (Cert == NULL) {\r
1180 return EFI_NOT_FOUND;\r
1181 }\r
1182\r
1183 //\r
1184 // Only DER encoding is supported currently.\r
1185 //\r
1186 if (*DataSize < (UINTN) i2d_X509 (Cert, NULL)) {\r
1187 *DataSize = (UINTN) i2d_X509 (Cert, NULL);\r
1188 return EFI_BUFFER_TOO_SMALL;\r
1189 }\r
1190\r
1191 *DataSize = (UINTN) i2d_X509 (Cert, (unsigned char **) &Data);\r
1192\r
1193 return EFI_SUCCESS;\r
1194}\r
1195\r
1196/**\r
1197 Gets the local private key set in the specified TLS object.\r
1198\r
1199 This function returns the local private key data which was currently set\r
1200 in the specified TLS object.\r
1201\r
1202 @param[in] Tls Pointer to the TLS object.\r
1203 @param[out] Data Pointer to the data buffer to receive the local\r
1204 private key data.\r
1205 @param[in,out] DataSize The size of data buffer in bytes.\r
1206\r
1207 @retval EFI_SUCCESS The operation succeeded.\r
1208 @retval EFI_UNSUPPORTED This function is not supported.\r
1209 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
1210\r
1211**/\r
1212EFI_STATUS\r
1213EFIAPI\r
1214TlsGetHostPrivateKey (\r
1215 IN VOID *Tls,\r
1216 OUT VOID *Data,\r
1217 IN OUT UINTN *DataSize\r
1218 )\r
1219{\r
1220 return EFI_UNSUPPORTED;\r
1221}\r
1222\r
1223/**\r
1224 Gets the CA-supplied certificate revocation list data set in the specified\r
1225 TLS object.\r
1226\r
1227 This function returns the CA-supplied certificate revocation list data which\r
1228 was currently set in the specified TLS object.\r
1229\r
1230 @param[out] Data Pointer to the data buffer to receive the CRL data.\r
1231 @param[in,out] DataSize The size of data buffer in bytes.\r
1232\r
1233 @retval EFI_SUCCESS The operation succeeded.\r
1234 @retval EFI_UNSUPPORTED This function is not supported.\r
1235 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
1236\r
1237**/\r
1238EFI_STATUS\r
1239EFIAPI\r
1240TlsGetCertRevocationList (\r
1241 OUT VOID *Data,\r
1242 IN OUT UINTN *DataSize\r
1243 )\r
1244{\r
1245 return EFI_UNSUPPORTED;\r
1246}\r
1247\r