]> git.proxmox.com Git - mirror_edk2.git/blame - CryptoPkg/Library/TlsLibNull/TlsConfigNull.c
CryptoPkg: Add Null instance of the TlsLib class
[mirror_edk2.git] / CryptoPkg / Library / TlsLibNull / TlsConfigNull.c
CommitLineData
79cd636f
SB
1/** @file\r
2 SSL/TLS Configuration Null Library Wrapper Implementation.\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
6SPDX-License-Identifier: BSD-2-Clause-Patent\r
7\r
8**/\r
9\r
10#include "InternalTlsLib.h"\r
11\r
12/**\r
13 Set a new TLS/SSL method for a particular TLS object.\r
14\r
15 This function sets a new TLS/SSL method for a particular TLS object.\r
16\r
17 @param[in] Tls Pointer to a TLS object.\r
18 @param[in] MajorVer Major Version of TLS/SSL Protocol.\r
19 @param[in] MinorVer Minor Version of TLS/SSL Protocol.\r
20\r
21 @retval EFI_SUCCESS The TLS/SSL method was set successfully.\r
22 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
23 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.\r
24\r
25**/\r
26EFI_STATUS\r
27EFIAPI\r
28TlsSetVersion (\r
29 IN VOID *Tls,\r
30 IN UINT8 MajorVer,\r
31 IN UINT8 MinorVer\r
32 )\r
33{\r
34 ASSERT(FALSE);\r
35 return EFI_UNSUPPORTED;\r
36}\r
37\r
38/**\r
39 Set TLS object to work in client or server mode.\r
40\r
41 This function prepares a TLS object to work in client or server mode.\r
42\r
43 @param[in] Tls Pointer to a TLS object.\r
44 @param[in] IsServer Work in server mode.\r
45\r
46 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.\r
47 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
48 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.\r
49\r
50**/\r
51EFI_STATUS\r
52EFIAPI\r
53TlsSetConnectionEnd (\r
54 IN VOID *Tls,\r
55 IN BOOLEAN IsServer\r
56 )\r
57{\r
58 ASSERT(FALSE);\r
59 return EFI_UNSUPPORTED;\r
60}\r
61\r
62/**\r
63 Set the ciphers list to be used by the TLS object.\r
64\r
65 This function sets the ciphers for use by a specified TLS object.\r
66\r
67 @param[in] Tls Pointer to a TLS object.\r
68 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16\r
69 cipher identifier comes from the TLS Cipher Suite\r
70 Registry of the IANA, interpreting Byte1 and Byte2\r
71 in network (big endian) byte order.\r
72 @param[in] CipherNum The number of cipher in the list.\r
73\r
74 @retval EFI_SUCCESS The ciphers list was set successfully.\r
75 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
76 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.\r
77 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.\r
78\r
79**/\r
80EFI_STATUS\r
81EFIAPI\r
82TlsSetCipherList (\r
83 IN VOID *Tls,\r
84 IN UINT16 *CipherId,\r
85 IN UINTN CipherNum\r
86 )\r
87{\r
88 ASSERT(FALSE);\r
89 return EFI_UNSUPPORTED;\r
90}\r
91\r
92/**\r
93 Set the compression method for TLS/SSL operations.\r
94\r
95 This function handles TLS/SSL integrated compression methods.\r
96\r
97 @param[in] CompMethod The compression method ID.\r
98\r
99 @retval EFI_SUCCESS The compression method for the communication was\r
100 set successfully.\r
101 @retval EFI_UNSUPPORTED Unsupported compression method.\r
102\r
103**/\r
104EFI_STATUS\r
105EFIAPI\r
106TlsSetCompressionMethod (\r
107 IN UINT8 CompMethod\r
108 )\r
109{\r
110 ASSERT(FALSE);\r
111 return EFI_UNSUPPORTED;\r
112}\r
113\r
114/**\r
115 Set peer certificate verification mode for the TLS connection.\r
116\r
117 This function sets the verification mode flags for the TLS connection.\r
118\r
119 @param[in] Tls Pointer to the TLS object.\r
120 @param[in] VerifyMode A set of logically or'ed verification mode flags.\r
121\r
122**/\r
123VOID\r
124EFIAPI\r
125TlsSetVerify (\r
126 IN VOID *Tls,\r
127 IN UINT32 VerifyMode\r
128 )\r
129{\r
130 ASSERT(FALSE);\r
131}\r
132\r
133// MU_CHANGE - Proposed fixes for TCBZ960, invalid domain name (CN) accepted. [BEGIN]\r
134/**\r
135 Set the specified host name to be verified.\r
136\r
137 @param[in] Tls Pointer to the TLS object.\r
138 @param[in] Flags The setting flags during the validation.\r
139 @param[in] HostName The specified host name to be verified.\r
140\r
141 @retval EFI_SUCCESS The HostName setting was set successfully.\r
142 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
143 @retval EFI_ABORTED Invalid HostName setting.\r
144\r
145**/\r
146EFI_STATUS\r
147EFIAPI\r
148TlsSetVerifyHost (\r
149 IN VOID *Tls,\r
150 IN UINT32 Flags,\r
151 IN CHAR8 *HostName\r
152 )\r
153{\r
154 ASSERT(FALSE);\r
155 return EFI_UNSUPPORTED;\r
156}\r
157\r
158// MU_CHANGE - Proposed fixes for TCBZ960, invalid domain name (CN) accepted. [END]\r
159\r
160/**\r
161 Sets a TLS/SSL session ID to be used during TLS/SSL connect.\r
162\r
163 This function sets a session ID to be used when the TLS/SSL connection is\r
164 to be established.\r
165\r
166 @param[in] Tls Pointer to the TLS object.\r
167 @param[in] SessionId Session ID data used for session resumption.\r
168 @param[in] SessionIdLen Length of Session ID in bytes.\r
169\r
170 @retval EFI_SUCCESS Session ID was set successfully.\r
171 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
172 @retval EFI_UNSUPPORTED No available session for ID setting.\r
173\r
174**/\r
175EFI_STATUS\r
176EFIAPI\r
177TlsSetSessionId (\r
178 IN VOID *Tls,\r
179 IN UINT8 *SessionId,\r
180 IN UINT16 SessionIdLen\r
181 )\r
182{\r
183 ASSERT(FALSE);\r
184 return EFI_UNSUPPORTED;\r
185}\r
186\r
187/**\r
188 Adds the CA to the cert store when requesting Server or Client authentication.\r
189\r
190 This function adds the CA certificate to the list of CAs when requesting\r
191 Server or Client authentication for the chosen TLS connection.\r
192\r
193 @param[in] Tls Pointer to the TLS object.\r
194 @param[in] Data Pointer to the data buffer of a DER-encoded binary\r
195 X.509 certificate or PEM-encoded X.509 certificate.\r
196 @param[in] DataSize The size of data buffer in bytes.\r
197\r
198 @retval EFI_SUCCESS The operation succeeded.\r
199 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
200 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
201 @retval EFI_ABORTED Invalid X.509 certificate.\r
202\r
203**/\r
204EFI_STATUS\r
205EFIAPI\r
206TlsSetCaCertificate (\r
207 IN VOID *Tls,\r
208 IN VOID *Data,\r
209 IN UINTN DataSize\r
210 )\r
211{\r
212 ASSERT(FALSE);\r
213 return EFI_UNSUPPORTED;\r
214}\r
215\r
216/**\r
217 Loads the local public certificate into the specified TLS object.\r
218\r
219 This function loads the X.509 certificate into the specified TLS object\r
220 for TLS negotiation.\r
221\r
222 @param[in] Tls Pointer to the TLS object.\r
223 @param[in] Data Pointer to the data buffer of a DER-encoded binary\r
224 X.509 certificate or PEM-encoded X.509 certificate.\r
225 @param[in] DataSize The size of data buffer in bytes.\r
226\r
227 @retval EFI_SUCCESS The operation succeeded.\r
228 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
229 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.\r
230 @retval EFI_ABORTED Invalid X.509 certificate.\r
231\r
232**/\r
233EFI_STATUS\r
234EFIAPI\r
235TlsSetHostPublicCert (\r
236 IN VOID *Tls,\r
237 IN VOID *Data,\r
238 IN UINTN DataSize\r
239 )\r
240{\r
241 ASSERT(FALSE);\r
242 return EFI_UNSUPPORTED;\r
243}\r
244\r
245/**\r
246 Adds the local private key to the specified TLS object.\r
247\r
248 This function adds the local private key (PEM-encoded RSA or PKCS#8 private\r
249 key) into the specified TLS object for TLS negotiation.\r
250\r
251 @param[in] Tls Pointer to the TLS object.\r
252 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA\r
253 or PKCS#8 private key.\r
254 @param[in] DataSize The size of data buffer in bytes.\r
255\r
256 @retval EFI_SUCCESS The operation succeeded.\r
257 @retval EFI_UNSUPPORTED This function is not supported.\r
258 @retval EFI_ABORTED Invalid private key data.\r
259\r
260**/\r
261EFI_STATUS\r
262EFIAPI\r
263TlsSetHostPrivateKey (\r
264 IN VOID *Tls,\r
265 IN VOID *Data,\r
266 IN UINTN DataSize\r
267 )\r
268{\r
269 ASSERT(FALSE);\r
270 return EFI_UNSUPPORTED;\r
271}\r
272\r
273/**\r
274 Adds the CA-supplied certificate revocation list for certificate validation.\r
275\r
276 This function adds the CA-supplied certificate revocation list data for\r
277 certificate validity checking.\r
278\r
279 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.\r
280 @param[in] DataSize The size of data buffer in bytes.\r
281\r
282 @retval EFI_SUCCESS The operation succeeded.\r
283 @retval EFI_UNSUPPORTED This function is not supported.\r
284 @retval EFI_ABORTED Invalid CRL data.\r
285\r
286**/\r
287EFI_STATUS\r
288EFIAPI\r
289TlsSetCertRevocationList (\r
290 IN VOID *Data,\r
291 IN UINTN DataSize\r
292 )\r
293{\r
294 ASSERT(FALSE);\r
295 return EFI_UNSUPPORTED;\r
296}\r
297\r
298/**\r
299 Gets the protocol version used by the specified TLS connection.\r
300\r
301 This function returns the protocol version used by the specified TLS\r
302 connection.\r
303\r
304 If Tls is NULL, then ASSERT().\r
305\r
306 @param[in] Tls Pointer to the TLS object.\r
307\r
308 @return The protocol version of the specified TLS connection.\r
309\r
310**/\r
311UINT16\r
312EFIAPI\r
313TlsGetVersion (\r
314 IN VOID *Tls\r
315 )\r
316{\r
317 ASSERT(FALSE);\r
318 return 0;\r
319}\r
320\r
321/**\r
322 Gets the connection end of the specified TLS connection.\r
323\r
324 This function returns the connection end (as client or as server) used by\r
325 the specified TLS connection.\r
326\r
327 If Tls is NULL, then ASSERT().\r
328\r
329 @param[in] Tls Pointer to the TLS object.\r
330\r
331 @return The connection end used by the specified TLS connection.\r
332\r
333**/\r
334UINT8\r
335EFIAPI\r
336TlsGetConnectionEnd (\r
337 IN VOID *Tls\r
338 )\r
339{\r
340 ASSERT(FALSE);\r
341 return 0;\r
342}\r
343\r
344/**\r
345 Gets the cipher suite used by the specified TLS connection.\r
346\r
347 This function returns current cipher suite used by the specified\r
348 TLS connection.\r
349\r
350 @param[in] Tls Pointer to the TLS object.\r
351 @param[in,out] CipherId The cipher suite used by the TLS object.\r
352\r
353 @retval EFI_SUCCESS The cipher suite was returned successfully.\r
354 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
355 @retval EFI_UNSUPPORTED Unsupported cipher suite.\r
356\r
357**/\r
358EFI_STATUS\r
359EFIAPI\r
360TlsGetCurrentCipher (\r
361 IN VOID *Tls,\r
362 IN OUT UINT16 *CipherId\r
363 )\r
364{\r
365 ASSERT(FALSE);\r
366 return EFI_UNSUPPORTED;\r
367}\r
368\r
369/**\r
370 Gets the compression methods used by the specified TLS connection.\r
371\r
372 This function returns current integrated compression methods used by\r
373 the specified TLS connection.\r
374\r
375 @param[in] Tls Pointer to the TLS object.\r
376 @param[in,out] CompressionId The current compression method used by\r
377 the TLS object.\r
378\r
379 @retval EFI_SUCCESS The compression method was returned successfully.\r
380 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
381 @retval EFI_ABORTED Invalid Compression method.\r
382 @retval EFI_UNSUPPORTED This function is not supported.\r
383\r
384**/\r
385EFI_STATUS\r
386EFIAPI\r
387TlsGetCurrentCompressionId (\r
388 IN VOID *Tls,\r
389 IN OUT UINT8 *CompressionId\r
390 )\r
391{\r
392 ASSERT(FALSE);\r
393 return EFI_UNSUPPORTED;\r
394}\r
395\r
396/**\r
397 Gets the verification mode currently set in the TLS connection.\r
398\r
399 This function returns the peer verification mode currently set in the\r
400 specified TLS connection.\r
401\r
402 If Tls is NULL, then ASSERT().\r
403\r
404 @param[in] Tls Pointer to the TLS object.\r
405\r
406 @return The verification mode set in the specified TLS connection.\r
407\r
408**/\r
409UINT32\r
410EFIAPI\r
411TlsGetVerify (\r
412 IN VOID *Tls\r
413 )\r
414{\r
415 ASSERT(FALSE);\r
416 return 0;\r
417}\r
418\r
419/**\r
420 Gets the session ID used by the specified TLS connection.\r
421\r
422 This function returns the TLS/SSL session ID currently used by the\r
423 specified TLS connection.\r
424\r
425 @param[in] Tls Pointer to the TLS object.\r
426 @param[in,out] SessionId Buffer to contain the returned session ID.\r
427 @param[in,out] SessionIdLen The length of Session ID in bytes.\r
428\r
429 @retval EFI_SUCCESS The Session ID was returned successfully.\r
430 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
431 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r
432\r
433**/\r
434EFI_STATUS\r
435EFIAPI\r
436TlsGetSessionId (\r
437 IN VOID *Tls,\r
438 IN OUT UINT8 *SessionId,\r
439 IN OUT UINT16 *SessionIdLen\r
440 )\r
441{\r
442 ASSERT(FALSE);\r
443 return EFI_UNSUPPORTED;\r
444}\r
445\r
446/**\r
447 Gets the client random data used in the specified TLS connection.\r
448\r
449 This function returns the TLS/SSL client random data currently used in\r
450 the specified TLS connection.\r
451\r
452 @param[in] Tls Pointer to the TLS object.\r
453 @param[in,out] ClientRandom Buffer to contain the returned client\r
454 random data (32 bytes).\r
455\r
456**/\r
457VOID\r
458EFIAPI\r
459TlsGetClientRandom (\r
460 IN VOID *Tls,\r
461 IN OUT UINT8 *ClientRandom\r
462 )\r
463{\r
464 ASSERT(FALSE);\r
465}\r
466\r
467/**\r
468 Gets the server random data used in the specified TLS connection.\r
469\r
470 This function returns the TLS/SSL server random data currently used in\r
471 the specified TLS connection.\r
472\r
473 @param[in] Tls Pointer to the TLS object.\r
474 @param[in,out] ServerRandom Buffer to contain the returned server\r
475 random data (32 bytes).\r
476\r
477**/\r
478VOID\r
479EFIAPI\r
480TlsGetServerRandom (\r
481 IN VOID *Tls,\r
482 IN OUT UINT8 *ServerRandom\r
483 )\r
484{\r
485 ASSERT(FALSE);\r
486}\r
487\r
488/**\r
489 Gets the master key data used in the specified TLS connection.\r
490\r
491 This function returns the TLS/SSL master key material currently used in\r
492 the specified TLS connection.\r
493\r
494 @param[in] Tls Pointer to the TLS object.\r
495 @param[in,out] KeyMaterial Buffer to contain the returned key material.\r
496\r
497 @retval EFI_SUCCESS Key material was returned successfully.\r
498 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
499 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.\r
500\r
501**/\r
502EFI_STATUS\r
503EFIAPI\r
504TlsGetKeyMaterial (\r
505 IN VOID *Tls,\r
506 IN OUT UINT8 *KeyMaterial\r
507 )\r
508{\r
509 ASSERT(FALSE);\r
510 return EFI_UNSUPPORTED;\r
511}\r
512\r
513/**\r
514 Gets the CA Certificate from the cert store.\r
515\r
516 This function returns the CA certificate for the chosen\r
517 TLS connection.\r
518\r
519 @param[in] Tls Pointer to the TLS object.\r
520 @param[out] Data Pointer to the data buffer to receive the CA\r
521 certificate data sent to the client.\r
522 @param[in,out] DataSize The size of data buffer in bytes.\r
523\r
524 @retval EFI_SUCCESS The operation succeeded.\r
525 @retval EFI_UNSUPPORTED This function is not supported.\r
526 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
527\r
528**/\r
529EFI_STATUS\r
530EFIAPI\r
531TlsGetCaCertificate (\r
532 IN VOID *Tls,\r
533 OUT VOID *Data,\r
534 IN OUT UINTN *DataSize\r
535 )\r
536{\r
537 ASSERT(FALSE);\r
538 return EFI_UNSUPPORTED;\r
539}\r
540\r
541/**\r
542 Gets the local public Certificate set in the specified TLS object.\r
543\r
544 This function returns the local public certificate which was currently set\r
545 in the specified TLS object.\r
546\r
547 @param[in] Tls Pointer to the TLS object.\r
548 @param[out] Data Pointer to the data buffer to receive the local\r
549 public certificate.\r
550 @param[in,out] DataSize The size of data buffer in bytes.\r
551\r
552 @retval EFI_SUCCESS The operation succeeded.\r
553 @retval EFI_INVALID_PARAMETER The parameter is invalid.\r
554 @retval EFI_NOT_FOUND The certificate is not found.\r
555 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
556\r
557**/\r
558EFI_STATUS\r
559EFIAPI\r
560TlsGetHostPublicCert (\r
561 IN VOID *Tls,\r
562 OUT VOID *Data,\r
563 IN OUT UINTN *DataSize\r
564 )\r
565{\r
566 ASSERT(FALSE);\r
567 return EFI_UNSUPPORTED;\r
568}\r
569\r
570/**\r
571 Gets the local private key set in the specified TLS object.\r
572\r
573 This function returns the local private key data which was currently set\r
574 in the specified TLS object.\r
575\r
576 @param[in] Tls Pointer to the TLS object.\r
577 @param[out] Data Pointer to the data buffer to receive the local\r
578 private key data.\r
579 @param[in,out] DataSize The size of data buffer in bytes.\r
580\r
581 @retval EFI_SUCCESS The operation succeeded.\r
582 @retval EFI_UNSUPPORTED This function is not supported.\r
583 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
584\r
585**/\r
586EFI_STATUS\r
587EFIAPI\r
588TlsGetHostPrivateKey (\r
589 IN VOID *Tls,\r
590 OUT VOID *Data,\r
591 IN OUT UINTN *DataSize\r
592 )\r
593{\r
594 ASSERT(FALSE);\r
595 return EFI_UNSUPPORTED;\r
596}\r
597\r
598/**\r
599 Gets the CA-supplied certificate revocation list data set in the specified\r
600 TLS object.\r
601\r
602 This function returns the CA-supplied certificate revocation list data which\r
603 was currently set in the specified TLS object.\r
604\r
605 @param[out] Data Pointer to the data buffer to receive the CRL data.\r
606 @param[in,out] DataSize The size of data buffer in bytes.\r
607\r
608 @retval EFI_SUCCESS The operation succeeded.\r
609 @retval EFI_UNSUPPORTED This function is not supported.\r
610 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.\r
611\r
612**/\r
613EFI_STATUS\r
614EFIAPI\r
615TlsGetCertRevocationList (\r
616 OUT VOID *Data,\r
617 IN OUT UINTN *DataSize\r
618 )\r
619{\r
620 ASSERT(FALSE);\r
621 return EFI_UNSUPPORTED;\r
622}\r