diff --git a/patches/bcrypt-Improvements/0010-bcrypt-tests-Add-test-for-bugs-in-BCryptGetProperty.patch b/patches/bcrypt-Improvements/0010-bcrypt-tests-Add-test-for-bugs-in-BCryptGetProperty.patch index 6d1865a9..c508c541 100644 --- a/patches/bcrypt-Improvements/0010-bcrypt-tests-Add-test-for-bugs-in-BCryptGetProperty.patch +++ b/patches/bcrypt-Improvements/0010-bcrypt-tests-Add-test-for-bugs-in-BCryptGetProperty.patch @@ -1,4 +1,4 @@ -From eafc346618f1b1c5355f67ccb4381ac708d8cffe Mon Sep 17 00:00:00 2001 +From 73d73983bcb5d63470998096e502fabbf82bc06d Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 04:38:15 +0100 Subject: [PATCH] bcrypt/tests: Add test for bugs in BCryptGetProperty. diff --git a/patches/bcrypt-Improvements/0011-bcrypt-tests-Add-tests-for-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0011-bcrypt-tests-Add-tests-for-AES-GCM-mode.patch index c1f567f4..fae31a78 100644 --- a/patches/bcrypt-Improvements/0011-bcrypt-tests-Add-tests-for-AES-GCM-mode.patch +++ b/patches/bcrypt-Improvements/0011-bcrypt-tests-Add-tests-for-AES-GCM-mode.patch @@ -1,4 +1,4 @@ -From 65adbaee97870e85cab097ac3d6b2929d1d69ffd Mon Sep 17 00:00:00 2001 +From f7f71658aa091abc71f4dff1449a2ef4db396590 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 05:37:02 +0100 Subject: [PATCH] bcrypt/tests: Add tests for AES GCM mode. diff --git a/patches/bcrypt-Improvements/0012-bcrypt-Pass-object-to-get_-alg-hash-_property-instea.patch b/patches/bcrypt-Improvements/0012-bcrypt-Pass-object-to-get_-alg-hash-_property-instea.patch index c1776da3..c16863ae 100644 --- a/patches/bcrypt-Improvements/0012-bcrypt-Pass-object-to-get_-alg-hash-_property-instea.patch +++ b/patches/bcrypt-Improvements/0012-bcrypt-Pass-object-to-get_-alg-hash-_property-instea.patch @@ -1,15 +1,15 @@ -From 53b662ae4f93b518e1e140f765c04b23a1fc10c7 Mon Sep 17 00:00:00 2001 +From 96fcffc63b4777700544f938f10e868acf71a177 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 06:18:01 +0100 Subject: [PATCH] bcrypt: Pass object to get_{alg,hash}_property instead of alg_id. --- - dlls/bcrypt/bcrypt_main.c | 32 ++++++++++++++++---------------- - 1 file changed, 16 insertions(+), 16 deletions(-) + dlls/bcrypt/bcrypt_main.c | 40 ++++++++++++++++++++-------------------- + 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 72b5df2..c780976 100644 +index 72b5df2..7b37e1b 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -510,15 +510,15 @@ static NTSTATUS generic_alg_property( enum alg_id id, const WCHAR *prop, UCHAR * @@ -93,9 +93,8 @@ index 72b5df2..c780976 100644 } - if (!(key->block_size = get_block_size( id ))) return STATUS_INVALID_PARAMETER; -- if (!(buffer = heap_alloc( secret_len ))) return STATUS_NO_MEMORY; + if (!(key->block_size = get_block_size( alg ))) return STATUS_INVALID_PARAMETER; -+ if (!(buffer = heap_alloc( GetProcessHeap(), 0, secret_len ))) return STATUS_NO_MEMORY; + if (!(buffer = heap_alloc( secret_len ))) return STATUS_NO_MEMORY; memcpy( buffer, secret, secret_len ); - key->alg_id = id; @@ -103,6 +102,37 @@ index 72b5df2..c780976 100644 key->handle = 0; /* initialized on first use */ key->secret = buffer; key->secret_len = secret_len; +@@ -909,25 +909,25 @@ struct key + ULONG secret_len; + }; + +-static NTSTATUS key_init( struct key *key, enum alg_id id, const UCHAR *secret, ULONG secret_len ) ++static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len ) + { + UCHAR *buffer; + +- switch (id) ++ switch (alg->id) + { + case ALG_ID_AES: + break; + + default: +- FIXME( "algorithm %u not supported\n", id ); ++ FIXME( "algorithm %u not supported\n", alg->id ); + return STATUS_NOT_SUPPORTED; + } + +- if (!(key->block_size = get_block_size( id ))) return STATUS_INVALID_PARAMETER; ++ if (!(key->block_size = get_block_size( alg ))) return STATUS_INVALID_PARAMETER; + if (!(buffer = heap_alloc( secret_len ))) return STATUS_NO_MEMORY; + memcpy( buffer, secret, secret_len ); + +- key->alg_id = id; ++ key->alg_id = alg->id; + key->ref_encrypt = NULL; /* initialized on first use */ + key->ref_decrypt = NULL; + key->secret = buffer; @@ -1012,7 +1012,7 @@ struct key ULONG block_size; }; diff --git a/patches/bcrypt-Improvements/0013-bcrypt-Implement-BCryptSetProperty-for-algorithms.patch b/patches/bcrypt-Improvements/0013-bcrypt-Implement-BCryptSetProperty-for-algorithms.patch index 2982b610..c16b8952 100644 --- a/patches/bcrypt-Improvements/0013-bcrypt-Implement-BCryptSetProperty-for-algorithms.patch +++ b/patches/bcrypt-Improvements/0013-bcrypt-Implement-BCryptSetProperty-for-algorithms.patch @@ -1,4 +1,4 @@ -From d5d11e2ada220c0bfcd11a9975ef4ef242254937 Mon Sep 17 00:00:00 2001 +From 1d2d95c30925b24b337978b0ad203ff4353f7ec1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 06:08:33 +0100 Subject: [PATCH] bcrypt: Implement BCryptSetProperty for algorithms. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Implement BCryptSetProperty for algorithms. 2 files changed, 67 insertions(+), 5 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index c780976..190baca 100644 +index 7b37e1b..1db0a16 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -192,6 +192,12 @@ enum alg_id diff --git a/patches/bcrypt-Improvements/0014-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_CHAINI.patch b/patches/bcrypt-Improvements/0014-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_CHAINI.patch index 3faccc0c..b6fa2d44 100644 --- a/patches/bcrypt-Improvements/0014-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_CHAINI.patch +++ b/patches/bcrypt-Improvements/0014-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_CHAINI.patch @@ -1,4 +1,4 @@ -From a386ddc14722a35509d1f3a19c037fcb3ff1b465 Mon Sep 17 00:00:00 2001 +From 049fa305cf5b74336cac77ebaaef109aeb94364f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 06:46:11 +0100 Subject: [PATCH] bcrypt: Implement BCryptGetProperty for BCRYPT_CHAINING_MODE. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Implement BCryptGetProperty for BCRYPT_CHAINING_MODE. 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 190baca..4ffac3f 100644 +index 1db0a16..f55c7d4 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -540,17 +540,18 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop diff --git a/patches/bcrypt-Improvements/0015-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_AUTH_T.patch b/patches/bcrypt-Improvements/0015-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_AUTH_T.patch index 9dc4f31b..84cf9311 100644 --- a/patches/bcrypt-Improvements/0015-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_AUTH_T.patch +++ b/patches/bcrypt-Improvements/0015-bcrypt-Implement-BCryptGetProperty-for-BCRYPT_AUTH_T.patch @@ -1,4 +1,4 @@ -From 9ec7993211eab9a3a44bc326cdd7a2abed377b46 Mon Sep 17 00:00:00 2001 +From 943d83df3c24ff415863425287e6ba5434bfe927 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 06:50:28 +0100 Subject: [PATCH] bcrypt: Implement BCryptGetProperty for @@ -10,7 +10,7 @@ Subject: [PATCH] bcrypt: Implement BCryptGetProperty for 2 files changed, 22 insertions(+), 8 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 4ffac3f..485a71e 100644 +index f55c7d4..089ef45 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -566,6 +566,20 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop diff --git a/patches/bcrypt-Improvements/0016-bcrypt-Fix-string-comparison-in-set_alg_property.patch b/patches/bcrypt-Improvements/0016-bcrypt-Fix-string-comparison-in-set_alg_property.patch index c435bb97..09b287f2 100644 --- a/patches/bcrypt-Improvements/0016-bcrypt-Fix-string-comparison-in-set_alg_property.patch +++ b/patches/bcrypt-Improvements/0016-bcrypt-Fix-string-comparison-in-set_alg_property.patch @@ -1,4 +1,4 @@ -From df838a6fa3107044fd151f441148d768e408779e Mon Sep 17 00:00:00 2001 +From 2987f2d44eec9ab8269e0af331cdc7bf16d6383e Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 07:21:27 +0100 Subject: [PATCH] bcrypt: Fix string comparison in set_alg_property. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Fix string comparison in set_alg_property. 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 485a71e..a903437 100644 +index 089ef45..9cd58c6 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -597,14 +597,12 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA diff --git a/patches/bcrypt-Improvements/0017-bcrypt-Implement-BCryptEncrypt-for-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0017-bcrypt-Implement-BCryptEncrypt-for-AES-GCM-mode.patch index 02a09590..60aeab9d 100644 --- a/patches/bcrypt-Improvements/0017-bcrypt-Implement-BCryptEncrypt-for-AES-GCM-mode.patch +++ b/patches/bcrypt-Improvements/0017-bcrypt-Implement-BCryptEncrypt-for-AES-GCM-mode.patch @@ -1,4 +1,4 @@ -From 0a0013fd0f077161a0975c2c83889bae85a37be0 Mon Sep 17 00:00:00 2001 +From fe6fae656c8755b7eb96f7cba4828bd45e7efaec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 07:46:57 +0100 Subject: [PATCH] bcrypt: Implement BCryptEncrypt for AES GCM mode. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Implement BCryptEncrypt for AES GCM mode. 2 files changed, 51 insertions(+), 17 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index a903437..381c11f 100644 +index 9cd58c6..88f3ef2 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -63,6 +63,12 @@ MAKE_FUNCPTR(gnutls_global_set_log_level); diff --git a/patches/bcrypt-Improvements/0018-bcrypt-Implement-BCryptDecrypt-for-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0018-bcrypt-Implement-BCryptDecrypt-for-AES-GCM-mode.patch index 612d3d14..7ac0eaa3 100644 --- a/patches/bcrypt-Improvements/0018-bcrypt-Implement-BCryptDecrypt-for-AES-GCM-mode.patch +++ b/patches/bcrypt-Improvements/0018-bcrypt-Implement-BCryptDecrypt-for-AES-GCM-mode.patch @@ -1,4 +1,4 @@ -From 8391836c505c33c0f0671dde92585d53c4f2885c Mon Sep 17 00:00:00 2001 +From 9fdb049ba640b416515052670a2c2f7cdc285190 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 07:53:10 +0100 Subject: [PATCH] bcrypt: Implement BCryptDecrypt for AES GCM mode. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Implement BCryptDecrypt for AES GCM mode. 2 files changed, 27 insertions(+), 9 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 381c11f..28e3b30 100644 +index 88f3ef2..533344b 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1261,17 +1261,35 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp diff --git a/patches/bcrypt-Improvements/0019-bcrypt-Add-support-for-computing-comparing-cipher-ta.patch b/patches/bcrypt-Improvements/0019-bcrypt-Add-support-for-computing-comparing-cipher-ta.patch index 9421cb78..15cf3c8c 100644 --- a/patches/bcrypt-Improvements/0019-bcrypt-Add-support-for-computing-comparing-cipher-ta.patch +++ b/patches/bcrypt-Improvements/0019-bcrypt-Add-support-for-computing-comparing-cipher-ta.patch @@ -1,4 +1,4 @@ -From 8a7e13f2942197a83e9f5b7b8bbbd7ef684bcd1a Mon Sep 17 00:00:00 2001 +From d28a934a7013ac3ab6b97c333ff404d2e76e829a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 08:02:36 +0100 Subject: [PATCH] bcrypt: Add support for computing/comparing cipher tag. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Add support for computing/comparing cipher tag. 2 files changed, 45 insertions(+), 6 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 28e3b30..12d61e8 100644 +index 533344b..0ea8c68 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -50,6 +50,9 @@ static HINSTANCE instance; diff --git a/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch b/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch index 1d0d1d05..cc0fee72 100644 --- a/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch +++ b/patches/bcrypt-Improvements/0020-bcrypt-Implement-BCryptDuplicateKey.patch @@ -1,4 +1,4 @@ -From 91c7e05a9845d2caad78e292774cffeb67b342ca Mon Sep 17 00:00:00 2001 +From c529d8ff61ab26fcd3d558f96f86196af037290f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 08:28:24 +0100 Subject: [PATCH] bcrypt: Implement BCryptDuplicateKey. @@ -23,7 +23,7 @@ index f00f55c..fcd0f6d 100644 @ stdcall BCryptEnumAlgorithms(long ptr ptr long) @ stub BCryptEnumContextFunctionProviders diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 12d61e8..5591850 100644 +index 0ea8c68..5f7f86a 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -913,6 +913,24 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s diff --git a/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch b/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch index 17347093..578fc313 100644 --- a/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch +++ b/patches/bcrypt-Improvements/0021-bcrypt-tests-Add-tests-for-BCryptDuplicateKey.patch @@ -1,4 +1,4 @@ -From 2211b77a46bed8baf2e327aaa2809006f0776717 Mon Sep 17 00:00:00 2001 +From c8e9ffd4e5bcc6de9b8e59ff9eb98fb316970363 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 08:30:43 +0100 Subject: [PATCH] bcrypt/tests: Add tests for BCryptDuplicateKey. diff --git a/patches/bcrypt-Improvements/0022-bcrypt-Allow-to-call-BCryptSetProperty-on-key-object.patch b/patches/bcrypt-Improvements/0022-bcrypt-Allow-to-call-BCryptSetProperty-on-key-object.patch index 5698cefa..0e9e1977 100644 --- a/patches/bcrypt-Improvements/0022-bcrypt-Allow-to-call-BCryptSetProperty-on-key-object.patch +++ b/patches/bcrypt-Improvements/0022-bcrypt-Allow-to-call-BCryptSetProperty-on-key-object.patch @@ -1,4 +1,4 @@ -From 2b1715f4d088c7281cd0d97281635ea47fe24124 Mon Sep 17 00:00:00 2001 +From c625100431c570195863b2ed7e3c17c160426f26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 08:41:31 +0100 Subject: [PATCH] bcrypt: Allow to call BCryptSetProperty on key objects. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Allow to call BCryptSetProperty on key objects. 2 files changed, 40 insertions(+), 2 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 5591850..2bb8f8f 100644 +index 5f7f86a..d57cc6f 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -246,6 +246,9 @@ struct algorithm diff --git a/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch index ee08be44..74402c93 100644 --- a/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch +++ b/patches/bcrypt-Improvements/0023-bcrypt-Add-support-for-auth-data-in-AES-GCM-mode.patch @@ -1,4 +1,4 @@ -From 47242ae4cb2f6bd7ffbf5eb9ae22a354916147c6 Mon Sep 17 00:00:00 2001 +From 819a2d3c4c10b2512760e554f7f1c142ec9fc07a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Mon, 26 Dec 2016 15:01:19 +0100 Subject: [PATCH] bcrypt: Add support for auth data in AES GCM mode. @@ -8,7 +8,7 @@ Subject: [PATCH] bcrypt: Add support for auth data in AES GCM mode. 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 2bb8f8f..117e351 100644 +index d57cc6f..506ed70 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -51,7 +51,8 @@ static HINSTANCE instance; diff --git a/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch b/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch index 666aecf1..ecf67b57 100644 --- a/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch +++ b/patches/bcrypt-Improvements/0024-bcrypt-tests-Add-tests-for-auth-data-in-AES-GCM-mode.patch @@ -1,4 +1,4 @@ -From 04ad5960981996bdf3c9f14e40da3a9044e55b60 Mon Sep 17 00:00:00 2001 +From 3c7e2cb0745400c3e48229b7fa3baf224e2e849b Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 15:01:38 +0100 Subject: [PATCH] bcrypt/tests: Add tests for auth data in AES GCM mode. diff --git a/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch b/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch index 56cedac4..bc8bf10d 100644 --- a/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch +++ b/patches/bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch @@ -1,4 +1,4 @@ -From 02d978a02918d24f9b7dd502a560081a9ce1c980 Mon Sep 17 00:00:00 2001 +From a86334fac65af406c7e634fbf4f68c4796fb1f41 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Mon, 26 Dec 2016 16:20:57 +0100 Subject: [PATCH] bcrypt: Avoid crash in tests when compiling without gnutls @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Avoid crash in tests when compiling without gnutls 1 file changed, 11 insertions(+) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 117e351..d17224c 100644 +index 506ed70..b52d289 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1269,12 +1269,19 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ diff --git a/patches/bcrypt-Improvements/0026-bcrypt-Implement-support-for-ECB-chain-mode.patch b/patches/bcrypt-Improvements/0026-bcrypt-Implement-support-for-ECB-chain-mode.patch index c30331a5..219df6bc 100644 --- a/patches/bcrypt-Improvements/0026-bcrypt-Implement-support-for-ECB-chain-mode.patch +++ b/patches/bcrypt-Improvements/0026-bcrypt-Implement-support-for-ECB-chain-mode.patch @@ -1,4 +1,4 @@ -From f7a292fc7e53b5d2300b68e2e3234fad3eb80c57 Mon Sep 17 00:00:00 2001 +From ce3479faa24fcaab430d2c62c1d0c386089206b6 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sun, 5 Mar 2017 23:18:03 +0100 Subject: [PATCH] bcrypt: Implement support for ECB chain mode. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Implement support for ECB chain mode. 2 files changed, 244 insertions(+), 9 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index d17224c..420f668 100644 +index b52d289..6859788 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -225,6 +225,7 @@ enum alg_id diff --git a/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch b/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch index 543ae401..a465237a 100644 --- a/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch +++ b/patches/bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch @@ -1,4 +1,4 @@ -From d517939ffb93bd49d13376770b1b270f9338b2ee Mon Sep 17 00:00:00 2001 +From d0f750269e6c667bf459ed53bb748a0f558eaa47 Mon Sep 17 00:00:00 2001 From: Andrew Wesie Date: Mon, 1 May 2017 22:57:43 -0500 Subject: [PATCH] bcrypt: Fix BCryptEncrypt with AES_GCM and no input and no @@ -11,7 +11,7 @@ Signed-off-by: Andrew Wesie 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 420f668..005c98d 100644 +index 6859788..bb92c04 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1379,7 +1379,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp diff --git a/patches/bcrypt-Improvements/0028-bcrypt-Partial-implementation-of-BCryptImportKey-and.patch b/patches/bcrypt-Improvements/0028-bcrypt-Partial-implementation-of-BCryptImportKey-and.patch index 37a72b22..e099f759 100644 --- a/patches/bcrypt-Improvements/0028-bcrypt-Partial-implementation-of-BCryptImportKey-and.patch +++ b/patches/bcrypt-Improvements/0028-bcrypt-Partial-implementation-of-BCryptImportKey-and.patch @@ -1,4 +1,4 @@ -From e0684348c300573e6729ce235fce2f49a1760f29 Mon Sep 17 00:00:00 2001 +From 3617913e722505d39009bc2dc2f32ba05289ff42 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 13 Aug 2017 04:28:43 +0200 Subject: [PATCH] bcrypt: Partial implementation of BCryptImportKey and @@ -35,7 +35,7 @@ index fcd0f6d..28c2394 100644 @ stdcall BCryptOpenAlgorithmProvider(ptr wstr wstr long) @ stub BCryptQueryContextConfiguration diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 005c98d..bfe4708 100644 +index bb92c04..f00a154 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1091,6 +1091,13 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len ) diff --git a/patches/bcrypt-Improvements/0029-bcrypt-Add-support-for-192-and-256-bit-aes-keys.patch b/patches/bcrypt-Improvements/0029-bcrypt-Add-support-for-192-and-256-bit-aes-keys.patch index aa25bfb2..ef471765 100644 --- a/patches/bcrypt-Improvements/0029-bcrypt-Add-support-for-192-and-256-bit-aes-keys.patch +++ b/patches/bcrypt-Improvements/0029-bcrypt-Add-support-for-192-and-256-bit-aes-keys.patch @@ -1,4 +1,4 @@ -From 9f5728e55070f4e5d5ad91a06f6837c1513c2917 Mon Sep 17 00:00:00 2001 +From 7345fd134e82db7d3c53cf67bb4374496c1ed650 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Sun, 13 Aug 2017 05:04:21 +0200 Subject: [PATCH] bcrypt: Add support for 192 and 256 bit aes keys. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Add support for 192 and 256 bit aes keys. 2 files changed, 44 insertions(+), 2 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index bfe4708..2cd1271 100644 +index f00a154..44c334f 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -990,11 +990,21 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key ) diff --git a/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch b/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch index ae01c075..3bc3502e 100644 --- a/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch +++ b/patches/bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch @@ -1,14 +1,14 @@ -From c720c7cffa486b64b860822e765fb7818c2c2081 Mon Sep 17 00:00:00 2001 +From fccac8005af4ef28211ab1ce6ca67d9e069eb951 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 18:31:55 +0200 Subject: [PATCH] bcrypt: Preparation for asymmetric keys. --- - dlls/bcrypt/bcrypt_main.c | 316 ++++++++++++++++++++++++++++++---------------- - 1 file changed, 207 insertions(+), 109 deletions(-) + dlls/bcrypt/bcrypt_main.c | 340 +++++++++++++++++++++++++++++++--------------- + 1 file changed, 231 insertions(+), 109 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 2cd1271..7eca112 100644 +index 44c334f..8568d35 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -238,16 +238,17 @@ static const struct { @@ -50,7 +50,7 @@ index 2cd1271..7eca112 100644 enum mode_id mode; ULONG block_size; gnutls_cipher_hd_t handle; -@@ -905,7 +904,17 @@ struct key +@@ -905,7 +904,39 @@ struct key ULONG secret_len; }; @@ -65,34 +65,6 @@ index 2cd1271..7eca112 100644 + } u; +}; + -+static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len ) - { - UCHAR *buffer; - -@@ -921,34 +930,64 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s - return STATUS_NOT_SUPPORTED; - } - -- if (!(key->block_size = get_block_size( alg ))) return STATUS_INVALID_PARAMETER; -- if (!(buffer = heap_alloc( GetProcessHeap(), 0, secret_len ))) return STATUS_NO_MEMORY; -+ if (!(key->u.s.block_size = get_block_size( alg ))) return STATUS_INVALID_PARAMETER; -+ if (!(buffer = heap_alloc( secret_len ))) return STATUS_NO_MEMORY; - memcpy( buffer, secret, secret_len ); - -- key->alg_id = alg->id; -- key->mode = alg->mode; -- key->handle = 0; /* initialized on first use */ -- key->secret = buffer; -- key->secret_len = secret_len; -+ key->alg_id = alg->id; -+ key->u.s.mode = alg->mode; -+ key->u.s.handle = 0; /* initialized on first use */ -+ key->u.s.secret = buffer; -+ key->u.s.secret_len = secret_len; - - return STATUS_SUCCESS; - } - +static inline BOOL key_is_symmetric( struct key *key ) +{ + return alg_props[key->alg_id].symmetric; @@ -103,26 +75,65 @@ index 2cd1271..7eca112 100644 + return !alg_props[key->alg_id].symmetric; +} + - static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) ++static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) ++{ ++ *mode = key->u.s.mode; ++ return STATUS_SUCCESS; ++} ++ ++static NTSTATUS key_symmetric_get_blocksize( struct key *key, ULONG *size ) ++{ ++ *size = key->u.s.block_size; ++ return STATUS_SUCCESS; ++} ++ ++static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len ) + { + UCHAR *buffer; + +@@ -921,15 +952,15 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s + return STATUS_NOT_SUPPORTED; + } + +- if (!(key->block_size = get_block_size( alg ))) return STATUS_INVALID_PARAMETER; ++ if (!(key->u.s.block_size = get_block_size( alg ))) return STATUS_INVALID_PARAMETER; + if (!(buffer = heap_alloc( secret_len ))) return STATUS_NO_MEMORY; + memcpy( buffer, secret, secret_len ); + + key->alg_id = alg->id; +- key->mode = alg->mode; +- key->handle = 0; /* initialized on first use */ +- key->secret = buffer; +- key->secret_len = secret_len; ++ key->u.s.mode = alg->mode; ++ key->u.s.handle = 0; /* initialized on first use */ ++ key->u.s.secret = buffer; ++ key->u.s.secret_len = secret_len; + + return STATUS_SUCCESS; + } +@@ -938,37 +969,48 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) { UCHAR *buffer; - if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->secret_len ))) return STATUS_NO_MEMORY; - memcpy( buffer, key_orig->secret, key_orig->secret_len ); -- - key_copy->hdr = key_orig->hdr; - key_copy->alg_id = key_orig->alg_id; ++ key_copy->hdr = key_orig->hdr; ++ key_copy->alg_id = key_orig->alg_id; + +- key_copy->hdr = key_orig->hdr; +- key_copy->alg_id = key_orig->alg_id; - key_copy->mode = key_orig->mode; - key_copy->block_size = key_orig->block_size; - key_copy->handle = NULL; - key_copy->secret = buffer; - key_copy->secret_len = key_orig->secret_len; - + if (key_is_symmetric(key_orig)) + { + if (!(buffer = HeapAlloc( GetProcessHeap(), 0, key_orig->u.s.secret_len ))) return STATUS_NO_MEMORY; + memcpy( buffer, key_orig->u.s.secret, key_orig->u.s.secret_len ); -+ + +- return STATUS_SUCCESS; + key_copy->u.s.mode = key_orig->u.s.mode; + key_copy->u.s.block_size = key_orig->u.s.block_size; + key_copy->u.s.handle = NULL; @@ -135,21 +146,9 @@ index 2cd1271..7eca112 100644 + { + return STATUS_NOT_IMPLEMENTED; + } -+} -+ -+static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) -+{ -+ *mode = key->u.s.mode; -+ return STATUS_SUCCESS; -+} -+ -+static NTSTATUS key_symmetric_get_blocksize( struct key *key, ULONG *size ) -+{ -+ *size = key->u.s.block_size; - return STATUS_SUCCESS; } -@@ -956,19 +995,22 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val + static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *value, ULONG size, ULONG flags ) { if (!strcmpW( prop, BCRYPT_CHAINING_MODE )) { @@ -329,7 +328,36 @@ index 2cd1271..7eca112 100644 return STATUS_SUCCESS; } #elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080 -@@ -1231,59 +1277,80 @@ struct key +@@ -1127,6 +1173,28 @@ struct key + ULONG secret_len; + }; + ++static inline BOOL key_is_symmetric( struct key *key ) ++{ ++ return alg_props[key->alg_id].symmetric; ++} ++ ++static inline BOOL key_is_asymmetric( struct key *key ) ++{ ++ return !alg_props[key->alg_id].symmetric; ++} ++ ++static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) ++{ ++ *mode = key->u.s.mode; ++ return STATUS_SUCCESS; ++} ++ ++static NTSTATUS key_symmetric_get_blocksize( struct key *key, ULONG *size ) ++{ ++ *size = key->u.s.block_size; ++ return STATUS_SUCCESS; ++} ++ + static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len ) + { + UCHAR *buffer; +@@ -1231,59 +1299,82 @@ struct key ULONG block_size; }; @@ -343,6 +371,7 @@ index 2cd1271..7eca112 100644 +static inline BOOL key_is_asymmetric( struct key *key ) +{ + ERR( "support for keys not available at build time\n" ); ++ return 0; +}; + +static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, UCHAR *secret, ULONG secret_len ) @@ -354,20 +383,21 @@ index 2cd1271..7eca112 100644 static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) { -+ ERR( "support for keys not available at build time\n" ); -+ return STATUS_NOT_IMPLEMENTED; -+} -+ -+static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) -+{ ERR( "support for keys not available at build time\n" ); - key_copy->mode = MODE_ID_CBC; return STATUS_NOT_IMPLEMENTED; } ++static NTSTATUS key_symmetric_get_mode( struct key *key, enum mode_id *mode ) ++{ ++ ERR( "support for keys not available at build time\n" ); ++ return STATUS_NOT_IMPLEMENTED; ++} ++ +static NTSTATUS key_symmetric_get_blocksize( struct key *key, ULONG *size ) +{ + ERR( "support for keys not available at build time\n" ); ++ return 0; +} + + @@ -419,7 +449,7 @@ index 2cd1271..7eca112 100644 { ERR( "support for keys not available at build time\n" ); return STATUS_NOT_IMPLEMENTED; -@@ -1318,7 +1385,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ +@@ -1318,7 +1409,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_ key->hdr.magic = MAGIC_KEY; @@ -428,7 +458,7 @@ index 2cd1271..7eca112 100644 { heap_free( key ); *handle = NULL; -@@ -1415,13 +1482,19 @@ NTSTATUS WINAPI BCryptExportKey( BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE +@@ -1415,13 +1506,19 @@ NTSTATUS WINAPI BCryptExportKey( BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE; if (!output || !output_len || !size) return STATUS_INVALID_PARAMETER; @@ -449,7 +479,7 @@ index 2cd1271..7eca112 100644 return status; if (!strcmpW( type, BCRYPT_KEY_DATA_BLOB )) -@@ -1462,19 +1535,30 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1462,19 +1559,30 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp struct key *key = handle; ULONG bytes_left = input_len; UCHAR *buf, *src, *dst; @@ -481,7 +511,7 @@ index 2cd1271..7eca112 100644 { BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding; -@@ -1485,7 +1569,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1485,7 +1593,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (auth_info->dwFlags & BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG) FIXME( "call chaining not implemented\n" ); @@ -490,7 +520,7 @@ index 2cd1271..7eca112 100644 return status; *ret_len = input_len; -@@ -1493,46 +1577,48 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1493,46 +1601,48 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (input && !output) return STATUS_SUCCESS; if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; @@ -555,7 +585,7 @@ index 2cd1271..7eca112 100644 heap_free( buf ); } -@@ -1546,19 +1632,30 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1546,19 +1656,30 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp struct key *key = handle; ULONG bytes_left = input_len; UCHAR *buf, *src, *dst; @@ -587,7 +617,7 @@ index 2cd1271..7eca112 100644 { BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding; UCHAR tag[16]; -@@ -1568,7 +1665,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1568,7 +1689,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (!auth_info->pbTag) return STATUS_INVALID_PARAMETER; if (auth_info->cbTag < 12 || auth_info->cbTag > 16) return STATUS_INVALID_PARAMETER; @@ -596,7 +626,7 @@ index 2cd1271..7eca112 100644 return status; *ret_len = input_len; -@@ -1576,12 +1673,12 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1576,12 +1697,12 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp if (!output) return STATUS_SUCCESS; if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL; @@ -612,7 +642,7 @@ index 2cd1271..7eca112 100644 return status; if (memcmp( tag, auth_info->pbTag, auth_info->cbTag )) return STATUS_AUTH_TAG_MISMATCH; -@@ -1589,44 +1686,45 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp +@@ -1589,44 +1710,45 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp return STATUS_SUCCESS; } diff --git a/patches/bcrypt-Improvements/0031-include-Add-ecdsa-and-asymmetric-key-related-bcrypt-.patch b/patches/bcrypt-Improvements/0031-include-Add-ecdsa-and-asymmetric-key-related-bcrypt-.patch index 1678c39a..bb5c6f2d 100644 --- a/patches/bcrypt-Improvements/0031-include-Add-ecdsa-and-asymmetric-key-related-bcrypt-.patch +++ b/patches/bcrypt-Improvements/0031-include-Add-ecdsa-and-asymmetric-key-related-bcrypt-.patch @@ -1,4 +1,4 @@ -From 3dc66c17df931e50e8cb639307e0d53db5039d1f Mon Sep 17 00:00:00 2001 +From 080654bd51c431b745dd75bbe43cadd8f3974113 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 18:49:09 +0200 Subject: [PATCH] include: Add ecdsa and asymmetric key related bcrypt diff --git a/patches/bcrypt-Improvements/0032-bcrypt-tests-Add-basic-test-for-ecdsa.patch b/patches/bcrypt-Improvements/0032-bcrypt-tests-Add-basic-test-for-ecdsa.patch index 7ded0e39..acb55c0c 100644 --- a/patches/bcrypt-Improvements/0032-bcrypt-tests-Add-basic-test-for-ecdsa.patch +++ b/patches/bcrypt-Improvements/0032-bcrypt-tests-Add-basic-test-for-ecdsa.patch @@ -1,4 +1,4 @@ -From 5dfa33fabba4065c5d6a15736d4253e31baa6261 Mon Sep 17 00:00:00 2001 +From 97f00b37c8daf589826b88225db540348bc9f52b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 18:50:04 +0200 Subject: [PATCH] bcrypt/tests: Add basic test for ecdsa. diff --git a/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch b/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch index e5f376c3..405c800c 100644 --- a/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch +++ b/patches/bcrypt-Improvements/0033-bcrypt-Implement-importing-of-ecdsa-keys.patch @@ -1,4 +1,4 @@ -From eba8c4fffe792b267e4e6b527c68b7cf51600910 Mon Sep 17 00:00:00 2001 +From 64827bb05687927e9f241fc53293e415d4772720 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 19:18:58 +0200 Subject: [PATCH] bcrypt: Implement importing of ecdsa keys. @@ -33,7 +33,7 @@ index 28c2394..78824d7 100644 @ stub GetCipherInterface @ stub GetHashInterface diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 7eca112..2c40ac9 100644 +index 8568d35..0ec271e 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -220,7 +220,9 @@ enum alg_id @@ -80,7 +80,7 @@ index 7eca112..2c40ac9 100644 struct key { struct object hdr; -@@ -911,6 +923,7 @@ struct key +@@ -911,9 +923,37 @@ struct key union { struct key_symmetric s; @@ -88,10 +88,6 @@ index 7eca112..2c40ac9 100644 } u; }; -@@ -943,6 +956,33 @@ static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, cons - return STATUS_SUCCESS; - } - +static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHAR *pubkey, ULONG pubkey_len ) +{ + UCHAR *buffer; @@ -122,7 +118,7 @@ index 7eca112..2c40ac9 100644 static inline BOOL key_is_symmetric( struct key *key ) { return alg_props[key->alg_id].symmetric; -@@ -975,7 +1015,13 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) +@@ -987,7 +1027,13 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) } else { @@ -148,7 +144,7 @@ index 7eca112..2c40ac9 100644 heap_free( key ); return STATUS_SUCCESS; -@@ -1294,6 +1344,12 @@ static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, UCHA +@@ -1317,6 +1367,12 @@ static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, UCHA return STATUS_NOT_IMPLEMENTED; } @@ -160,8 +156,8 @@ index 7eca112..2c40ac9 100644 + static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy ) { - ERR( "support for keys not available at build time\n" ); -@@ -1518,6 +1574,88 @@ NTSTATUS WINAPI BCryptExportKey( BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE + ERR( "support for keys not available at build time\n" ); +@@ -1542,6 +1598,88 @@ NTSTATUS WINAPI BCryptExportKey( BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE return STATUS_INVALID_PARAMETER; } diff --git a/patches/bcrypt-Improvements/0034-bcrypt-Implement-BCryptVerifySignature-for-ecdsa-sig.patch b/patches/bcrypt-Improvements/0034-bcrypt-Implement-BCryptVerifySignature-for-ecdsa-sig.patch index ee3e14ff..1b080ce0 100644 --- a/patches/bcrypt-Improvements/0034-bcrypt-Implement-BCryptVerifySignature-for-ecdsa-sig.patch +++ b/patches/bcrypt-Improvements/0034-bcrypt-Implement-BCryptVerifySignature-for-ecdsa-sig.patch @@ -1,4 +1,4 @@ -From 55060223c611c8091c7a248e978966bb8ee3f57b Mon Sep 17 00:00:00 2001 +From 2776e51e8bb9affd3464834e784c7c0b5dbfc2bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michael=20M=C3=BCller?= Date: Fri, 29 Sep 2017 20:31:00 +0200 Subject: [PATCH] bcrypt: Implement BCryptVerifySignature for ecdsa signatures. @@ -9,7 +9,7 @@ Subject: [PATCH] bcrypt: Implement BCryptVerifySignature for ecdsa signatures. 2 files changed, 326 insertions(+), 4 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 2c40ac9..17fb3fe 100644 +index 0ec271e..74704ea 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -27,6 +27,7 @@ @@ -384,7 +384,7 @@ index 2c40ac9..17fb3fe 100644 static NTSTATUS key_destroy( struct key *key ) { if (key_is_symmetric(key)) -@@ -1412,6 +1726,13 @@ static NTSTATUS key_symmetric_get_secret( struct key *key, UCHAR **secret, ULONG +@@ -1436,6 +1750,13 @@ static NTSTATUS key_symmetric_get_secret( struct key *key, UCHAR **secret, ULONG return STATUS_NOT_IMPLEMENTED; } @@ -398,7 +398,7 @@ index 2c40ac9..17fb3fe 100644 static NTSTATUS key_destroy( struct key *key ) { ERR( "support for keys not available at build time\n" ); -@@ -1647,13 +1968,14 @@ NTSTATUS WINAPI BCryptVerifySignature( BCRYPT_KEY_HANDLE handle, void *padding, +@@ -1671,13 +1992,14 @@ NTSTATUS WINAPI BCryptVerifySignature( BCRYPT_KEY_HANDLE handle, void *padding, { struct key *key = handle; diff --git a/patches/bcrypt-Improvements/0035-bcrypt-Initial-implementation-for-RSA-key-import-and.patch b/patches/bcrypt-Improvements/0035-bcrypt-Initial-implementation-for-RSA-key-import-and.patch index aa6aabec..7eba694c 100644 --- a/patches/bcrypt-Improvements/0035-bcrypt-Initial-implementation-for-RSA-key-import-and.patch +++ b/patches/bcrypt-Improvements/0035-bcrypt-Initial-implementation-for-RSA-key-import-and.patch @@ -1,4 +1,4 @@ -From d6296c86cc818de227689c44f3b6a01670115f2a Mon Sep 17 00:00:00 2001 +From c3255fceabfc20372fe78b9e838e85cf5adbd824 Mon Sep 17 00:00:00 2001 From: Kimmo Myllyvirta Date: Tue, 10 Oct 2017 16:40:41 +0300 Subject: [PATCH] bcrypt: Initial implementation for RSA key import and @@ -10,7 +10,7 @@ Subject: [PATCH] bcrypt: Initial implementation for RSA key import and 2 files changed, 135 insertions(+), 10 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 17fb3fe..11f5fbb 100644 +index 74704ea..c1232bf 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -72,6 +72,9 @@ static int (*pgnutls_pubkey_verify_hash2)(gnutls_pubkey_t key, gnutls_sign_algor @@ -71,7 +71,7 @@ index 17fb3fe..11f5fbb 100644 else if (!strcmpW( id, BCRYPT_SHA1_ALGORITHM )) alg_id = ALG_ID_SHA1; else if (!strcmpW( id, BCRYPT_SHA256_ALGORITHM )) alg_id = ALG_ID_SHA256; else if (!strcmpW( id, BCRYPT_SHA384_ALGORITHM )) alg_id = ALG_ID_SHA384; -@@ -1022,6 +1038,7 @@ static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, con +@@ -993,6 +1009,7 @@ static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, con { case ALG_ID_ECDSA_P256: case ALG_ID_ECDSA_P384: @@ -215,7 +215,7 @@ index 17fb3fe..11f5fbb 100644 pgnutls_pubkey_deinit( gnutls_key ); return (ret < 0) ? STATUS_INVALID_SIGNATURE : STATUS_SUCCESS; } -@@ -1958,6 +2039,33 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN +@@ -1982,6 +2063,33 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN *ret_key = key; return STATUS_SUCCESS; } diff --git a/patches/bcrypt-Improvements/0036-bcrypt-tests-Add-simple-test-for-RSA.patch b/patches/bcrypt-Improvements/0036-bcrypt-tests-Add-simple-test-for-RSA.patch index 9db259ea..c592a8f2 100644 --- a/patches/bcrypt-Improvements/0036-bcrypt-tests-Add-simple-test-for-RSA.patch +++ b/patches/bcrypt-Improvements/0036-bcrypt-tests-Add-simple-test-for-RSA.patch @@ -1,4 +1,4 @@ -From 7b67f0c8ef5d80a930bc3a2826f2cd7551d625a4 Mon Sep 17 00:00:00 2001 +From 385edce41cabb41837ecd4f1edbc1f5567d6983b Mon Sep 17 00:00:00 2001 From: Kimmo Myllyvirta Date: Tue, 10 Oct 2017 16:41:09 +0300 Subject: [PATCH] bcrypt/tests: Add simple test for RSA. diff --git a/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch b/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch index 769e7063..058621e0 100644 --- a/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch +++ b/patches/bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch @@ -1,4 +1,4 @@ -From b76a055bfc3acdb49a9cc9601c9799169e45ddec Mon Sep 17 00:00:00 2001 +From 122b26c953e65e243abf5c2d6543fe9fc9869599 Mon Sep 17 00:00:00 2001 From: Sebastian Lackner Date: Sat, 14 Oct 2017 22:44:13 +0200 Subject: [PATCH] bcrypt: Store full ECCKEY_BLOB struct in BCryptImportKeyPair. @@ -8,7 +8,7 @@ Subject: [PATCH] bcrypt: Store full ECCKEY_BLOB struct in BCryptImportKeyPair. 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c -index 11f5fbb..203bd69 100644 +index c1232bf..a805f64 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1380,6 +1380,7 @@ static void buffer_append_asn1_r_s( struct buffer *buffer, BYTE *r, DWORD r_len, @@ -35,7 +35,7 @@ index 11f5fbb..203bd69 100644 if ((ret = pgnutls_pubkey_import_ecc_raw( *gnutls_key, curve, &x, &y ))) { -@@ -2030,7 +2032,7 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN +@@ -2054,7 +2056,7 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN return STATUS_NO_MEMORY; key->hdr.magic = MAGIC_KEY;