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