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