bcrypt-ECDHSecretAgreement: Add a missing function table entry.

This commit is contained in:
Zebediah Figura 2020-10-26 18:38:43 -05:00
parent 40dda2bf72
commit d1a75649b7
2 changed files with 35 additions and 27 deletions

View File

@ -1,4 +1,4 @@
From 885d9313f5fdd835fb753d2c2b30abfb49f54051 Mon Sep 17 00:00:00 2001
From 6176e021f570d5b6ed95dd521450a60ef02d955c Mon Sep 17 00:00:00 2001
From: Derek Lesho <dlesho@codeweavers.com>
Date: Fri, 2 Oct 2020 11:29:24 -0500
Subject: [PATCH] bcrypt: Allow multiple backends to coexist.
@ -9,8 +9,8 @@ Signed-off-by: Derek Lesho <dlesho@codeweavers.com>
dlls/bcrypt/bcrypt_internal.h | 3 +
dlls/bcrypt/gnutls.c | 32 ++++--
dlls/bcrypt/macos.c | 18 +++-
dlls/bcrypt/unixlib.c | 186 ++++++++++++++++++++++++++++++++++
5 files changed, 227 insertions(+), 15 deletions(-)
dlls/bcrypt/unixlib.c | 193 ++++++++++++++++++++++++++++++++++
5 files changed, 234 insertions(+), 15 deletions(-)
create mode 100644 dlls/bcrypt/unixlib.c
diff --git a/dlls/bcrypt/Makefile.in b/dlls/bcrypt/Makefile.in
@ -126,10 +126,10 @@ index d8bba46ad5c..8df5ca8645f 100644
#endif
diff --git a/dlls/bcrypt/unixlib.c b/dlls/bcrypt/unixlib.c
new file mode 100644
index 00000000000..791b5d54188
index 00000000000..c122df63f0b
--- /dev/null
+++ b/dlls/bcrypt/unixlib.c
@@ -0,0 +1,186 @@
@@ -0,0 +1,193 @@
+#if 0
+#pragma makedep unix
+#endif
@ -250,6 +250,12 @@ index 00000000000..791b5d54188
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+static NTSTATUS CDECL key_asymmetric_duplicate( struct key *key_orig, struct key *key_copy )
+{
+ FIXME( "not implemented\n" );
+ return STATUS_NOT_IMPLEMENTED;
+}
+
+static void CDECL key_asymmetric_destroy( struct key *key )
+{
+ FIXME( "not implemented\n" );
@ -267,6 +273,7 @@ index 00000000000..791b5d54188
+ key_symmetric_destroy,
+ key_asymmetric_init,
+ key_asymmetric_generate,
+ key_asymmetric_duplicate,
+ key_asymmetric_sign,
+ key_asymmetric_verify,
+ key_asymmetric_destroy,

View File

@ -1,4 +1,4 @@
From dd993178a8e0f8db6b09e059ba39820c9b609913 Mon Sep 17 00:00:00 2001
From 6f2d3fa75e7fd783816d52af0ca9b3c16f2a947e 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,16 +9,16 @@ 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 | 289 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gcrypt.c | 290 ++++++++++++++++++++++++++++++++++
dlls/bcrypt/gnutls.c | 3 +-
dlls/bcrypt/macos.c | 3 +-
dlls/bcrypt/tests/bcrypt.c | 2 +-
dlls/bcrypt/unixlib.c | 15 +-
9 files changed, 376 insertions(+), 10 deletions(-)
9 files changed, 377 insertions(+), 10 deletions(-)
create mode 100644 dlls/bcrypt/gcrypt.c
diff --git a/configure.ac b/configure.ac
index 865aa924d07..35233aa5d08 100644
index 372785ee0fd..68fff9bf6d8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -45,6 +45,7 @@ AC_ARG_WITH(faudio, AS_HELP_STRING([--without-faudio],[do not use FAudio (XAu
@ -62,7 +62,7 @@ index 46a20d473dd..4a3016784af 100644
macos.c \
md2.c \
diff --git a/dlls/bcrypt/bcrypt_internal.h b/dlls/bcrypt/bcrypt_internal.h
index 7563d19aac5..f4fcfebabd6 100644
index 90551868cf0..03254f72d92 100644
--- a/dlls/bcrypt/bcrypt_internal.h
+++ b/dlls/bcrypt/bcrypt_internal.h
@@ -191,6 +191,8 @@ struct key
@ -74,7 +74,7 @@ index 7563d19aac5..f4fcfebabd6 100644
};
struct key_funcs
@@ -212,9 +214,11 @@ struct key_funcs
@@ -213,9 +215,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 7563d19aac5..f4fcfebabd6 100644
#endif /* __BCRYPT_INTERNAL_H */
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index a91f31e9f09..6787b0d66cb 100644
index 85d06f6001e..0f023d02076 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1807,9 +1807,12 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
@@ -1828,9 +1828,12 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
{
struct key *privkey = privatekey;
struct key *pubkey = publickey;
@ -104,7 +104,7 @@ index a91f31e9f09..6787b0d66cb 100644
if (!privkey || privkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
if (!pubkey || pubkey->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
@@ -1818,18 +1821,39 @@ NTSTATUS WINAPI BCryptSecretAgreement(BCRYPT_KEY_HANDLE privatekey, BCRYPT_KEY_H
@@ -1839,18 +1842,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 a91f31e9f09..6787b0d66cb 100644
heap_free( secret );
return STATUS_SUCCESS;
}
@@ -1839,12 +1863,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
@@ -1860,12 +1884,33 @@ NTSTATUS WINAPI BCryptDeriveKey(BCRYPT_SECRET_HANDLE handle, LPCWSTR kdf, BCrypt
{
struct secret *secret = handle;
@ -184,10 +184,10 @@ index a91f31e9f09..6787b0d66cb 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..d127e1a2903
index 00000000000..00849358c68
--- /dev/null
+++ b/dlls/bcrypt/gcrypt.c
@@ -0,0 +1,289 @@
@@ -0,0 +1,290 @@
+#if 0
+#pragma makedep unix
+#endif
@ -449,6 +449,7 @@ index 00000000000..d127e1a2903
+ NULL,
+ NULL,
+ NULL,
+ NULL,
+ key_compute_secret_ecc
+};
+
@ -478,10 +479,10 @@ index 00000000000..d127e1a2903
+}
+#endif
diff --git a/dlls/bcrypt/gnutls.c b/dlls/bcrypt/gnutls.c
index cffaa2a5c77..aa60054d315 100644
index 7a1eada329c..4505a8d965c 100644
--- a/dlls/bcrypt/gnutls.c
+++ b/dlls/bcrypt/gnutls.c
@@ -1754,7 +1754,8 @@ static struct key_funcs key_funcs =
@@ -1848,7 +1848,8 @@ static const struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@ -492,10 +493,10 @@ index cffaa2a5c77..aa60054d315 100644
struct key_funcs * gnutls_lib_init( DWORD reason )
diff --git a/dlls/bcrypt/macos.c b/dlls/bcrypt/macos.c
index 5868b445625..a631d42b3f1 100644
index 8df5ca8645f..e44436a73fb 100644
--- a/dlls/bcrypt/macos.c
+++ b/dlls/bcrypt/macos.c
@@ -277,7 +277,8 @@ static struct key_funcs key_funcs =
@@ -284,7 +284,8 @@ static const struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@ -506,7 +507,7 @@ 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 d499ce65a65..334694c4336 100644
index 0ae4b5dad53..559f49ec78c 100644
--- a/dlls/bcrypt/tests/bcrypt.c
+++ b/dlls/bcrypt/tests/bcrypt.c
@@ -2102,7 +2102,7 @@ static void test_ECDH(void)
@ -519,10 +520,10 @@ index d499ce65a65..334694c4336 100644
if (status != STATUS_SUCCESS)
{
diff --git a/dlls/bcrypt/unixlib.c b/dlls/bcrypt/unixlib.c
index 791b5d54188..a691d82afe2 100644
index c122df63f0b..fabb0ea40aa 100644
--- a/dlls/bcrypt/unixlib.c
+++ b/dlls/bcrypt/unixlib.c
@@ -123,6 +123,12 @@ static void CDECL key_asymmetric_destroy( struct key *key )
@@ -129,6 +129,12 @@ static void CDECL key_asymmetric_destroy( struct key *key )
FIXME( "not implemented\n" );
}
@ -535,7 +536,7 @@ index 791b5d54188..a691d82afe2 100644
static struct key_funcs key_funcs =
{
key_set_property,
@@ -141,13 +147,15 @@ static struct key_funcs key_funcs =
@@ -148,13 +154,15 @@ static struct key_funcs key_funcs =
key_export_dsa_capi,
key_export_ecc,
key_import_dsa_capi,
@ -552,7 +553,7 @@ index 791b5d54188..a691d82afe2 100644
if (reason == DLL_PROCESS_ATTACH)
{
@@ -155,7 +163,9 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
@@ -162,7 +170,9 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
if (macos_funcs && macos_funcs->key_##name) \
key_funcs.key_##name = macos_funcs->key_##name; \
if (gnutls_funcs && gnutls_funcs->key_##name) \
@ -563,7 +564,7 @@ index 791b5d54188..a691d82afe2 100644
RESOLVE_FUNC(set_property)
RESOLVE_FUNC(symmetric_init)
@@ -174,6 +184,7 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
@@ -181,6 +191,7 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p
RESOLVE_FUNC(export_ecc)
RESOLVE_FUNC(import_dsa_capi)
RESOLVE_FUNC(import_ecc)