public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification.
@ 2017-12-21  5:16 Jiaxin Wu
  2017-12-21  7:59 ` Long, Qin
  0 siblings, 1 reply; 2+ messages in thread
From: Jiaxin Wu @ 2017-12-21  5:16 UTC (permalink / raw)
  To: edk2-devel; +Cc: Ye Ting, Long Qin, Fu Siyuan, Wu Jiaxin

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification.
  2017-12-21  5:16 [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification Jiaxin Wu
@ 2017-12-21  7:59 ` Long, Qin
  0 siblings, 0 replies; 2+ messages in thread
From: Long, Qin @ 2017-12-21  7:59 UTC (permalink / raw)
  To: Wu, Jiaxin, edk2-devel@lists.01.org; +Cc: Ye, Ting, Fu, Siyuan

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



^ permalink raw reply related	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2017-12-21  7:54 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-12-21  5:16 [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification Jiaxin Wu
2017-12-21  7:59 ` Long, Qin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox