From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received-SPF: Pass (sender SPF authorized) identity=mailfrom; client-ip=192.55.52.136; helo=mga12.intel.com; envelope-from=qin.long@intel.com; receiver=edk2-devel@lists.01.org Received: from mga12.intel.com (mga12.intel.com [192.55.52.136]) (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 B8AC9207E36DF for ; Tue, 8 May 2018 01:51:37 -0700 (PDT) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 08 May 2018 01:51:36 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,377,1520924400"; d="scan'208";a="52444286" Received: from fmsmsx103.amr.corp.intel.com ([10.18.124.201]) by fmsmga004.fm.intel.com with ESMTP; 08 May 2018 01:51:35 -0700 Received: from fmsmsx126.amr.corp.intel.com (10.18.125.43) by FMSMSX103.amr.corp.intel.com (10.18.124.201) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 8 May 2018 01:51:36 -0700 Received: from shsmsx102.ccr.corp.intel.com (10.239.4.154) by FMSMSX126.amr.corp.intel.com (10.18.125.43) with Microsoft SMTP Server (TLS) id 14.3.319.2; Tue, 8 May 2018 01:51:36 -0700 Received: from shsmsx103.ccr.corp.intel.com ([169.254.4.210]) by shsmsx102.ccr.corp.intel.com ([169.254.2.79]) with mapi id 14.03.0319.002; Tue, 8 May 2018 16:51:17 +0800 From: "Long, Qin" To: Laszlo Ersek , edk2-devel-01 CC: "Ye, Ting" Thread-Topic: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function Thread-Index: AQHT5kDvTuD/VeRpVEaQt7fgVubWhqQlhpUg Date: Tue, 8 May 2018 08:51:17 +0000 Message-ID: References: <20180507202054.1293-1-lersek@redhat.com> In-Reply-To: <20180507202054.1293-1-lersek@redhat.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.239.127.40] MIME-Version: 1.0 Subject: Re: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 08 May 2018 08:51:37 -0000 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable It's OK for me to add this NULL wrapper.=20 Reviewed-by: Long Qin Best Regards & Thanks, LONG, Qin -----Original Message----- From: Laszlo Ersek [mailto:lersek@redhat.com]=20 Sent: Tuesday, May 8, 2018 4:21 AM To: edk2-devel-01 Cc: Long, Qin ; Ye, Ting Subject: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function The Fedora distro ships a modified OpenSSL 1.1.0 package stream. One of the= ir patches calls the secure_getenv() C library function. We already have a = stub for getenv(); it applies trivially to secure_getenv() as well. Add the secure_getenv() stub so that edk2 can be built with Fedora's OpenSS= L 1.1.0 sources. Cc: Qin Long Cc: Ting Ye Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Laszlo Ersek --- Notes: Repo: https://github.com/lersek/edk2.git Branch: secure_getenv CryptoPkg/Library/Include/CrtLibSupport.h | 1 + CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/CryptoPkg/Library/Include/CrtLibSupport.h b/CryptoPkg/Library/= Include/CrtLibSupport.h index 7f1ec1230206..feaf58b0c79a 100644 --- a/CryptoPkg/Library/Include/CrtLibSupport.h +++ b/CryptoPkg/Library/Include/CrtLibSupport.h @@ -163,6 +163,7 @@ gid_t getgid (void); gid_t getegid (void); void qsort (void *, size_t, size_t, int (*)(const void *, = const void *)); char *getenv (const char *); +char *secure_getenv (const char *); #if defined(__GNUC__) && (__GNUC__ >=3D 2) void abort (void) __attribute__((__noreturn__)); #else diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPk= g/Library/BaseCryptLib/SysCall/CrtWrapper.c index 20c96563d270..9510a4a383e6 100644 --- a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c +++ b/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c @@ -361,6 +361,19 @@ char *getenv (const char *varname) return NULL; } =20 +/* Get a value from the current environment */ char *secure_getenv=20 +(const char *varname) { + // + // Null secure_getenv() function implementation to satisfy the=20 +linker, since + // there is no direct functionality logic dependency in present UEFI cas= es. + // + // From the secure_getenv() manual: 'just like getenv() except that=20 +it + // returns NULL in cases where "secure execution" is required'. + // + return NULL; +} + // // -- Stream I/O Routines -- // -- 2.14.1.3.gb7cf6e02401b