public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: devel@edk2.groups.io, lersek@redhat.com
Cc: David Woodhouse <dwmw2@infradead.org>,
	Jian J Wang <jian.j.wang@intel.com>,
	Jiaxin Wu <jiaxin.wu@intel.com>,
	Sivaraman Nainar <sivaramann@amiindia.co.in>,
	Xiaoyu Lu <xiaoyux.lu@intel.com>
Subject: Re: [edk2-devel] [PATCH v2 2/8] CryptoPkg/TlsLib: Add the new API "TlsSetVerifyHost" (CVE-2019-14553)
Date: Sat, 26 Oct 2019 13:51:50 +0200	[thread overview]
Message-ID: <46d160b9-851d-ed02-4dab-4c3ca122d7af@redhat.com> (raw)
In-Reply-To: <20191026053719.10453-3-lersek@redhat.com>

On 10/26/19 7:37 AM, Laszlo Ersek wrote:
> From: "Wu, Jiaxin" <jiaxin.wu@intel.com>
> 
> REF: https://bugzilla.tianocore.org/show_bug.cgi?id=960
> CVE: CVE-2019-14553
> In the patch, we add the new API "TlsSetVerifyHost" for the TLS
> protocol to set the specified host name that need to be verified.
> 
> Signed-off-by: Wu Jiaxin <jiaxin.wu@intel.com>
> Reviewed-by: Ye Ting <ting.ye@intel.com>
> Reviewed-by: Long Qin <qin.long@intel.com>
> Reviewed-by: Fu Siyuan <siyuan.fu@intel.com>
> Acked-by: Laszlo Ersek <lersek@redhat.com>
> Message-Id: <20190927034441.3096-3-Jiaxin.wu@intel.com>
> Cc: David Woodhouse <dwmw2@infradead.org>
> Cc: Jian J Wang <jian.j.wang@intel.com>
> Cc: Jiaxin Wu <jiaxin.wu@intel.com>
> Cc: Sivaraman Nainar <sivaramann@amiindia.co.in>
> Cc: Xiaoyu Lu <xiaoyux.lu@intel.com>
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> Notes:
>      v2:
>      - fix whitespace in subject line
>      - drop Contributed-under line per BZ#1373
> 
>   CryptoPkg/Include/Library/TlsLib.h   | 20 +++++++++++
>   CryptoPkg/Library/TlsLib/TlsConfig.c | 38 +++++++++++++++++++-
>   2 files changed, 57 insertions(+), 1 deletion(-)
> 
> diff --git a/CryptoPkg/Include/Library/TlsLib.h b/CryptoPkg/Include/Library/TlsLib.h
> index 9875cb6e746b..3af7d4bc095e 100644
> --- a/CryptoPkg/Include/Library/TlsLib.h
> +++ b/CryptoPkg/Include/Library/TlsLib.h
> @@ -395,8 +395,28 @@ TlsSetVerify (
>     IN     VOID                     *Tls,
>     IN     UINT32                   VerifyMode
>     );
>   
> +/**
> +  Set the specified host name to be verified.
> +
> +  @param[in]  Tls           Pointer to the TLS object.
> +  @param[in]  Flags         The setting flags during the validation.
> +  @param[in]  HostName      The specified host name to be verified.
> +
> +  @retval  EFI_SUCCESS           The HostName setting was set successfully.
> +  @retval  EFI_INVALID_PARAMETER The parameter is invalid.
> +  @retval  EFI_ABORTED           Invalid HostName setting.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +TlsSetVerifyHost (
> +  IN     VOID                     *Tls,
> +  IN     UINT32                   Flags,
> +  IN     CHAR8                    *HostName
> +  );
> +
>   /**
>     Sets a TLS/SSL session ID to be used during TLS/SSL connect.
>   
>     This function sets a session ID to be used when the TLS/SSL connection is
> diff --git a/CryptoPkg/Library/TlsLib/TlsConfig.c b/CryptoPkg/Library/TlsLib/TlsConfig.c
> index 74b577d60ee3..2bf5aee7c093 100644
> --- a/CryptoPkg/Library/TlsLib/TlsConfig.c
> +++ b/CryptoPkg/Library/TlsLib/TlsConfig.c
> @@ -1,8 +1,8 @@
>   /** @file
>     SSL/TLS Configuration Library Wrapper Implementation over OpenSSL.
>   
> -Copyright (c) 2016 - 2017, Intel Corporation. All rights reserved.<BR>
> +Copyright (c) 2016 - 2018, Intel Corporation. All rights reserved.<BR>
>   (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
>   SPDX-License-Identifier: BSD-2-Clause-Patent
>   
>   **/
> @@ -496,8 +496,44 @@ TlsSetVerify (
>     //
>     SSL_set_verify (TlsConn->Ssl, VerifyMode, NULL);
>   }
>   
> +/**
> +  Set the specified host name to be verified.
> +
> +  @param[in]  Tls           Pointer to the TLS object.
> +  @param[in]  Flags         The setting flags during the validation.
> +  @param[in]  HostName      The specified host name to be verified.
> +
> +  @retval  EFI_SUCCESS           The HostName setting was set successfully.
> +  @retval  EFI_INVALID_PARAMETER The parameter is invalid.
> +  @retval  EFI_ABORTED           Invalid HostName setting.
> +
> +**/
> +EFI_STATUS
> +EFIAPI
> +TlsSetVerifyHost (
> +  IN     VOID                     *Tls,
> +  IN     UINT32                   Flags,
> +  IN     CHAR8                    *HostName
> +  )
> +{
> +  TLS_CONNECTION  *TlsConn;
> +
> +  TlsConn = (TLS_CONNECTION *) Tls;
> +  if (TlsConn == NULL || TlsConn->Ssl == NULL || HostName == NULL) {

Nitpicking, I'd check HostName first.

Reviewed-by: Philippe Mathieu-Daude <philmd@redhat.com>

> +     return EFI_INVALID_PARAMETER;
> +  }
> +
> +  SSL_set_hostflags(TlsConn->Ssl, Flags);
> +
> +  if (SSL_set1_host(TlsConn->Ssl, HostName) == 0) {
> +    return EFI_ABORTED;
> +  }
> +
> +  return EFI_SUCCESS;
> +}
> +
>   /**
>     Sets a TLS/SSL session ID to be used during TLS/SSL connect.
>   
>     This function sets a session ID to be used when the TLS/SSL connection is
> 

  reply	other threads:[~2019-10-26 11:51 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-26  5:37 [PATCH v2 0/8] support server identity validation in HTTPS Boot (CVE-2019-14553) Laszlo Ersek
2019-10-26  5:37 ` [PATCH v2 1/8] MdePkg/Include/Protocol/Tls.h: Add the data type of EfiTlsVerifyHost (CVE-2019-14553) Laszlo Ersek
2019-10-28  8:12   ` [edk2-devel] " Liming Gao
2019-10-26  5:37 ` [PATCH v2 2/8] CryptoPkg/TlsLib: Add the new API "TlsSetVerifyHost" (CVE-2019-14553) Laszlo Ersek
2019-10-26 11:51   ` Philippe Mathieu-Daudé [this message]
2019-11-02 11:01     ` [edk2-devel] " Laszlo Ersek
2019-10-28  5:28   ` Wang, Jian J
2019-10-26  5:37 ` [PATCH v2 3/8] CryptoPkg/Crt: turn strchr() into a function (CVE-2019-14553) Laszlo Ersek
2019-10-26 11:47   ` [edk2-devel] " Philippe Mathieu-Daudé
2019-10-28  5:12   ` Wang, Jian J
2019-10-26  5:37 ` [PATCH v2 4/8] CryptoPkg/Crt: satisfy "inet_pton.c" dependencies (CVE-2019-14553) Laszlo Ersek
2019-10-28  5:34   ` Wang, Jian J
2019-10-28 13:06   ` David Woodhouse
2019-10-29  0:47     ` Laszlo Ersek
2019-10-29  2:44       ` [edk2-devel] " Wu, Jiaxin
2019-10-29  3:19         ` Wang, Jian J
2019-10-26  5:37 ` [PATCH v2 5/8] CryptoPkg/Crt: import "inet_pton.c" (CVE-2019-14553) Laszlo Ersek
2019-10-28  6:16   ` Wang, Jian J
2019-10-26  5:37 ` [PATCH v2 6/8] CryptoPkg/TlsLib: TlsSetVerifyHost: parse IP address literals as such (CVE-2019-14553) Laszlo Ersek
2019-10-28  6:12   ` Wang, Jian J
2019-10-26  5:37 ` [PATCH v2 7/8] NetworkPkg/TlsDxe: Add the support of host validation to TlsDxe driver (CVE-2019-14553) Laszlo Ersek
2019-10-26  5:37 ` [PATCH v2 8/8] NetworkPkg/HttpDxe: Set the HostName for the verification (CVE-2019-14553) Laszlo Ersek
2019-10-29  2:37 ` [edk2-devel] [PATCH v2 0/8] support server identity validation in HTTPS Boot (CVE-2019-14553) Wu, Jiaxin
2019-11-02 11:15   ` Laszlo Ersek
2019-10-31  9:28 ` Laszlo Ersek
2019-11-02 11:23   ` Laszlo Ersek

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=46d160b9-851d-ed02-4dab-4c3ca122d7af@redhat.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