]>
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.
133 // MU_CHANGE - Proposed fixes for TCBZ960, invalid domain name (CN) accepted. [BEGIN]
135 Set the specified host name to be verified.
137 @param[in] Tls Pointer to the TLS object.
138 @param[in] Flags The setting flags during the validation.
139 @param[in] HostName The specified host name to be verified.
141 @retval EFI_SUCCESS The HostName setting was set successfully.
142 @retval EFI_INVALID_PARAMETER The parameter is invalid.
143 @retval EFI_ABORTED Invalid HostName setting.
155 return EFI_UNSUPPORTED
;
158 // MU_CHANGE - Proposed fixes for TCBZ960, invalid domain name (CN) accepted. [END]
161 Sets a TLS/SSL session ID to be used during TLS/SSL connect.
163 This function sets a session ID to be used when the TLS/SSL connection is
166 @param[in] Tls Pointer to the TLS object.
167 @param[in] SessionId Session ID data used for session resumption.
168 @param[in] SessionIdLen Length of Session ID in bytes.
170 @retval EFI_SUCCESS Session ID was set successfully.
171 @retval EFI_INVALID_PARAMETER The parameter is invalid.
172 @retval EFI_UNSUPPORTED No available session for ID setting.
180 IN UINT16 SessionIdLen
184 return EFI_UNSUPPORTED
;
188 Adds the CA to the cert store when requesting Server or Client authentication.
190 This function adds the CA certificate to the list of CAs when requesting
191 Server or Client authentication for the chosen TLS connection.
193 @param[in] Tls Pointer to the TLS object.
194 @param[in] Data Pointer to the data buffer of a DER-encoded binary
195 X.509 certificate or PEM-encoded X.509 certificate.
196 @param[in] DataSize The size of data buffer in bytes.
198 @retval EFI_SUCCESS The operation succeeded.
199 @retval EFI_INVALID_PARAMETER The parameter is invalid.
200 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
201 @retval EFI_ABORTED Invalid X.509 certificate.
206 TlsSetCaCertificate (
213 return EFI_UNSUPPORTED
;
217 Loads the local public certificate into the specified TLS object.
219 This function loads the X.509 certificate into the specified TLS object
222 @param[in] Tls Pointer to the TLS object.
223 @param[in] Data Pointer to the data buffer of a DER-encoded binary
224 X.509 certificate or PEM-encoded X.509 certificate.
225 @param[in] DataSize The size of data buffer in bytes.
227 @retval EFI_SUCCESS The operation succeeded.
228 @retval EFI_INVALID_PARAMETER The parameter is invalid.
229 @retval EFI_OUT_OF_RESOURCES Required resources could not be allocated.
230 @retval EFI_ABORTED Invalid X.509 certificate.
235 TlsSetHostPublicCert (
242 return EFI_UNSUPPORTED
;
246 Adds the local private key to the specified TLS object.
248 This function adds the local private key (PEM-encoded RSA or PKCS#8 private
249 key) into the specified TLS object for TLS negotiation.
251 @param[in] Tls Pointer to the TLS object.
252 @param[in] Data Pointer to the data buffer of a PEM-encoded RSA
253 or PKCS#8 private key.
254 @param[in] DataSize The size of data buffer in bytes.
256 @retval EFI_SUCCESS The operation succeeded.
257 @retval EFI_UNSUPPORTED This function is not supported.
258 @retval EFI_ABORTED Invalid private key data.
263 TlsSetHostPrivateKey (
270 return EFI_UNSUPPORTED
;
274 Adds the CA-supplied certificate revocation list for certificate validation.
276 This function adds the CA-supplied certificate revocation list data for
277 certificate validity checking.
279 @param[in] Data Pointer to the data buffer of a DER-encoded CRL data.
280 @param[in] DataSize The size of data buffer in bytes.
282 @retval EFI_SUCCESS The operation succeeded.
283 @retval EFI_UNSUPPORTED This function is not supported.
284 @retval EFI_ABORTED Invalid CRL data.
289 TlsSetCertRevocationList (
295 return EFI_UNSUPPORTED
;
299 Gets the protocol version used by the specified TLS connection.
301 This function returns the protocol version used by the specified TLS
304 If Tls is NULL, then ASSERT().
306 @param[in] Tls Pointer to the TLS object.
308 @return The protocol version of the specified TLS connection.
322 Gets the connection end of the specified TLS connection.
324 This function returns the connection end (as client or as server) used by
325 the specified TLS connection.
327 If Tls is NULL, then ASSERT().
329 @param[in] Tls Pointer to the TLS object.
331 @return The connection end used by the specified TLS connection.
336 TlsGetConnectionEnd (
345 Gets the cipher suite used by the specified TLS connection.
347 This function returns current cipher suite used by the specified
350 @param[in] Tls Pointer to the TLS object.
351 @param[in,out] CipherId The cipher suite used by the TLS object.
353 @retval EFI_SUCCESS The cipher suite was returned successfully.
354 @retval EFI_INVALID_PARAMETER The parameter is invalid.
355 @retval EFI_UNSUPPORTED Unsupported cipher suite.
360 TlsGetCurrentCipher (
362 IN OUT UINT16
*CipherId
366 return EFI_UNSUPPORTED
;
370 Gets the compression methods used by the specified TLS connection.
372 This function returns current integrated compression methods used by
373 the specified TLS connection.
375 @param[in] Tls Pointer to the TLS object.
376 @param[in,out] CompressionId The current compression method used by
379 @retval EFI_SUCCESS The compression method was returned successfully.
380 @retval EFI_INVALID_PARAMETER The parameter is invalid.
381 @retval EFI_ABORTED Invalid Compression method.
382 @retval EFI_UNSUPPORTED This function is not supported.
387 TlsGetCurrentCompressionId (
389 IN OUT UINT8
*CompressionId
393 return EFI_UNSUPPORTED
;
397 Gets the verification mode currently set in the TLS connection.
399 This function returns the peer verification mode currently set in the
400 specified TLS connection.
402 If Tls is NULL, then ASSERT().
404 @param[in] Tls Pointer to the TLS object.
406 @return The verification mode set in the specified TLS connection.
420 Gets the session ID used by the specified TLS connection.
422 This function returns the TLS/SSL session ID currently used by the
423 specified TLS connection.
425 @param[in] Tls Pointer to the TLS object.
426 @param[in,out] SessionId Buffer to contain the returned session ID.
427 @param[in,out] SessionIdLen The length of Session ID in bytes.
429 @retval EFI_SUCCESS The Session ID was returned successfully.
430 @retval EFI_INVALID_PARAMETER The parameter is invalid.
431 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
438 IN OUT UINT8
*SessionId
,
439 IN OUT UINT16
*SessionIdLen
443 return EFI_UNSUPPORTED
;
447 Gets the client random data used in the specified TLS connection.
449 This function returns the TLS/SSL client random data currently used in
450 the specified TLS connection.
452 @param[in] Tls Pointer to the TLS object.
453 @param[in,out] ClientRandom Buffer to contain the returned client
454 random data (32 bytes).
461 IN OUT UINT8
*ClientRandom
468 Gets the server random data used in the specified TLS connection.
470 This function returns the TLS/SSL server random data currently used in
471 the specified TLS connection.
473 @param[in] Tls Pointer to the TLS object.
474 @param[in,out] ServerRandom Buffer to contain the returned server
475 random data (32 bytes).
482 IN OUT UINT8
*ServerRandom
489 Gets the master key data used in the specified TLS connection.
491 This function returns the TLS/SSL master key material currently used in
492 the specified TLS connection.
494 @param[in] Tls Pointer to the TLS object.
495 @param[in,out] KeyMaterial Buffer to contain the returned key material.
497 @retval EFI_SUCCESS Key material was returned successfully.
498 @retval EFI_INVALID_PARAMETER The parameter is invalid.
499 @retval EFI_UNSUPPORTED Invalid TLS/SSL session.
506 IN OUT UINT8
*KeyMaterial
510 return EFI_UNSUPPORTED
;
514 Gets the CA Certificate from the cert store.
516 This function returns the CA certificate for the chosen
519 @param[in] Tls Pointer to the TLS object.
520 @param[out] Data Pointer to the data buffer to receive the CA
521 certificate data sent to the client.
522 @param[in,out] DataSize The size of data buffer in bytes.
524 @retval EFI_SUCCESS The operation succeeded.
525 @retval EFI_UNSUPPORTED This function is not supported.
526 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
531 TlsGetCaCertificate (
534 IN OUT UINTN
*DataSize
538 return EFI_UNSUPPORTED
;
542 Gets the local public Certificate set in the specified TLS object.
544 This function returns the local public certificate which was currently set
545 in the specified TLS object.
547 @param[in] Tls Pointer to the TLS object.
548 @param[out] Data Pointer to the data buffer to receive the local
550 @param[in,out] DataSize The size of data buffer in bytes.
552 @retval EFI_SUCCESS The operation succeeded.
553 @retval EFI_INVALID_PARAMETER The parameter is invalid.
554 @retval EFI_NOT_FOUND The certificate is not found.
555 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
560 TlsGetHostPublicCert (
563 IN OUT UINTN
*DataSize
567 return EFI_UNSUPPORTED
;
571 Gets the local private key set in the specified TLS object.
573 This function returns the local private key data which was currently set
574 in the specified TLS object.
576 @param[in] Tls Pointer to the TLS object.
577 @param[out] Data Pointer to the data buffer to receive the local
579 @param[in,out] DataSize The size of data buffer in bytes.
581 @retval EFI_SUCCESS The operation succeeded.
582 @retval EFI_UNSUPPORTED This function is not supported.
583 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
588 TlsGetHostPrivateKey (
591 IN OUT UINTN
*DataSize
595 return EFI_UNSUPPORTED
;
599 Gets the CA-supplied certificate revocation list data set in the specified
602 This function returns the CA-supplied certificate revocation list data which
603 was currently set in the specified TLS object.
605 @param[out] Data Pointer to the data buffer to receive the CRL data.
606 @param[in,out] DataSize The size of data buffer in bytes.
608 @retval EFI_SUCCESS The operation succeeded.
609 @retval EFI_UNSUPPORTED This function is not supported.
610 @retval EFI_BUFFER_TOO_SMALL The Data is too small to hold the data.
615 TlsGetCertRevocationList (
617 IN OUT UINTN
*DataSize
621 return EFI_UNSUPPORTED
;