Commit 7ee5dfcc authored by Steve Lhomme's avatar Steve Lhomme

update patchset

- fix more wincrypt usage
- add QSV+chromecast patches
parent 26334e09
From 6caad9761747a9d3b24a5ac92009a93349352fbe Mon Sep 17 00:00:00 2001
From c3e0d1d05ba98a04843db251fbcea159999de7b8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Tue, 10 Feb 2015 11:58:54 +0100
Subject: [PATCH 01/22] wasapi: Don't fail if the client is already initialized
Subject: [PATCH 01/28] wasapi: Don't fail if the client is already initialized
make the extra test only for Winstore builds
---
......
From 6a58901922ad8dd94a0c51ecbe9e7fcfe20497cc Mon Sep 17 00:00:00 2001
From 7e26b4404b5164c3c04b26626d27207210580799 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 11 May 2016 17:37:47 +0200
Subject: [PATCH 02/22] gnutls: Set cannot_unload_broken_library for winrt
Subject: [PATCH 02/28] gnutls: Set cannot_unload_broken_library for winrt
---
modules/misc/gnutls.c | 3 +++
......
From 9697dcc2acfe4be995d0157d8603e94e3a056f91 Mon Sep 17 00:00:00 2001
From 3bddca74b880796c250aad691be13129f8fb1683 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Wed, 16 Apr 2014 16:09:53 +0200
Subject: [PATCH 03/22] Cheat for Windows Store subtitles
Subject: [PATCH 03/28] Cheat for Windows Store subtitles
---
lib/video.c | 5 +++++
......
From fbb521380f9d63f94273227802db6dc633a061de Mon Sep 17 00:00:00 2001
From f1a59782ccd3ff26a73cf0dc6d67606648f80714 Mon Sep 17 00:00:00 2001
From: Jean-Baptiste Kempf <jb@videolan.org>
Date: Wed, 12 Mar 2014 00:11:26 +0100
Subject: [PATCH 04/22] Accept the weird WinRT pathes
Subject: [PATCH 04/28] Accept the weird WinRT pathes
---
src/text/url.c | 5 +++++
......
From 23ca62309fd27d228f45a3bf1f6491392ef2f4e1 Mon Sep 17 00:00:00 2001
From 78dc28dca7dd0c620644f3c8df60239d0e490156 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Tue, 2 Aug 2016 18:54:28 +0200
Subject: [PATCH 05/22] config: cmdline: Use msg_* instead of fprintf
Subject: [PATCH 05/28] config: cmdline: Use msg_* instead of fprintf
---
src/config/cmdline.c | 14 +++++++-------
......
From 199c0f8d20bb7439963826e8a73a9fc4bd18c601 Mon Sep 17 00:00:00 2001
From 88a9c4a7aa767a1506cb6464595105575adbe8fb Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Fri, 30 Sep 2016 09:49:19 +0200
Subject: [PATCH 06/22] plugin cache: Windows doesn't like relative pathes in
Subject: [PATCH 06/28] plugin cache: Windows doesn't like relative pathes in
LoadLibraryEx()
Fixes "vlc-cache-gen ../modules" on Windows and general VLC_PLUGIN_PATH usage.
......
From 3f3cae2869882544bf6477175f9c50468edaf0c4 Mon Sep 17 00:00:00 2001
From 495543392a431f63d1c56201d472f590cbfcfd67 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <slhomme@matroska.org>
Date: Fri, 2 Dec 2016 11:14:40 +0100
Subject: [PATCH 07/22] TEMPORARY: disable cuda/nvenc when building for
Subject: [PATCH 07/28] TEMPORARY: disable cuda/nvenc when building for
Winstore
---
......
From 4bc96a804813af82da82eb5bfa4694f41e854b9e Mon Sep 17 00:00:00 2001
From 9d5bf6681222d5ca390bcfac84cf1b2fef101c91 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Wed, 25 Jan 2017 10:49:37 +0100
Subject: [PATCH 08/22] core: avcodec requires 32-bytes memory alignment in
Subject: [PATCH 08/28] core: avcodec requires 32-bytes memory alignment in
many cases
For example a IA0L texture on Windows is not 32 bytes aligned and avcodec
......
From 5202c1627c25477a699e14e18d36687f0d258ba1 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Hugo=20Beauz=C3=A9e-Luyssen?= <hugo@beauzee.fr>
Date: Wed, 22 Nov 2017 14:13:15 +0100
Subject: [PATCH 09/15] contrib: ffmpeg: Fix winstore build
---
contrib/src/ffmpeg/disable-wincrypt.patch | 10 ++++++++++
contrib/src/ffmpeg/rules.mak | 3 +++
2 files changed, 13 insertions(+)
create mode 100644 contrib/src/ffmpeg/disable-wincrypt.patch
diff --git a/contrib/src/ffmpeg/disable-wincrypt.patch b/contrib/src/ffmpeg/disable-wincrypt.patch
new file mode 100644
index 0000000..7c5a802
--- /dev/null
+++ b/contrib/src/ffmpeg/disable-wincrypt.patch
@@ -0,0 +1,10 @@
+--- ffmpeg/configure 2017-07-12 20:36:13.000000000 +0200
++++ ffmpeg/configure.new 2017-11-22 14:12:43.884159531 +0100
+@@ -5717,7 +5717,6 @@
+
+ check_lib ole32 "windows.h" CoTaskMemFree -lole32
+ check_lib shell32 "windows.h shellapi.h" CommandLineToArgvW -lshell32
+-check_lib wincrypt "windows.h wincrypt.h" CryptGenRandom -ladvapi32
+ check_lib psapi "windows.h psapi.h" GetProcessMemoryInfo -lpsapi
+
+ check_lib coreservices "CoreServices/CoreServices.h" UTGetOSTypeFromString "-framework CoreServices"
diff --git a/contrib/src/ffmpeg/rules.mak b/contrib/src/ffmpeg/rules.mak
index 92c400d..4535551 100644
--- a/contrib/src/ffmpeg/rules.mak
+++ b/contrib/src/ffmpeg/rules.mak
@@ -241,6 +241,9 @@ endif
ifdef USE_LIBAV
$(APPLY) $(SRC)/ffmpeg/libav_gsm.patch
endif
+ifdef HAVE_WINSTORE
+ $(APPLY) $(SRC)/ffmpeg/disable-wincrypt.patch
+endif
$(MOVE)
.ffmpeg: ffmpeg
--
2.10.1.windows.1
From bf4df2a56204e108fd486832fd8c34208281da7b Mon Sep 17 00:00:00 2001
From 2818fc0a9e21fe117d651fc44981d869019660cb Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 15:46:11 +0200
Subject: [PATCH 09/22] contrib: ffmpeg: use bcrypt instead of the old wincrypt
Subject: [PATCH 09/28] contrib: ffmpeg: use bcrypt instead of the old wincrypt
API
When targeting Windows Vista and above
......
From 2c85ec8cd63c37bbc44ff0c2cf96261b04a8765f Mon Sep 17 00:00:00 2001
From 87e261e528f5ff3213862b8bff9ab3833279592b Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Tue, 19 Dec 2017 12:39:06 +0100
Subject: [PATCH 10/22] contrib:avcodec: use a more recent FFmpeg version
Subject: [PATCH 10/28] contrib:avcodec: use a more recent FFmpeg version
So that it doesn't use bogus atomics based code
---
......
From 0d08e043d8a7916a7cf879213d690fc5051761a1 Mon Sep 17 00:00:00 2001
From 8f169dcc6a9bdaf040e5a6b69b1970c8845ea446 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Tue, 20 Feb 2018 11:24:43 +0100
Subject: [PATCH 11/22] contrib:mpg123: don't use forbidden APIs on Phone apps
Subject: [PATCH 11/28] contrib:mpg123: don't use forbidden APIs on Phone apps
---
contrib/src/mpg123/mpg123-winstore.patch | 11 +++++++++++
......
From e0e21250c591db7ae8a8bcbe0eb5b148e9329ddd Mon Sep 17 00:00:00 2001
From 401b4bae3ccdab41ce01a23fce740b835cabd9dd Mon Sep 17 00:00:00 2001
From: Carola Nitz <nitz.carola@googlemail.com>
Date: Fri, 29 Sep 2017 14:49:02 +0200
Subject: [PATCH 12/22] contrib: use live555 version that is compatible with
Subject: [PATCH 12/28] contrib: use live555 version that is compatible with
LGPL2
---
......
From 81e870b8217449c5e5eedd2700d0af65c30ed6aa Mon Sep 17 00:00:00 2001
From e517b735fdf1692ce8c34bbf383b91797877ba12 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Tue, 27 Mar 2018 18:57:41 +0200
Subject: [PATCH 13/22] rand: use bcrypt instead of CryptographicBufferStatics
Subject: [PATCH 13/28] rand: use bcrypt instead of CryptographicBufferStatics
for Winstore builds
It's available to winstore apps and on desktop since Vista.
......
From a10c97fe38d89b09324cd1fcb7b6e5cb889fce29 Mon Sep 17 00:00:00 2001
From 1587fc6f4ac4f72e41fbcbd675e58f9f08013a58 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Wed, 28 Mar 2018 09:10:39 +0200
Subject: [PATCH 14/22] keystore: CryptUnprotectData is officially found in
Subject: [PATCH 14/28] keystore: CryptUnprotectData is officially found in
dpapi.h
In MS SDKs and in mingw64
......
From f24d37eb06407f1fba4fcad4c83a58edfba3084a Mon Sep 17 00:00:00 2001
From bfa52f94346d14414cb123df59cab34ff8ea58cb Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@videolabs.io>
Date: Mon, 23 May 2016 09:18:17 +0200
Subject: [PATCH 15/22] contrib: gnutls: fix Winstore forbidden API calls
Subject: [PATCH 15/28] contrib: gnutls: fix Winstore forbidden API calls
---
contrib/src/gnutls/rules.mak | 3 +
......@@ -10,10 +10,10 @@ Subject: [PATCH 15/22] contrib: gnutls: fix Winstore forbidden API calls
create mode 100644 contrib/src/gnutls/winstore.patch
diff --git a/contrib/src/gnutls/rules.mak b/contrib/src/gnutls/rules.mak
index 9cd29be..b04b3c0 100644
index c8454d4..78941c1 100644
--- a/contrib/src/gnutls/rules.mak
+++ b/contrib/src/gnutls/rules.mak
@@ -38,6 +38,9 @@ ifdef HAVE_MACOSX
@@ -37,6 +37,9 @@ ifdef HAVE_MACOSX
$(APPLY) $(SRC)/gnutls/gnutls-disable-connectx-macos.patch
endif
$(APPLY) $(SRC)/gnutls/gnutls-libidn.patch
......
From 3e419035921f82b4ff3e7530cc83913c3f953523 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 09:05:06 +0200
Subject: [PATCH 16/22] contrib: gnutls: update to current stable 3.5.18
---
contrib/src/gnutls/32b5628-upstream.patch | 42 -------------------------------
contrib/src/gnutls/SHA512SUMS | 2 +-
contrib/src/gnutls/rules.mak | 3 +--
3 files changed, 2 insertions(+), 45 deletions(-)
delete mode 100644 contrib/src/gnutls/32b5628-upstream.patch
diff --git a/contrib/src/gnutls/32b5628-upstream.patch b/contrib/src/gnutls/32b5628-upstream.patch
deleted file mode 100644
index 70ffdce..0000000
--- a/contrib/src/gnutls/32b5628-upstream.patch
+++ /dev/null
@@ -1,42 +0,0 @@
-From 32b56287cc9d07dfbbc2ee21b70a8fbe1f2d9f2f Mon Sep 17 00:00:00 2001
-From: Nikos Mavrogiannopoulos <nmav@gnutls.org>
-Date: Sat, 30 Dec 2017 19:57:08 +0100
-Subject: [PATCH] x509/verify: when verifying against a self signed certificate ignore issuer
-
-That is, ignore issuer when checking the issuer's parameters strength. That
-resolves the issue of marking self-signed certificates as with insecure
-parameters during verification.
-
-Resolves #347
-
-Signed-off-by: Nikos Mavrogiannopoulos <nmav@gnutls.org>
----
- lib/x509/verify.c | 12 +++++++-----
- 1 file changed, 7 insertions(+), 5 deletions(-)
-
-diff --git a/lib/x509/verify.c b/lib/x509/verify.c
-index 26b1ab3..a59e637 100644
---- a/lib/x509/verify.c
-+++ b/lib/x509/verify.c
-@@ -431,11 +431,13 @@ unsigned _gnutls_is_broken_sig_allowed(const gnutls_sign_entry_st *se, unsigned
- _gnutls_debug_log(#level": certificate's security level is unacceptable\n"); \
- return gnutls_assert_val(0); \
- } \
-- sp = gnutls_pk_bits_to_sec_param(issuer_pkalg, issuer_bits); \
-- if (sp < level) { \
-- _gnutls_cert_log("issuer", issuer); \
-- _gnutls_debug_log(#level": certificate's issuer security level is unacceptable\n"); \
-- return gnutls_assert_val(0); \
-+ if (issuer) { \
-+ sp = gnutls_pk_bits_to_sec_param(issuer_pkalg, issuer_bits); \
-+ if (sp < level) { \
-+ _gnutls_cert_log("issuer", issuer); \
-+ _gnutls_debug_log(#level": certificate's issuer security level is unacceptable\n"); \
-+ return gnutls_assert_val(0); \
-+ } \
- } \
- break;
-
---
-libgit2 0.26.0
-
diff --git a/contrib/src/gnutls/SHA512SUMS b/contrib/src/gnutls/SHA512SUMS
index e5e3af8..79bb5ee 100644
--- a/contrib/src/gnutls/SHA512SUMS
+++ b/contrib/src/gnutls/SHA512SUMS
@@ -1 +1 @@
-451d3167be599ed8e0333dd7c9f8501fcb47b7aa871aeb461c368381c0b7ecd7e2026ec35dbbb2aa685cb2c3a22e9296e0a0699409e3744b731c1bb7e7e69f07 gnutls-3.5.16.tar.xz
+434cf33a4221fe2edce1b531cb53690d14a0991cb2056006021f625fb018987351f8ec917c3a7803e5e64179cf1647a3002ae783736ffca3188d2d294b76df52 gnutls-3.5.18.tar.xz
diff --git a/contrib/src/gnutls/rules.mak b/contrib/src/gnutls/rules.mak
index b04b3c0..78941c1 100644
--- a/contrib/src/gnutls/rules.mak
+++ b/contrib/src/gnutls/rules.mak
@@ -1,6 +1,6 @@
# GnuTLS
-GNUTLS_VERSION := 3.5.16
+GNUTLS_VERSION := 3.5.18
GNUTLS_URL := ftp://ftp.gnutls.org/gcrypt/gnutls/v3.5/gnutls-$(GNUTLS_VERSION).tar.xz
ifdef BUILD_NETWORK
@@ -19,7 +19,6 @@ $(TARBALLS)/gnutls-$(GNUTLS_VERSION).tar.xz:
gnutls: gnutls-$(GNUTLS_VERSION).tar.xz .sum-gnutls
$(UNPACK)
- $(APPLY) $(SRC)/gnutls/32b5628-upstream.patch
$(APPLY) $(SRC)/gnutls/gnutls-pkgconfig-static.patch
ifdef HAVE_WIN32
$(APPLY) $(SRC)/gnutls/gnutls-win32.patch
--
2.10.1.windows.1
From 078914be6f32c5b151b1c02b836cbca5e5eef07e Mon Sep 17 00:00:00 2001
From c1f264bf979fdeb227d54238ff55dfe233044fde Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 13:09:59 +0200
Subject: [PATCH 17/22] sap: use the same declaration signature as the
Subject: [PATCH 16/28] sap: use the same declaration signature as the
definition
---
......
From f791703c3e44561a148502c5c51789d6e274614b Mon Sep 17 00:00:00 2001
From a6139aae6ac57fc1a18c29e1756603ff1284b26e Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 15:00:53 +0200
Subject: [PATCH 18/22] contrib: shout: respect the availability of strings.h
Subject: [PATCH 17/28] contrib: shout: respect the availability of strings.h
everywhere
---
......
From 381c321f53cab9d547a9305cba5ab10df40b748a Mon Sep 17 00:00:00 2001
From 1110dee6efad99e4253d14677ac0ad97f4418b7e Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 15:03:37 +0200
Subject: [PATCH 19/22] contrib: shout: usleep() is not a Windows API
Subject: [PATCH 18/28] contrib: shout: usleep() is not a Windows API
---
contrib/src/shout/rules.mak | 1 +
......
From f0582ce4ad1a91d36a7c768e18ffb39bcbc53b04 Mon Sep 17 00:00:00 2001
From c185223ad0eb49e9c50a785fbf43f41b97d2eded Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 15:06:53 +0200
Subject: [PATCH 20/22] contrib: shout: timeval is defined in winsock2.h on
Subject: [PATCH 19/28] contrib: shout: timeval is defined in winsock2.h on
Windows
---
......
From e51432e6e9079453968de586471a3a9675bb1969 Mon Sep 17 00:00:00 2001
From aa82f3f6487527629e459b469cc24cfa396f660d Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 15:13:55 +0200
Subject: [PATCH 21/22] contrib: shout: socklen_t can be found in ws2tcpip.h on
Subject: [PATCH 20/28] contrib: shout: socklen_t can be found in ws2tcpip.h on
Windows
and make sure it's found on Windows Store builds as well
......
From 42c4617e5589464f441f5729068b648cd34ebe55 Mon Sep 17 00:00:00 2001
From 0a1d049358f5449ef484b16aee3aa966ef8968f7 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 29 Mar 2018 15:46:50 +0200
Subject: [PATCH 22/22] contrib: ffmpeg: don't use libvpx at all in libavcodec
Subject: [PATCH 21/28] contrib: ffmpeg: don't use libvpx at all in libavcodec
We have our own decoder/encoder
---
......
From f674574b20063e3f0d35e6d9458e6f7a7135be90 Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Thu, 5 Apr 2018 13:29:40 +0200
Subject: [PATCH 22/28] contrib: gcrypt: use bcrypt rather than wincrypt
---
contrib/src/gcrypt/winrt.patch | 177 +++++++++++++++++++++++++++++------------
1 file changed, 124 insertions(+), 53 deletions(-)
diff --git a/contrib/src/gcrypt/winrt.patch b/contrib/src/gcrypt/winrt.patch
index fdceb26..7041e88 100644
--- a/contrib/src/gcrypt/winrt.patch
+++ b/contrib/src/gcrypt/winrt.patch
@@ -1,75 +1,146 @@
---- libgcrypt/random/rndw32.c 2015-09-08 08:17:06.000000000 +0200
-+++ libgcrypt/random/rndw32.c.winrt 2016-05-24 14:07:35.202767500 +0200
-@@ -96,8 +96,13 @@
+--- libgcrypt-1.7.8/random/rndw32.c.winrt 2017-05-03 12:45:22.000000000 +0200
++++ libgcrypt-1.7.8/random/rndw32.c 2018-04-05 13:11:54.339814800 +0200
+@@ -96,8 +96,8 @@
value in a newer release. So we use a far larger value. */
#define SIZEOF_DISK_PERFORMANCE_STRUCT 256
+-/* We don't include wincrypt.h so define it here. */
+-#define HCRYPTPROV HANDLE
+#include <winapifamily.h>
-+#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
-+#include <wincrypt.h>
-+#else
- /* We don't include wincrypt.h so define it here. */
- #define HCRYPTPROV HANDLE
-+#endif
++#include <bcrypt.h>
/* When we query the performance counters, we allocate an initial buffer and
-@@ -234,7 +239,9 @@ static NTQUERYSYSTEMINFORMATION pNtQuer
+@@ -140,25 +140,13 @@ typedef DWORD (WINAPI *NTPOWERINFORMATIO
+ ULONG inputBufferLength, PVOID outputBuffer, ULONG outputBufferLength );
+
+ /* Type definitions for function pointers to call CryptoAPI functions. */
+-typedef BOOL (WINAPI *CRYPTACQUIRECONTEXT)(HCRYPTPROV *phProv,
+- LPCTSTR pszContainer,
+- LPCTSTR pszProvider,
+- DWORD dwProvType,
+- DWORD dwFlags);
+-typedef BOOL (WINAPI *CRYPTGENRANDOM)(HCRYPTPROV hProv, DWORD dwLen,
+- BYTE *pbBuffer);
+-typedef BOOL (WINAPI *CRYPTRELEASECONTEXT)(HCRYPTPROV hProv, DWORD dwFlags);
+-
+-/* Somewhat alternative functionality available as a direct call, for
+- Windows XP and newer. This is the CryptoAPI RNG, which isn't anywhere
+- near as good as the HW RNG, but we use it if it's present on the basis
+- that at least it can't make things any worse. This direct access version
+- is only available under Windows XP, we don't go out of our way to access
+- the more general CryptoAPI one since the main purpose of using it is to
+- take advantage of any possible future hardware RNGs that may be added,
+- for example via TCPA devices. */
+-typedef BOOL (WINAPI *RTLGENRANDOM)(PVOID RandomBuffer,
+- ULONG RandomBufferLength);
++typedef NTSTATUS (WINAPI *CRYPTOPENALGORITHMPROVIDER)(BCRYPT_ALG_HANDLE *phAlgorithm,
++ LPCWSTR pszAlgId,
++ LPCWSTR pszImplementation,
++ DWORD dwFlags);
++typedef NTSTATUS (WINAPI *CRYPTGENRANDOM)(BCRYPT_ALG_HANDLE hAlgorithm, UCHAR *pbBuffer,
++ ULONG cbBuffer, ULONG dwFlags);
++typedef BOOL (WINAPI *CRYPTCLOSEALGORITHMPROVIDER)(BCRYPT_ALG_HANDLE hAlgorithm, DWORD dwFlags);
+
+
+
+@@ -234,16 +222,17 @@ static NTQUERYSYSTEMINFORMATION pNtQuer
static NTQUERYINFORMATIONPROCESS pNtQueryInformationProcess;
static NTPOWERINFORMATION pNtPowerInformation;
+-static HANDLE hAdvAPI32;
+-static CRYPTACQUIRECONTEXT pCryptAcquireContext;
+-static CRYPTGENRANDOM pCryptGenRandom;
+-static CRYPTRELEASECONTEXT pCryptReleaseContext;
+-static RTLGENRANDOM pRtlGenRandom;
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
- static HANDLE hAdvAPI32;
++static HANDLE hBcrypt;
+#endif
- static CRYPTACQUIRECONTEXT pCryptAcquireContext;
- static CRYPTGENRANDOM pCryptGenRandom;
- static CRYPTRELEASECONTEXT pCryptReleaseContext;
-@@ -259,6 +266,12 @@ init_system_rng (void)
++static CRYPTOPENALGORITHMPROVIDER pBCryptOpenAlgorithmProvider;
++static CRYPTGENRANDOM pBCryptGenRandom;
++static CRYPTCLOSEALGORITHMPROVIDER pBCryptCloseAlgorithmProvider;
+
+
+ /* Other module global variables. */
+ static int system_rng_available; /* Whether a system RNG is available. */
+-static HCRYPTPROV hRNGProv; /* Handle to Intel RNG CSP. */
++static BCRYPT_ALG_HANDLE hRNGProv; /* Handle to Intel RNG CSP. */
+
+ static int debug_me; /* Debug flag. */
+
+@@ -259,21 +248,22 @@ init_system_rng (void)
system_rng_available = 0;
hRNGProv = NULL;
+- hAdvAPI32 = GetModuleHandle ("AdvAPI32.dll");
+- if (!hAdvAPI32)
+#if (WINAPI_FAMILY == WINAPI_FAMILY_PC_APP || WINAPI_FAMILY == WINAPI_FAMILY_PHONE_APP)
-+ pCryptAcquireContext = CryptAcquireContext;
-+ pCryptGenRandom = CryptGenRandom;
-+ pCryptReleaseContext = CryptReleaseContext;
-+ pRtlGenRandom = CryptGenRandom;
++ pBCryptOpenAlgorithmProvider = (CRYPTOPENALGORITHMPROVIDER) BCryptOpenAlgorithmProvider;
++ pBCryptGenRandom = (CRYPTGENRANDOM) BCryptGenRandom;
++ pBCryptCloseAlgorithmProvider = (CRYPTCLOSEALGORITHMPROVIDER) BCryptCloseAlgorithmProvider;
+#else
- hAdvAPI32 = GetModuleHandle ("AdvAPI32.dll");
- if (!hAdvAPI32)
++ hBcrypt = GetModuleHandle ("bcrypt.dll");
++ if (!hBcrypt)
return;
-@@ -274,6 +287,7 @@ init_system_rng (void)
- This isn't exported by name, so we have to get it by ordinal. */
- pRtlGenRandom = (RTLGENRANDOM)
- GetProcAddress (hAdvAPI32, "SystemFunction036");
+
+- pCryptAcquireContext = (CRYPTACQUIRECONTEXT)
+- GetProcAddress (hAdvAPI32, "CryptAcquireContextA");
+- pCryptGenRandom = (CRYPTGENRANDOM)
+- GetProcAddress (hAdvAPI32, "CryptGenRandom");
+- pCryptReleaseContext = (CRYPTRELEASECONTEXT)
+- GetProcAddress (hAdvAPI32, "CryptReleaseContext");
+-
+- /* Get a pointer to the native randomness function if it's available.
+- This isn't exported by name, so we have to get it by ordinal. */
+- pRtlGenRandom = (RTLGENRANDOM)
+- GetProcAddress (hAdvAPI32, "SystemFunction036");
++ pBCryptOpenAlgorithmProvider = (CRYPTOPENALGORITHMPROVIDER)
++ GetProcAddress (hBcrypt, "BCryptOpenAlgorithmProvider");
++ pBCryptGenRandom = (CRYPTGENRANDOM)
++ GetProcAddress (hBcrypt, "BCryptGenRandom");
++ pBCryptCloseAlgorithmProvider = (CRYPTCLOSEALGORITHMPROVIDER)
++ GetProcAddress (hBcrypt, "BCryptCloseAlgorithmProvider");
+#endif
/* Try and connect to the PIII RNG CSP. The AMD 768 southbridge (from
the 760 MP chipset) also has a hardware RNG, but there doesn't appear
-@@ -286,7 +300,9 @@ init_system_rng (void)
- PROV_INTEL_SEC, 0) )
- && !pRtlGenRandom)
- {
+@@ -281,12 +271,13 @@ init_system_rng (void)
+ can't do much with it. OTOH the Intel RNG is also effectively dead
+ as well, mostly due to virtually nonexistent support/marketing by
+ Intel, it's included here mostly for form's sake. */
+- if ( (!pCryptAcquireContext || !pCryptGenRandom || !pCryptReleaseContext
+- || !pCryptAcquireContext (&hRNGProv, NULL, INTEL_DEF_PROV,
+- PROV_INTEL_SEC, 0) )
+- && !pRtlGenRandom)
+- {
+- hAdvAPI32 = NULL;
++ if ( (!pBCryptOpenAlgorithmProvider || !pBCryptGenRandom || !pBCryptCloseAlgorithmProvider
++ || !pBCryptOpenAlgorithmProvider (&hRNGProv, BCRYPT_RNG_ALGORITHM,
++ MS_PRIMITIVE_PROVIDER, 0) ) )
++ {
+#if (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
- hAdvAPI32 = NULL;
++ hBcrypt = NULL;
+#endif
}
else
system_rng_available = 1;
-@@ -312,11 +328,13 @@ read_system_rng (void (*add)(const void*
- if (pCryptGenRandom (hRNGProv, SYSTEMRNG_BYTES, buffer))
- quality = 80;
- }
-+#if (WINAPI_FAMILY != WINAPI_FAMILY_PC_APP && WINAPI_FAMILY != WINAPI_FAMILY_PHONE_APP)
- else if (pRtlGenRandom)
+@@ -309,14 +300,9 @@ read_system_rng (void (*add)(const void*
+ software RNG) in case it's broken in some way. */
+ if (hRNGProv)
{
- if ( pRtlGenRandom (buffer, SYSTEMRNG_BYTES))
- quality = 50;
+- if (pCryptGenRandom (hRNGProv, SYSTEMRNG_BYTES, buffer))
++ if (pBCryptGenRandom (hRNGProv, buffer, SYSTEMRNG_BYTES, 0))
+ quality = 80;
}
-+#endif
+- else if (pRtlGenRandom)
+- {
+- if ( pRtlGenRandom (buffer, SYSTEMRNG_BYTES))
+- quality = 50;
+- }
if (quality > 0)
{
if (debug_me)
-@@ -337,6 +355,7 @@ read_mbm_data (void (*add)(const void*,
+@@ -337,6 +323,7 @@ read_mbm_data (void (*add)(const void*,
HANDLE hMBMData;
SharedData *mbmDataPtr;
@@ -77,7 +148,7 @@
hMBMData = OpenFileMapping (FILE_MAP_READ, FALSE, "$M$B$M$5$S$D$" );
if (hMBMData)
{
-@@ -351,6 +370,7 @@ read_mbm_data (void (*add)(const void*,
+@@ -351,6 +338,7 @@ read_mbm_data (void (*add)(const void*,
}
CloseHandle (hMBMData);
}
@@ -85,7 +156,7 @@
}
-@@ -359,6 +379,7 @@ static void
+@@ -359,6 +347,7 @@ static void
registry_poll (void (*add)(const void*, size_t, enum random_origins),
enum random_origins requester)
{
@@ -93,7 +164,7 @@
static int cbPerfData = PERFORMANCE_BUFFER_SIZE;
int iterations;
DWORD dwSize, status;
-@@ -478,6 +499,7 @@ registry_poll (void (*add)(const void*,
+@@ -478,6 +467,7 @@ registry_poll (void (*add)(const void*,
isn't done then any system components which provide performance data
can't be removed or changed while the handle remains active. */
RegCloseKey (HKEY_PERFORMANCE_DATA);
@@ -101,7 +172,7 @@
}
-@@ -496,6 +518,7 @@ slow_gatherer ( void (*add)(const void*,
+@@ -496,6 +486,7 @@ slow_gatherer ( void (*add)(const void*,
if ( !is_initialized )
{
@@ -109,7 +180,7 @@
HKEY hKey;
if ( debug_me )
-@@ -565,6 +588,7 @@ slow_gatherer ( void (*add)(const void*,
+@@ -565,6 +556,7 @@ slow_gatherer ( void (*add)(const void*,
if (!pNtQuerySystemInformation || !pNtQueryInformationProcess)
hNTAPI = NULL;
}
@@ -117,7 +188,7 @@
is_initialized = 1;
-@@ -594,6 +618,7 @@ slow_gatherer ( void (*add)(const void*,
+@@ -594,6 +586,7 @@ slow_gatherer ( void (*add)(const void*,
}
}
@@ -125,7 +196,7 @@
/* Get disk I/O statistics for all the hard drives. 100 is an
arbitrary failsafe limit. */
for (drive_no = 0; drive_no < 100 ; drive_no++)
-@@ -628,6 +653,7 @@ slow_gatherer ( void (*add)(const void*,
+@@ -628,6 +621,7 @@ slow_gatherer ( void (*add)(const void*,
}
CloseHandle (hDevice);
}
@@ -133,7 +204,7 @@
/* In theory we should be using the Win32 performance query API to obtain
unpredictable data from the system, however this is so unreliable (see
-@@ -786,12 +812,16 @@ _gcry_rndw32_gather_random (void (*add)(
+@@ -786,12 +780,16 @@ _gcry_rndw32_gather_random (void (*add)(
if (!is_initialized)
{
@@ -150,7 +221,7 @@
init_system_rng ();
is_initialized = 1;
}
-@@ -842,14 +872,11 @@ _gcry_rndw32_gather_random_fast (void (*
+@@ -842,14 +840,11 @@ _gcry_rndw32_gather_random_fast (void (*
ADDINT((SIZE_T)aptr); \
} while (0)
@@ -166,7 +237,7 @@
ADDPTR ( GetDesktopWindow ());
ADDPTR ( GetFocus ());
ADDINT ( GetInputState ());
-@@ -858,6 +885,11 @@ _gcry_rndw32_gather_random_fast (void (*
+@@ -858,6 +853,11 @@ _gcry_rndw32_gather_random_fast (void (*
ADDPTR ( GetOpenClipboardWindow ());
ADDPTR ( GetProcessHeap ());
ADDPTR ( GetProcessWindowStation ());
@@ -178,7 +249,7 @@
/* Following function in some cases stops returning events, and cannot
be used as an entropy source. */
/*ADDINT ( GetQueueStatus (QS_ALLEVENTS));*/
-@@ -871,6 +903,7 @@ _gcry_rndw32_gather_random_fast (void (*
+@@ -871,6 +871,7 @@ _gcry_rndw32_gather_random_fast (void (*
/* Get multiword system information: Current caret position, current
mouse cursor position. */
@@ -186,7 +257,7 @@
{
POINT point;
-@@ -922,10 +955,12 @@ _gcry_rndw32_gather_random_fast (void (*
+@@ -922,10 +923,12 @@ _gcry_rndw32_gather_random_fast (void (*
(*add) ( &minimumWorkingSetSize, sizeof (int), origin );
(*add) ( &maximumWorkingSetSize, sizeof (int), origin );
}
@@ -199,7 +270,7 @@
if (!addedFixedItems)
{
STARTUPINFO startupInfo;
-@@ -938,6 +973,7 @@ _gcry_rndw32_gather_random_fast (void (*
+@@ -938,6 +941,7 @@ _gcry_rndw32_gather_random_fast (void (*
(*add) ( &startupInfo, sizeof (STARTUPINFO), origin );
addedFixedItems = 1;
}
--
2.10.1.windows.1
From 5602018e10e5f46a9e0a275be197d809a956627f Mon Sep 17 00:00:00 2001
From: Steve Lhomme <robux4@ycbcr.xyz>
Date: Wed, 4 Apr 2018 12:10:17 +0200
Subject: [PATCH 22/26] transcode: do not include the decoder padding in the
output SAR
---
modules/stream_out/transcode/video.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/modules/stream_out/transcode/video.c b/modules/stream_out/transcode/video.c </