[openssl-commits] [openssl] master update

Matt Caswell matt at openssl.org
Tue Aug 23 20:08:19 UTC 2016


The branch master has been updated
       via  652c52a602b4c88cfadb99e85ef175441b7f5d18 (commit)
      from  2338ad88859313922e3a861e07aec441a90464de (commit)


- Log -----------------------------------------------------------------
commit 652c52a602b4c88cfadb99e85ef175441b7f5d18
Author: Andy Polyakov <appro at openssl.org>
Date:   Tue Aug 23 09:45:03 2016 +0200

    80-test_pkcs12.t: skip the test on Windows with non-Greek locale.
    
    Test doesn't work on Windows with non-Greek locale, because of
    Win32 perl[!] limitation, not OpenSSL. For example it passes on
    Cygwin and MSYS...
    
    Reviewed-by: Matt Caswell <matt at openssl.org>

-----------------------------------------------------------------------

Summary of changes:
 test/recipes/80-test_pkcs12.t | 30 ++++++++++++++++++++----------
 1 file changed, 20 insertions(+), 10 deletions(-)

diff --git a/test/recipes/80-test_pkcs12.t b/test/recipes/80-test_pkcs12.t
index 4a65268..95d1e69 100644
--- a/test/recipes/80-test_pkcs12.t
+++ b/test/recipes/80-test_pkcs12.t
@@ -19,20 +19,28 @@ setup("test_pkcs12");
 plan skip_all => "The PKCS12 command line utility is not supported by this OpenSSL build"
     if disabled("des");
 
-plan tests => 1;
-
 my $pass = "σύνθημα γνώρισμα";
 
 my $savedcp;
-if (eval { require Win32::Console; 1; }) {
+if (eval { require Win32::API; 1; }) {
     # Trouble is that Win32 perl uses CreateProcessA, which
-    # makes it problematic to pass non-ASCII arguments. The only
-    # feasible option is to pick one language, set corresponding
-    # code page and reencode the problematic string...
+    # makes it problematic to pass non-ASCII arguments, from perl[!]
+    # that is. This is because CreateProcessA is just a wrapper for
+    # CreateProcessW and will call MultiByteToWideChar and use
+    # system default locale. Since we attempt Greek pass-phrase
+    # conversion can be done only with Greek locale.
 
-    $savedcp = Win32::Console::OutputCP();
-    Win32::Console::OutputCP(1253);
-    $pass = Encode::encode("cp1253",Encode::decode("utf-8",$pass));
+    Win32::API->Import("kernel32","UINT GetSystemDefaultLCID()");
+    if (GetSystemDefaultLCID() != 0x408) {
+        plan skip_all => "Non-Greek system locale";
+    } else {
+        # Ensure correct code page so that VERBOSE output is right.
+        Win32::API->Import("kernel32","UINT GetConsoleOutputCP()");
+        Win32::API->Import("kernel32","BOOL SetConsoleOutputCP(UINT cp)");
+        $savedcp = GetConsoleOutputCP();
+        SetConsoleOutputCP(1253);
+        $pass = Encode::encode("cp1253",Encode::decode("utf-8",$pass));
+    }
 } else {
     # Running MinGW tests transparenly under Wine apparently requires
     # UTF-8 locale...
@@ -46,10 +54,12 @@ if (eval { require Win32::Console; 1; }) {
     }
 }
 
+plan tests => 1;
+
 # just see that we can read shibboleth.pfx protected with $pass
 ok(run(app(["openssl", "pkcs12", "-noout",
             "-password", "pass:$pass",
             "-in", srctop_file("test", "shibboleth.pfx")])),
    "test_pkcs12");
 
-Win32::Console::OutputCP($savedcp) if (defined($savedcp));
+SetConsoleOutputCP($savedcp) if (defined($savedcp));


More information about the openssl-commits mailing list