public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function
@ 2018-05-07 20:20 Laszlo Ersek
  2018-05-08  8:51 ` Long, Qin
  0 siblings, 1 reply; 3+ messages in thread
From: Laszlo Ersek @ 2018-05-07 20:20 UTC (permalink / raw)
  To: edk2-devel-01; +Cc: Qin Long, Ting Ye

The Fedora distro ships a modified OpenSSL 1.1.0 package stream. One of
their 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
OpenSSL 1.1.0 sources.

Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

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__ >= 2)
 void           abort       (void) __attribute__((__noreturn__));
 #else
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/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;
 }
 
+/* Get a value from the current environment */
+char *secure_getenv (const char *varname)
+{
+  //
+  // Null secure_getenv() function implementation to satisfy the linker, since
+  // there is no direct functionality logic dependency in present UEFI cases.
+  //
+  // From the secure_getenv() manual: 'just like getenv() except that it
+  // returns NULL in cases where "secure execution" is required'.
+  //
+  return NULL;
+}
+
 //
 // -- Stream I/O Routines --
 //
-- 
2.14.1.3.gb7cf6e02401b



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function
  2018-05-07 20:20 [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function Laszlo Ersek
@ 2018-05-08  8:51 ` Long, Qin
  2018-05-08 11:32   ` Laszlo Ersek
  0 siblings, 1 reply; 3+ messages in thread
From: Long, Qin @ 2018-05-08  8:51 UTC (permalink / raw)
  To: Laszlo Ersek, edk2-devel-01; +Cc: Ye, Ting

It's OK for me to add this NULL wrapper. 

Reviewed-by: Long Qin <qin.long@intel.com>


Best Regards & Thanks,
LONG, Qin

-----Original Message-----
From: Laszlo Ersek [mailto:lersek@redhat.com] 
Sent: Tuesday, May 8, 2018 4:21 AM
To: edk2-devel-01 <edk2-devel@lists.01.org>
Cc: Long, Qin <qin.long@intel.com>; Ye, Ting <ting.ye@intel.com>
Subject: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function

The Fedora distro ships a modified OpenSSL 1.1.0 package stream. One of their 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 OpenSSL 1.1.0 sources.

Cc: Qin Long <qin.long@intel.com>
Cc: Ting Ye <ting.ye@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Laszlo Ersek <lersek@redhat.com>
---

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__ >= 2)
 void           abort       (void) __attribute__((__noreturn__));
 #else
diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/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;
 }
 
+/* Get a value from the current environment */ char *secure_getenv 
+(const char *varname) {
+  //
+  // Null secure_getenv() function implementation to satisfy the 
+linker, since
+  // there is no direct functionality logic dependency in present UEFI cases.
+  //
+  // From the secure_getenv() manual: 'just like getenv() except that 
+it
+  // returns NULL in cases where "secure execution" is required'.
+  //
+  return NULL;
+}
+
 //
 // -- Stream I/O Routines --
 //
--
2.14.1.3.gb7cf6e02401b



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function
  2018-05-08  8:51 ` Long, Qin
@ 2018-05-08 11:32   ` Laszlo Ersek
  0 siblings, 0 replies; 3+ messages in thread
From: Laszlo Ersek @ 2018-05-08 11:32 UTC (permalink / raw)
  To: Long, Qin, edk2-devel-01; +Cc: Ye, Ting

On 05/08/18 10:51, Long, Qin wrote:
> It's OK for me to add this NULL wrapper. 
> 
> Reviewed-by: Long Qin <qin.long@intel.com>

Thank you very much!

Commit ee3198e672e2.

Laszlo

> -----Original Message-----
> From: Laszlo Ersek [mailto:lersek@redhat.com] 
> Sent: Tuesday, May 8, 2018 4:21 AM
> To: edk2-devel-01 <edk2-devel@lists.01.org>
> Cc: Long, Qin <qin.long@intel.com>; Ye, Ting <ting.ye@intel.com>
> Subject: [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function
> 
> The Fedora distro ships a modified OpenSSL 1.1.0 package stream. One of their 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 OpenSSL 1.1.0 sources.
> 
> Cc: Qin Long <qin.long@intel.com>
> Cc: Ting Ye <ting.ye@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Laszlo Ersek <lersek@redhat.com>
> ---
> 
> 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__ >= 2)
>  void           abort       (void) __attribute__((__noreturn__));
>  #else
> diff --git a/CryptoPkg/Library/BaseCryptLib/SysCall/CrtWrapper.c b/CryptoPkg/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;
>  }
>  
> +/* Get a value from the current environment */ char *secure_getenv 
> +(const char *varname) {
> +  //
> +  // Null secure_getenv() function implementation to satisfy the 
> +linker, since
> +  // there is no direct functionality logic dependency in present UEFI cases.
> +  //
> +  // From the secure_getenv() manual: 'just like getenv() except that 
> +it
> +  // returns NULL in cases where "secure execution" is required'.
> +  //
> +  return NULL;
> +}
> +
>  //
>  // -- Stream I/O Routines --
>  //
> --
> 2.14.1.3.gb7cf6e02401b
> 
> _______________________________________________
> edk2-devel mailing list
> edk2-devel@lists.01.org
> https://lists.01.org/mailman/listinfo/edk2-devel
> 



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2018-05-08 11:32 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-05-07 20:20 [PATCH] CryptoPkg/CrtLibSupport: add secure_getenv() stub function Laszlo Ersek
2018-05-08  8:51 ` Long, Qin
2018-05-08 11:32   ` Laszlo Ersek

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox