]>
git.proxmox.com Git - mirror_edk2.git/blob - CryptoPkg/Library/TlsLibNull/TlsConfigNull.c
2 SSL/TLS Configuration Null Library Wrapper Implementation.
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
10 #include "InternalTlsLib.h"
13 Set a new TLS/SSL method for a particular TLS object.
15 This function sets a new TLS/SSL method for a particular TLS object.
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.
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.
35 return EFI_UNSUPPORTED
;
39 Set TLS object to work in client or server mode.
41 This function prepares a TLS object to work in client or server mode.
43 @param[in] Tls Pointer to a TLS object.
44 @param[in] IsServer Work in server mode.
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.
59 return EFI_UNSUPPORTED
;
63 Set the ciphers list to be used by the TLS object.
65 This function sets the ciphers for use by a specified TLS object.
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.
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.
89 return EFI_UNSUPPORTED
;
93 Set the compression method for TLS/SSL operations.
95 This function handles TLS/SSL integrated compression methods.
97 @param[in] CompMethod The compression method ID.
99 @retval EFI_SUCCESS The compression method for the communication was
101 @retval EFI_UNSUPPORTED Unsupported compression method.
106 TlsSetCompressionMethod (
111 return EFI_UNSUPPORTED
;
115 Set peer certificate verification mode for the TLS connection.
117 This function sets the verification mode flags for the TLS connection.
119 @param[in] Tls Pointer to the TLS object.
120 @param[in] VerifyMode A set of logically or'ed verification mode flags.
134 Set the specified host name to be verified.
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.
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.
154 return EFI_UNSUPPORTED
;
158 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
160 This function sets a session ID to be used when the TLS/SSL connection is
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.
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.
177 IN UINT16 SessionIdLen
181 return EFI_UNSUPPORTED
;
185 Adds the CA to the cert store when requesting Server or Client authentication.
187 This function adds the CA certificate to the list of CAs when requesting
188 Server or Client authentication for the chosen TLS connection.
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.
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.
203 TlsSetCaCertificate (
210 return EFI_UNSUPPORTED
;
214 Loads the local public certificate into the specified TLS object.
216 This function loads the X.509 certificate into the specified TLS object
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.
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.
232 TlsSetHostPublicCert (
239 return EFI_UNSUPPORTED
;
243 Adds the local private key to the specified TLS object.
245 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
246 key) into the specified TLS object for TLS negotiation.
248 @param[in] Tls Pointer to the TLS object.
249 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
250 or PKCS#8 private key.
251 @param[in] DataSize The size of data buffer in bytes.
253 @retval EFI_SUCCESS The operation succeeded.
254 @retval EFI_UNSUPPORTED This function is not supported.
255 @retval EFI_ABORTED Invalid private key data.
260 TlsSetHostPrivateKey (
267 return EFI_UNSUPPORTED
;
271 Adds the CA-supplied certificate revocation list for certificate validation.
273 This function adds the CA-supplied certificate revocation list data for
274 certificate validity checking.
276 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
277 @param[in] DataSize The size of data buffer in bytes.
279 @retval EFI_SUCCESS The operation succeeded.
280 @retval EFI_UNSUPPORTED This function is not supported.
281 @retval EFI_ABORTED Invalid CRL data.
286 TlsSetCertRevocationList (
292 return EFI_UNSUPPORTED
;
296 Gets the protocol version used by the specified TLS connection.
298 This function returns the protocol version used by the specified TLS
301 If Tls is NULL, then ASSERT().
303 @param[in] Tls Pointer to the TLS object.
305 @return The protocol version of the specified TLS connection.
319 Gets the connection end of the specified TLS connection.
321 This function returns the connection end (as client or as server) used by
322 the specified TLS connection.
324 If Tls is NULL, then ASSERT().
326 @param[in] Tls Pointer to the TLS object.
328 @return The connection end used by the specified TLS connection.
333 TlsGetConnectionEnd (
342 Gets the cipher suite used by the specified TLS connection.
344 This function returns current cipher suite used by the specified
347 @param[in] Tls Pointer to the TLS object.
348 @param[in,out] CipherId The cipher suite used by the TLS object.
350 @retval EFI_SUCCESS The cipher suite was returned successfully.
351 @retval EFI_INVALID_PARAMETER The parameter is invalid.
352 @retval EFI_UNSUPPORTED Unsupported cipher suite.
357 TlsGetCurrentCipher (
359 IN OUT UINT16
*CipherId
363 return EFI_UNSUPPORTED
;
367 Gets the compression methods used by the specified TLS connection.
369 This function returns current integrated compression methods used by
370 the specified TLS connection.
372 @param[in] Tls Pointer to the TLS object.
373 @param[in,out] CompressionId The current compression method used by
376 @retval EFI_SUCCESS The compression method was returned successfully.
377 @retval EFI_INVALID_PARAMETER The parameter is invalid.
378 @retval EFI_ABORTED Invalid Compression method.
379 @retval EFI_UNSUPPORTED This function is not supported.
384 TlsGetCurrentCompressionId (
386 IN OUT UINT8
*CompressionId
390 return EFI_UNSUPPORTED
;
394 Gets the verification mode currently set in the TLS connection.
396 This function returns the peer verification mode currently set in the
397 specified TLS connection.
399 If Tls is NULL, then ASSERT().
401 @param[in] Tls Pointer to the TLS object.
403 @return The verification mode set in the specified TLS connection.
417 Gets the session ID used by the specified TLS connection.
419 This function returns the TLS/SSL session ID currently used by the
420 specified TLS connection.
422 @param[in] Tls Pointer to the TLS object.
423 @param[in,out] SessionId Buffer to contain the returned session ID.
424 @param[in,out] SessionIdLen The length of Session ID in bytes.
426 @retval EFI_SUCCESS The Session ID was returned successfully.
427 @retval EFI_INVALID_PARAMETER The parameter is invalid.
428 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
435 IN OUT UINT8
*SessionId
,
436 IN OUT UINT16
*SessionIdLen
440 return EFI_UNSUPPORTED
;
444 Gets the client random data used in the specified TLS connection.
446 This function returns the TLS/SSL client random data currently used in
447 the specified TLS connection.
449 @param[in] Tls Pointer to the TLS object.
450 @param[in,out] ClientRandom Buffer to contain the returned client
451 random data (32 bytes).
458 IN OUT UINT8
*ClientRandom
465 Gets the server random data used in the specified TLS connection.
467 This function returns the TLS/SSL server random data currently used in
468 the specified TLS connection.
470 @param[in] Tls Pointer to the TLS object.
471 @param[in,out] ServerRandom Buffer to contain the returned server
472 random data (32 bytes).
479 IN OUT UINT8
*ServerRandom
486 Gets the master key data used in the specified TLS connection.
488 This function returns the TLS/SSL master key material currently used in
489 the specified TLS connection.
491 @param[in] Tls Pointer to the TLS object.
492 @param[in,out] KeyMaterial Buffer to contain the returned key material.
494 @retval EFI_SUCCESS Key material was returned successfully.
495 @retval EFI_INVALID_PARAMETER The parameter is invalid.
496 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
503 IN OUT UINT8
*KeyMaterial
507 return EFI_UNSUPPORTED
;
511 Gets the CA Certificate from the cert store.
513 This function returns the CA certificate for the chosen
516 @param[in] Tls Pointer to the TLS object.
517 @param[out] Data Pointer to the data buffer to receive the CA
518 certificate data sent to the client.
519 @param[in,out] DataSize The size of data buffer in bytes.
521 @retval EFI_SUCCESS The operation succeeded.
522 @retval EFI_UNSUPPORTED This function is not supported.
523 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
528 TlsGetCaCertificate (
531 IN OUT UINTN
*DataSize
535 return EFI_UNSUPPORTED
;
539 Gets the local public Certificate set in the specified TLS object.
541 This function returns the local public certificate which was currently set
542 in the specified TLS object.
544 @param[in] Tls Pointer to the TLS object.
545 @param[out] Data Pointer to the data buffer to receive the local
547 @param[in,out] DataSize The size of data buffer in bytes.
549 @retval EFI_SUCCESS The operation succeeded.
550 @retval EFI_INVALID_PARAMETER The parameter is invalid.
551 @retval EFI_NOT_FOUND The certificate is not found.
552 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
557 TlsGetHostPublicCert (
560 IN OUT UINTN
*DataSize
564 return EFI_UNSUPPORTED
;
568 Gets the local private key set in the specified TLS object.
570 This function returns the local private key data which was currently set
571 in the specified TLS object.
573 @param[in] Tls Pointer to the TLS object.
574 @param[out] Data Pointer to the data buffer to receive the local
576 @param[in,out] DataSize The size of data buffer in bytes.
578 @retval EFI_SUCCESS The operation succeeded.
579 @retval EFI_UNSUPPORTED This function is not supported.
580 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
585 TlsGetHostPrivateKey (
588 IN OUT UINTN
*DataSize
592 return EFI_UNSUPPORTED
;
596 Gets the CA-supplied certificate revocation list data set in the specified
599 This function returns the CA-supplied certificate revocation list data which
600 was currently set in the specified TLS object.
602 @param[out] Data Pointer to the data buffer to receive the CRL data.
603 @param[in,out] DataSize The size of data buffer in bytes.
605 @retval EFI_SUCCESS The operation succeeded.
606 @retval EFI_UNSUPPORTED This function is not supported.
607 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
612 TlsGetCertRevocationList (
614 IN OUT UINTN
*DataSize
618 return EFI_UNSUPPORTED
;