public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [Patch 0/4] BaseTools: support OPENSSL_PATH has space character
@ 2017-04-19 10:18 Yonghong Zhu
  2017-04-19 10:18 ` [Patch 1/4] BaseTools/VolInfo: Update OPENSSL_PATH to support space characters Yonghong Zhu
                   ` (4 more replies)
  0 siblings, 5 replies; 6+ messages in thread
From: Yonghong Zhu @ 2017-04-19 10:18 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Update related Tools to support OPENSSL_PATH has space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>

Yonghong Zhu (4):
  BaseTools/VolInfo: Update OPENSSL_PATH to support space characters
  BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space
  BaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space
  BaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space

 BaseTools/Source/C/VolInfo/VolInfo.c                        | 13 +++++++++----
 BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py              |  2 ++
 .../Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py   |  2 ++
 .../Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py    |  2 ++
 4 files changed, 15 insertions(+), 4 deletions(-)

-- 
2.6.1.windows.1



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

* [Patch 1/4] BaseTools/VolInfo: Update OPENSSL_PATH to support space characters
  2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
@ 2017-04-19 10:18 ` Yonghong Zhu
  2017-04-19 10:18 ` [Patch 2/4] BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space Yonghong Zhu
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yonghong Zhu @ 2017-04-19 10:18 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Update OPENSSL_PATH handling to support space characters in the Path.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/C/VolInfo/VolInfo.c | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/BaseTools/Source/C/VolInfo/VolInfo.c b/BaseTools/Source/C/VolInfo/VolInfo.c
index eff5f9e..a695529 100644
--- a/BaseTools/Source/C/VolInfo/VolInfo.c
+++ b/BaseTools/Source/C/VolInfo/VolInfo.c
@@ -329,11 +329,14 @@ Returns:
       OpenSslCommand = "openssl";
       OpenSslEnv = getenv("OPENSSL_PATH");
       if (OpenSslEnv == NULL) {
         OpenSslPath = OpenSslCommand;
       } else {
-        OpenSslPath = malloc(strlen(OpenSslEnv)+strlen(OpenSslCommand)+1);
+        //
+        // We add quotes to the Openssl Path in case it has space characters
+        //
+        OpenSslPath = malloc(2+strlen(OpenSslEnv)+strlen(OpenSslCommand)+1);
         if (OpenSslPath == NULL) {
           Error (NULL, 0, 4001, "Resource", "memory cannot be allocated!");
           return GetUtilityStatus ();
         }
         CombinePath(OpenSslEnv, OpenSslCommand, OpenSslPath);
@@ -1589,15 +1592,16 @@ CombinePath (
   OUT CHAR8* NewPath
 )
 {
   UINT32 DefaultPathLen;
   UINT64 Index;
-
+  CHAR8  QuotesStr[] = "\"";
+  strcpy(NewPath, QuotesStr);
   DefaultPathLen = strlen(DefaultPath);
-  strcpy(NewPath, DefaultPath);
+  strcat(NewPath, DefaultPath);
   Index = 0;
-  for (; Index < DefaultPathLen; Index ++) {
+  for (; Index < DefaultPathLen + 1; Index ++) {
     if (NewPath[Index] == '\\' || NewPath[Index] == '/') {
       if (NewPath[Index + 1] != '\0') {
         NewPath[Index] = '/';
       }
     }
@@ -1605,10 +1609,11 @@ CombinePath (
   if (NewPath[Index -1] != '/') {
     NewPath[Index] = '/';
     NewPath[Index + 1] = '\0';
   }
   strcat(NewPath, AppendPath);
+  strcat(NewPath, QuotesStr);
   return EFI_SUCCESS;
 }
 
 EFI_STATUS
 ParseSection (
-- 
2.6.1.windows.1



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

* [Patch 2/4] BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space
  2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
  2017-04-19 10:18 ` [Patch 1/4] BaseTools/VolInfo: Update OPENSSL_PATH to support space characters Yonghong Zhu
@ 2017-04-19 10:18 ` Yonghong Zhu
  2017-04-19 10:18 ` [Patch 3/4] BaseTools: Rsa2048Sha256Sign " Yonghong Zhu
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 6+ messages in thread
From: Yonghong Zhu @ 2017-04-19 10:18 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Update Pkcs7Sign Tool to support the case that OPENSSL_PATH has space
characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
index ef79f80..de85756 100644
--- a/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
+++ b/BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py
@@ -100,10 +100,12 @@ if __name__ == '__main__':
   #
   OpenSslCommand = 'openssl'
   try:
     OpenSslPath = os.environ['OPENSSL_PATH']
     OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
+    if ' ' in OpenSslCommand:
+      OpenSslCommand = '"' + OpenSslCommand + '"'
   except:
     pass
 
   #
   # Verify that Open SSL command is available
-- 
2.6.1.windows.1



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

* [Patch 3/4] BaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space
  2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
  2017-04-19 10:18 ` [Patch 1/4] BaseTools/VolInfo: Update OPENSSL_PATH to support space characters Yonghong Zhu
  2017-04-19 10:18 ` [Patch 2/4] BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space Yonghong Zhu
@ 2017-04-19 10:18 ` Yonghong Zhu
  2017-04-19 10:18 ` [Patch 4/4] BaseTools: Rsa2048Sha256GenerateKeys " Yonghong Zhu
  2017-04-27  9:31 ` [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Gao, Liming
  4 siblings, 0 replies; 6+ messages in thread
From: Yonghong Zhu @ 2017-04-19 10:18 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Update Rsa2048Sha256Sign Tool to support the case that OPENSSL_PATH has
space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
index 4367194..1ae6ebb 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py
@@ -83,10 +83,12 @@ if __name__ == '__main__':
   #
   OpenSslCommand = 'openssl'
   try:
     OpenSslPath = os.environ['OPENSSL_PATH']
     OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
+    if ' ' in OpenSslCommand:
+      OpenSslCommand = '"' + OpenSslCommand + '"'
   except:
     pass
 
   #
   # Verify that Open SSL command is available
-- 
2.6.1.windows.1



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

* [Patch 4/4] BaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has space
  2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
                   ` (2 preceding siblings ...)
  2017-04-19 10:18 ` [Patch 3/4] BaseTools: Rsa2048Sha256Sign " Yonghong Zhu
@ 2017-04-19 10:18 ` Yonghong Zhu
  2017-04-27  9:31 ` [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Gao, Liming
  4 siblings, 0 replies; 6+ messages in thread
From: Yonghong Zhu @ 2017-04-19 10:18 UTC (permalink / raw)
  To: edk2-devel; +Cc: Liming Gao

Update Rsa2048Sha256GenerateKeys Tool to support the case that
OPENSSL_PATH has space characters.

Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
index df2d989..95a6369 100644
--- a/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
+++ b/BaseTools/Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py
@@ -62,10 +62,12 @@ if __name__ == '__main__':
   #
   OpenSslCommand = 'openssl'
   try:
     OpenSslPath = os.environ['OPENSSL_PATH']
     OpenSslCommand = os.path.join(OpenSslPath, OpenSslCommand)
+    if ' ' in OpenSslCommand:
+      OpenSslCommand = '"' + OpenSslCommand + '"'
   except:
     pass
 
   #
   # Verify that Open SSL command is available
-- 
2.6.1.windows.1



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

* Re: [Patch 0/4] BaseTools: support OPENSSL_PATH has space character
  2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
                   ` (3 preceding siblings ...)
  2017-04-19 10:18 ` [Patch 4/4] BaseTools: Rsa2048Sha256GenerateKeys " Yonghong Zhu
@ 2017-04-27  9:31 ` Gao, Liming
  4 siblings, 0 replies; 6+ messages in thread
From: Gao, Liming @ 2017-04-27  9:31 UTC (permalink / raw)
  To: Zhu, Yonghong, edk2-devel@lists.01.org

Reviewed-by: Liming Gao <liming.gao@intel.com>

>-----Original Message-----
>From: Zhu, Yonghong
>Sent: Wednesday, April 19, 2017 6:18 PM
>To: edk2-devel@lists.01.org
>Cc: Gao, Liming <liming.gao@intel.com>
>Subject: [Patch 0/4] BaseTools: support OPENSSL_PATH has space character
>
>Update related Tools to support OPENSSL_PATH has space characters.
>
>Cc: Liming Gao <liming.gao@intel.com>
>Contributed-under: TianoCore Contribution Agreement 1.0
>Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
>
>Yonghong Zhu (4):
>  BaseTools/VolInfo: Update OPENSSL_PATH to support space characters
>  BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space
>  BaseTools: Rsa2048Sha256Sign Tool to support OPENSSL_PATH has space
>  BaseTools: Rsa2048Sha256GenerateKeys to support OPENSSL_PATH has
>space
>
> BaseTools/Source/C/VolInfo/VolInfo.c                        | 13 +++++++++----
> BaseTools/Source/Python/Pkcs7Sign/Pkcs7Sign.py              |  2 ++
> .../Python/Rsa2048Sha256Sign/Rsa2048Sha256GenerateKeys.py   |  2 ++
> .../Source/Python/Rsa2048Sha256Sign/Rsa2048Sha256Sign.py    |  2 ++
> 4 files changed, 15 insertions(+), 4 deletions(-)
>
>--
>2.6.1.windows.1



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

end of thread, other threads:[~2017-04-27  9:31 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-04-19 10:18 [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Yonghong Zhu
2017-04-19 10:18 ` [Patch 1/4] BaseTools/VolInfo: Update OPENSSL_PATH to support space characters Yonghong Zhu
2017-04-19 10:18 ` [Patch 2/4] BaseTools: Pkcs7Sign Tool to support OPENSSL_PATH has space Yonghong Zhu
2017-04-19 10:18 ` [Patch 3/4] BaseTools: Rsa2048Sha256Sign " Yonghong Zhu
2017-04-19 10:18 ` [Patch 4/4] BaseTools: Rsa2048Sha256GenerateKeys " Yonghong Zhu
2017-04-27  9:31 ` [Patch 0/4] BaseTools: support OPENSSL_PATH has space character Gao, Liming

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