From 143e59bfe29c5a21f9439789476518e71bb1a2a8 Mon Sep 17 00:00:00 2001 From: Paul Gofman Date: Wed, 16 Dec 2020 16:23:52 +0300 Subject: [PATCH] Updated bcrypt-ECDHSecretAgreement patchset. Also fix fallback function table and backend function resolution. --- ...t-Allow-multiple-backends-to-coexist.patch | 31 ++++++++++++++----- ...-BCryptSecretAgreement-with-libgcryp.patch | 28 ++++++++--------- ...003-bcrypt-Implement-BCRYPT_KDF_HASH.patch | 2 +- 3 files changed, 38 insertions(+), 23 deletions(-) diff --git a/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Allow-multiple-backends-to-coexist.patch b/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Allow-multiple-backends-to-coexist.patch index aab3987b..a9885c3f 100644 --- a/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Allow-multiple-backends-to-coexist.patch +++ b/patches/bcrypt-ECDHSecretAgreement/0001-bcrypt-Allow-multiple-backends-to-coexist.patch @@ -1,4 +1,4 @@ -From e2d88702bb88b9f4e2531d5c1c634553b2928554 Mon Sep 17 00:00:00 2001 +From 3478a4e41c07a66e7e913c54bcf5ad52e16a8fee Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 2 Oct 2020 11:29:24 -0500 Subject: [PATCH] bcrypt: Allow multiple backends to coexist. @@ -8,9 +8,9 @@ Signed-off-by: Derek Lesho dlls/bcrypt/Makefile.in | 3 +- dlls/bcrypt/bcrypt_internal.h | 3 + dlls/bcrypt/gnutls.c | 32 ++++-- - dlls/bcrypt/macos.c | 18 +++- - dlls/bcrypt/unixlib.c | 194 ++++++++++++++++++++++++++++++++++ - 5 files changed, 235 insertions(+), 15 deletions(-) + dlls/bcrypt/macos.c | 18 ++- + dlls/bcrypt/unixlib.c | 211 ++++++++++++++++++++++++++++++++++ + 5 files changed, 252 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 44906519cef0..2a88aec8362c 100644 #endif diff --git a/dlls/bcrypt/unixlib.c b/dlls/bcrypt/unixlib.c new file mode 100644 -index 000000000000..a158ec1630a6 +index 000000000000..9cbb25f5740c --- /dev/null +++ b/dlls/bcrypt/unixlib.c -@@ -0,0 +1,194 @@ +@@ -0,0 +1,211 @@ +#if 0 +#pragma makedep unix +#endif @@ -261,6 +261,19 @@ index 000000000000..a158ec1630a6 + FIXME( "not implemented\n" ); +} + ++static NTSTATUS CDECL key_asymmetric_decrypt( struct key *key, UCHAR *input, ULONG input_len, ++ UCHAR *output, ULONG *output_len ) ++{ ++ FIXME( "not implemented\n" ); ++ return STATUS_NOT_IMPLEMENTED; ++} ++ ++static NTSTATUS CDECL key_import_rsa( struct key *key, UCHAR *input, ULONG input_len ) ++{ ++ FIXME( "not implemented\n" ); ++ return STATUS_NOT_IMPLEMENTED; ++} ++ +static struct key_funcs key_funcs = +{ + key_set_property, @@ -273,6 +286,7 @@ index 000000000000..a158ec1630a6 + key_symmetric_destroy, + key_asymmetric_init, + key_asymmetric_generate, ++ key_asymmetric_decrypt, + key_asymmetric_duplicate, + key_asymmetric_sign, + key_asymmetric_verify, @@ -280,7 +294,8 @@ index 000000000000..a158ec1630a6 + key_export_dsa_capi, + key_export_ecc, + key_import_dsa_capi, -+ key_import_ecc ++ key_import_ecc, ++ key_import_rsa, +}; + +NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out ) @@ -306,6 +321,7 @@ index 000000000000..a158ec1630a6 + RESOLVE_FUNC(symmetric_destroy) + RESOLVE_FUNC(asymmetric_init) + RESOLVE_FUNC(asymmetric_generate) ++ RESOLVE_FUNC(asymmetric_decrypt) + RESOLVE_FUNC(asymmetric_duplicate) + RESOLVE_FUNC(asymmetric_sign) + RESOLVE_FUNC(asymmetric_verify) @@ -314,6 +330,7 @@ index 000000000000..a158ec1630a6 + RESOLVE_FUNC(export_ecc) + RESOLVE_FUNC(import_dsa_capi) + RESOLVE_FUNC(import_ecc) ++ RESOLVE_FUNC(import_rsa) + +#undef RESOLVE_FUNC + diff --git a/patches/bcrypt-ECDHSecretAgreement/0002-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch b/patches/bcrypt-ECDHSecretAgreement/0002-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch index e7fe386b..442893a6 100644 --- a/patches/bcrypt-ECDHSecretAgreement/0002-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch +++ b/patches/bcrypt-ECDHSecretAgreement/0002-bcrypt-Implement-BCryptSecretAgreement-with-libgcryp.patch @@ -1,4 +1,4 @@ -From 71de99f0e405cc39e819421ccc470b1085dbe8a1 Mon Sep 17 00:00:00 2001 +From e2442f39015a5982bfd15479ee06d7163d36771d Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Fri, 2 Oct 2020 12:11:49 -0500 Subject: [PATCH] bcrypt: Implement BCryptSecretAgreement with libgcrypt. @@ -13,8 +13,8 @@ Signed-off-by: Derek Lesho dlls/bcrypt/gnutls.c | 3 +- dlls/bcrypt/macos.c | 3 +- dlls/bcrypt/tests/bcrypt.c | 2 +- - dlls/bcrypt/unixlib.c | 15 +- - 9 files changed, 379 insertions(+), 10 deletions(-) + dlls/bcrypt/unixlib.c | 13 +- + 9 files changed, 378 insertions(+), 9 deletions(-) create mode 100644 dlls/bcrypt/gcrypt.c diff --git a/configure.ac b/configure.ac @@ -522,11 +522,11 @@ index 456727d04a96..6be406dee21f 100644 if (status != STATUS_SUCCESS) { diff --git a/dlls/bcrypt/unixlib.c b/dlls/bcrypt/unixlib.c -index a158ec1630a6..a01e2ad02ed9 100644 +index 9cbb25f5740c..6f8ff7f97887 100644 --- a/dlls/bcrypt/unixlib.c +++ b/dlls/bcrypt/unixlib.c -@@ -129,6 +129,12 @@ static void CDECL key_asymmetric_destroy( struct key *key ) - FIXME( "not implemented\n" ); +@@ -142,6 +142,12 @@ static NTSTATUS CDECL key_import_rsa( struct key *key, UCHAR *input, ULONG input + return STATUS_NOT_IMPLEMENTED; } +static NTSTATUS CDECL key_compute_secret_ecc (unsigned char *privkey_in, struct key *pubkey_in, struct secret *secret) @@ -538,13 +538,11 @@ index a158ec1630a6..a01e2ad02ed9 100644 static struct key_funcs key_funcs = { key_set_property, -@@ -148,13 +154,15 @@ static struct key_funcs key_funcs = - key_export_dsa_capi, - key_export_ecc, +@@ -164,12 +170,14 @@ static struct key_funcs key_funcs = key_import_dsa_capi, -- key_import_ecc -+ key_import_ecc, -+ key_compute_secret_ecc + key_import_ecc, + key_import_rsa, ++ key_compute_secret_ecc, }; NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *ptr_in, void *ptr_out ) @@ -555,7 +553,7 @@ index a158ec1630a6..a01e2ad02ed9 100644 if (reason == DLL_PROCESS_ATTACH) { -@@ -162,7 +170,9 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p +@@ -177,7 +185,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) \ @@ -566,10 +564,10 @@ index a158ec1630a6..a01e2ad02ed9 100644 RESOLVE_FUNC(set_property) RESOLVE_FUNC(symmetric_init) -@@ -182,6 +192,7 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p - RESOLVE_FUNC(export_ecc) +@@ -199,6 +209,7 @@ NTSTATUS CDECL __wine_init_unix_lib( HMODULE module, DWORD reason, const void *p RESOLVE_FUNC(import_dsa_capi) RESOLVE_FUNC(import_ecc) + RESOLVE_FUNC(import_rsa) + RESOLVE_FUNC(compute_secret_ecc) #undef RESOLVE_FUNC diff --git a/patches/bcrypt-ECDHSecretAgreement/0003-bcrypt-Implement-BCRYPT_KDF_HASH.patch b/patches/bcrypt-ECDHSecretAgreement/0003-bcrypt-Implement-BCRYPT_KDF_HASH.patch index 9951caaf..b9385c4c 100644 --- a/patches/bcrypt-ECDHSecretAgreement/0003-bcrypt-Implement-BCRYPT_KDF_HASH.patch +++ b/patches/bcrypt-ECDHSecretAgreement/0003-bcrypt-Implement-BCRYPT_KDF_HASH.patch @@ -1,4 +1,4 @@ -From 718b9e52a3f66ad18da55c32ba6583e10751c87a Mon Sep 17 00:00:00 2001 +From 305131e59c071ca84e4447ab053b04bf4023fee8 Mon Sep 17 00:00:00 2001 From: Derek Lesho Date: Tue, 7 Jan 2020 14:22:49 -0600 Subject: [PATCH] bcrypt: Implement BCRYPT_KDF_HASH.