Updated bcrypt-ECDHSecretAgreement patchset

This commit is contained in:
Alistair Leslie-Hughes 2020-10-10 09:06:27 +11:00
parent 8bef81b0a6
commit 24fa2aa786

View File

@ -1,4 +1,4 @@
From d98bbb02ed35d835cf24f6bd470a10bb499feb2f Mon Sep 17 00:00:00 2001
From dd993178a8e0f8db6b09e059ba39820c9b609913 Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Fri, 2 Oct 2020 12:11:49 -0500
Subject: [PATCH] bcrypt: Implement BCryptSecretAgreement with libgcrypt.
@ -9,12 +9,12 @@ Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
dlls/bcrypt/Makefile.in | 1 +
dlls/bcrypt/bcrypt_internal.h | 4 +
dlls/bcrypt/bcrypt_main.c | 55 ++++++-
dlls/bcrypt/gcrypt.c | 288 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gcrypt.c | 289 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gnutls.c | 3 +-
dlls/bcrypt/macos.c | 3 +-
dlls/bcrypt/tests/bcrypt.c | 2 +-
dlls/bcrypt/unixlib.c | 15 +-
9 files changed, 375 insertions(+), 10 deletions(-)
9 files changed, 376 insertions(+), 10 deletions(-)
create mode 100644 dlls/bcrypt/gcrypt.c
diff --git a/configure.ac b/configure.ac
@ -62,10 +62,10 @@ index 46a20d473dd..4a3016784af 100644
macos.c \
md2.c \
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index 29db7210b59..2fab462d40e 100644
index 7563d19aac5..f4fcfebabd6 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -187,6 +187,8 @@ struct key
@@ -191,6 +191,8 @@ struct key
struct secret
{
struct object hdr;
@ -74,7 +74,7 @@ index 29db7210b59..2fab462d40e 100644
};
struct key_funcs
@@ -208,9 +210,11 @@ struct key_funcs
@@ -212,9 +214,11 @@ struct key_funcs
NTSTATUS (CDECL *key_export_ecc)( struct key *, UCHAR *, ULONG, ULONG * );
NTSTATUS (CDECL *key_import_dsa_capi)( struct key *, UCHAR *, ULONG );
NTSTATUS (CDECL *key_import_ecc)( struct key *, UCHAR *, ULONG );
@ -87,10 +87,10 @@ index 29db7210b59..2fab462d40e 100644
#endif /* __BCRYPT_INTERNAL_H */
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index 16c68ed6911..8dae41a2e2e 100644
index a91f31e9f09..6787b0d66cb 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1776,9 +1776,12 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
@@ -1807,9 +1807,12 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
{
struct key *privkey = privatekey;
struct key *pubkey = publickey;
@ -104,7 +104,7 @@ index 16c68ed6911..8dae41a2e2e 100644
if (!privkey || privkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (!pubkey || pubkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
@@ -1787,18 +1790,39 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
@@ -1818,18 +1821,39 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
if (!(secret = heap_alloc_zero( sizeof(*secret) ))) return STATUS_NO_MEMORY;
secret->hdr.magic = MAGIC_SECRET;
@ -146,7 +146,7 @@ index 16c68ed6911..8dae41a2e2e 100644
heap_free( secret );
return STATUS_SUCCESS;
}
@@ -1808,12 +1832,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
@@ -1839,12 +1863,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
{
struct secret *secret = handle;
@ -184,10 +184,10 @@ index 16c68ed6911..8dae41a2e2e 100644
BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
diff --git a/dlls/bcrypt/gcrypt.c b/dlls/bcrypt/gcrypt.c
new file mode 100644
index 00000000000..d0049b6cf69
index 00000000000..d127e1a2903
--- /dev/null
+++ b/dlls/bcrypt/gcrypt.c
@@ -0,0 +1,288 @@
@@ -0,0 +1,289 @@
+#if 0
+#pragma makedep unix
+#endif
@ -195,9 +195,10 @@ index 00000000000..d0049b6cf69
+#include "config.h"
+#include "wine/port.h"
+
+#include <stdarg.h>
+
+#ifdef HAVE_GCRYPT_H
+
+#include <stdarg.h>
+#include <gcrypt.h>
+
+#include "ntstatus.h"
@ -477,10 +478,10 @@ index 00000000000..d0049b6cf69
+}
+#endif
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index b761c732acf..6ddcfce14d7 100644
index cffaa2a5c77..aa60054d315 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -1589,7 +1589,8 @@ static struct key_funcs key_funcs =
@@ -1754,7 +1754,8 @@ static struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@ -505,10 +506,10 @@ index 5868b445625..a631d42b3f1 100644
struct key_funcs * macos_lib_init( DWORD reason )
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
index 7fdc0ac7fb2..5701a0a30ce 100644
index d499ce65a65..334694c4336 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -2115,7 +2115,7 @@ static void test_ECDH(void)
@@ -2102,7 +2102,7 @@ static void test_ECDH(void)
goto raw_secret_end;
}