summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2020-07-08 23:29:37 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2020-07-09 13:34:08 +0530
commit0ca18f250fe98ff2b3d319929b4a38f3a575903c (patch)
treef19b57abbff566cc0214da451bf97fe32dfc5edd
parent71486c167e8b4f0a989b0ad78174fddf7d364f73 (diff)
openssl.recipe: Fix some UWP incompatibilities
These errors were reported by the Windows App Certification Kit. Part-of: <https://gitlab.freedesktop.org/gstreamer/cerbero/-/merge_requests/544>
-rw-r--r--recipes/openssl.recipe5
-rw-r--r--recipes/openssl/0001-crypto-win-Don-t-use-disallowed-APIs-on-UWP.patch51
-rw-r--r--recipes/openssl/0002-win-onecore-Build-with-APPCONTAINER-for-UWP-compat.patch57
3 files changed, 112 insertions, 1 deletions
diff --git a/recipes/openssl.recipe b/recipes/openssl.recipe
index f1ef78b5..e6305cce 100644
--- a/recipes/openssl.recipe
+++ b/recipes/openssl.recipe
@@ -27,7 +27,10 @@ class Recipe(recipe.Recipe):
# MSVC and UWP support
'openssl/0001-windows-makefile.tmpl-Generate-and-install-pkgconfig.patch',
'openssl/0002-windows-makefile.tmpl-Fix-ONECORE-build.patch',
- 'openssl/0003-windows-makefile.tmpl-Do-not-prefix-import-libraries.patch'
+ 'openssl/0003-windows-makefile.tmpl-Do-not-prefix-import-libraries.patch',
+ # https://github.com/openssl/openssl/pull/12400
+ 'openssl/0001-crypto-win-Don-t-use-disallowed-APIs-on-UWP.patch',
+ 'openssl/0002-win-onecore-Build-with-APPCONTAINER-for-UWP-compat.patch',
]
files_bins = ['openssl']
diff --git a/recipes/openssl/0001-crypto-win-Don-t-use-disallowed-APIs-on-UWP.patch b/recipes/openssl/0001-crypto-win-Don-t-use-disallowed-APIs-on-UWP.patch
new file mode 100644
index 00000000..5653c38c
--- /dev/null
+++ b/recipes/openssl/0001-crypto-win-Don-t-use-disallowed-APIs-on-UWP.patch
@@ -0,0 +1,51 @@
+From f198066024d3371be78819b18e737caf63a26aa0 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Wed, 8 Jul 2020 23:10:34 +0530
+Subject: [PATCH 1/2] 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
+---
+ crypto/async/arch/async_win.c | 2 +-
+ crypto/async/arch/async_win.h | 3 ++-
+ 2 files changed, 3 insertions(+), 2 deletions(-)
+
+diff --git a/crypto/async/arch/async_win.c b/crypto/async/arch/async_win.c
+index 1f360d8..30aa018 100644
+--- a/crypto/async/arch/async_win.c
++++ b/crypto/async/arch/async_win.c
+@@ -34,7 +34,7 @@ void async_local_cleanup(void)
+
+ int async_fibre_init_dispatcher(async_fibre *fibre)
+ {
+- fibre->fibre = ConvertThreadToFiber(NULL);
++ fibre->fibre = ConvertThreadToFiberEx(NULL, FIBER_FLAG_FLOAT_SWITCH);
+ 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 61cfdd7..9f09caa 100644
+--- a/crypto/async/arch/async_win.h
++++ b/crypto/async/arch/async_win.h
+@@ -27,7 +27,8 @@ typedef struct async_fibre_st {
+ # define async_fibre_swapcontext(o,n,r) \
+ (SwitchToFiber((n)->fibre), 1)
+ # define async_fibre_makecontext(c) \
+- ((c)->fibre = CreateFiber(0, async_start_func_win, 0))
++ ((c)->fibre = CreateFiberEx(0, 0, FIBER_FLAG_FLOAT_SWITCH, \
++ async_start_func_win, 0))
+ # define async_fibre_free(f) (DeleteFiber((f)->fibre))
+
+ int async_fibre_init_dispatcher(async_fibre *fibre);
+--
+2.26.2
+
diff --git a/recipes/openssl/0002-win-onecore-Build-with-APPCONTAINER-for-UWP-compat.patch b/recipes/openssl/0002-win-onecore-Build-with-APPCONTAINER-for-UWP-compat.patch
new file mode 100644
index 00000000..481a9631
--- /dev/null
+++ b/recipes/openssl/0002-win-onecore-Build-with-APPCONTAINER-for-UWP-compat.patch
@@ -0,0 +1,57 @@
+From c17b1751f3758890a8a5837466e4ddc1e6f2f3f0 Mon Sep 17 00:00:00 2001
+From: Nirbheek Chauhan <nirbheek@centricular.com>
+Date: Wed, 8 Jul 2020 23:23:04 +0530
+Subject: [PATCH 2/2] 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
+---
+ Configurations/50-win-onecore.conf | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/Configurations/50-win-onecore.conf b/Configurations/50-win-onecore.conf
+index c595279..fb2d961 100644
+--- a/Configurations/50-win-onecore.conf
++++ b/Configurations/50-win-onecore.conf
+@@ -16,13 +16,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",
+ },
+@@ -48,7 +49,7 @@ my %targets = (
+ defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
+ "OPENSSL_SYS_WIN_CORE"),
+ bn_ops => "BN_LLONG RC4_CHAR EXPORT_VAR_AS_FN",
+- lflags => add("/NODEFAULTLIB:kernel32.lib"),
++ lflags => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
+ ex_libs => "onecore.lib",
+ multilib => "-arm",
+ },
+@@ -57,7 +58,7 @@ my %targets = (
+ defines => add("_ARM_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE",
+ "OPENSSL_SYS_WIN_CORE"),
+ bn_ops => "SIXTY_FOUR_BIT RC4_CHAR EXPORT_VAR_AS_FN",
+- lflags => add("/NODEFAULTLIB:kernel32.lib"),
++ lflags => add("/NODEFAULTLIB:kernel32.lib /APPCONTAINER"),
+ ex_libs => "onecore.lib",
+ multilib => "-arm64",
+ },
+--
+2.26.2
+