From nobody Tue Feb 10 03:44:23 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) client-ip=66.175.222.12; envelope-from=bounce+27952+49466+1787277+3901457@groups.io; helo=web01.groups.io; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49466+1787277+3901457@groups.io; dmarc=fail(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1572068262; cv=none; d=zoho.com; s=zohoarc; b=LreMC4mHTj2WU+rvkEXmwWUAX5rR4V0eH/NVK9kKG/zQw/+2s4ao9vApwJkH9RaIHK5hT+qr2jsy7u9Zl3sWzXliG+j5CuWxzfVCJFz1agW8BqtIZuv5V2BHTnzfvmAbt2u60+pGLI0/30h/htDBqo82hEcwA7EFpUTK0l+axX0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1572068262; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Id:List-Unsubscribe:MIME-Version:Message-ID:Reply-To:References:Sender:Subject:To; bh=qZezOGI10fX2eizQfescMx4fYrvYpk4NEDEg1ljl7qk=; b=olZ2YDonop5CqiHxWtgq2CqXa9oP5AJNpr/mvfywVuDRgBoZtadLwUVfZzJ7UyVKmeNVw2JAFstZrrFUyo4e60UYWVDLJxDjsKfdEQaE4yIGB8vJrAFltgCkUG5e1xODIHWTHR9OYazlE8lDEbO+fMK/pjN8xwRdWNJkieu8Brg= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of groups.io designates 66.175.222.12 as permitted sender) smtp.mailfrom=bounce+27952+49466+1787277+3901457@groups.io; dmarc=fail header.from= (p=none dis=none) header.from= Received: from web01.groups.io (web01.groups.io [66.175.222.12]) by mx.zohomail.com with SMTPS id 1572068262607552.2066483211598; Fri, 25 Oct 2019 22:37:42 -0700 (PDT) Return-Path: X-Received: by 127.0.0.2 with SMTP id YbtkYY1788612xXlckjDXNh9; Fri, 25 Oct 2019 22:37:41 -0700 X-Received: from us-smtp-1.mimecast.com (us-smtp-1.mimecast.com [205.139.110.120]) by mx.groups.io with SMTP id smtpd.web12.2108.1572068261049478158 for ; Fri, 25 Oct 2019 22:37:41 -0700 X-Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-234-IBSi3wV6PkiSsSN_0-Ea6Q-1; Sat, 26 Oct 2019 01:37:35 -0400 X-Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id EFF8C1800DCA; Sat, 26 Oct 2019 05:37:33 +0000 (UTC) X-Received: from lacos-laptop-7.usersys.redhat.com (ovpn-116-26.ams2.redhat.com [10.36.116.26]) by smtp.corp.redhat.com (Postfix) with ESMTP id 102E85D9CA; Sat, 26 Oct 2019 05:37:31 +0000 (UTC) From: "Laszlo Ersek" To: edk2-devel-groups-io Cc: David Woodhouse , Jian J Wang , Jiaxin Wu , Sivaraman Nainar , Xiaoyu Lu Subject: [edk2-devel] [PATCH v2 4/8] CryptoPkg/Crt: satisfy "inet_pton.c" dependencies (CVE-2019-14553) Date: Sat, 26 Oct 2019 07:37:15 +0200 Message-Id: <20191026053719.10453-5-lersek@redhat.com> In-Reply-To: <20191026053719.10453-1-lersek@redhat.com> References: <20191026053719.10453-1-lersek@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: IBSi3wV6PkiSsSN_0-Ea6Q-1 X-Mimecast-Spam-Score: 0 Precedence: Bulk List-Unsubscribe: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,lersek@redhat.com X-Gm-Message-State: RhjzRhllwvb5eqj3k0D6vbTzx1787277AA= Content-Transfer-Encoding: quoted-printable DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=groups.io; q=dns/txt; s=20140610; t=1572068261; bh=G+6L13RE9fQBwhUA4aMlBTuZnKNOtkPtMM4DCp4ern8=; h=Cc:Content-Type:Date:From:Reply-To:Subject:To; b=MkLyZdHCV/jio+vjrr4Vqv+5lwtYX6uO0tSD3wWoSvY87y6umRPs/t6n2L5rVOEiDt8 hKV0EboxVMX5+9RPEVNh4TOl8KJyuD8itx+i28dz9uWUVq8VPZoON1FBo9SsowTVKp2YB e9RsjFHu1CJotlUrTTWMCmGtnlqMYhnhTeo= X-ZohoMail-DKIM: pass (identity @groups.io) Content-Type: text/plain; charset="utf-8" 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 : - 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 Cc: Jian J Wang Cc: Jiaxin Wu Cc: Sivaraman Nainar Cc: Xiaoyu Lu Ref: https://bugzilla.tianocore.org/show_bug.cgi?id=3D960 CVE: CVE-2019-14553 Signed-off-by: Laszlo Ersek Reviewed-by: Jian J Wang --- 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 p= rotocol 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 */ =20 +// +// 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; =20 // diff --git a/CryptoPkg/Library/Include/arpa/inet.h b/CryptoPkg/Library/Incl= ude/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 co= de. + + Copyright (C) 2019, Red Hat, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include diff --git a/CryptoPkg/Library/Include/arpa/nameser.h b/CryptoPkg/Library/I= nclude/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 co= de. + + Copyright (C) 2019, Red Hat, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include diff --git a/CryptoPkg/Library/Include/netinet/in.h b/CryptoPkg/Library/Inc= lude/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 co= de. + + Copyright (C) 2019, Red Hat, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include diff --git a/CryptoPkg/Library/Include/sys/param.h b/CryptoPkg/Library/Incl= ude/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 co= de. + + Copyright (C) 2019, Red Hat, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include diff --git a/CryptoPkg/Library/Include/sys/socket.h b/CryptoPkg/Library/Inc= lude/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 co= de. + + Copyright (C) 2019, Red Hat, Inc. + + SPDX-License-Identifier: BSD-2-Clause-Patent +**/ + +#include --=20 2.19.1.3.g30247aa5d201 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#49466): https://edk2.groups.io/g/devel/message/49466 Mute This Topic: https://groups.io/mt/37952588/1787277 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/unsub [importer@patchew.org] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-