]> git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/TlsLibNull/TlsConfigNull.c
UefiCpuPkg: Move AsmRelocateApLoopStart from Mpfuncs.nasm to AmdSev.nasm
[mirror_edk2.git] / CryptoPkg / Library / TlsLibNull / TlsConfigNull.c
1 /** @file
2 SSL/TLS Configuration Null Library Wrapper Implementation.
3
4 Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
7
8 **/
9
10 #include "InternalTlsLib.h"
11
12 /**
13 Set a new TLS/SSL method for a particular TLS object.
14
15 This function sets a new TLS/SSL method for a particular TLS object.
16
17 @param[in] Tls Pointer to a TLS object.
18 @param[in] MajorVer Major Version of TLS/SSL Protocol.
19 @param[in] MinorVer Minor Version of TLS/SSL Protocol.
20
21 @retval EFI_SUCCESS The TLS/SSL method was set successfully.
22 @retval EFI_INVALID_PARAMETER The parameter is invalid.
23 @retval EFI_UNSUPPORTED Unsupported TLS/SSL method.
24
25 **/
26 EFI_STATUS
27 EFIAPI
28 TlsSetVersion (
29 IN VOID *Tls,
30 IN UINT8 MajorVer,
31 IN UINT8 MinorVer
32 )
33 {
34 ASSERT (FALSE);
35 return EFI_UNSUPPORTED;
36 }
37
38 /**
39 Set TLS object to work in client or server mode.
40
41 This function prepares a TLS object to work in client or server mode.
42
43 @param[in] Tls Pointer to a TLS object.
44 @param[in] IsServer Work in server mode.
45
46 @retval EFI_SUCCESS The TLS/SSL work mode was set successfully.
47 @retval EFI_INVALID_PARAMETER The parameter is invalid.
48 @retval EFI_UNSUPPORTED Unsupported TLS/SSL work mode.
49
50 **/
51 EFI_STATUS
52 EFIAPI
53 TlsSetConnectionEnd (
54 IN VOID *Tls,
55 IN BOOLEAN IsServer
56 )
57 {
58 ASSERT (FALSE);
59 return EFI_UNSUPPORTED;
60 }
61
62 /**
63 Set the ciphers list to be used by the TLS object.
64
65 This function sets the ciphers for use by a specified TLS object.
66
67 @param[in] Tls Pointer to a TLS object.
68 @param[in] CipherId Array of UINT16 cipher identifiers. Each UINT16
69 cipher identifier comes from the TLS Cipher Suite
70 Registry of the IANA, interpreting Byte1 and Byte2
71 in network (big endian) byte order.
72 @param[in] CipherNum The number of cipher in the list.
73
74 @retval EFI_SUCCESS The ciphers list was set successfully.
75 @retval EFI_INVALID_PARAMETER The parameter is invalid.
76 @retval EFI_UNSUPPORTED No supported TLS cipher was found in CipherId.
77 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
78
79 **/
80 EFI_STATUS
81 EFIAPI
82 TlsSetCipherList (
83 IN VOID *Tls,
84 IN UINT16 *CipherId,
85 IN UINTN CipherNum
86 )
87 {
88 ASSERT (FALSE);
89 return EFI_UNSUPPORTED;
90 }
91
92 /**
93 Set the compression method for TLS/SSL operations.
94
95 This function handles TLS/SSL integrated compression methods.
96
97 @param[in] CompMethod The compression method ID.
98
99 @retval EFI_SUCCESS The compression method for the communication was
100 set successfully.
101 @retval EFI_UNSUPPORTED Unsupported compression method.
102
103 **/
104 EFI_STATUS
105 EFIAPI
106 TlsSetCompressionMethod (
107 IN UINT8 CompMethod
108 )
109 {
110 ASSERT (FALSE);
111 return EFI_UNSUPPORTED;
112 }
113
114 /**
115 Set peer certificate verification mode for the TLS connection.
116
117 This function sets the verification mode flags for the TLS connection.
118
119 @param[in] Tls Pointer to the TLS object.
120 @param[in] VerifyMode A set of logically or'ed verification mode flags.
121
122 **/
123 VOID
124 EFIAPI
125 TlsSetVerify (
126 IN VOID *Tls,
127 IN UINT32 VerifyMode
128 )
129 {
130 ASSERT (FALSE);
131 }
132
133 /**
134 Set the specified host name to be verified.
135
136 @param[in] Tls Pointer to the TLS object.
137 @param[in] Flags The setting flags during the validation.
138 @param[in] HostName The specified host name to be verified.
139
140 @retval EFI_SUCCESS The HostName setting was set successfully.
141 @retval EFI_INVALID_PARAMETER The parameter is invalid.
142 @retval EFI_ABORTED Invalid HostName setting.
143
144 **/
145 EFI_STATUS
146 EFIAPI
147 TlsSetVerifyHost (
148 IN VOID *Tls,
149 IN UINT32 Flags,
150 IN CHAR8 *HostName
151 )
152 {
153 ASSERT (FALSE);
154 return EFI_UNSUPPORTED;
155 }
156
157 /**
158 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
159
160 This function sets a session ID to be used when the TLS/SSL connection is
161 to be established.
162
163 @param[in] Tls Pointer to the TLS object.
164 @param[in] SessionId Session ID data used for session resumption.
165 @param[in] SessionIdLen Length of Session ID in bytes.
166
167 @retval EFI_SUCCESS Session ID was set successfully.
168 @retval EFI_INVALID_PARAMETER The parameter is invalid.
169 @retval EFI_UNSUPPORTED No available session for ID setting.
170
171 **/
172 EFI_STATUS
173 EFIAPI
174 TlsSetSessionId (
175 IN VOID *Tls,
176 IN UINT8 *SessionId,
177 IN UINT16 SessionIdLen
178 )
179 {
180 ASSERT (FALSE);
181 return EFI_UNSUPPORTED;
182 }
183
184 /**
185 Adds the CA to the cert store when requesting Server or Client authentication.
186
187 This function adds the CA certificate to the list of CAs when requesting
188 Server or Client authentication for the chosen TLS connection.
189
190 @param[in] Tls Pointer to the TLS object.
191 @param[in] Data Pointer to the data buffer of a DER-encoded binary
192 X.509 certificate or PEM-encoded X.509 certificate.
193 @param[in] DataSize The size of data buffer in bytes.
194
195 @retval EFI_SUCCESS The operation succeeded.
196 @retval EFI_INVALID_PARAMETER The parameter is invalid.
197 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
198 @retval EFI_ABORTED Invalid X.509 certificate.
199
200 **/
201 EFI_STATUS
202 EFIAPI
203 TlsSetCaCertificate (
204 IN VOID *Tls,
205 IN VOID *Data,
206 IN UINTN DataSize
207 )
208 {
209 ASSERT (FALSE);
210 return EFI_UNSUPPORTED;
211 }
212
213 /**
214 Loads the local public certificate into the specified TLS object.
215
216 This function loads the X.509 certificate into the specified TLS object
217 for TLS negotiation.
218
219 @param[in] Tls Pointer to the TLS object.
220 @param[in] Data Pointer to the data buffer of a DER-encoded binary
221 X.509 certificate or PEM-encoded X.509 certificate.
222 @param[in] DataSize The size of data buffer in bytes.
223
224 @retval EFI_SUCCESS The operation succeeded.
225 @retval EFI_INVALID_PARAMETER The parameter is invalid.
226 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
227 @retval EFI_ABORTED Invalid X.509 certificate.
228
229 **/
230 EFI_STATUS
231 EFIAPI
232 TlsSetHostPublicCert (
233 IN VOID *Tls,
234 IN VOID *Data,
235 IN UINTN DataSize
236 )
237 {
238 ASSERT (FALSE);
239 return EFI_UNSUPPORTED;
240 }
241
242 /**
243 Adds the local private key to the specified TLS object.
244
245 This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private
246 key) into the specified TLS object for TLS negotiation.
247
248 @param[in] Tls Pointer to the TLS object.
249 @param[in] Data Pointer to the data buffer of a DER-encoded or PEM-encoded
250 or PKCS#8 private key.
251 @param[in] DataSize The size of data buffer in bytes.
252 @param[in] Password Pointer to NULL-terminated private key password, set it to NULL
253 if private key not encrypted.
254
255 @retval EFI_SUCCESS The operation succeeded.
256 @retval EFI_UNSUPPORTED This function is not supported.
257 @retval EFI_ABORTED Invalid private key data.
258
259 **/
260 EFI_STATUS
261 EFIAPI
262 TlsSetHostPrivateKeyEx (
263 IN VOID *Tls,
264 IN VOID *Data,
265 IN UINTN DataSize,
266 IN VOID *Password OPTIONAL
267 )
268 {
269 ASSERT (FALSE);
270 return EFI_UNSUPPORTED;
271 }
272
273 /**
274 Adds the local private key to the specified TLS object.
275
276 This function adds the local private key (DER-encoded or PEM-encoded or PKCS#8 private
277 key) into the specified TLS object for TLS negotiation.
278
279 @param[in] Tls Pointer to the TLS object.
280 @param[in] Data Pointer to the data buffer of a DER-encoded or PEM-encoded
281 or PKCS#8 private key.
282 @param[in] DataSize The size of data buffer in bytes.
283
284 @retval EFI_SUCCESS The operation succeeded.
285 @retval EFI_UNSUPPORTED This function is not supported.
286 @retval EFI_ABORTED Invalid private key data.
287
288 **/
289 EFI_STATUS
290 EFIAPI
291 TlsSetHostPrivateKey (
292 IN VOID *Tls,
293 IN VOID *Data,
294 IN UINTN DataSize
295 )
296 {
297 ASSERT (FALSE);
298 return EFI_UNSUPPORTED;
299 }
300
301 /**
302 Adds the CA-supplied certificate revocation list for certificate validation.
303
304 This function adds the CA-supplied certificate revocation list data for
305 certificate validity checking.
306
307 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
308 @param[in] DataSize The size of data buffer in bytes.
309
310 @retval EFI_SUCCESS The operation succeeded.
311 @retval EFI_UNSUPPORTED This function is not supported.
312 @retval EFI_ABORTED Invalid CRL data.
313
314 **/
315 EFI_STATUS
316 EFIAPI
317 TlsSetCertRevocationList (
318 IN VOID *Data,
319 IN UINTN DataSize
320 )
321 {
322 ASSERT (FALSE);
323 return EFI_UNSUPPORTED;
324 }
325
326 /**
327 Set the signature algorithm list to used by the TLS object.
328
329 This function sets the signature algorithms for use by a specified TLS object.
330
331 @param[in] Tls Pointer to a TLS object.
332 @param[in] Data Array of UINT8 of signature algorithms. The array consists of
333 pairs of the hash algorithm and the signature algorithm as defined
334 in RFC 5246
335 @param[in] DataSize The length the SignatureAlgoList. Must be divisible by 2.
336
337 @retval EFI_SUCCESS The signature algorithm list was set successfully.
338 @retval EFI_INVALID_PARAMETER The parameters are invalid.
339 @retval EFI_UNSUPPORTED No supported TLS signature algorithm was found in SignatureAlgoList
340 @retval EFI_OUT_OF_RESOURCES Memory allocation failed.
341
342 **/
343 EFI_STATUS
344 EFIAPI
345 TlsSetSignatureAlgoList (
346 IN VOID *Tls,
347 IN UINT8 *Data,
348 IN UINTN DataSize
349 )
350 {
351 ASSERT (FALSE);
352 return EFI_UNSUPPORTED;
353 }
354
355 /**
356 Set the EC curve to be used for TLS flows
357
358 This function sets the EC curve to be used for TLS flows.
359
360 @param[in] Tls Pointer to a TLS object.
361 @param[in] Data An EC named curve as defined in section 5.1.1 of RFC 4492.
362 @param[in] DataSize Size of Data, it should be sizeof (UINT32)
363
364 @retval EFI_SUCCESS The EC curve was set successfully.
365 @retval EFI_INVALID_PARAMETER The parameters are invalid.
366 @retval EFI_UNSUPPORTED The requested TLS EC curve is not supported
367
368 **/
369 EFI_STATUS
370 EFIAPI
371 TlsSetEcCurve (
372 IN VOID *Tls,
373 IN UINT8 *Data,
374 IN UINTN DataSize
375 )
376 {
377 ASSERT (FALSE);
378 return EFI_UNSUPPORTED;
379 }
380
381 /**
382 Gets the protocol version used by the specified TLS connection.
383
384 This function returns the protocol version used by the specified TLS
385 connection.
386
387 If Tls is NULL, then ASSERT().
388
389 @param[in] Tls Pointer to the TLS object.
390
391 @return The protocol version of the specified TLS connection.
392
393 **/
394 UINT16
395 EFIAPI
396 TlsGetVersion (
397 IN VOID *Tls
398 )
399 {
400 ASSERT (FALSE);
401 return 0;
402 }
403
404 /**
405 Gets the connection end of the specified TLS connection.
406
407 This function returns the connection end (as client or as server) used by
408 the specified TLS connection.
409
410 If Tls is NULL, then ASSERT().
411
412 @param[in] Tls Pointer to the TLS object.
413
414 @return The connection end used by the specified TLS connection.
415
416 **/
417 UINT8
418 EFIAPI
419 TlsGetConnectionEnd (
420 IN VOID *Tls
421 )
422 {
423 ASSERT (FALSE);
424 return 0;
425 }
426
427 /**
428 Gets the cipher suite used by the specified TLS connection.
429
430 This function returns current cipher suite used by the specified
431 TLS connection.
432
433 @param[in] Tls Pointer to the TLS object.
434 @param[in,out] CipherId The cipher suite used by the TLS object.
435
436 @retval EFI_SUCCESS The cipher suite was returned successfully.
437 @retval EFI_INVALID_PARAMETER The parameter is invalid.
438 @retval EFI_UNSUPPORTED Unsupported cipher suite.
439
440 **/
441 EFI_STATUS
442 EFIAPI
443 TlsGetCurrentCipher (
444 IN VOID *Tls,
445 IN OUT UINT16 *CipherId
446 )
447 {
448 ASSERT (FALSE);
449 return EFI_UNSUPPORTED;
450 }
451
452 /**
453 Gets the compression methods used by the specified TLS connection.
454
455 This function returns current integrated compression methods used by
456 the specified TLS connection.
457
458 @param[in] Tls Pointer to the TLS object.
459 @param[in,out] CompressionId The current compression method used by
460 the TLS object.
461
462 @retval EFI_SUCCESS The compression method was returned successfully.
463 @retval EFI_INVALID_PARAMETER The parameter is invalid.
464 @retval EFI_ABORTED Invalid Compression method.
465 @retval EFI_UNSUPPORTED This function is not supported.
466
467 **/
468 EFI_STATUS
469 EFIAPI
470 TlsGetCurrentCompressionId (
471 IN VOID *Tls,
472 IN OUT UINT8 *CompressionId
473 )
474 {
475 ASSERT (FALSE);
476 return EFI_UNSUPPORTED;
477 }
478
479 /**
480 Gets the verification mode currently set in the TLS connection.
481
482 This function returns the peer verification mode currently set in the
483 specified TLS connection.
484
485 If Tls is NULL, then ASSERT().
486
487 @param[in] Tls Pointer to the TLS object.
488
489 @return The verification mode set in the specified TLS connection.
490
491 **/
492 UINT32
493 EFIAPI
494 TlsGetVerify (
495 IN VOID *Tls
496 )
497 {
498 ASSERT (FALSE);
499 return 0;
500 }
501
502 /**
503 Gets the session ID used by the specified TLS connection.
504
505 This function returns the TLS/SSL session ID currently used by the
506 specified TLS connection.
507
508 @param[in] Tls Pointer to the TLS object.
509 @param[in,out] SessionId Buffer to contain the returned session ID.
510 @param[in,out] SessionIdLen The length of Session ID in bytes.
511
512 @retval EFI_SUCCESS The Session ID was returned successfully.
513 @retval EFI_INVALID_PARAMETER The parameter is invalid.
514 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
515
516 **/
517 EFI_STATUS
518 EFIAPI
519 TlsGetSessionId (
520 IN VOID *Tls,
521 IN OUT UINT8 *SessionId,
522 IN OUT UINT16 *SessionIdLen
523 )
524 {
525 ASSERT (FALSE);
526 return EFI_UNSUPPORTED;
527 }
528
529 /**
530 Gets the client random data used in the specified TLS connection.
531
532 This function returns the TLS/SSL client random data currently used in
533 the specified TLS connection.
534
535 @param[in] Tls Pointer to the TLS object.
536 @param[in,out] ClientRandom Buffer to contain the returned client
537 random data (32 bytes).
538
539 **/
540 VOID
541 EFIAPI
542 TlsGetClientRandom (
543 IN VOID *Tls,
544 IN OUT UINT8 *ClientRandom
545 )
546 {
547 ASSERT (FALSE);
548 }
549
550 /**
551 Gets the server random data used in the specified TLS connection.
552
553 This function returns the TLS/SSL server random data currently used in
554 the specified TLS connection.
555
556 @param[in] Tls Pointer to the TLS object.
557 @param[in,out] ServerRandom Buffer to contain the returned server
558 random data (32 bytes).
559
560 **/
561 VOID
562 EFIAPI
563 TlsGetServerRandom (
564 IN VOID *Tls,
565 IN OUT UINT8 *ServerRandom
566 )
567 {
568 ASSERT (FALSE);
569 }
570
571 /**
572 Gets the master key data used in the specified TLS connection.
573
574 This function returns the TLS/SSL master key material currently used in
575 the specified TLS connection.
576
577 @param[in] Tls Pointer to the TLS object.
578 @param[in,out] KeyMaterial Buffer to contain the returned key material.
579
580 @retval EFI_SUCCESS Key material was returned successfully.
581 @retval EFI_INVALID_PARAMETER The parameter is invalid.
582 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
583
584 **/
585 EFI_STATUS
586 EFIAPI
587 TlsGetKeyMaterial (
588 IN VOID *Tls,
589 IN OUT UINT8 *KeyMaterial
590 )
591 {
592 ASSERT (FALSE);
593 return EFI_UNSUPPORTED;
594 }
595
596 /**
597 Gets the CA Certificate from the cert store.
598
599 This function returns the CA certificate for the chosen
600 TLS connection.
601
602 @param[in] Tls Pointer to the TLS object.
603 @param[out] Data Pointer to the data buffer to receive the CA
604 certificate data sent to the client.
605 @param[in,out] DataSize The size of data buffer in bytes.
606
607 @retval EFI_SUCCESS The operation succeeded.
608 @retval EFI_UNSUPPORTED This function is not supported.
609 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
610
611 **/
612 EFI_STATUS
613 EFIAPI
614 TlsGetCaCertificate (
615 IN VOID *Tls,
616 OUT VOID *Data,
617 IN OUT UINTN *DataSize
618 )
619 {
620 ASSERT (FALSE);
621 return EFI_UNSUPPORTED;
622 }
623
624 /**
625 Gets the local public Certificate set in the specified TLS object.
626
627 This function returns the local public certificate which was currently set
628 in the specified TLS object.
629
630 @param[in] Tls Pointer to the TLS object.
631 @param[out] Data Pointer to the data buffer to receive the local
632 public certificate.
633 @param[in,out] DataSize The size of data buffer in bytes.
634
635 @retval EFI_SUCCESS The operation succeeded.
636 @retval EFI_INVALID_PARAMETER The parameter is invalid.
637 @retval EFI_NOT_FOUND The certificate is not found.
638 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
639
640 **/
641 EFI_STATUS
642 EFIAPI
643 TlsGetHostPublicCert (
644 IN VOID *Tls,
645 OUT VOID *Data,
646 IN OUT UINTN *DataSize
647 )
648 {
649 ASSERT (FALSE);
650 return EFI_UNSUPPORTED;
651 }
652
653 /**
654 Gets the local private key set in the specified TLS object.
655
656 This function returns the local private key data which was currently set
657 in the specified TLS object.
658
659 @param[in] Tls Pointer to the TLS object.
660 @param[out] Data Pointer to the data buffer to receive the local
661 private key data.
662 @param[in,out] DataSize The size of data buffer in bytes.
663
664 @retval EFI_SUCCESS The operation succeeded.
665 @retval EFI_UNSUPPORTED This function is not supported.
666 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
667
668 **/
669 EFI_STATUS
670 EFIAPI
671 TlsGetHostPrivateKey (
672 IN VOID *Tls,
673 OUT VOID *Data,
674 IN OUT UINTN *DataSize
675 )
676 {
677 ASSERT (FALSE);
678 return EFI_UNSUPPORTED;
679 }
680
681 /**
682 Gets the CA-supplied certificate revocation list data set in the specified
683 TLS object.
684
685 This function returns the CA-supplied certificate revocation list data which
686 was currently set in the specified TLS object.
687
688 @param[out] Data Pointer to the data buffer to receive the CRL data.
689 @param[in,out] DataSize The size of data buffer in bytes.
690
691 @retval EFI_SUCCESS The operation succeeded.
692 @retval EFI_UNSUPPORTED This function is not supported.
693 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
694
695 **/
696 EFI_STATUS
697 EFIAPI
698 TlsGetCertRevocationList (
699 OUT VOID *Data,
700 IN OUT UINTN *DataSize
701 )
702 {
703 ASSERT (FALSE);
704 return EFI_UNSUPPORTED;
705 }
706
707 /**
708 Derive keying material from a TLS connection.
709
710 This function exports keying material using the mechanism described in RFC
711 5705.
712
713 @param[in] Tls Pointer to the TLS object
714 @param[in] Label Description of the key for the PRF function
715 @param[in] Context Optional context
716 @param[in] ContextLen The length of the context value in bytes
717 @param[out] KeyBuffer Buffer to hold the output of the TLS-PRF
718 @param[in] KeyBufferLen The length of the KeyBuffer
719
720 @retval EFI_SUCCESS The operation succeeded.
721 @retval EFI_INVALID_PARAMETER The TLS object is invalid.
722 @retval EFI_PROTOCOL_ERROR Some other error occurred.
723
724 **/
725 EFI_STATUS
726 EFIAPI
727 TlsGetExportKey (
728 IN VOID *Tls,
729 IN CONST VOID *Label,
730 IN CONST VOID *Context,
731 IN UINTN ContextLen,
732 OUT VOID *KeyBuffer,
733 IN UINTN KeyBufferLen
734 )
735 {
736 ASSERT (FALSE);
737 return EFI_UNSUPPORTED;
738 }