From: "Wang, Jian J" <jian.j.wang@intel.com>
To: Laszlo Ersek <lersek@redhat.com>,
edk2-devel-groups-io <devel@edk2.groups.io>
Cc: David Woodhouse <dwmw2@infradead.org>,
"Wu, Jiaxin" <jiaxin.wu@intel.com>,
Sivaraman Nainar <sivaramann@amiindia.co.in>,
"Lu, XiaoyuX" <xiaoyux.lu@intel.com>
Subject: Re: [PATCH v2 4/8] CryptoPkg/Crt: satisfy "inet_pton.c" dependencies (CVE-2019-14553)
Date: Mon, 28 Oct 2019 05:34:18 +0000 [thread overview]
Message-ID: <D827630B58408649ACB04F44C5100036259A2EF4@SHSMSX107.ccr.corp.intel.com> (raw)
In-Reply-To: <20191026053719.10453-5-lersek@redhat.com>
Reviewed-by: Jian J Wang <jian.j.wang@intel.com>
Regards,
Jian
> -----Original Message-----
> From: Laszlo Ersek <lersek@redhat.com>
> Sent: Saturday, October 26, 2019 1:37 PM
> To: edk2-devel-groups-io <devel@edk2.groups.io>
> Cc: David Woodhouse <dwmw2@infradead.org>; Wang, Jian J
> <jian.j.wang@intel.com>; Wu, Jiaxin <jiaxin.wu@intel.com>; Sivaraman Nainar
> <sivaramann@amiindia.co.in>; Lu, XiaoyuX <xiaoyux.lu@intel.com>
> Subject: [PATCH v2 4/8] CryptoPkg/Crt: satisfy "inet_pton.c" dependencies (CVE-
> 2019-14553)
>
> In a later patch in this series, we're going to resurrect "inet_pton.c"
> (originally from the StdLib package). That source file has a number of
> standard C and BSD socket dependencies. Provide those dependencies here:
>
> - The header files below will simply #include <CrtLibSupport.h>:
>
> - arpa/inet.h
> - arpa/nameser.h
> - netinet/in.h
> - sys/param.h
> - sys/socket.h
>
> - EAFNOSUPPORT comes from "StdLib/Include/errno.h", at commit
> e2d3a25f1a31; which is the commit immediately preceding the removal of
> StdLib from edk2 (964f432b9b0a).
>
> Note that the other error macro, which we alread #define, namely EINVAL,
> has a value (22) that also matches "StdLib/Include/errno.h".
>
> - The AF_INET and AF_INET6 address family macros come from
> "StdLib/Include/sys/socket.h".
>
> - The NS_INT16SZ, NS_INADDRSZ and NS_IN6ADDRSZ macros come from
> "StdLib/Include/arpa/nameser.h".
>
> - The "u_int" and "u_char" types come from "StdLib/Include/sys/types.h".
>
> 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>
> Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=960
> CVE: CVE-2019-14553
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
>
> Notes:
> v2:
> - new patch
>
> CryptoPkg/Library/Include/CrtLibSupport.h | 16 ++++++++++++++++
> CryptoPkg/Library/Include/arpa/inet.h | 9 +++++++++
> CryptoPkg/Library/Include/arpa/nameser.h | 9 +++++++++
> CryptoPkg/Library/Include/netinet/in.h | 9 +++++++++
> CryptoPkg/Library/Include/sys/param.h | 9 +++++++++
> CryptoPkg/Library/Include/sys/socket.h | 9 +++++++++
> 6 files changed, 61 insertions(+)
>
> diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h
> b/CryptoPkg/Library/Include/CrtLibSupport.h
> index b90da20ff7e7..e603fad763f9 100644
> --- a/CryptoPkg/Library/Include/CrtLibSupport.h
> +++ b/CryptoPkg/Library/Include/CrtLibSupport.h
> @@ -73,22 +73,38 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
> //
> // Definitions for global constants used by CRT library routines
> //
> #define EINVAL 22 /* Invalid argument */
> +#define EAFNOSUPPORT 47 /* Address family not supported by
> protocol family */
> #define INT_MAX 0x7FFFFFFF /* Maximum (signed) int value */
> #define LONG_MAX 0X7FFFFFFFL /* max value for a long */
> #define LONG_MIN (-LONG_MAX-1) /* min value for a long */
> #define ULONG_MAX 0xFFFFFFFF /* Maximum unsigned long value */
> #define CHAR_BIT 8 /* Number of bits in a char */
>
> +//
> +// Address families.
> +//
> +#define AF_INET 2 /* internetwork: UDP, TCP, etc. */
> +#define AF_INET6 24 /* IP version 6 */
> +
> +//
> +// Define constants based on RFC0883, RFC1034, RFC 1035
> +//
> +#define NS_INT16SZ 2 /*%< #/bytes of data in a u_int16_t */
> +#define NS_INADDRSZ 4 /*%< IPv4 T_A */
> +#define NS_IN6ADDRSZ 16 /*%< IPv6 T_AAAA */
> +
> //
> // Basic types mapping
> //
> typedef UINTN size_t;
> +typedef UINTN u_int;
> typedef INTN ssize_t;
> typedef INT32 time_t;
> typedef UINT8 __uint8_t;
> typedef UINT8 sa_family_t;
> +typedef UINT8 u_char;
> typedef UINT32 uid_t;
> typedef UINT32 gid_t;
>
> //
> diff --git a/CryptoPkg/Library/Include/arpa/inet.h
> b/CryptoPkg/Library/Include/arpa/inet.h
> new file mode 100644
> index 000000000000..988e4e0a73e3
> --- /dev/null
> +++ b/CryptoPkg/Library/Include/arpa/inet.h
> @@ -0,0 +1,9 @@
> +/** @file
> + Include file to support building third-party standard C / BSD sockets code.
> +
> + Copyright (C) 2019, Red Hat, Inc.
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <CrtLibSupport.h>
> diff --git a/CryptoPkg/Library/Include/arpa/nameser.h
> b/CryptoPkg/Library/Include/arpa/nameser.h
> new file mode 100644
> index 000000000000..988e4e0a73e3
> --- /dev/null
> +++ b/CryptoPkg/Library/Include/arpa/nameser.h
> @@ -0,0 +1,9 @@
> +/** @file
> + Include file to support building third-party standard C / BSD sockets code.
> +
> + Copyright (C) 2019, Red Hat, Inc.
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <CrtLibSupport.h>
> diff --git a/CryptoPkg/Library/Include/netinet/in.h
> b/CryptoPkg/Library/Include/netinet/in.h
> new file mode 100644
> index 000000000000..988e4e0a73e3
> --- /dev/null
> +++ b/CryptoPkg/Library/Include/netinet/in.h
> @@ -0,0 +1,9 @@
> +/** @file
> + Include file to support building third-party standard C / BSD sockets code.
> +
> + Copyright (C) 2019, Red Hat, Inc.
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <CrtLibSupport.h>
> diff --git a/CryptoPkg/Library/Include/sys/param.h
> b/CryptoPkg/Library/Include/sys/param.h
> new file mode 100644
> index 000000000000..988e4e0a73e3
> --- /dev/null
> +++ b/CryptoPkg/Library/Include/sys/param.h
> @@ -0,0 +1,9 @@
> +/** @file
> + Include file to support building third-party standard C / BSD sockets code.
> +
> + Copyright (C) 2019, Red Hat, Inc.
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <CrtLibSupport.h>
> diff --git a/CryptoPkg/Library/Include/sys/socket.h
> b/CryptoPkg/Library/Include/sys/socket.h
> new file mode 100644
> index 000000000000..988e4e0a73e3
> --- /dev/null
> +++ b/CryptoPkg/Library/Include/sys/socket.h
> @@ -0,0 +1,9 @@
> +/** @file
> + Include file to support building third-party standard C / BSD sockets code.
> +
> + Copyright (C) 2019, Red Hat, Inc.
> +
> + SPDX-License-Identifier: BSD-2-Clause-Patent
> +**/
> +
> +#include <CrtLibSupport.h>
> --
> 2.19.1.3.g30247aa5d201
>
next prev parent reply other threads:[~2019-10-28 5:34 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 ` [edk2-devel] " Philippe Mathieu-Daudé
2019-11-02 11:01 ` 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 [this message]
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=D827630B58408649ACB04F44C5100036259A2EF4@SHSMSX107.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