CryptoPkg/Include/Library/TlsLib.h | 6 ++++++ CryptoPkg/Library/TlsLib/TlsConfig.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-)
Cc: Ye Ting <ting.ye@intel.com>
Cc: Long Qin <qin.long@intel.com>
Cc: Fu Siyuan <siyuan.fu@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
---
CryptoPkg/Include/Library/TlsLib.h | 6 ++++++
CryptoPkg/Library/TlsLib/TlsConfig.c | 8 +++++++-
2 files changed, 13 insertions(+), 1 deletion(-)
diff --git a/CryptoPkg/Include/Library/TlsLib.h b/CryptoPkg/Include/Library/TlsLib.h
index b69d513..e19a38a 100644
--- a/CryptoPkg/Include/Library/TlsLib.h
+++ b/CryptoPkg/Include/Library/TlsLib.h
@@ -521,10 +521,12 @@ TlsSetCertRevocationList (
Gets the protocol version used by the specified TLS connection.
This function returns the protocol version used by the specified TLS
connection.
+ If Tls is NULL, then ASSERT().
+
@param[in] Tls Pointer to the TLS object.
@return The protocol version of the specified TLS connection.
**/
@@ -538,10 +540,12 @@ TlsGetVersion (
Gets the connection end of the specified TLS connection.
This function returns the connection end (as client or as server) used by
the specified TLS connection.
+ If Tls is NULL, then ASSERT().
+
@param[in] Tls Pointer to the TLS object.
@return The connection end used by the specified TLS connection.
**/
@@ -599,10 +603,12 @@ TlsGetCurrentCompressionId (
Gets the verification mode currently set in the TLS connection.
This function returns the peer verification mode currently set in the
specified TLS connection.
+ If Tls is NULL, then ASSERT().
+
@param[in] Tls Pointer to the TLS object.
@return The verification mode set in the specified TLS connection.
**/
diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c b/CryptoPkg/Library/TlsLib/TlsConfig.c
index 4c88229..2ffe58a 100644
--- a/CryptoPkg/Library/TlsLib/TlsConfig.c
+++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
@@ -640,10 +640,12 @@ TlsSetCertRevocationList (
Gets the protocol version used by the specified TLS connection.
This function returns the protocol version used by the specified TLS
connection.
+ If Tls is NULL, then ASSERT().
+
@param[in] Tls Pointer to the TLS object.
@return The protocol version of the specified TLS connection.
**/
@@ -666,10 +668,12 @@ TlsGetVersion (
Gets the connection end of the specified TLS connection.
This function returns the connection end (as client or as server) used by
the specified TLS connection.
+ If Tls is NULL, then ASSERT().
+
@param[in] Tls Pointer to the TLS object.
@return The connection end used by the specified TLS connection.
**/
@@ -759,10 +763,12 @@ TlsGetCurrentCompressionId (
Gets the verification mode currently set in the TLS connection.
This function returns the peer verification mode currently set in the
specified TLS connection.
+ If Tls is NULL, then ASSERT().
+
@param[in] Tls Pointer to the TLS object.
@return The verification mode set in the specified TLS connection.
**/
@@ -982,11 +988,11 @@ TlsGetHostPublicCert (
TLS_CONNECTION *TlsConn;
Cert = NULL;
TlsConn = (TLS_CONNECTION *) Tls;
- if (TlsConn == NULL || TlsConn->Ssl == NULL || DataSize == NULL) {
+ if (TlsConn == NULL || TlsConn->Ssl == NULL || DataSize == NULL || (*DataSize != 0 && Data == NULL)) {
return EFI_INVALID_PARAMETER;
}
Cert = SSL_get_certificate(TlsConn->Ssl);
if (Cert == NULL) {
--
1.9.5.msysgit.1
_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Reviewed-by: Long Qin <qin.long@intel.com> Best Regards & Thanks, LONG, Qin -----Original Message----- From: Wu, Jiaxin Sent: Thursday, December 21, 2017 1:17 PM To: edk2-devel@lists.01.org Cc: Ye, Ting <ting.ye@intel.com>; Long, Qin <qin.long@intel.com>; Fu, Siyuan <siyuan.fu@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com> Subject: [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification. Cc: Ye Ting <ting.ye@intel.com> Cc: Long Qin <qin.long@intel.com> Cc: Fu Siyuan <siyuan.fu@intel.com> Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com> --- CryptoPkg/Include/Library/TlsLib.h | 6 ++++++ CryptoPkg/Library/TlsLib/TlsConfig.c | 8 +++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/CryptoPkg/Include/Library/TlsLib.h b/CryptoPkg/Include/Library/TlsLib.h index b69d513..e19a38a 100644 --- a/CryptoPkg/Include/Library/TlsLib.h +++ b/CryptoPkg/Include/Library/TlsLib.h @@ -521,10 +521,12 @@ TlsSetCertRevocationList ( Gets the protocol version used by the specified TLS connection. This function returns the protocol version used by the specified TLS connection. + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. @return The protocol version of the specified TLS connection. **/ @@ -538,10 +540,12 @@ TlsGetVersion ( Gets the connection end of the specified TLS connection. This function returns the connection end (as client or as server) used by the specified TLS connection. + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. @return The connection end used by the specified TLS connection. **/ @@ -599,10 +603,12 @@ TlsGetCurrentCompressionId ( Gets the verification mode currently set in the TLS connection. This function returns the peer verification mode currently set in the specified TLS connection. + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. @return The verification mode set in the specified TLS connection. **/ diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c b/CryptoPkg/Library/TlsLib/TlsConfig.c index 4c88229..2ffe58a 100644 --- a/CryptoPkg/Library/TlsLib/TlsConfig.c +++ b/CryptoPkg/Library/TlsLib/TlsConfig.c @@ -640,10 +640,12 @@ TlsSetCertRevocationList ( Gets the protocol version used by the specified TLS connection. This function returns the protocol version used by the specified TLS connection. + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. @return The protocol version of the specified TLS connection. **/ @@ -666,10 +668,12 @@ TlsGetVersion ( Gets the connection end of the specified TLS connection. This function returns the connection end (as client or as server) used by the specified TLS connection. + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. @return The connection end used by the specified TLS connection. **/ @@ -759,10 +763,12 @@ TlsGetCurrentCompressionId ( Gets the verification mode currently set in the TLS connection. This function returns the peer verification mode currently set in the specified TLS connection. + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. @return The verification mode set in the specified TLS connection. **/ @@ -982,11 +988,11 @@ TlsGetHostPublicCert ( TLS_CONNECTION *TlsConn; Cert = NULL; TlsConn = (TLS_CONNECTION *) Tls; - if (TlsConn == NULL || TlsConn->Ssl == NULL || DataSize == NULL) { + if (TlsConn == NULL || TlsConn->Ssl == NULL || DataSize == NULL || (*DataSize != 0 && Data == NULL)) { return EFI_INVALID_PARAMETER; } Cert = SSL_get_certificate(TlsConn->Ssl); if (Cert == NULL) { -- 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel
© 2016 - 2025 Red Hat, Inc.