[openssl] master update

Matt Caswell matt at openssl.org
Mon Jan 4 12:15:46 UTC 2021


The branch master has been updated
       via  2c61a670ebf2f1923a3bd2ef0ee4b2fa6261eaeb (commit)
       via  ce1119265005bd254fc92395f72490c19adc707c (commit)
      from  38b57c4c5268e4db0cad6db6744bf70ce4a0e188 (commit)


- Log -----------------------------------------------------------------
commit 2c61a670ebf2f1923a3bd2ef0ee4b2fa6261eaeb
Author: Nirbheek Chauhan <nirbheek.chauhan at gmail.com>
Date:   Wed Jul 8 23:23:04 2020 +0530

    win-onecore: Build with /APPCONTAINER for UWP compat
    
    When targeting the win-onecore configuration, we must link with
    /APPCONTAINER which is a requirement for submitting apps to the
    Windows Store.
    
    Without this, the Windows App Certificate Kit will reject the app:
    https://docs.microsoft.com/en-us/cpp/build/reference/appcontainer-windows-store-app
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/12400)

commit ce1119265005bd254fc92395f72490c19adc707c
Author: Nirbheek Chauhan <nirbheek.chauhan at gmail.com>
Date:   Wed Jul 8 23:10:34 2020 +0530

    crypto/win: Don't use disallowed APIs on UWP
    
    CreateFiber and ConvertThreadToFiber are not allowed in Windows Store
    (Universal Windows Platform) apps since they have been replaced by
    their Ex variants which have a new dwFlags parameter.
    
    This flag allows the fiber to do floating-point arithmetic in the
    fiber on x86, which would silently cause corruption otherwise since
    the floating-point state is not switched by default.
    
    Switch to these "new" APIs which were added in Vista.
    
    See: https://docs.microsoft.com/en-us/windows/win32/api/winbase/nf-winbase-createfiberex#parameters
    
    Reviewed-by: Richard Levitte <levitte at openssl.org>
    Reviewed-by: Matt Caswell <matt at openssl.org>
    (Merged from https://github.com/openssl/openssl/pull/12400)

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

Summary of changes:
 Configurations/50-win-onecore.conf |  9 +++++----
 crypto/async/arch/async_win.c      |  4 ++++
 crypto/async/arch/async_win.h      | 10 +++++++++-
 3 files changed, 18 insertions(+), 5 deletions(-)

diff --git a/Configurations/50-win-onecore.conf b/Configurations/50-win-onecore.conf
index 91e77b663f..efa2c837bc 100644
--- a/Configurations/50-win-onecore.conf
+++ b/Configurations/50-win-onecore.conf
@@ -36,13 +36,14 @@ my %targets = (
         # /NODEFAULTLIB:kernel32.lib is needed, because MSVCRT.LIB has
         # hidden reference to kernel32.lib, but we don't actually want
         # it in "onecore" build.
-        lflags          => add("/NODEFAULTLIB:kernel32.lib"),
+        # /APPCONTAINER is needed for Universal Windows Platform compat
+        lflags          => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
         defines         => add("OPENSSL_SYS_WIN_CORE"),
         ex_libs         => "onecore.lib",
     },
     "VC-WIN64A-ONECORE" => {
         inherit_from    => [ "VC-WIN64A" ],
-        lflags          => add("/NODEFAULTLIB:kernel32.lib"),
+        lflags          => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
         defines         => add("OPENSSL_SYS_WIN_CORE"),
         ex_libs         => "onecore.lib",
     },
@@ -68,7 +69,7 @@ my %targets = (
         defines         => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
                                "OPENSSL_SYS_WIN_CORE"),
         bn_ops          => "BN_LLONG RC4_CHAR",
-        lflags          => add("/NODEFAULTLIB:kernel32.lib"),
+        lflags          => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
         ex_libs         => "onecore.lib",
         multilib        => "-arm",
     },
@@ -77,7 +78,7 @@ my %targets = (
         defines         => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
                                "OPENSSL_SYS_WIN_CORE"),
         bn_ops          => "SIXTY_FOUR_BIT RC4_CHAR",
-        lflags          => add("/NODEFAULTLIB:kernel32.lib"),
+        lflags          => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
         ex_libs         => "onecore.lib",
         multilib        => "-arm64",
     },
diff --git a/crypto/async/arch/async_win.c b/crypto/async/arch/async_win.c
index 0db9efe3c1..72cc27c214 100644
--- a/crypto/async/arch/async_win.c
+++ b/crypto/async/arch/async_win.c
@@ -34,7 +34,11 @@ void async_local_cleanup(void)
 
 int async_fibre_init_dispatcher(async_fibre *fibre)
 {
+# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
+    fibre->fibre = ConvertThreadToFiberEx(NULL, FIBER_FLAG_FLOAT_SWITCH);
+# else
     fibre->fibre = ConvertThreadToFiber(NULL);
+# endif
     if (fibre->fibre == NULL) {
         fibre->converted = 0;
         fibre->fibre = GetCurrentFiber();
diff --git a/crypto/async/arch/async_win.h b/crypto/async/arch/async_win.h
index 87e661d766..eb61b032e0 100644
--- a/crypto/async/arch/async_win.h
+++ b/crypto/async/arch/async_win.h
@@ -26,8 +26,16 @@ typedef struct async_fibre_st {
 
 # define async_fibre_swapcontext(o,n,r) \
         (SwitchToFiber((n)->fibre), 1)
-# define async_fibre_makecontext(c) \
+
+# if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x600
+#   define async_fibre_makecontext(c) \
+        ((c)->fibre = CreateFiberEx(0, 0, FIBER_FLAG_FLOAT_SWITCH, \
+                                    async_start_func_win, 0))
+# else
+#   define async_fibre_makecontext(c) \
         ((c)->fibre = CreateFiber(0, async_start_func_win, 0))
+# endif
+
 # define async_fibre_free(f)             (DeleteFiber((f)->fibre))
 
 int async_fibre_init_dispatcher(async_fibre *fibre);


More information about the openssl-commits mailing list