Added bcrypt-BCryptGenerateKeyPair patchset

This commit is contained in:
Alistair Leslie-Hughes 2018-06-12 08:24:02 +10:00
parent 95d74e37bd
commit d78f0a5a7b
5 changed files with 201 additions and 1 deletions

View File

@ -0,0 +1,53 @@
From 41147c17b99a8e9c556449613228315e16f067b7 Mon Sep 17 00:00:00 2001
From: Maxime Lombard <berillions@gmail.com>
Date: Sun, 10 Jun 2018 14:47:01 +0200
Subject: [PATCH 1/3] bcrypt: Add support for algorithm ECDH P256.
---
dlls/bcrypt/bcrypt_main.c | 3 +++
include/bcrypt.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 29a0a785d9..f2f4c93ab8 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -288,6 +288,7 @@ enum alg_id
ALG_ID_SHA256,
ALG_ID_SHA384,
ALG_ID_SHA512,
+ ALG_ID_ECDH_P256,
ALG_ID_ECDSA_P256,
ALG_ID_ECDSA_P384,
};
@@ -322,6 +323,7 @@ alg_props[] =
/* ALG_ID_SHA256 */ { 286, 32, 512, BCRYPT_SHA256_ALGORITHM, FALSE },
/* ALG_ID_SHA384 */ { 382, 48, 1024, BCRYPT_SHA384_ALGORITHM, FALSE },
/* ALG_ID_SHA512 */ { 382, 64, 1024, BCRYPT_SHA512_ALGORITHM, FALSE },
+ /* ALG_ID_ECDH_P256 */ { 0, 0, 0, BCRYPT_ECDH_P256_ALGORITHM, FALSE },
/* ALG_ID_ECDSA_P256 */ { 0, 0, 0, BCRYPT_ECDSA_P256_ALGORITHM, FALSE },
/* ALG_ID_ECDSA_P384 */ { 0, 0, 0, BCRYPT_ECDSA_P384_ALGORITHM, FALSE },
};
@@ -400,6 +402,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
else if (!strcmpW( id, BCRYPT_SHA256_ALGORITHM )) alg_id = ALG_ID_SHA256;
else if (!strcmpW( id, BCRYPT_SHA384_ALGORITHM )) alg_id = ALG_ID_SHA384;
else if (!strcmpW( id, BCRYPT_SHA512_ALGORITHM )) alg_id = ALG_ID_SHA512;
+ else if (!strcmpW( id, BCRYPT_ECDH_P256_ALGORITHM )) alg_id = ALG_ID_ECDH_P256;
else if (!strcmpW( id, BCRYPT_ECDSA_P256_ALGORITHM )) alg_id = ALG_ID_ECDSA_P256;
else if (!strcmpW( id, BCRYPT_ECDSA_P384_ALGORITHM )) alg_id = ALG_ID_ECDSA_P384;
else
diff --git a/include/bcrypt.h b/include/bcrypt.h
index df54f621fa..d39920c3f6 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -81,6 +81,7 @@ typedef LONG NTSTATUS;
#define BCRYPT_SHA256_ALGORITHM (const WCHAR []){'S','H','A','2','5','6',0}
#define BCRYPT_SHA384_ALGORITHM (const WCHAR []){'S','H','A','3','8','4',0}
#define BCRYPT_SHA512_ALGORITHM (const WCHAR []){'S','H','A','5','1','2',0}
+#define BCRYPT_ECDH_P256_ALGORITHM (const WCHAR []){'E','C','D','H','_','P','2','5','6',0}
#define BCRYPT_ECDSA_P256_ALGORITHM (const WCHAR []){'E','C','D','S','A','_','P','2','5','6',0}
#define BCRYPT_ECDSA_P384_ALGORITHM (const WCHAR []){'E','C','D','S','A','_','P','3','8','4',0}
#define BCRYPT_ECDSA_P521_ALGORITHM (const WCHAR []){'E','C','D','S','A','_','P','5','2','1',0}
--
2.17.1

View File

@ -0,0 +1,56 @@
From 392cf1c3f3ddb6fa7935a6cd1f16d46004667aab Mon Sep 17 00:00:00 2001
From: Maxime Lombard <berillions@gmail.com>
Date: Sun, 10 Jun 2018 14:50:31 +0200
Subject: [PATCH 2/3] bcrypt: Add BCryptGenerateKeyPair stub.
---
dlls/bcrypt/bcrypt.spec | 2 +-
dlls/bcrypt/bcrypt_main.c | 6 ++++++
include/bcrypt.h | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
index 78824d73b3..ccfec632d6 100644
--- a/dlls/bcrypt/bcrypt.spec
+++ b/dlls/bcrypt/bcrypt.spec
@@ -25,7 +25,7 @@
@ stdcall BCryptFinishHash(ptr ptr long long)
@ stub BCryptFreeBuffer
@ stdcall BCryptGenRandom(ptr ptr long long)
-@ stub BCryptGenerateKeyPair
+@ stdcall BCryptGenerateKeyPair(ptr ptr long long)
@ stdcall BCryptGenerateSymmetricKey(ptr ptr ptr long ptr long long)
@ stdcall BCryptGetFipsAlgorithmMode(ptr)
@ stdcall BCryptGetProperty(ptr wstr ptr long ptr long)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index f2f4c93ab8..b4ac0168e6 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -336,6 +336,12 @@ struct algorithm
BOOL hmac;
};
+NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE *handle, ULONG input_len, ULONG flags)
+{
+ FIXME("%p, %p, %u, %08x - stub\n", algorithm, handle, input_len, flags);
+ return STATUS_SUCCESS;
+}
+
NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG count, ULONG flags)
{
const DWORD supported_flags = BCRYPT_USE_SYSTEM_PREFERRED_RNG;
diff --git a/include/bcrypt.h b/include/bcrypt.h
index d39920c3f6..e6b7d4a9ac 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -223,6 +223,7 @@ NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);
NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
+NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, ULONG, ULONG);
NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *);
--
2.17.1

View File

@ -0,0 +1,56 @@
From 85e1f780a0d26d6c1e286c944fbcf25e762633b9 Mon Sep 17 00:00:00 2001
From: Maxime Lombard <berillions@gmail.com>
Date: Sun, 10 Jun 2018 14:52:31 +0200
Subject: [PATCH 3/3] bcrypt: Add BCryptFinalizeKeyPair stub.
---
dlls/bcrypt/bcrypt.spec | 2 +-
dlls/bcrypt/bcrypt_main.c | 6 ++++++
include/bcrypt.h | 1 +
3 files changed, 8 insertions(+), 1 deletion(-)
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
index ccfec632d6..891381f2a8 100644
--- a/dlls/bcrypt/bcrypt.spec
+++ b/dlls/bcrypt/bcrypt.spec
@@ -21,7 +21,7 @@
@ stub BCryptEnumProviders
@ stub BCryptEnumRegisteredProviders
@ stdcall BCryptExportKey(ptr ptr wstr ptr long ptr long)
-@ stub BCryptFinalizeKeyPair
+@ stdcall BCryptFinalizeKeyPair(ptr long)
@ stdcall BCryptFinishHash(ptr ptr long long)
@ stub BCryptFreeBuffer
@ stdcall BCryptGenRandom(ptr ptr long long)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index b4ac0168e6..69037971bf 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -336,6 +336,12 @@ struct algorithm
BOOL hmac;
};
+NTSTATUS WINAPI BCryptFinalizeKeyPair(BCRYPT_KEY_HANDLE key, ULONG dwflags)
+{
+ FIXME("%p, %08x - stub\n", key, dwflags);
+ return STATUS_SUCCESS;
+}
+
NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE *handle, ULONG input_len, ULONG flags)
{
FIXME("%p, %p, %u, %08x - stub\n", algorithm, handle, input_len, flags);
diff --git a/include/bcrypt.h b/include/bcrypt.h
index e6b7d4a9ac..b5844a144d 100644
--- a/include/bcrypt.h
+++ b/include/bcrypt.h
@@ -222,6 +222,7 @@ NTSTATUS WINAPI BCryptDestroyHash(BCRYPT_HASH_HANDLE);
NTSTATUS WINAPI BCryptDestroyKey(BCRYPT_KEY_HANDLE);
NTSTATUS WINAPI BCryptEncrypt(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG *, ULONG);
NTSTATUS WINAPI BCryptEnumAlgorithms(ULONG, ULONG *, BCRYPT_ALGORITHM_IDENTIFIER **, ULONG);
+NTSTATUS WINAPI BCryptFinalizeKeyPair(BCRYPT_KEY_HANDLE, ULONG);
NTSTATUS WINAPI BCryptFinishHash(BCRYPT_HASH_HANDLE, PUCHAR, ULONG, ULONG);
NTSTATUS WINAPI BCryptGenerateKeyPair(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, ULONG, ULONG);
NTSTATUS WINAPI BCryptGenerateSymmetricKey(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE *, PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
--
2.17.1

View File

@ -0,0 +1,2 @@
Fixes: [45312] Fix issue for Assassin's Creed : Syndicate
Depends: crypt32-ECDSA_Cert_Chains

View File

@ -98,6 +98,7 @@ patch_enable_all ()
enable_avifil32_IGetFrame_fnSetFormat="$1"
enable_avifile_dll16_AVIStreamGetFrame="$1"
enable_bcrypt_BCryptDeriveKeyPBKDF2="$1"
enable_bcrypt_BCryptGenerateKeyPair="$1"
enable_browseui_Progress_Dialog="$1"
enable_comctl32_Listview_DrawItem="$1"
enable_comdlg32_lpstrFileTitle="$1"
@ -471,6 +472,9 @@ patch_enable ()
bcrypt-BCryptDeriveKeyPBKDF2)
enable_bcrypt_BCryptDeriveKeyPBKDF2="$2"
;;
bcrypt-BCryptGenerateKeyPair)
enable_bcrypt_BCryptGenerateKeyPair="$2"
;;
browseui-Progress_Dialog)
enable_browseui_Progress_Dialog="$2"
;;
@ -2286,6 +2290,13 @@ if test "$enable_nvapi_Stub_DLL" -eq 1; then
enable_nvcuda_CUDA_Support=1
fi
if test "$enable_bcrypt_BCryptGenerateKeyPair" -eq 1; then
if test "$enable_crypt32_ECDSA_Cert_Chains" -gt 1; then
abort "Patchset crypt32-ECDSA_Cert_Chains disabled, but bcrypt-BCryptGenerateKeyPair depends on that."
fi
enable_crypt32_ECDSA_Cert_Chains=1
fi
if test "$enable_bcrypt_BCryptDeriveKeyPBKDF2" -eq 1; then
if test "$enable_crypt32_ECDSA_Cert_Chains" -gt 1; then
abort "Patchset crypt32-ECDSA_Cert_Chains disabled, but bcrypt-BCryptDeriveKeyPBKDF2 depends on that."
@ -2770,6 +2781,28 @@ if test "$enable_bcrypt_BCryptDeriveKeyPBKDF2" -eq 1; then
) >> "$patchlist"
fi
# Patchset bcrypt-BCryptGenerateKeyPair
# |
# | This patchset has the following (direct or indirect) dependencies:
# | * crypt32-ECDSA_Cert_Chains
# |
# | This patchset fixes the following Wine bugs:
# | * [#45312] Fix issue for Assassin's Creed : Syndicate
# |
# | Modified files:
# | * dlls/bcrypt/bcrypt.spec, dlls/bcrypt/bcrypt_main.c, include/bcrypt.h
# |
if test "$enable_bcrypt_BCryptGenerateKeyPair" -eq 1; then
patch_apply bcrypt-BCryptGenerateKeyPair/0001-Add-support-for-bcrypt-algorythm-ECDH-P256.-Necessar.patch
patch_apply bcrypt-BCryptGenerateKeyPair/0002-Add-support-for-bcrypt-function-BCryptGenerateKeyPai.patch
patch_apply bcrypt-BCryptGenerateKeyPair/0003-Add-support-for-bcrypt-function-BCryptFinalizeKeyPai.patch
(
printf '%s\n' '+ { "Maxime Lombard", "bcrypt: Add support for algorythm ECDH P256.", 1 },';
printf '%s\n' '+ { "Maxime Lombard", "bcrypt: Add BCryptGenerateKeyPair stub.", 1 },';
printf '%s\n' '+ { "Maxime Lombard", "bcrypt: Add BCryptFinalizeKeyPair stub.", 1 },';
) >> "$patchlist"
fi
# Patchset browseui-Progress_Dialog
# |
# | Modified files:
@ -6710,7 +6743,7 @@ fi
# |
# | Modified files:
# | * configure, configure.ac, dlls/uianimation/Makefile.in, dlls/uianimation/main.c, dlls/uianimation/uianimation.spec,
# | dlls/uianimation/uianimation_private.h, dlls/uianimation/uianimation_typelib.idl, include/uianimation.idl
# | dlls/uianimation/uianimation_typelib.idl, include/uianimation.idl
# |
if test "$enable_uianimation_stubs" -eq 1; then
patch_apply uianimation-stubs/0001-uianimation.idl-add-more-interfaces.patch