From nobody Thu May 2 03:30:31 2024 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; spf=none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) smtp.mailfrom=edk2-devel-bounces@lists.01.org Return-Path: Received: from ml01.01.org (ml01.01.org [198.145.21.10]) by mx.zohomail.com with SMTPS id 1513833408715594.1195564988881; Wed, 20 Dec 2017 21:16:48 -0800 (PST) Received: from [127.0.0.1] (localhost [IPv6:::1]) by ml01.01.org (Postfix) with ESMTP id ECCCC221ED77D; Wed, 20 Dec 2017 21:11:58 -0800 (PST) Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id D6794221ED764 for ; Wed, 20 Dec 2017 21:11:57 -0800 (PST) Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 20 Dec 2017 21:16:45 -0800 Received: from jiaxinwu-mobl2.ccr.corp.intel.com ([10.239.196.141]) by orsmga007.jf.intel.com with ESMTP; 20 Dec 2017 21:16:43 -0800 X-Original-To: edk2-devel@lists.01.org Received-SPF: none (zoho.com: 198.145.21.10 is neither permitted nor denied by domain of lists.01.org) client-ip=198.145.21.10; envelope-from=edk2-devel-bounces@lists.01.org; helo=ml01.01.org; Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.43; helo=mga05.intel.com; envelope-from=jiaxin.wu@intel.com; receiver=edk2-devel@lists.01.org X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.45,434,1508828400"; d="scan'208";a="4427322" From: Jiaxin Wu To: edk2-devel@lists.01.org Date: Thu, 21 Dec 2017 13:16:41 +0800 Message-Id: <1513833401-13644-1-git-send-email-jiaxin.wu@intel.com> X-Mailer: git-send-email 1.9.5.msysgit.1 Subject: [edk2] [Patch] CryptoPkg/TlsLib: Add some parameter check and clarification. X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ye Ting , Fu Siyuan , Wu Jiaxin , Long Qin MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Errors-To: edk2-devel-bounces@lists.01.org Sender: "edk2-devel" X-ZohoMail: RSF_4 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" Cc: Ye Ting Cc: Long Qin Cc: Fu Siyuan Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Wu Jiaxin Reviewed-by: Long Qin --- 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. =20 This function returns the protocol version used by the specified TLS connection. =20 + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. =20 @return The protocol version of the specified TLS connection. =20 **/ @@ -538,10 +540,12 @@ TlsGetVersion ( Gets the connection end of the specified TLS connection. =20 This function returns the connection end (as client or as server) used by the specified TLS connection. =20 + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. =20 @return The connection end used by the specified TLS connection. =20 **/ @@ -599,10 +603,12 @@ TlsGetCurrentCompressionId ( Gets the verification mode currently set in the TLS connection. =20 This function returns the peer verification mode currently set in the specified TLS connection. =20 + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. =20 @return The verification mode set in the specified TLS connection. =20 **/ diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c b/CryptoPkg/Library/TlsLi= b/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. =20 This function returns the protocol version used by the specified TLS connection. =20 + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. =20 @return The protocol version of the specified TLS connection. =20 **/ @@ -666,10 +668,12 @@ TlsGetVersion ( Gets the connection end of the specified TLS connection. =20 This function returns the connection end (as client or as server) used by the specified TLS connection. =20 + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. =20 @return The connection end used by the specified TLS connection. =20 **/ @@ -759,10 +763,12 @@ TlsGetCurrentCompressionId ( Gets the verification mode currently set in the TLS connection. =20 This function returns the peer verification mode currently set in the specified TLS connection. =20 + If Tls is NULL, then ASSERT(). + @param[in] Tls Pointer to the TLS object. =20 @return The verification mode set in the specified TLS connection. =20 **/ @@ -982,11 +988,11 @@ TlsGetHostPublicCert ( TLS_CONNECTION *TlsConn; =20 Cert =3D NULL; TlsConn =3D (TLS_CONNECTION *) Tls; =20 - if (TlsConn =3D=3D NULL || TlsConn->Ssl =3D=3D NULL || DataSize =3D=3D N= ULL) { + if (TlsConn =3D=3D NULL || TlsConn->Ssl =3D=3D NULL || DataSize =3D=3D N= ULL || (*DataSize !=3D 0 && Data =3D=3D NULL)) { return EFI_INVALID_PARAMETER; } =20 Cert =3D SSL_get_certificate(TlsConn->Ssl); if (Cert =3D=3D NULL) { --=20 1.9.5.msysgit.1 _______________________________________________ edk2-devel mailing list edk2-devel@lists.01.org https://lists.01.org/mailman/listinfo/edk2-devel