public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Long, Qin" <qin.long@intel.com>
To: "Wu, Jiaxin" <jiaxin.wu@intel.com>,
	"edk2-devel@lists.01.org" <edk2-devel@lists.01.org>
Cc: "Ye, Ting" <ting.ye@intel.com>, "Fu, Siyuan" <siyuan.fu@intel.com>
Subject: Re: [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification.
Date: Thu, 21 Dec 2017 07:59:39 +0000	[thread overview]
Message-ID: <BF2CCE9263284D428840004653A28B6E54033D11@SHSMSX103.ccr.corp.intel.com> (raw)
In-Reply-To: <1513833401-13644-1-git-send-email-jiaxin.wu@intel.com>

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



      reply	other threads:[~2017-12-21  7:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-21  5:16 [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification Jiaxin Wu
2017-12-21  7:59 ` Long, Qin [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BF2CCE9263284D428840004653A28B6E54033D11@SHSMSX103.ccr.corp.intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox