[vlc-commits] [Git][videolan/vlc][master] 4 commits: contrib: mingw64: allow some wincrypt API in Win10 19H1 UWP builds

Felix Paul Kühne (@fkuehne) gitlab at videolan.org
Sun Jun 25 20:59:49 UTC 2023



Felix Paul Kühne pushed to branch master at VideoLAN / VLC


Commits:
51b4c6f9 by Steve Lhomme at 2023-06-25T20:13:58+00:00
contrib: mingw64: allow some wincrypt API in Win10 19H1 UWP builds

- - - - -
286e1930 by Steve Lhomme at 2023-06-25T20:13:58+00:00
contrib: librist: remove unmerged bcrypt patch

We should be able to use wincrypt since we target 19H1.

- - - - -
f40641ba by Steve Lhomme at 2023-06-25T20:13:58+00:00
contrib: librist: use upstreamed patch for _WIN32_WINNT fix

It's slightly different than the initial version.

- - - - -
b8f82e45 by Steve Lhomme at 2023-06-25T20:13:58+00:00
contrib: libarchive: don't force bcrypt on Vista+

We can use the provided API's in UWP 19H1.

- - - - -


11 changed files:

- − contrib/src/libarchive/0009-Use-Windows-bcrypt-when-enabled-and-building-for-Vis.patch
- contrib/src/libarchive/rules.mak
- − contrib/src/librist/0001-Use-bcrypt-on-Windows-Vista.patch
- contrib/src/librist/0001-meson-don-t-force-the-Windows-version-if-it-s-higher.patch
- contrib/src/librist/rules.mak
- + contrib/src/mingw64/0001-headers-allow-CryptAcquireContext-in-Win10-RS4-UWP-b.patch
- + contrib/src/mingw64/0002-headers-allow-CryptGenRandom-in-Win10-19H1-UWP-build.patch
- + contrib/src/mingw64/0003-headers-allow-more-wincrypt-API-s-in-Win10-RS4-UWP-b.patch
- + contrib/src/mingw64/0004-headers-allow-more-wincrypt-API-s-in-Win10-19H1-UWP-.patch
- + contrib/src/mingw64/0005-crt-use-wincrypt-API-from-windowsapp-in-Windows-10.patch
- contrib/src/mingw64/rules.mak


Changes:

=====================================
contrib/src/libarchive/0009-Use-Windows-bcrypt-when-enabled-and-building-for-Vis.patch deleted
=====================================
@@ -1,349 +0,0 @@
-From 9817dab89dc01ea42e48e0fa38e721c63cc0bd5c Mon Sep 17 00:00:00 2001
-From: Steve Lhomme <robux4 at ycbcr.xyz>
-Date: Fri, 26 May 2023 11:58:48 +0200
-Subject: [PATCH 9/9] Use Windows bcrypt when enabled and building for Vista+
-
-The wincrypt API is deprecated and is not allowed in UWP builds.
-We can use the more modern bcrypt API which has equivalent calls.
----
- libarchive/archive_digest.c         | 60 +++++++++++++++++++++++++++++
- libarchive/archive_digest_private.h | 10 +++++
- libarchive/archive_random.c         | 28 +++++++++++++-
- libarchive/archive_util.c           | 42 ++++++++++++++++++--
- 4 files changed, 135 insertions(+), 5 deletions(-)
-
-diff --git a/libarchive/archive_digest.c b/libarchive/archive_digest.c
-index a7bd5f02..cd9b3f9d 100644
---- a/libarchive/archive_digest.c
-+++ b/libarchive/archive_digest.c
-@@ -36,6 +36,11 @@
- #error Cannot use both OpenSSL and libmd.
- #endif
- 
-+/* Common in other bcrypt implementations, but missing from VS2008. */
-+#ifndef BCRYPT_SUCCESS
-+#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
-+#endif
-+
- /*
-  * Message digest functions for Windows platform.
-  */
-@@ -48,6 +53,26 @@
- /*
-  * Initialize a Message digest.
-  */
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+static int
-+win_crypto_init(Digest_CTX *ctx, const WCHAR *algo)
-+{
-+	NTSTATUS status;
-+	ctx->valid = 0;
-+
-+	status = BCryptOpenAlgorithmProvider(&ctx->hAlg, algo, NULL, 0);
-+	if (!BCRYPT_SUCCESS(status))
-+		return (ARCHIVE_FAILED);
-+	status = BCryptCreateHash(ctx->hAlg, &ctx->hHash, NULL, 0, NULL, 0, 0);
-+	if (!BCRYPT_SUCCESS(status)) {
-+		BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
-+		return (ARCHIVE_FAILED);
-+	}
-+
-+	ctx->valid = 1;
-+	return (ARCHIVE_OK);
-+}
-+#else
- static int
- win_crypto_init(Digest_CTX *ctx, ALG_ID algId)
- {
-@@ -70,6 +95,7 @@ win_crypto_init(Digest_CTX *ctx, ALG_ID algId)
- 	ctx->valid = 1;
- 	return (ARCHIVE_OK);
- }
-+#endif
- 
- /*
-  * Update a Message digest.
-@@ -81,23 +107,37 @@ win_crypto_Update(Digest_CTX *ctx, const unsigned char *buf, size_t len)
- 	if (!ctx->valid)
- 		return (ARCHIVE_FAILED);
- 
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+	BCryptHashData(ctx->hHash,
-+		      (PUCHAR)(uintptr_t)buf,
-+		      len, 0);
-+#else
- 	CryptHashData(ctx->hash,
- 		      (unsigned char *)(uintptr_t)buf,
- 		      (DWORD)len, 0);
-+#endif
- 	return (ARCHIVE_OK);
- }
- 
- static int
- win_crypto_Final(unsigned char *buf, size_t bufsize, Digest_CTX *ctx)
- {
-+#if !(defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA)
- 	DWORD siglen = (DWORD)bufsize;
-+#endif
- 
- 	if (!ctx->valid)
- 		return (ARCHIVE_FAILED);
- 
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+	BCryptFinishHash(ctx->hHash, buf, (ULONG)bufsize, 0);
-+	BCryptDestroyHash(ctx->hHash);
-+	BCryptCloseAlgorithmProvider(ctx->hAlg, 0);
-+#else
- 	CryptGetHashParam(ctx->hash, HP_HASHVAL, buf, &siglen, 0);
- 	CryptDestroyHash(ctx->hash);
- 	CryptReleaseContext(ctx->cryptProv, 0);
-+#endif
- 	ctx->valid = 0;
- 	return (ARCHIVE_OK);
- }
-@@ -276,7 +316,11 @@ __archive_md5final(archive_md5_ctx *ctx, void *md)
- static int
- __archive_md5init(archive_md5_ctx *ctx)
- {
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+  return (win_crypto_init(ctx, BCRYPT_MD5_ALGORITHM));
-+#else
-   return (win_crypto_init(ctx, CALG_MD5));
-+#endif
- }
- 
- static int
-@@ -659,7 +703,11 @@ __archive_sha1final(archive_sha1_ctx *ctx, void *md)
- static int
- __archive_sha1init(archive_sha1_ctx *ctx)
- {
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+  return (win_crypto_init(ctx, BCRYPT_SHA1_ALGORITHM));
-+#else
-   return (win_crypto_init(ctx, CALG_SHA1));
-+#endif
- }
- 
- static int
-@@ -919,7 +967,11 @@ __archive_sha256final(archive_sha256_ctx *ctx, void *md)
- static int
- __archive_sha256init(archive_sha256_ctx *ctx)
- {
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+  return (win_crypto_init(ctx, BCRYPT_SHA256_ALGORITHM));
-+#else
-   return (win_crypto_init(ctx, CALG_SHA_256));
-+#endif
- }
- 
- static int
-@@ -1155,7 +1207,11 @@ __archive_sha384final(archive_sha384_ctx *ctx, void *md)
- static int
- __archive_sha384init(archive_sha384_ctx *ctx)
- {
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+  return (win_crypto_init(ctx, BCRYPT_SHA384_ALGORITHM));
-+#else
-   return (win_crypto_init(ctx, CALG_SHA_384));
-+#endif
- }
- 
- static int
-@@ -1415,7 +1471,11 @@ __archive_sha512final(archive_sha512_ctx *ctx, void *md)
- static int
- __archive_sha512init(archive_sha512_ctx *ctx)
- {
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+  return (win_crypto_init(ctx, BCRYPT_SHA512_ALGORITHM));
-+#else
-   return (win_crypto_init(ctx, CALG_SHA_512));
-+#endif
- }
- 
- static int
-diff --git a/libarchive/archive_digest_private.h b/libarchive/archive_digest_private.h
-index 9b3bd662..339b4edc 100644
---- a/libarchive/archive_digest_private.h
-+++ b/libarchive/archive_digest_private.h
-@@ -164,6 +164,15 @@
-   defined(ARCHIVE_CRYPTO_SHA256_WIN) ||\
-   defined(ARCHIVE_CRYPTO_SHA384_WIN) ||\
-   defined(ARCHIVE_CRYPTO_SHA512_WIN)
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+/* don't use bcrypt when XP needs to be supported */
-+#include <bcrypt.h>
-+typedef struct {
-+  int   valid;
-+  BCRYPT_ALG_HANDLE  hAlg;
-+  BCRYPT_HASH_HANDLE hHash;
-+} Digest_CTX;
-+#else
- #include <windows.h>
- #include <wincrypt.h>
- typedef struct {
-@@ -172,6 +181,7 @@ typedef struct {
-   HCRYPTHASH  hash;
- } Digest_CTX;
- #endif
-+#endif
- 
- /* typedefs */
- #if defined(ARCHIVE_CRYPTO_MD5_LIBC)
-diff --git a/libarchive/archive_random.c b/libarchive/archive_random.c
-index 9d1aa493..57d57e10 100644
---- a/libarchive/archive_random.c
-+++ b/libarchive/archive_random.c
-@@ -58,9 +58,20 @@ static void arc4random_buf(void *, size_t);
- #include "archive.h"
- #include "archive_random_private.h"
- 
--#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+/* don't use bcrypt when XP needs to be supported */
-+#include <bcrypt.h>
-+
-+/* Common in other bcrypt implementations, but missing from VS2008. */
-+#ifndef BCRYPT_SUCCESS
-+#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
-+#endif
-+
-+#elif defined(HAVE_WINCRYPT_H)
- #include <wincrypt.h>
- #endif
-+#endif
- 
- #ifndef O_CLOEXEC
- #define O_CLOEXEC	0
-@@ -75,6 +86,20 @@ int
- archive_random(void *buf, size_t nbytes)
- {
- #if defined(_WIN32) && !defined(__CYGWIN__)
-+# if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+	NTSTATUS status;
-+	BCRYPT_ALG_HANDLE hAlg;
-+
-+	status = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM, NULL, 0);
-+	if (!BCRYPT_SUCCESS(status))
-+		return ARCHIVE_FAILED;
-+	status = BCryptGenRandom(hAlg, buf, nbytes, 0);
-+	BCryptCloseAlgorithmProvider(hAlg, 0);
-+	if (!BCRYPT_SUCCESS(status))
-+		return ARCHIVE_FAILED;
-+
-+	return ARCHIVE_OK;
-+# else
- 	HCRYPTPROV hProv;
- 	BOOL success;
- 
-@@ -92,6 +117,7 @@ archive_random(void *buf, size_t nbytes)
- 	}
- 	/* TODO: Does this case really happen? */
- 	return ARCHIVE_FAILED;
-+# endif
- #else
- 	arc4random_buf(buf, nbytes);
- 	return ARCHIVE_OK;
-diff --git a/libarchive/archive_util.c b/libarchive/archive_util.c
-index 17123b94..40603c48 100644
---- a/libarchive/archive_util.c
-+++ b/libarchive/archive_util.c
-@@ -42,9 +42,20 @@ __FBSDID("$FreeBSD: head/lib/libarchive/archive_util.c 201098 2009-12-28 02:58:1
- #ifdef HAVE_STRING_H
- #include <string.h>
- #endif
--#if defined(HAVE_WINCRYPT_H) && !defined(__CYGWIN__)
-+#if defined(_WIN32) && !defined(__CYGWIN__)
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+/* don't use bcrypt when XP needs to be supported */
-+#include <bcrypt.h>
-+
-+/* Common in other bcrypt implementations, but missing from VS2008. */
-+#ifndef BCRYPT_SUCCESS
-+#define BCRYPT_SUCCESS(r) ((NTSTATUS)(r) == STATUS_SUCCESS)
-+#endif
-+
-+#elif defined(HAVE_WINCRYPT_H)
- #include <wincrypt.h>
- #endif
-+#endif
- #ifdef HAVE_ZLIB_H
- #include <zlib.h>
- #endif
-@@ -233,14 +244,16 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
- 		L'm', L'n', L'o', L'p', L'q', L'r', L's', L't',
- 		L'u', L'v', L'w', L'x', L'y', L'z'
- 	};
--	HCRYPTPROV hProv;
- 	struct archive_wstring temp_name;
- 	wchar_t *ws;
- 	DWORD attr;
- 	wchar_t *xp, *ep;
- 	int fd;
--
--	hProv = (HCRYPTPROV)NULL;
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+	BCRYPT_ALG_HANDLE hAlg = NULL;
-+#else
-+	HCRYPTPROV hProv = (HCRYPTPROV)NULL;
-+#endif
- 	fd = -1;
- 	ws = NULL;
- 
-@@ -314,11 +327,19 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
- 			abort();
- 	}
- 
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+	if (!BCRYPT_SUCCESS(BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RNG_ALGORITHM,
-+		NULL, 0))) {
-+		la_dosmaperr(GetLastError());
-+		goto exit_tmpfile;
-+	}
-+#else
- 	if (!CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL,
- 		CRYPT_VERIFYCONTEXT)) {
- 		la_dosmaperr(GetLastError());
- 		goto exit_tmpfile;
- 	}
-+#endif
- 
- 	for (;;) {
- 		wchar_t *p;
-@@ -329,11 +350,19 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
- 
- 		/* Generate a random file name through CryptGenRandom(). */
- 		p = xp;
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+		if (!BCRYPT_SUCCESS(BCryptGenRandom(hAlg, (PUCHAR)p,
-+		    (DWORD)(ep - p)*sizeof(wchar_t), 0))) {
-+			la_dosmaperr(GetLastError());
-+			goto exit_tmpfile;
-+		}
-+#else
- 		if (!CryptGenRandom(hProv, (DWORD)(ep - p)*sizeof(wchar_t),
- 		    (BYTE*)p)) {
- 			la_dosmaperr(GetLastError());
- 			goto exit_tmpfile;
- 		}
-+#endif
- 		for (; p < ep; p++)
- 			*p = num[((DWORD)*p) % (sizeof(num)/sizeof(num[0]))];
- 
-@@ -387,8 +416,13 @@ __archive_mktempx(const char *tmpdir, wchar_t *template)
- 			break;/* success! */
- 	}
- exit_tmpfile:
-+#if defined(HAVE_BCRYPT_H) && _WIN32_WINNT >= _WIN32_WINNT_VISTA
-+	if (hAlg != NULL)
-+		BCryptCloseAlgorithmProvider(hAlg, 0);
-+#else
- 	if (hProv != (HCRYPTPROV)NULL)
- 		CryptReleaseContext(hProv, 0);
-+#endif
- 	free(ws);
- 	if (template == temp_name.s)
- 		archive_wstring_free(&temp_name);
--- 
-2.37.3.windows.1
-


=====================================
contrib/src/libarchive/rules.mak
=====================================
@@ -9,7 +9,7 @@ endif
 
 DEPS_libarchive = zlib $(DEPS_zlib)
 ifdef HAVE_WINSTORE
-# libarchive uses CreateHardLinkW
+# libarchive uses CreateHardLinkW and wincrypt
 DEPS_libarchive += alloweduwp $(DEPS_alloweduwp)
 endif
 
@@ -45,7 +45,6 @@ libarchive: libarchive-$(LIBARCHIVE_VERSION).tar.gz .sum-libarchive
 	$(APPLY) $(SRC)/libarchive/0006-Use-CreateFile2-instead-of-CreateFileW-on-Win8-build.patch
 	$(APPLY) $(SRC)/libarchive/0007-Disable-CreateFileA-calls-in-UWP-builds.patch
 	$(APPLY) $(SRC)/libarchive/0008-Disable-program-call-with-stdin-stdout-usage-on-UWP-.patch
-	$(APPLY) $(SRC)/libarchive/0009-Use-Windows-bcrypt-when-enabled-and-building-for-Vis.patch
 	$(call pkg_static,"build/pkgconfig/libarchive.pc.in")
 	$(MOVE)
 


=====================================
contrib/src/librist/0001-Use-bcrypt-on-Windows-Vista.patch deleted
=====================================
@@ -1,90 +0,0 @@
-From e30f5842045c3894d9f46f1122c1702ba7925536 Mon Sep 17 00:00:00 2001
-From: Steve Lhomme <robux4 at ycbcr.xyz>
-Date: Tue, 23 May 2023 14:58:11 +0200
-Subject: [PATCH 1/2] Use bcrypt on Windows Vista+
-
-wincrypt is deprecated and not available in UWP.
----
- contrib/mbedtls/library/CMakeLists.txt |  2 +-
- contrib/mbedtls/library/entropy_poll.c | 23 ++++++++++++++++++++++-
- meson.build                            |  2 +-
- 3 files changed, 24 insertions(+), 3 deletions(-)
-
-diff --git a/contrib/mbedtls/library/CMakeLists.txt b/contrib/mbedtls/library/CMakeLists.txt
-index c7542b5..8ad7fb3 100644
---- a/contrib/mbedtls/library/CMakeLists.txt
-+++ b/contrib/mbedtls/library/CMakeLists.txt
-@@ -119,7 +119,7 @@ if(CMAKE_COMPILER_IS_CLANG)
- endif(CMAKE_COMPILER_IS_CLANG)
- 
- if(WIN32)
--    set(libs ${libs} ws2_32)
-+    set(libs ${libs} ws2_32 bcrypt)
- endif(WIN32)
- 
- if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
-diff --git a/contrib/mbedtls/library/entropy_poll.c b/contrib/mbedtls/library/entropy_poll.c
-index 2c1e093..bb276bb 100644
---- a/contrib/mbedtls/library/entropy_poll.c
-+++ b/contrib/mbedtls/library/entropy_poll.c
-@@ -56,15 +56,35 @@
- #define _WIN32_WINNT 0x0400
- #endif
- #include <windows.h>
-+#if _WIN32_WINNT >= 0x0600 /* _WIN32_WINNT_VISTA */
-+#include <ntstatus.h>
-+#include <bcrypt.h>
-+#else
- #include <wincrypt.h>
-+#endif
- 
- int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len,
-                            size_t *olen )
- {
--    HCRYPTPROV provider;
-     ((void) data);
-     *olen = 0;
- 
-+#if _WIN32_WINNT >= 0x0600 /* _WIN32_WINNT_VISTA */
-+    BCRYPT_ALG_HANDLE algo_handle;
-+    if( BCryptOpenAlgorithmProvider( &algo_handle, BCRYPT_RNG_ALGORITHM, NULL,
-+                                     0 ) != STATUS_SUCCESS )
-+    {
-+        return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
-+    }
-+    if( BCryptGenRandom(algo_handle, output, len, 0) != STATUS_SUCCESS )
-+    {
-+        BCryptCloseAlgorithmProvider( algo_handle, 0 );
-+        return( MBEDTLS_ERR_ENTROPY_SOURCE_FAILED );
-+    }
-+
-+    BCryptCloseAlgorithmProvider( algo_handle, 0 );
-+#else
-+    HCRYPTPROV provider;
-     if( CryptAcquireContext( &provider, NULL, NULL,
-                               PROV_RSA_FULL, CRYPT_VERIFYCONTEXT ) == FALSE )
-     {
-@@ -78,6 +98,7 @@ int mbedtls_platform_entropy_poll( void *data, unsigned char *output, size_t len
-     }
- 
-     CryptReleaseContext( provider, 0 );
-+#endif
-     *olen = len;
- 
-     return( 0 );
-diff --git a/meson.build b/meson.build
-index f8ec49b..c06be2c 100755
---- a/meson.build
-+++ b/meson.build
-@@ -63,7 +63,7 @@ have_clock_gettime = false
- threads = []
- test_args = []
- if host_machine.system() == 'windows'
--	deps += [ cc.find_library('ws2_32') ]
-+	deps += [ cc.find_library('ws2_32'), cc.find_library('bcrypt') ]
- 	add_project_arguments(['-D_WIN32_WINNT=0x0601'], language: 'c')
- 	if get_option('default_library') != 'static'
- 		add_project_arguments(['-DLIBRIST_BUILDING_DLL'], language: 'c')
--- 
-2.37.3.windows.1
-


=====================================
contrib/src/librist/0001-meson-don-t-force-the-Windows-version-if-it-s-higher.patch
=====================================
@@ -1,4 +1,4 @@
-From 673191638f6030f1822d32df159bfa64e4cea5c3 Mon Sep 17 00:00:00 2001
+From ce4c19c96fb0f90c7728fc209f3544023bb5ddcd Mon Sep 17 00:00:00 2001
 From: Steve Lhomme <robux4 at ycbcr.xyz>
 Date: Tue, 23 May 2023 15:02:15 +0200
 Subject: [PATCH 1/2] meson: don't force the Windows version if it's higher
@@ -16,22 +16,22 @@ Vista [1]. So building for a Vista target should be fine.
  1 file changed, 11 insertions(+), 1 deletion(-)
 
 diff --git a/meson.build b/meson.build
-index c06be2c..10f0acd 100755
+index f8ec49b..c2df33a 100755
 --- a/meson.build
 +++ b/meson.build
 @@ -64,7 +64,17 @@ threads = []
  test_args = []
  if host_machine.system() == 'windows'
- 	deps += [ cc.find_library('ws2_32'), cc.find_library('bcrypt') ]
+ 	deps += [ cc.find_library('ws2_32') ]
 -	add_project_arguments(['-D_WIN32_WINNT=0x0601'], language: 'c')
 +
 +windows_version_test = '''
-+#include <sdkddkver.h>
-+#if defined(_WIN32_WINNT) && _WIN32_WINNT >= 0x0600
-+# error _WIN32_WINNT toolchain default high enough
++#include <windef.h>
++#if !defined(_WIN32_WINNT) || _WIN32_WINNT < 0x0600
++# error _WIN32_WINNT toolchain default not high enough
 +#endif
 +'''
-+	if cc.compiles(windows_version_test, name: 'need _WIN32_WINNT defined to Vista')
++	if not cc.compiles(windows_version_test, name: '_WIN32_WINNT includes Vista')
 +		add_project_arguments(['-D_WIN32_WINNT=0x0600'], language: 'c')
 +	endif
 +


=====================================
contrib/src/librist/rules.mak
=====================================
@@ -11,6 +11,10 @@ DEPS_librist =
 ifdef HAVE_WIN32
 DEPS_librist += winpthreads $(DEPS_winpthreads)
 endif
+ifdef HAVE_WINSTORE
+# librist uses wincrypt
+DEPS_librist += alloweduwp $(DEPS_alloweduwp)
+endif
 
 ifeq ($(call need_pkg,"librist >= 0.2"),)
 PKGS_FOUND += librist
@@ -30,7 +34,6 @@ librist: librist-$(LIBRIST_VERSION).tar.gz .sum-librist
 	$(UNPACK)
 	$(APPLY) $(SRC)/librist/librist-fix-libcjson-meson.patch
 	$(APPLY) $(SRC)/librist/win32-timing.patch
-	$(APPLY) $(SRC)/librist/0001-Use-bcrypt-on-Windows-Vista.patch
 	$(APPLY) $(SRC)/librist/0001-meson-don-t-force-the-Windows-version-if-it-s-higher.patch
 	$(MOVE)
 


=====================================
contrib/src/mingw64/0001-headers-allow-CryptAcquireContext-in-Win10-RS4-UWP-b.patch
=====================================
@@ -0,0 +1,33 @@
+From 8c7a455ce283451a8f2cfb8ab785ec2b0b3a0f0a Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 22 Jun 2023 09:00:49 +0200
+Subject: [PATCH 1/5] headers: allow CryptAcquireContext in Win10 RS4 UWP
+ builds
+
+It's allowed by the WACK and in api-ms-win-security-cryptoapi-l1-1-0
+since the 16299/RS4 SDK.
+---
+ mingw-w64-headers/include/wincrypt.h | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/mingw-w64-headers/include/wincrypt.h b/mingw-w64-headers/include/wincrypt.h
+index 8c719b1c5..e60e3cd23 100644
+--- a/mingw-w64-headers/include/wincrypt.h
++++ b/mingw-w64-headers/include/wincrypt.h
+@@ -773,10 +773,12 @@ extern "C" {
+ #endif
+ #endif
+ 
+-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || defined(WINSTORECOMPAT)
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_RS4 || defined(WINSTORECOMPAT)
+   WINIMPM WINBOOL WINAPI CryptAcquireContextA (HCRYPTPROV *phProv, LPCSTR szContainer, LPCSTR szProvider, DWORD dwProvType, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags);
+ #define CryptAcquireContext __MINGW_NAME_AW(CryptAcquireContext)
++#endif
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || defined(WINSTORECOMPAT)
+   WINIMPM WINBOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
+ #endif
+ #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/mingw64/0002-headers-allow-CryptGenRandom-in-Win10-19H1-UWP-build.patch
=====================================
@@ -0,0 +1,27 @@
+From b19b9c357d29769c7f1dd03ef0fa47315e4f2705 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 22 Jun 2023 09:03:08 +0200
+Subject: [PATCH 2/5] headers: allow CryptGenRandom in Win10 19H1 UWP builds
+
+It's allowed by the WACK and in api-ms-win-security-cryptoapi-l1-1-0
+since the 18362/19H1 SDK.
+---
+ mingw-w64-headers/include/wincrypt.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/mingw-w64-headers/include/wincrypt.h b/mingw-w64-headers/include/wincrypt.h
+index e60e3cd23..05fd577fb 100644
+--- a/mingw-w64-headers/include/wincrypt.h
++++ b/mingw-w64-headers/include/wincrypt.h
+@@ -778,7 +778,7 @@ extern "C" {
+   WINIMPM WINBOOL WINAPI CryptAcquireContextW (HCRYPTPROV *phProv, LPCWSTR szContainer, LPCWSTR szProvider, DWORD dwProvType, DWORD dwFlags);
+ #define CryptAcquireContext __MINGW_NAME_AW(CryptAcquireContext)
+ #endif
+-#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || defined(WINSTORECOMPAT)
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_19H1 || defined(WINSTORECOMPAT)
+   WINIMPM WINBOOL WINAPI CryptGenRandom (HCRYPTPROV hProv, DWORD dwLen, BYTE *pbBuffer);
+ #endif
+ #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_APP)
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/mingw64/0003-headers-allow-more-wincrypt-API-s-in-Win10-RS4-UWP-b.patch
=====================================
@@ -0,0 +1,94 @@
+From 50d55a75c1513a1f2751c49bf87e76e90f7adff9 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 22 Jun 2023 08:52:51 +0200
+Subject: [PATCH 3/5] headers: allow more wincrypt API's in Win10 RS4 UWP
+ builds
+
+The API's are allowed in windowsapp since RS4 and are allowed by the WACK.
+Only the MS header don't specify it properly for WINAPI_FAMILY_PC_APP
+but since the DLL is on all WINAPI_FAMILY_DESKTOP_APP and allowed by the
+WACK this always works.
+
+CMS_DH_KEY_INFO is needed by CryptSetKeyParam().
+---
+ mingw-w64-headers/include/wincrypt.h | 42 +++++++++++++++-------------
+ 1 file changed, 23 insertions(+), 19 deletions(-)
+
+diff --git a/mingw-w64-headers/include/wincrypt.h b/mingw-w64-headers/include/wincrypt.h
+index 05fd577fb..4bcc3ff70 100644
+--- a/mingw-w64-headers/include/wincrypt.h
++++ b/mingw-w64-headers/include/wincrypt.h
+@@ -785,6 +785,29 @@ extern "C" {
+   WINIMPM WINBOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
+ #endif
+ #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
++#define CryptEnumProviders __MINGW_NAME_AW(CryptEnumProviders)
++#define CryptEnumProviderTypes __MINGW_NAME_AW(CryptEnumProviderTypes)
++#define CryptSetProvider __MINGW_NAME_AW(CryptSetProvider)
++#define CryptSetProviderEx __MINGW_NAME_AW(CryptSetProviderEx)
++
++  WINIMPM WINBOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
++  WINIMPM WINBOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
++  WINIMPM WINBOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
++  WINIMPM WINBOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
++  WINIMPM WINBOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
++  WINIMPM WINBOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szTypeName, DWORD *pcbTypeName);
++  WINIMPM WINBOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szTypeName, DWORD *pcbTypeName);
++  WINIMPM WINBOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szProvName, DWORD *pcbProvName);
++  WINIMPM WINBOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szProvName, DWORD *pcbProvName);
++  WINIMPM WINBOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
++  WINIMPM WINBOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
++  WINIMPM WINBOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash);
++#if NTDDI_VERSION >= NTDDI_WS03
++  WINBOOL __cdecl GetEncSChannel (BYTE **pData, DWORD *dwDecSize);
++#endif
++#endif
++
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_RS4
+   typedef struct _CMS_DH_KEY_INFO {
+     DWORD dwVersion;
+     ALG_ID Algid;
+@@ -795,11 +818,7 @@ extern "C" {
+ 
+ #define CryptSignHash __MINGW_NAME_AW(CryptSignHash)
+ #define CryptVerifySignature __MINGW_NAME_AW(CryptVerifySignature)
+-#define CryptSetProvider __MINGW_NAME_AW(CryptSetProvider)
+-#define CryptSetProviderEx __MINGW_NAME_AW(CryptSetProviderEx)
+ #define CryptGetDefaultProvider __MINGW_NAME_AW(CryptGetDefaultProvider)
+-#define CryptEnumProviderTypes __MINGW_NAME_AW(CryptEnumProviderTypes)
+-#define CryptEnumProviders __MINGW_NAME_AW(CryptEnumProviders)
+ 
+   WINIMPM WINBOOL WINAPI CryptGenKey (HCRYPTPROV hProv, ALG_ID Algid, DWORD dwFlags, HCRYPTKEY *phKey);
+   WINIMPM WINBOOL WINAPI CryptDeriveKey (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTHASH hBaseData, DWORD dwFlags, HCRYPTKEY *phKey);
+@@ -817,28 +836,13 @@ extern "C" {
+   WINIMPM WINBOOL WINAPI CryptDecrypt (HCRYPTKEY hKey, HCRYPTHASH hHash, WINBOOL Final, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen);
+   WINIMPM WINBOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey, DWORD dwFlags, HCRYPTHASH *phHash);
+   WINIMPM WINBOOL WINAPI CryptHashData (HCRYPTHASH hHash, CONST BYTE *pbData, DWORD dwDataLen, DWORD dwFlags);
+-  WINIMPM WINBOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptDestroyHash (HCRYPTHASH hHash);
+   WINIMPM WINBOOL WINAPI CryptSignHashA (HCRYPTHASH hHash, DWORD dwKeySpec, LPCSTR szDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
+   WINIMPM WINBOOL WINAPI CryptSignHashW (HCRYPTHASH hHash, DWORD dwKeySpec, LPCWSTR szDescription, DWORD dwFlags, BYTE *pbSignature, DWORD *pdwSigLen);
+   WINIMPM WINBOOL WINAPI CryptVerifySignatureA (HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCSTR szDescription, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptVerifySignatureW (HCRYPTHASH hHash, CONST BYTE *pbSignature, DWORD dwSigLen, HCRYPTKEY hPubKey, LPCWSTR szDescription, DWORD dwFlags);
+-  WINIMPM WINBOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
+-  WINIMPM WINBOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
+-  WINIMPM WINBOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
+-  WINIMPM WINBOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptGetDefaultProviderA (DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags, LPSTR pszProvName, DWORD *pcbProvName);
+   WINIMPM WINBOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
+-  WINIMPM WINBOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szTypeName, DWORD *pcbTypeName);
+-  WINIMPM WINBOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szTypeName, DWORD *pcbTypeName);
+-  WINIMPM WINBOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szProvName, DWORD *pcbProvName);
+-  WINIMPM WINBOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szProvName, DWORD *pcbProvName);
+-  WINIMPM WINBOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
+-  WINIMPM WINBOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
+-  WINIMPM WINBOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash);
+-#if NTDDI_VERSION >= NTDDI_WS03
+-  WINBOOL __cdecl GetEncSChannel (BYTE **pData, DWORD *dwDecSize);
+-#endif
+ #endif
+ 
+ #ifndef _DDK_DRIVER_
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/mingw64/0004-headers-allow-more-wincrypt-API-s-in-Win10-19H1-UWP-.patch
=====================================
@@ -0,0 +1,60 @@
+From 920f2e29b1a3a296f6863bcd26179094aa94535a Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 22 Jun 2023 10:53:22 +0200
+Subject: [PATCH 4/5] headers: allow more wincrypt API's in Win10 19H1 UWP
+ builds
+
+The API's are allowed in windowsapp since 19H1 and are allowed by the WACK.
+Only the MS header don't specify it properly for WINAPI_FAMILY_PC_APP
+but since the DLL is on all WINAPI_FAMILY_DESKTOP_APP and allowed by the
+WACK this always works.
+---
+ mingw-w64-headers/include/wincrypt.h | 14 +++++++++-----
+ 1 file changed, 9 insertions(+), 5 deletions(-)
+
+diff --git a/mingw-w64-headers/include/wincrypt.h b/mingw-w64-headers/include/wincrypt.h
+index 4bcc3ff70..475ef7883 100644
+--- a/mingw-w64-headers/include/wincrypt.h
++++ b/mingw-w64-headers/include/wincrypt.h
+@@ -785,22 +785,17 @@ extern "C" {
+   WINIMPM WINBOOL WINAPI CryptReleaseContext (HCRYPTPROV hProv, DWORD dwFlags);
+ #endif
+ #if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP)
+-#define CryptEnumProviders __MINGW_NAME_AW(CryptEnumProviders)
+ #define CryptEnumProviderTypes __MINGW_NAME_AW(CryptEnumProviderTypes)
+ #define CryptSetProvider __MINGW_NAME_AW(CryptSetProvider)
+ #define CryptSetProviderEx __MINGW_NAME_AW(CryptSetProviderEx)
+ 
+   WINIMPM WINBOOL WINAPI CryptHashSessionKey (HCRYPTHASH hHash, HCRYPTKEY hKey, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptSetProviderA (LPCSTR pszProvName, DWORD dwProvType);
+-  WINIMPM WINBOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
+   WINIMPM WINBOOL WINAPI CryptSetProviderExA (LPCSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptSetProviderExW (LPCWSTR pszProvName, DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags);
+   WINIMPM WINBOOL WINAPI CryptEnumProviderTypesA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szTypeName, DWORD *pcbTypeName);
+   WINIMPM WINBOOL WINAPI CryptEnumProviderTypesW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szTypeName, DWORD *pcbTypeName);
+-  WINIMPM WINBOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szProvName, DWORD *pcbProvName);
+-  WINIMPM WINBOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szProvName, DWORD *pcbProvName);
+   WINIMPM WINBOOL WINAPI CryptContextAddRef (HCRYPTPROV hProv, DWORD *pdwReserved, DWORD dwFlags);
+-  WINIMPM WINBOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
+   WINIMPM WINBOOL WINAPI CryptDuplicateHash (HCRYPTHASH hHash, DWORD *pdwReserved, DWORD dwFlags, HCRYPTHASH *phHash);
+ #if NTDDI_VERSION >= NTDDI_WS03
+   WINBOOL __cdecl GetEncSChannel (BYTE **pData, DWORD *dwDecSize);
+@@ -845,6 +840,15 @@ extern "C" {
+   WINIMPM WINBOOL WINAPI CryptGetDefaultProviderW (DWORD dwProvType, DWORD *pdwReserved, DWORD dwFlags, LPWSTR pszProvName, DWORD *pcbProvName);
+ #endif
+ 
++#if WINAPI_FAMILY_PARTITION (WINAPI_PARTITION_DESKTOP) || NTDDI_VERSION >= NTDDI_WIN10_19H1
++  WINIMPM WINBOOL WINAPI CryptDuplicateKey (HCRYPTKEY hKey, DWORD *pdwReserved, DWORD dwFlags, HCRYPTKEY *phKey);
++  WINIMPM WINBOOL WINAPI CryptEnumProvidersA (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPSTR szProvName, DWORD *pcbProvName);
++  WINIMPM WINBOOL WINAPI CryptEnumProvidersW (DWORD dwIndex, DWORD *pdwReserved, DWORD dwFlags, DWORD *pdwProvType, LPWSTR szProvName, DWORD *pcbProvName);
++  WINIMPM WINBOOL WINAPI CryptSetProviderW (LPCWSTR pszProvName, DWORD dwProvType);
++
++#define CryptEnumProviders __MINGW_NAME_AW(CryptEnumProviders)
++#endif
++
+ #ifndef _DDK_DRIVER_
+   typedef ULONG_PTR HCRYPTPROV_OR_NCRYPT_KEY_HANDLE;
+   typedef ULONG_PTR HCRYPTPROV_LEGACY;
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/mingw64/0005-crt-use-wincrypt-API-from-windowsapp-in-Windows-10.patch
=====================================
@@ -0,0 +1,108 @@
+From 92d8233a063e7170c234bdfc8409689f15150d83 Mon Sep 17 00:00:00 2001
+From: Steve Lhomme <robux4 at ycbcr.xyz>
+Date: Thu, 22 Jun 2023 09:01:28 +0200
+Subject: [PATCH 5/5] crt: use wincrypt API from windowsapp in Windows 10
+
+The hidden API are found in windowsapp since the RS4/19H1 SDK. They are
+also allowed by the WACK in api-ms-win-security-cryptoapi-l1-1-0.
+That DLL has been on all Windows 10 versions [1].
+
+It's better to use the real API than using CCryptography winrt API just for
+these calls.
+
+Crypto.c is kept in the old winstorecompat when targetting Windows 8.
+
+Apps targetting UWP before 19H1 and using CryptGenRandom may not work
+if api-ms-win-security-cryptoapi-l1-1-0.dll on older Windows doesn't
+contain the entry.
+
+[1] https://learn.microsoft.com/en-us/uwp/win32-and-com/win32-apis#apis-from-api-ms-win-security-cryptoapi-l1-1-0dll
+---
+ .../lib-common/api-ms-win-security-cryptoapi-l1-1-0.def  | 9 ++++-----
+ .../lib32/api-ms-win-security-cryptoapi-l1-1-0.def       | 9 ++++-----
+ mingw-w64-libraries/winstorecompat/Makefile.am           | 1 -
+ 3 files changed, 8 insertions(+), 11 deletions(-)
+
+diff --git a/mingw-w64-crt/lib-common/api-ms-win-security-cryptoapi-l1-1-0.def b/mingw-w64-crt/lib-common/api-ms-win-security-cryptoapi-l1-1-0.def
+index 93bdb91e6..ebeeda2c5 100644
+--- a/mingw-w64-crt/lib-common/api-ms-win-security-cryptoapi-l1-1-0.def
++++ b/mingw-w64-crt/lib-common/api-ms-win-security-cryptoapi-l1-1-0.def
+@@ -2,9 +2,8 @@ LIBRARY api-ms-win-security-cryptoapi-l1-1-0
+ 
+ EXPORTS
+ 
+-; Implemented in windowsappcompat
+-;CryptAcquireContextA
+-;CryptAcquireContextW
++CryptAcquireContextA
++CryptAcquireContextW
+ CryptCreateHash
+ CryptDecrypt
+ CryptDeriveKey
+@@ -16,7 +15,7 @@ CryptEnumProvidersA
+ CryptEnumProvidersW
+ CryptExportKey
+ CryptGenKey
+-;CryptGenRandom
++CryptGenRandom
+ CryptGetDefaultProviderA
+ CryptGetDefaultProviderW
+ CryptGetHashParam
+@@ -25,7 +24,7 @@ CryptGetProvParam
+ CryptGetUserKey
+ CryptHashData
+ CryptImportKey
+-;CryptReleaseContext
++CryptReleaseContext
+ CryptSetHashParam
+ CryptSetKeyParam
+ CryptSetProviderW
+diff --git a/mingw-w64-crt/lib32/api-ms-win-security-cryptoapi-l1-1-0.def b/mingw-w64-crt/lib32/api-ms-win-security-cryptoapi-l1-1-0.def
+index e175547ec..2590c143c 100644
+--- a/mingw-w64-crt/lib32/api-ms-win-security-cryptoapi-l1-1-0.def
++++ b/mingw-w64-crt/lib32/api-ms-win-security-cryptoapi-l1-1-0.def
+@@ -2,9 +2,8 @@ LIBRARY api-ms-win-security-cryptoapi-l1-1-0
+ 
+ EXPORTS
+ 
+-; Implemented in windowsappcompat
+-;CryptAcquireContextA at 20
+-;CryptAcquireContextW at 20
++CryptAcquireContextA at 20
++CryptAcquireContextW at 20
+ CryptCreateHash at 20
+ CryptDecrypt at 24
+ CryptDeriveKey at 20
+@@ -16,7 +15,7 @@ CryptEnumProvidersA at 24
+ CryptEnumProvidersW at 24
+ CryptExportKey at 24
+ CryptGenKey at 16
+-;CryptGenRandom at 12
++CryptGenRandom at 12
+ CryptGetDefaultProviderA at 20
+ CryptGetDefaultProviderW at 20
+ CryptGetHashParam at 20
+@@ -25,7 +24,7 @@ CryptGetProvParam at 20
+ CryptGetUserKey at 12
+ CryptHashData at 16
+ CryptImportKey at 24
+-;CryptReleaseContext at 8
++CryptReleaseContext at 8
+ CryptSetHashParam at 16
+ CryptSetKeyParam at 16
+ CryptSetProviderW at 8
+diff --git a/mingw-w64-libraries/winstorecompat/Makefile.am b/mingw-w64-libraries/winstorecompat/Makefile.am
+index 8b3312312..469b28b19 100644
+--- a/mingw-w64-libraries/winstorecompat/Makefile.am
++++ b/mingw-w64-libraries/winstorecompat/Makefile.am
+@@ -59,7 +59,6 @@ libwindowsappcompat_a_SOURCES = \
+   src/GetFileSize.c \
+   src/SHGetFolderPathW.c \
+   src/QueueTimer.c \
+-  src/Crypto.c \
+   src/GetStartupInfo.c \
+   src/EnumProcessModules.c \
+   src/RtlAddFunctionTable.c \
+-- 
+2.37.3.windows.1
+


=====================================
contrib/src/mingw64/rules.mak
=====================================
@@ -73,6 +73,11 @@ mingw64: mingw-w64-v$(MINGW64_VERSION).tar.bz2 .sum-mingw64
 	$(APPLY) $(SRC)/mingw64/0015-headers-enabled-LoadLibraryEx-flags-in-Win10-19H1-UW.patch
 	$(APPLY) $(SRC)/mingw64/0016-headers-Allow-SetDllDirectoryW-A-API-in-Win10-19H1-U.patch
 	$(APPLY) $(SRC)/mingw64/0017-headers-allow-FORMAT_MESSAGE_ALLOCATE_BUFFER-in-UWP.patch
+	$(APPLY) $(SRC)/mingw64/0001-headers-allow-CryptAcquireContext-in-Win10-RS4-UWP-b.patch
+	$(APPLY) $(SRC)/mingw64/0002-headers-allow-CryptGenRandom-in-Win10-19H1-UWP-build.patch
+	$(APPLY) $(SRC)/mingw64/0003-headers-allow-more-wincrypt-API-s-in-Win10-RS4-UWP-b.patch
+	$(APPLY) $(SRC)/mingw64/0004-headers-allow-more-wincrypt-API-s-in-Win10-19H1-UWP-.patch
+	$(APPLY) $(SRC)/mingw64/0005-crt-use-wincrypt-API-from-windowsapp-in-Windows-10.patch
 	$(MOVE)
 
 .mingw64: mingw64
@@ -160,12 +165,13 @@ endif
 
 .alloweduwp: mingw64
 	install -d "$(PREFIX)/include"
-	install $</mingw-w64-headers/include/fileapi.h "$(PREFIX)/include"
-	install $</mingw-w64-headers/include/memoryapi.h "$(PREFIX)/include"
-	install $</mingw-w64-headers/include/winbase.h "$(PREFIX)/include"
+	install $</mingw-w64-headers/include/fileapi.h      "$(PREFIX)/include"
+	install $</mingw-w64-headers/include/memoryapi.h    "$(PREFIX)/include"
+	install $</mingw-w64-headers/include/winbase.h      "$(PREFIX)/include"
 	install $</mingw-w64-headers/include/libloaderapi.h "$(PREFIX)/include"
-	install $</mingw-w64-headers/include/winreg.h "$(PREFIX)/include"
-	install $</mingw-w64-headers/include/handleapi.h "$(PREFIX)/include"
+	install $</mingw-w64-headers/include/winreg.h       "$(PREFIX)/include"
+	install $</mingw-w64-headers/include/handleapi.h    "$(PREFIX)/include"
+	install $</mingw-w64-headers/include/wincrypt.h     "$(PREFIX)/include"
 
 	# Trick mingw-w64 into just building libwindowsapp.a
 	$(MAKEBUILDDIR)



View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5c6ccf768bf5be8e57e5219ea569a7821926a4bb...b8f82e459ccc0af14ce5ec24eefd07533c4ff581

-- 
View it on GitLab: https://code.videolan.org/videolan/vlc/-/compare/5c6ccf768bf5be8e57e5219ea569a7821926a4bb...b8f82e459ccc0af14ce5ec24eefd07533c4ff581
You're receiving this email because of your account on code.videolan.org.


VideoLAN code repository instance


More information about the vlc-commits mailing list