mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Rebase against 0a72708126f5b8fc06698172d973bb529944c3bf
This commit is contained in:
parent
d3bcb61436
commit
9999806838
@ -1,29 +0,0 @@
|
||||
From 73d73983bcb5d63470998096e502fabbf82bc06d Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 04:38:15 +0100
|
||||
Subject: [PATCH] bcrypt/tests: Add test for bugs in BCryptGetProperty.
|
||||
|
||||
---
|
||||
dlls/bcrypt/tests/bcrypt.c | 6 ++++++
|
||||
1 file changed, 6 insertions(+)
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 6fa04b0..8fd6c6a 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -452,6 +452,12 @@ static void test_aes(void)
|
||||
ok(size == 64, "got %u\n", size);
|
||||
|
||||
size = 0;
|
||||
+ ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
|
||||
+ todo_wine ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
|
||||
+ ok(size == 64, "got %u\n", size);
|
||||
+
|
||||
+ size = 0;
|
||||
+ memset(mode, 0, sizeof(mode));
|
||||
ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode), &size, 0);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
ok(!lstrcmpW((const WCHAR *)mode, BCRYPT_CHAIN_MODE_CBC), "got %s\n", mode);
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
From f7f71658aa091abc71f4dff1449a2ef4db396590 Mon Sep 17 00:00:00 2001
|
||||
From a19e65b706a6dc0ca59454375d8b33bcca0265ea Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 05:37:02 +0100
|
||||
Subject: [PATCH] bcrypt/tests: Add tests for AES GCM mode.
|
||||
Subject: [PATCH 11/36] bcrypt/tests: Add tests for AES GCM mode.
|
||||
|
||||
---
|
||||
dlls/bcrypt/tests/bcrypt.c | 155 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
@ -10,10 +10,10 @@ Subject: [PATCH] bcrypt/tests: Add tests for AES GCM mode.
|
||||
3 files changed, 179 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 8fd6c6a..517baf2 100644
|
||||
index 6e283487b5..6cefe13226 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -561,6 +561,8 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
@@ -564,6 +564,8 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
|
||||
static void test_BCryptEncrypt(void)
|
||||
{
|
||||
@ -22,7 +22,7 @@ index 8fd6c6a..517baf2 100644
|
||||
static UCHAR secret[] =
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
|
||||
static UCHAR iv[] =
|
||||
@@ -579,15 +581,28 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -582,15 +584,28 @@ static void test_BCryptEncrypt(void)
|
||||
{0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79,
|
||||
0xb1,0xa2,0x92,0x73,0xbe,0x2c,0x42,0x07,0xa5,0xac,0xe3,0x93,0x39,0x8c,0xb6,0xfb,
|
||||
0x87,0x5d,0xea,0xa3,0x7e,0x0f,0xde,0xfa,0xd9,0xec,0x6c,0x4e,0x3c,0x76,0x86,0xe4};
|
||||
@ -52,7 +52,7 @@ index 8fd6c6a..517baf2 100644
|
||||
len = 0xdeadbeef;
|
||||
size = sizeof(len);
|
||||
ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
|
||||
@@ -674,12 +689,101 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -677,12 +692,101 @@ static void test_BCryptEncrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
|
||||
@ -154,7 +154,7 @@ index 8fd6c6a..517baf2 100644
|
||||
static UCHAR secret[] =
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
|
||||
static UCHAR iv[] =
|
||||
@@ -701,6 +805,12 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -704,6 +808,12 @@ static void test_BCryptDecrypt(void)
|
||||
{0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79,
|
||||
0xb1,0xa2,0x92,0x73,0xbe,0x2c,0x42,0x07,0xa5,0xac,0xe3,0x93,0x39,0x8c,0xb6,0xfb,
|
||||
0x87,0x5d,0xea,0xa3,0x7e,0x0f,0xde,0xfa,0xd9,0xec,0x6c,0x4e,0x3c,0x76,0x86,0xe4};
|
||||
@ -167,7 +167,7 @@ index 8fd6c6a..517baf2 100644
|
||||
BCRYPT_KEY_LENGTHS_STRUCT key_lengths;
|
||||
BCRYPT_ALG_HANDLE aes;
|
||||
BCRYPT_KEY_HANDLE key;
|
||||
@@ -720,6 +830,10 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -723,6 +833,10 @@ static void test_BCryptDecrypt(void)
|
||||
ok(key_lengths.dwMaxLength == 256, "Expected 256, got %d\n", key_lengths.dwMaxLength);
|
||||
ok(key_lengths.dwIncrement == 64, "Expected 64, got %d\n", key_lengths.dwIncrement);
|
||||
|
||||
@ -178,7 +178,7 @@ index 8fd6c6a..517baf2 100644
|
||||
len = 0xdeadbeef;
|
||||
size = sizeof(len);
|
||||
ret = pBCryptGetProperty(aes, BCRYPT_OBJECT_LENGTH, (UCHAR *)&len, sizeof(len), &size, 0);
|
||||
@@ -817,6 +931,45 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -820,6 +934,45 @@ static void test_BCryptDecrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
|
||||
@ -225,10 +225,10 @@ index 8fd6c6a..517baf2 100644
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
}
|
||||
diff --git a/include/bcrypt.h b/include/bcrypt.h
|
||||
index 1f7093c..1e468a3 100644
|
||||
index 1be9b8533e..d0b29c7cdd 100644
|
||||
--- a/include/bcrypt.h
|
||||
+++ b/include/bcrypt.h
|
||||
@@ -92,7 +92,29 @@ typedef struct __BCRYPT_KEY_LENGTHS_STRUCT
|
||||
@@ -96,7 +96,29 @@ typedef struct __BCRYPT_KEY_LENGTHS_STRUCT
|
||||
ULONG dwMinLength;
|
||||
ULONG dwMaxLength;
|
||||
ULONG dwIncrement;
|
||||
@ -260,7 +260,7 @@ index 1f7093c..1e468a3 100644
|
||||
typedef struct _CRYPT_INTERFACE_REG
|
||||
{
|
||||
diff --git a/include/ntstatus.h b/include/ntstatus.h
|
||||
index 86dad85..7026de7 100644
|
||||
index 86dad85b43..7026de7f85 100644
|
||||
--- a/include/ntstatus.h
|
||||
+++ b/include/ntstatus.h
|
||||
@@ -990,6 +990,8 @@
|
||||
@ -273,5 +273,5 @@ index 86dad85..7026de7 100644
|
||||
#define RPC_NT_WRONG_KIND_OF_BINDING ((NTSTATUS) 0xC0020002)
|
||||
#define RPC_NT_INVALID_BINDING ((NTSTATUS) 0xC0020003)
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
From 96fcffc63b4777700544f938f10e868acf71a177 Mon Sep 17 00:00:00 2001
|
||||
From a6e56ac8c6a42f4cf6008564c3b91c5868314b6b Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 06:18:01 +0100
|
||||
Subject: [PATCH] bcrypt: Pass object to get_{alg,hash}_property instead of
|
||||
alg_id.
|
||||
Subject: [PATCH 12/36] bcrypt: Pass object to get_{alg,hash}_property instead
|
||||
of alg_id.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 40 ++++++++++++++++++++--------------------
|
||||
1 file changed, 20 insertions(+), 20 deletions(-)
|
||||
dlls/bcrypt/bcrypt_main.c | 42 ++++++++++++++++++++++--------------------
|
||||
1 file changed, 22 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 72b5df2..7b37e1b 100644
|
||||
index 6e47349de4..73a5c36fed 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 *
|
||||
@ -60,8 +60,14 @@ index 72b5df2..7b37e1b 100644
|
||||
}
|
||||
default:
|
||||
WARN( "unknown magic %08x\n", object->magic );
|
||||
@@ -769,7 +769,7 @@ NTSTATUS WINAPI BCryptHash( BCRYPT_ALG_HANDLE algorithm, UCHAR *secret, ULONG se
|
||||
}
|
||||
@@ -794,11 +794,13 @@ struct key
|
||||
{
|
||||
struct object hdr;
|
||||
ULONG block_size;
|
||||
+ UCHAR *secret;
|
||||
+ ULONG secret_len;
|
||||
};
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) || defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
-static ULONG get_block_size( enum alg_id alg )
|
||||
@ -69,10 +75,10 @@ index 72b5df2..7b37e1b 100644
|
||||
{
|
||||
ULONG ret = 0, size = sizeof(ret);
|
||||
get_alg_property( alg, BCRYPT_BLOCK_LENGTH, (UCHAR *)&ret, sizeof(ret), &size );
|
||||
@@ -788,27 +788,27 @@ struct key
|
||||
ULONG secret_len;
|
||||
};
|
||||
@@ -827,27 +829,27 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H)
|
||||
-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 )
|
||||
{
|
||||
@ -102,10 +108,10 @@ index 72b5df2..7b37e1b 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;
|
||||
};
|
||||
|
||||
@@ -937,25 +939,25 @@ static NTSTATUS key_destroy( struct key *key )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
-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 )
|
||||
{
|
||||
@ -124,7 +130,7 @@ index 72b5df2..7b37e1b 100644
|
||||
}
|
||||
|
||||
- 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 (!(key->block_size = get_block_size( arg ))) return STATUS_INVALID_PARAMETER;
|
||||
if (!(buffer = heap_alloc( secret_len ))) return STATUS_NO_MEMORY;
|
||||
memcpy( buffer, secret, secret_len );
|
||||
|
||||
@ -133,16 +139,16 @@ index 72b5df2..7b37e1b 100644
|
||||
key->ref_encrypt = NULL; /* initialized on first use */
|
||||
key->ref_decrypt = NULL;
|
||||
key->secret = buffer;
|
||||
@@ -1012,7 +1012,7 @@ struct key
|
||||
ULONG block_size;
|
||||
};
|
||||
|
||||
@@ -1034,7 +1036,7 @@ static NTSTATUS key_destroy( struct key *key )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
-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, UCHAR *secret, ULONG secret_len )
|
||||
+static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
@@ -1061,7 +1061,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
||||
@@ -1089,7 +1091,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
||||
if (!(key = heap_alloc( sizeof(*key) ))) return STATUS_NO_MEMORY;
|
||||
key->hdr.magic = MAGIC_KEY;
|
||||
|
||||
@ -152,5 +158,5 @@ index 72b5df2..7b37e1b 100644
|
||||
heap_free( key );
|
||||
return status;
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 1d2d95c30925b24b337978b0ad203ff4353f7ec1 Mon Sep 17 00:00:00 2001
|
||||
From b27eaf2a7d4ca0811a7b8a7665b44a1b897ddbe3 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 06:08:33 +0100
|
||||
Subject: [PATCH] bcrypt: Implement BCryptSetProperty for algorithms.
|
||||
Subject: [PATCH 13/36] bcrypt: Implement BCryptSetProperty for algorithms.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 66 ++++++++++++++++++++++++++++++++++++++++++++--
|
||||
@ -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 7b37e1b..1db0a16 100644
|
||||
index 73a5c36fed..cbf7576860 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -192,6 +192,12 @@ enum alg_id
|
||||
@ -114,10 +114,10 @@ index 7b37e1b..1db0a16 100644
|
||||
|
||||
NTSTATUS WINAPI BCryptCreateHash( BCRYPT_ALG_HANDLE algorithm, BCRYPT_HASH_HANDLE *handle, UCHAR *object, ULONG objectlen,
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 517baf2..4522505 100644
|
||||
index 6cefe13226..75c25d0929 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -509,7 +509,7 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
@@ -512,7 +512,7 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
|
||||
ret = pBCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR *)BCRYPT_CHAIN_MODE_CBC,
|
||||
sizeof(BCRYPT_CHAIN_MODE_CBC), 0);
|
||||
@ -126,7 +126,7 @@ index 517baf2..4522505 100644
|
||||
|
||||
size = 0xdeadbeef;
|
||||
ret = pBCryptEncrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
|
||||
@@ -698,7 +698,7 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -701,7 +701,7 @@ static void test_BCryptEncrypt(void)
|
||||
todo_wine ok(ret == STATUS_NOT_SUPPORTED, "got %08x\n", ret);
|
||||
|
||||
ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
|
||||
@ -135,7 +135,7 @@ index 517baf2..4522505 100644
|
||||
|
||||
size = 0;
|
||||
ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
|
||||
@@ -936,7 +936,7 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -939,7 +939,7 @@ static void test_BCryptDecrypt(void)
|
||||
******************/
|
||||
|
||||
ret = BCryptSetProperty(aes, BCRYPT_CHAINING_MODE, (UCHAR*)BCRYPT_CHAIN_MODE_GCM, sizeof(BCRYPT_CHAIN_MODE_GCM), 0);
|
||||
@ -145,5 +145,5 @@ index 517baf2..4522505 100644
|
||||
buf = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len);
|
||||
ret = pBCryptGenerateSymmetricKey(aes, &key, buf, len, secret, sizeof(secret), 0);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,22 +1,22 @@
|
||||
From 049fa305cf5b74336cac77ebaaef109aeb94364f Mon Sep 17 00:00:00 2001
|
||||
From 03f5aab7ed244185ec6af90d14213ffff3241536 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 06:46:11 +0100
|
||||
Subject: [PATCH] bcrypt: Implement BCryptGetProperty for BCRYPT_CHAINING_MODE.
|
||||
Subject: [PATCH 14/36] bcrypt: Implement BCryptGetProperty for
|
||||
BCRYPT_CHAINING_MODE.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 19 ++++++++++---------
|
||||
dlls/bcrypt/tests/bcrypt.c | 2 +-
|
||||
2 files changed, 11 insertions(+), 10 deletions(-)
|
||||
dlls/bcrypt/bcrypt_main.c | 19 ++++++++++---------
|
||||
1 file changed, 10 insertions(+), 9 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 1db0a16..f55c7d4 100644
|
||||
index cbf7576860..186e619d5f 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
|
||||
}
|
||||
if (!strcmpW( prop, BCRYPT_CHAINING_MODE ))
|
||||
{
|
||||
- if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC))
|
||||
- if (size >= sizeof(BCRYPT_CHAIN_MODE_CBC) * sizeof(WCHAR))
|
||||
+ const WCHAR *mode;
|
||||
+ switch (alg->mode)
|
||||
{
|
||||
@ -40,19 +40,6 @@ index 1db0a16..f55c7d4 100644
|
||||
}
|
||||
if (!strcmpW( prop, BCRYPT_KEY_LENGTHS ))
|
||||
{
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 4522505..d1633a8 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -453,7 +453,7 @@ static void test_aes(void)
|
||||
|
||||
size = 0;
|
||||
ret = pBCryptGetProperty(alg, BCRYPT_CHAINING_MODE, mode, sizeof(mode) - 1, &size, 0);
|
||||
- todo_wine ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
|
||||
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
|
||||
ok(size == 64, "got %u\n", size);
|
||||
|
||||
size = 0;
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 943d83df3c24ff415863425287e6ba5434bfe927 Mon Sep 17 00:00:00 2001
|
||||
From 744b3c49bafcff56b8780666ed0da8cec97f4866 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 06:50:28 +0100
|
||||
Subject: [PATCH] bcrypt: Implement BCryptGetProperty for
|
||||
Subject: [PATCH 15/36] bcrypt: Implement BCryptGetProperty for
|
||||
BCRYPT_AUTH_TAG_LENGTH.
|
||||
|
||||
---
|
||||
@ -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 f55c7d4..089ef45 100644
|
||||
index 186e619d5f..47ed8e0533 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
|
||||
@ -35,10 +35,10 @@ index f55c7d4..089ef45 100644
|
||||
|
||||
default:
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index d1633a8..14f9eaa 100644
|
||||
index 75c25d0929..27feabb5f4 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -695,24 +695,24 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -698,24 +698,24 @@ static void test_BCryptEncrypt(void)
|
||||
|
||||
size = 0;
|
||||
ret = BCryptGetProperty(aes, BCRYPT_AUTH_TAG_LENGTH, NULL, 0, &size, 0);
|
||||
@ -72,5 +72,5 @@ index d1633a8..14f9eaa 100644
|
||||
len = 0xdeadbeef;
|
||||
size = sizeof(len);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 2987f2d44eec9ab8269e0af331cdc7bf16d6383e Mon Sep 17 00:00:00 2001
|
||||
From 3ef6086a7db8a9d101ea763b3415a727ce2cf6a8 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 07:21:27 +0100
|
||||
Subject: [PATCH] bcrypt: Fix string comparison in set_alg_property.
|
||||
Subject: [PATCH 16/36] bcrypt: Fix string comparison in set_alg_property.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 6 ++----
|
||||
@ -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 089ef45..9cd58c6 100644
|
||||
index 47ed8e0533..9e9e357634 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
|
||||
@ -30,10 +30,10 @@ index 089ef45..9cd58c6 100644
|
||||
alg->mode = MODE_ID_GCM;
|
||||
return STATUS_SUCCESS;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 14f9eaa..c4b411d 100644
|
||||
index 27feabb5f4..70d9e0c246 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -472,6 +472,17 @@ static void test_aes(void)
|
||||
@@ -475,6 +475,17 @@ static void test_aes(void)
|
||||
ok(key_lengths.dwMaxLength == 256, "Expected 256, got %d\n", key_lengths.dwMaxLength);
|
||||
ok(key_lengths.dwIncrement == 64, "Expected 64, got %d\n", key_lengths.dwIncrement);
|
||||
|
||||
@ -52,5 +52,5 @@ index 14f9eaa..c4b411d 100644
|
||||
|
||||
ret = pBCryptCloseAlgorithmProvider(alg, 0);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,15 +1,15 @@
|
||||
From fe6fae656c8755b7eb96f7cba4828bd45e7efaec Mon Sep 17 00:00:00 2001
|
||||
From ae6849dde0d3c7e125c9913f7bcde27e5c514304 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 07:46:57 +0100
|
||||
Subject: [PATCH] bcrypt: Implement BCryptEncrypt for AES GCM mode.
|
||||
Subject: [PATCH 17/36] bcrypt: Implement BCryptEncrypt for AES GCM mode.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 50 ++++++++++++++++++++++++++++++++++++++--------
|
||||
dlls/bcrypt/bcrypt_main.c | 48 ++++++++++++++++++++++++++++++++++++++--------
|
||||
dlls/bcrypt/tests/bcrypt.c | 18 ++++++++---------
|
||||
2 files changed, 51 insertions(+), 17 deletions(-)
|
||||
2 files changed, 49 insertions(+), 17 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 9cd58c6..88f3ef2 100644
|
||||
index 9e9e357634..387f448516 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -63,6 +63,12 @@ MAKE_FUNCPTR(gnutls_global_set_log_level);
|
||||
@ -25,7 +25,7 @@ index 9cd58c6..88f3ef2 100644
|
||||
static void gnutls_log( int level, const char *msg )
|
||||
{
|
||||
TRACE( "<%d> %s", level, msg );
|
||||
@@ -857,6 +863,7 @@ struct key
|
||||
@@ -848,6 +854,7 @@ struct key
|
||||
{
|
||||
struct object hdr;
|
||||
enum alg_id alg_id;
|
||||
@ -33,7 +33,7 @@ index 9cd58c6..88f3ef2 100644
|
||||
ULONG block_size;
|
||||
gnutls_cipher_hd_t handle;
|
||||
UCHAR *secret;
|
||||
@@ -884,6 +891,7 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
@@ -925,6 +932,7 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
memcpy( buffer, secret, secret_len );
|
||||
|
||||
key->alg_id = alg->id;
|
||||
@ -41,7 +41,7 @@ index 9cd58c6..88f3ef2 100644
|
||||
key->handle = 0; /* initialized on first use */
|
||||
key->secret = buffer;
|
||||
key->secret_len = secret_len;
|
||||
@@ -896,9 +904,13 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
@@ -937,9 +945,13 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
switch (key->alg_id)
|
||||
{
|
||||
case ALG_ID_AES:
|
||||
@ -58,22 +58,7 @@ index 9cd58c6..88f3ef2 100644
|
||||
default:
|
||||
FIXME( "algorithm %u not supported\n", key->alg_id );
|
||||
return GNUTLS_CIPHER_UNKNOWN;
|
||||
@@ -1084,12 +1096,14 @@ static NTSTATUS key_destroy( struct key *key )
|
||||
struct key
|
||||
{
|
||||
struct object hdr;
|
||||
+ enum mode_id mode;
|
||||
ULONG block_size;
|
||||
};
|
||||
|
||||
static NTSTATUS key_init( struct key *key, struct algorithm *alg, UCHAR *secret, ULONG secret_len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
+ key->mode = MODE_ID_CBC;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -1169,17 +1183,37 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1262,17 +1274,37 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
padding, iv, iv_len, output, output_len, ret_len, flags );
|
||||
|
||||
if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
|
||||
@ -117,10 +102,10 @@ index 9cd58c6..88f3ef2 100644
|
||||
|
||||
*ret_len = input_len;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index c4b411d..2721d7d 100644
|
||||
index 70d9e0c246..355a414bca 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -748,12 +748,12 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -751,12 +751,12 @@ static void test_BCryptEncrypt(void)
|
||||
memset(ciphertext, 0xff, sizeof(ciphertext));
|
||||
memset(tag, 0xff, sizeof(tag));
|
||||
ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 32, &size, 0);
|
||||
@ -137,7 +122,7 @@ index c4b411d..2721d7d 100644
|
||||
for (i = 0; i < 16; i++)
|
||||
todo_wine ok(tag[i] == expected_tag[i], "%u: %02x != %02x\n", i, tag[i], expected_tag[i]);
|
||||
|
||||
@@ -763,12 +763,12 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -766,12 +766,12 @@ static void test_BCryptEncrypt(void)
|
||||
memset(ciphertext, 0xff, sizeof(ciphertext));
|
||||
memset(tag, 0xff, sizeof(tag));
|
||||
ret = pBCryptEncrypt(key, data2, 24, &auth_info, ivbuf, 16, ciphertext, 24, &size, 0);
|
||||
@ -154,7 +139,7 @@ index c4b411d..2721d7d 100644
|
||||
for (i = 0; i < 16; i++)
|
||||
todo_wine ok(tag[i] == expected_tag2[i], "%u: %02x != %02x\n", i, tag[i], expected_tag2[i]);
|
||||
|
||||
@@ -781,7 +781,7 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -784,7 +784,7 @@ static void test_BCryptEncrypt(void)
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
memset(ciphertext, 0, sizeof(ciphertext));
|
||||
ret = pBCryptEncrypt(key, data2, 32, &auth_info, ivbuf, 16, ciphertext, 48, &size, BCRYPT_BLOCK_PADDING);
|
||||
@ -164,5 +149,5 @@ index c4b411d..2721d7d 100644
|
||||
ret = pBCryptDestroyKey(key);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 9fdb049ba640b416515052670a2c2f7cdc285190 Mon Sep 17 00:00:00 2001
|
||||
From 94a36fa538e9ac90ba19e76a0be3f616b53e02fe Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 07:53:10 +0100
|
||||
Subject: [PATCH] bcrypt: Implement BCryptDecrypt for AES GCM mode.
|
||||
Subject: [PATCH 18/36] bcrypt: Implement BCryptDecrypt for AES GCM mode.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 28 +++++++++++++++++++++++-----
|
||||
@ -9,10 +9,10 @@ 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 88f3ef2..533344b 100644
|
||||
index 387f448516..17cc92dded 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
|
||||
@@ -1352,17 +1352,35 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
padding, iv, iv_len, output, output_len, ret_len, flags );
|
||||
|
||||
if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
|
||||
@ -54,10 +54,10 @@ index 88f3ef2..533344b 100644
|
||||
|
||||
*ret_len = input_len;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 2721d7d..2a646e8 100644
|
||||
index 355a414bca..89a3c40850 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -966,16 +966,16 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -969,16 +969,16 @@ static void test_BCryptDecrypt(void)
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
memset(plaintext, 0, sizeof(plaintext));
|
||||
ret = pBCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
|
||||
@ -79,5 +79,5 @@ index 2721d7d..2a646e8 100644
|
||||
ret = pBCryptDestroyKey(key);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From d28a934a7013ac3ab6b97c333ff404d2e76e829a Mon Sep 17 00:00:00 2001
|
||||
From c7ce0b85b9d54ee608e0c2e70e6376c2f68d188e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 08:02:36 +0100
|
||||
Subject: [PATCH] bcrypt: Add support for computing/comparing cipher tag.
|
||||
Subject: [PATCH 19/36] bcrypt: Add support for computing/comparing cipher tag.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 41 ++++++++++++++++++++++++++++++++++++++++-
|
||||
@ -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 533344b..0ea8c68 100644
|
||||
index 17cc92dded..bdf02ca375 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -50,6 +50,9 @@ static HINSTANCE instance;
|
||||
@ -47,7 +47,7 @@ index 533344b..0ea8c68 100644
|
||||
if ((ret = pgnutls_global_init()) != GNUTLS_E_SUCCESS)
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
@@ -977,6 +991,19 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
@@ -1018,6 +1032,19 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -67,7 +67,7 @@ index 533344b..0ea8c68 100644
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
if (key->handle) pgnutls_cipher_deinit( key->handle );
|
||||
@@ -1127,6 +1154,12 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
@@ -1149,6 +1176,12 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -80,7 +80,15 @@ index 533344b..0ea8c68 100644
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
@@ -1211,7 +1244,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1283,6 +1316,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if (key->mode == MODE_ID_GCM)
|
||||
{
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding;
|
||||
+ UCHAR tag[16];
|
||||
|
||||
if (!auth_info) return STATUS_INVALID_PARAMETER;
|
||||
if (!auth_info->pbNonce) return STATUS_INVALID_PARAMETER;
|
||||
@@ -1302,7 +1336,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if ((status = key_encrypt( key, input, input_len, output, output_len )))
|
||||
return status;
|
||||
|
||||
@ -89,15 +97,7 @@ index 533344b..0ea8c68 100644
|
||||
}
|
||||
|
||||
if ((status = key_set_params( key, iv, iv_len ))) return status;
|
||||
@@ -1270,6 +1303,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if (key->mode == MODE_ID_GCM)
|
||||
{
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding;
|
||||
+ UCHAR tag[16];
|
||||
|
||||
if (!auth_info) return STATUS_INVALID_PARAMETER;
|
||||
if (!auth_info->pbNonce) return STATUS_INVALID_PARAMETER;
|
||||
@@ -1287,6 +1321,11 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1378,6 +1412,11 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if ((status = key_decrypt( key, input, input_len, output, output_len )))
|
||||
return status;
|
||||
|
||||
@ -110,10 +110,10 @@ index 533344b..0ea8c68 100644
|
||||
}
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 2a646e8..887fe85 100644
|
||||
index 89a3c40850..18cd2a2713 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -751,11 +751,11 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -754,11 +754,11 @@ static void test_BCryptEncrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
ok(size == 32, "got %u\n", size);
|
||||
ok(!memcmp(ciphertext, expected4, sizeof(expected4)), "wrong data\n");
|
||||
@ -127,7 +127,7 @@ index 2a646e8..887fe85 100644
|
||||
|
||||
/* input size is not multiple of block size */
|
||||
size = 0;
|
||||
@@ -766,11 +766,11 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -769,11 +769,11 @@ static void test_BCryptEncrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
ok(size == 24, "got %u\n", size);
|
||||
ok(!memcmp(ciphertext, expected4, 24), "wrong data\n");
|
||||
@ -141,7 +141,7 @@ index 2a646e8..887fe85 100644
|
||||
|
||||
/* test with padding */
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
@@ -974,7 +974,7 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -977,7 +977,7 @@ static void test_BCryptDecrypt(void)
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
auth_info.pbTag = iv; /* wrong tag */
|
||||
ret = pBCryptDecrypt(key, ciphertext4, 32, &auth_info, ivbuf, 16, plaintext, 32, &size, 0);
|
||||
@ -151,5 +151,5 @@ index 2a646e8..887fe85 100644
|
||||
|
||||
ret = pBCryptDestroyKey(key);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c529d8ff61ab26fcd3d558f96f86196af037290f Mon Sep 17 00:00:00 2001
|
||||
From 790c773742b2a0a4b4a8672de3bdfcbf539dc046 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 08:28:24 +0100
|
||||
Subject: [PATCH] bcrypt: Implement BCryptDuplicateKey.
|
||||
Subject: [PATCH 20/36] bcrypt: Implement BCryptDuplicateKey.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt.spec | 2 +-
|
||||
@ -10,7 +10,7 @@ Subject: [PATCH] bcrypt: Implement BCryptDuplicateKey.
|
||||
3 files changed, 51 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
|
||||
index f00f55c..fcd0f6d 100644
|
||||
index 21b54b4934..28c2394ce4 100644
|
||||
--- a/dlls/bcrypt/bcrypt.spec
|
||||
+++ b/dlls/bcrypt/bcrypt.spec
|
||||
@@ -12,7 +12,7 @@
|
||||
@ -23,10 +23,10 @@ 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 0ea8c68..5f7f86a 100644
|
||||
index bdf02ca375..8d4b5ade64 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
|
||||
@@ -954,6 +954,24 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ index 0ea8c68..5f7f86a 100644
|
||||
static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
{
|
||||
switch (key->alg_id)
|
||||
@@ -1134,6 +1152,13 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, UCHAR *secret,
|
||||
@@ -1156,6 +1174,13 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -65,8 +65,8 @@ index 0ea8c68..5f7f86a 100644
|
||||
static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
@@ -1193,6 +1218,30 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
||||
return STATUS_SUCCESS;
|
||||
@@ -1284,6 +1309,30 @@ NTSTATUS WINAPI BCryptExportKey(BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE
|
||||
return key_export( key, type, output, output_len, size );
|
||||
}
|
||||
|
||||
+NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE *handle_copy,
|
||||
@ -97,7 +97,7 @@ index 0ea8c68..5f7f86a 100644
|
||||
{
|
||||
struct key *key = handle;
|
||||
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
|
||||
index 5d37121..68735eb 100644
|
||||
index 5d5fae0b5c..d0f0f56cc4 100644
|
||||
--- a/dlls/ncrypt/ncrypt.spec
|
||||
+++ b/dlls/ncrypt/ncrypt.spec
|
||||
@@ -14,7 +14,7 @@
|
||||
@ -110,5 +110,5 @@ index 5d37121..68735eb 100644
|
||||
@ stdcall BCryptEnumAlgorithms(long ptr ptr long) bcrypt.BCryptEnumAlgorithms
|
||||
@ stub BCryptEnumContextFunctionProviders
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
From c8e9ffd4e5bcc6de9b8e59ff9eb98fb316970363 Mon Sep 17 00:00:00 2001
|
||||
From cf71e3c1c9bd50a1e1d3f9310c526844f65510c9 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 08:30:43 +0100
|
||||
Subject: [PATCH] bcrypt/tests: Add tests for BCryptDuplicateKey.
|
||||
Subject: [PATCH 21/36] bcrypt/tests: Add tests for BCryptDuplicateKey.
|
||||
|
||||
---
|
||||
dlls/bcrypt/tests/bcrypt.c | 33 ++++++++++++++++++++++++++++++++-
|
||||
1 file changed, 32 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index 887fe85..e33dcd3 100644
|
||||
index 18cd2a2713..6ec429e309 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -45,6 +45,7 @@ static NTSTATUS (WINAPI *pBCryptEncrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID
|
||||
@ -17,9 +17,9 @@ index 887fe85..e33dcd3 100644
|
||||
ULONG *, ULONG);
|
||||
+static NTSTATUS (WINAPI *pBCryptDuplicateKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG);
|
||||
static NTSTATUS (WINAPI *pBCryptDestroyKey)(BCRYPT_KEY_HANDLE);
|
||||
|
||||
static void test_BCryptGenRandom(void)
|
||||
@@ -500,7 +501,7 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
static NTSTATUS (WINAPI *pBCryptImportKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *,
|
||||
PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
|
||||
@@ -503,7 +504,7 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
static UCHAR expected[] =
|
||||
{0xc6,0xa1,0x3b,0x37,0x87,0x8f,0x5b,0x82,0x6f,0x4f,0x81,0x62,0xa1,0xc8,0xd8,0x79};
|
||||
BCRYPT_ALG_HANDLE aes;
|
||||
@ -28,7 +28,7 @@ index 887fe85..e33dcd3 100644
|
||||
UCHAR *buf, ciphertext[16], plaintext[16], ivbuf[16];
|
||||
ULONG size, len, i;
|
||||
NTSTATUS ret;
|
||||
@@ -543,6 +544,35 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
@@ -546,6 +547,35 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
for (i = 0; i < 16; i++)
|
||||
ok(ciphertext[i] == expected[i], "%u: %02x != %02x\n", i, ciphertext[i], expected[i]);
|
||||
|
||||
@ -64,14 +64,14 @@ index 887fe85..e33dcd3 100644
|
||||
size = 0xdeadbeef;
|
||||
ret = pBCryptDecrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
@@ -1011,6 +1041,7 @@ START_TEST(bcrypt)
|
||||
@@ -1059,6 +1089,7 @@ START_TEST(bcrypt)
|
||||
pBCryptGenerateSymmetricKey = (void *)GetProcAddress(module, "BCryptGenerateSymmetricKey");
|
||||
pBCryptEncrypt = (void *)GetProcAddress(module, "BCryptEncrypt");
|
||||
pBCryptDecrypt = (void *)GetProcAddress(module, "BCryptDecrypt");
|
||||
+ pBCryptDuplicateKey = (void *)GetProcAddress(module, "BCryptDuplicateKey");
|
||||
pBCryptDestroyKey = (void *)GetProcAddress(module, "BCryptDestroyKey");
|
||||
|
||||
test_BCryptGenRandom();
|
||||
pBCryptImportKey = (void *)GetProcAddress(module, "BCryptImportKey");
|
||||
pBCryptExportKey = (void *)GetProcAddress(module, "BCryptExportKey");
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c625100431c570195863b2ed7e3c17c160426f26 Mon Sep 17 00:00:00 2001
|
||||
From 99c36c1642f054366532902bb9a41bc264d06df6 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 08:41:31 +0100
|
||||
Subject: [PATCH] bcrypt: Allow to call BCryptSetProperty on key objects.
|
||||
Subject: [PATCH 22/36] bcrypt: Allow to call BCryptSetProperty on key objects.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 38 ++++++++++++++++++++++++++++++++++++--
|
||||
@ -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 5f7f86a..d57cc6f 100644
|
||||
index 8d4b5ade64..5913d1283e 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -246,6 +246,9 @@ struct algorithm
|
||||
@ -33,7 +33,7 @@ index 5f7f86a..d57cc6f 100644
|
||||
}
|
||||
default:
|
||||
WARN( "unknown magic %08x\n", object->magic );
|
||||
@@ -931,6 +934,31 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
@@ -972,6 +975,31 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -65,7 +65,7 @@ index 5f7f86a..d57cc6f 100644
|
||||
static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
{
|
||||
switch (key->alg_id)
|
||||
@@ -1159,6 +1187,12 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
@@ -1181,6 +1209,12 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -79,10 +79,10 @@ index 5f7f86a..d57cc6f 100644
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index e33dcd3..c826697 100644
|
||||
index 6ec429e309..baf5b638f9 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -523,6 +523,10 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
@@ -526,6 +526,10 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
sizeof(BCRYPT_CHAIN_MODE_CBC), 0);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
|
||||
@ -94,5 +94,5 @@ index e33dcd3..c826697 100644
|
||||
ret = pBCryptEncrypt(key, NULL, 0, NULL, NULL, 0, NULL, 0, &size, 0);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,53 +1,62 @@
|
||||
From 819a2d3c4c10b2512760e554f7f1c142ec9fc07a Mon Sep 17 00:00:00 2001
|
||||
From 71875d0a5fa90536bb48d83c3e9cf6163df370de Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 15:01:19 +0100
|
||||
Subject: [PATCH] bcrypt: Add support for auth data in AES GCM mode.
|
||||
Subject: [PATCH 23/36] bcrypt: Add support for auth data in AES GCM mode.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 38 ++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 36 insertions(+), 2 deletions(-)
|
||||
dlls/bcrypt/bcrypt_main.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 47 insertions(+)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index d57cc6f..506ed70 100644
|
||||
index 5913d1283e..a9dfb00ab4 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -51,7 +51,8 @@ static HINSTANCE instance;
|
||||
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
||||
|
||||
@@ -53,6 +53,10 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
||||
/* Not present in gnutls version < 3.0 */
|
||||
-static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t handle, void * tag, size_t tag_size);
|
||||
static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t handle, void * tag, size_t tag_size);
|
||||
|
||||
+/* Not present in gnutls version < 3.0 */
|
||||
+static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t handle, void *tag, size_t tag_size);
|
||||
+static int (*pgnutls_cipher_add_auth)(gnutls_cipher_hd_t handle, const void *ptext, size_t ptext_size);
|
||||
|
||||
+
|
||||
static void *libgnutls_handle;
|
||||
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
|
||||
@@ -72,7 +73,12 @@ MAKE_FUNCPTR(gnutls_perror);
|
||||
#define GNUTLS_CIPHER_AES_256_GCM 94
|
||||
#endif
|
||||
MAKE_FUNCPTR(gnutls_cipher_decrypt2);
|
||||
@@ -77,6 +81,16 @@ static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void * tag, size_
|
||||
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
}
|
||||
|
||||
-static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void * tag, size_t tag_size)
|
||||
+static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size)
|
||||
+{
|
||||
+ return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
+}
|
||||
+
|
||||
+static int compat_gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void *ptext, size_t ptext_size)
|
||||
+{
|
||||
+ return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
+}
|
||||
+
|
||||
static void gnutls_log( int level, const char *msg )
|
||||
{
|
||||
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
}
|
||||
@@ -115,6 +121,11 @@ static BOOL gnutls_initialize(void)
|
||||
WARN("gnutls_cipher_tag not found\n");
|
||||
pgnutls_cipher_tag = compat_gnutls_cipher_tag;
|
||||
TRACE( "<%d> %s", level, msg );
|
||||
@@ -127,6 +141,16 @@ static BOOL gnutls_initialize(void)
|
||||
pgnutls_global_set_log_level( 4 );
|
||||
pgnutls_global_set_log_function( gnutls_log );
|
||||
}
|
||||
+ if (!(pgnutls_cipher_tag = wine_dlsym( libgnutls_handle, "gnutls_cipher_tag", NULL, 0 )))
|
||||
+ {
|
||||
+ WARN("gnutls_cipher_tag not found\n");
|
||||
+ pgnutls_cipher_tag = compat_gnutls_cipher_tag;
|
||||
+ }
|
||||
+ if (!(pgnutls_cipher_add_auth = wine_dlsym( libgnutls_handle, "gnutls_cipher_add_auth", NULL, 0 )))
|
||||
+ {
|
||||
+ WARN("gnutls_cipher_add_auth not found\n");
|
||||
+ pgnutls_cipher_add_auth = compat_gnutls_cipher_add_auth;
|
||||
+ }
|
||||
|
||||
if ((ret = pgnutls_global_init()) != GNUTLS_E_SUCCESS)
|
||||
{
|
||||
@@ -1009,6 +1020,19 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
return TRUE;
|
||||
|
||||
@@ -1050,6 +1074,19 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -67,7 +76,7 @@ index d57cc6f..506ed70 100644
|
||||
static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output,
|
||||
ULONG output_len )
|
||||
{
|
||||
@@ -1199,6 +1223,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
@@ -1221,6 +1258,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -80,7 +89,7 @@ index d57cc6f..506ed70 100644
|
||||
static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output,
|
||||
ULONG output_len )
|
||||
{
|
||||
@@ -1324,6 +1354,8 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1416,6 +1459,8 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if (!output) return STATUS_SUCCESS;
|
||||
if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
@ -89,7 +98,7 @@ index d57cc6f..506ed70 100644
|
||||
if ((status = key_encrypt( key, input, input_len, output, output_len )))
|
||||
return status;
|
||||
|
||||
@@ -1401,6 +1433,8 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1492,6 +1537,8 @@ 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;
|
||||
|
||||
@ -99,5 +108,5 @@ index d57cc6f..506ed70 100644
|
||||
return status;
|
||||
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
From 3c7e2cb0745400c3e48229b7fa3baf224e2e849b Mon Sep 17 00:00:00 2001
|
||||
From 66401fad72037ba43d5dcd9c457cdc9b4aef0498 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 15:01:38 +0100
|
||||
Subject: [PATCH] bcrypt/tests: Add tests for auth data in AES GCM mode.
|
||||
Subject: [PATCH 24/36] bcrypt/tests: Add tests for auth data in AES GCM mode.
|
||||
|
||||
---
|
||||
dlls/bcrypt/tests/bcrypt.c | 44 ++++++++++++++++++++++++++++++++++++++++++--
|
||||
1 file changed, 42 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index c826697..fafc4a1 100644
|
||||
index baf5b638f9..bd22b80d9a 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -607,7 +607,9 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
@@ -610,7 +610,9 @@ static void test_BCryptGenerateSymmetricKey(void)
|
||||
static void test_BCryptEncrypt(void)
|
||||
{
|
||||
static UCHAR nonce[] =
|
||||
@ -22,7 +22,7 @@ index c826697..fafc4a1 100644
|
||||
static UCHAR secret[] =
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
|
||||
static UCHAR iv[] =
|
||||
@@ -633,6 +635,8 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -636,6 +638,8 @@ static void test_BCryptEncrypt(void)
|
||||
{0x89,0xb3,0x92,0x00,0x39,0x20,0x09,0xb4,0x6a,0xd6,0xaf,0xca,0x4b,0x5b,0xfd,0xd0};
|
||||
static UCHAR expected_tag2[] =
|
||||
{0x9a,0x92,0x32,0x2c,0x61,0x2a,0xae,0xef,0x66,0x2a,0xfb,0x55,0xe9,0x48,0xdf,0xbd};
|
||||
@ -31,7 +31,7 @@ index c826697..fafc4a1 100644
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO auth_info;
|
||||
UCHAR *buf, ciphertext[48], ivbuf[16], tag[16];
|
||||
BCRYPT_AUTH_TAG_LENGTHS_STRUCT tag_length;
|
||||
@@ -806,6 +810,24 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -809,6 +813,24 @@ static void test_BCryptEncrypt(void)
|
||||
for (i = 0; i < 16; i++)
|
||||
ok(tag[i] == expected_tag2[i], "%u: %02x != %02x\n", i, tag[i], expected_tag2[i]);
|
||||
|
||||
@ -56,7 +56,7 @@ index c826697..fafc4a1 100644
|
||||
/* test with padding */
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
memset(ciphertext, 0, sizeof(ciphertext));
|
||||
@@ -828,7 +850,9 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -831,7 +853,9 @@ static void test_BCryptEncrypt(void)
|
||||
static void test_BCryptDecrypt(void)
|
||||
{
|
||||
static UCHAR nonce[] =
|
||||
@ -67,7 +67,7 @@ index c826697..fafc4a1 100644
|
||||
static UCHAR secret[] =
|
||||
{0x00,0x01,0x02,0x03,0x04,0x05,0x06,0x07,0x08,0x09,0x0a,0x0b,0x0c,0x0d,0x0e,0x0f};
|
||||
static UCHAR iv[] =
|
||||
@@ -855,6 +879,8 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -858,6 +882,8 @@ static void test_BCryptDecrypt(void)
|
||||
0x86,0x64,0xc3,0xfe,0xa3,0x07,0x61,0xf8,0x16,0xc9,0x78,0x7f,0xe7,0xb1,0xc4,0x94};
|
||||
static UCHAR tag[] =
|
||||
{0x89,0xb3,0x92,0x00,0x39,0x20,0x09,0xb4,0x6a,0xd6,0xaf,0xca,0x4b,0x5b,0xfd,0xd0};
|
||||
@ -76,7 +76,7 @@ index c826697..fafc4a1 100644
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO auth_info;
|
||||
BCRYPT_KEY_LENGTHS_STRUCT key_lengths;
|
||||
BCRYPT_ALG_HANDLE aes;
|
||||
@@ -1004,6 +1030,20 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -1007,6 +1033,20 @@ static void test_BCryptDecrypt(void)
|
||||
ok(size == 32, "got %u\n", size);
|
||||
ok(!memcmp(plaintext, expected3, sizeof(expected3)), "wrong data\n");
|
||||
|
||||
@ -98,5 +98,5 @@ index c826697..fafc4a1 100644
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
auth_info.pbTag = iv; /* wrong tag */
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,18 +1,18 @@
|
||||
From a86334fac65af406c7e634fbf4f68c4796fb1f41 Mon Sep 17 00:00:00 2001
|
||||
From aad04c30ad73ffec87b46b59f65fc6d451138d0c Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Mon, 26 Dec 2016 16:20:57 +0100
|
||||
Subject: [PATCH] bcrypt: Avoid crash in tests when compiling without gnutls
|
||||
support.
|
||||
Subject: [PATCH 25/36] bcrypt: Avoid crash in tests when compiling without
|
||||
gnutls support.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 11 +++++++++++
|
||||
1 file changed, 11 insertions(+)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 506ed70..b52d289 100644
|
||||
index a9dfb00ab4..79e62e33c9 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_
|
||||
@@ -1310,12 +1310,19 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
||||
if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
|
||||
if (object) FIXME( "ignoring object buffer\n" );
|
||||
|
||||
@ -32,7 +32,7 @@ index 506ed70..b52d289 100644
|
||||
return status;
|
||||
}
|
||||
|
||||
@@ -1294,11 +1301,15 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE
|
||||
@@ -1398,11 +1405,15 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE
|
||||
if (!key_orig || key_orig->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
|
||||
if (!handle_copy) return STATUS_INVALID_PARAMETER;
|
||||
if (!(key_copy = HeapAlloc( GetProcessHeap(), 0, sizeof(*key_copy) )))
|
||||
@ -49,5 +49,5 @@ index 506ed70..b52d289 100644
|
||||
}
|
||||
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From ce3479faa24fcaab430d2c62c1d0c386089206b6 Mon Sep 17 00:00:00 2001
|
||||
From 344221b351b7dc15b9cd1e75b741e2dec978e744 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sun, 5 Mar 2017 23:18:03 +0100
|
||||
Subject: [PATCH] bcrypt: Implement support for ECB chain mode.
|
||||
Subject: [PATCH 26/36] bcrypt: Implement support for ECB chain mode.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 43 ++++++++--
|
||||
@ -9,10 +9,10 @@ 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 b52d289..6859788 100644
|
||||
index 79e62e33c9..22a653f7f2 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -225,6 +225,7 @@ enum alg_id
|
||||
@@ -238,6 +238,7 @@ enum alg_id
|
||||
|
||||
enum mode_id
|
||||
{
|
||||
@ -20,7 +20,7 @@ index b52d289..6859788 100644
|
||||
MODE_ID_CBC,
|
||||
MODE_ID_GCM
|
||||
};
|
||||
@@ -577,8 +578,9 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop
|
||||
@@ -590,8 +591,9 @@ static NTSTATUS get_alg_property( const struct algorithm *alg, const WCHAR *prop
|
||||
const WCHAR *mode;
|
||||
switch (alg->mode)
|
||||
{
|
||||
@ -31,7 +31,7 @@ index b52d289..6859788 100644
|
||||
default: return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@@ -631,7 +633,12 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
|
||||
@@ -644,7 +646,12 @@ static NTSTATUS set_alg_property( struct algorithm *alg, const WCHAR *prop, UCHA
|
||||
case ALG_ID_AES:
|
||||
if (!strcmpW( prop, BCRYPT_CHAINING_MODE ))
|
||||
{
|
||||
@ -45,7 +45,7 @@ index b52d289..6859788 100644
|
||||
{
|
||||
alg->mode = MODE_ID_CBC;
|
||||
return STATUS_SUCCESS;
|
||||
@@ -949,7 +956,12 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val
|
||||
@@ -1003,7 +1010,12 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val
|
||||
{
|
||||
if (!strcmpW( prop, BCRYPT_CHAINING_MODE ))
|
||||
{
|
||||
@ -59,7 +59,7 @@ index b52d289..6859788 100644
|
||||
{
|
||||
key->mode = MODE_ID_CBC;
|
||||
return STATUS_SUCCESS;
|
||||
@@ -979,6 +991,7 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
@@ -1033,6 +1045,7 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
switch (key->mode)
|
||||
{
|
||||
case MODE_ID_GCM: return GNUTLS_CIPHER_AES_128_GCM;
|
||||
@ -67,7 +67,7 @@ index b52d289..6859788 100644
|
||||
case MODE_ID_CBC:
|
||||
default: return GNUTLS_CIPHER_AES_128_CBC;
|
||||
}
|
||||
@@ -990,6 +1003,7 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
@@ -1044,6 +1057,7 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
|
||||
static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
{
|
||||
@ -75,7 +75,7 @@ index b52d289..6859788 100644
|
||||
gnutls_cipher_algorithm_t cipher;
|
||||
gnutls_datum_t secret, vector;
|
||||
int ret;
|
||||
@@ -1003,15 +1017,18 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
@@ -1057,15 +1071,18 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
if ((cipher = get_gnutls_cipher( key )) == GNUTLS_CIPHER_UNKNOWN)
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
|
||||
@ -100,7 +100,7 @@ index b52d289..6859788 100644
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
@@ -1385,11 +1402,15 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1490,11 +1507,15 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if (!output) return STATUS_SUCCESS;
|
||||
if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
@ -116,7 +116,7 @@ index b52d289..6859788 100644
|
||||
bytes_left -= key->block_size;
|
||||
src += key->block_size;
|
||||
dst += key->block_size;
|
||||
@@ -1472,11 +1493,15 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1576,11 +1597,15 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
else if (output_len < *ret_len)
|
||||
return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
@ -133,10 +133,10 @@ index b52d289..6859788 100644
|
||||
src += key->block_size;
|
||||
dst += key->block_size;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index fafc4a1..f9bf77b 100644
|
||||
index bd22b80d9a..ade8058724 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -631,6 +631,15 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -634,6 +634,15 @@ static void test_BCryptEncrypt(void)
|
||||
static UCHAR expected4[] =
|
||||
{0xe1,0x82,0xc3,0xc0,0x24,0xfb,0x86,0x85,0xf3,0xf1,0x2b,0x7d,0x09,0xb4,0x73,0x67,
|
||||
0x86,0x64,0xc3,0xfe,0xa3,0x07,0x61,0xf8,0x16,0xc9,0x78,0x7f,0xe7,0xb1,0xc4,0x94};
|
||||
@ -152,7 +152,7 @@ index fafc4a1..f9bf77b 100644
|
||||
static UCHAR expected_tag[] =
|
||||
{0x89,0xb3,0x92,0x00,0x39,0x20,0x09,0xb4,0x6a,0xd6,0xaf,0xca,0x4b,0x5b,0xfd,0xd0};
|
||||
static UCHAR expected_tag2[] =
|
||||
@@ -843,6 +852,97 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -846,6 +855,97 @@ static void test_BCryptEncrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
|
||||
@ -250,7 +250,7 @@ index fafc4a1..f9bf77b 100644
|
||||
ret = pBCryptCloseAlgorithmProvider(aes, 0);
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
}
|
||||
@@ -877,6 +977,13 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -880,6 +980,13 @@ static void test_BCryptDecrypt(void)
|
||||
static UCHAR ciphertext4[] =
|
||||
{0xe1,0x82,0xc3,0xc0,0x24,0xfb,0x86,0x85,0xf3,0xf1,0x2b,0x7d,0x09,0xb4,0x73,0x67,
|
||||
0x86,0x64,0xc3,0xfe,0xa3,0x07,0x61,0xf8,0x16,0xc9,0x78,0x7f,0xe7,0xb1,0xc4,0x94};
|
||||
@ -264,7 +264,7 @@ index fafc4a1..f9bf77b 100644
|
||||
static UCHAR tag[] =
|
||||
{0x89,0xb3,0x92,0x00,0x39,0x20,0x09,0xb4,0x6a,0xd6,0xaf,0xca,0x4b,0x5b,0xfd,0xd0};
|
||||
static UCHAR tag2[] =
|
||||
@@ -1055,6 +1162,109 @@ static void test_BCryptDecrypt(void)
|
||||
@@ -1058,6 +1165,109 @@ static void test_BCryptDecrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
HeapFree(GetProcessHeap(), 0, buf);
|
||||
|
||||
@ -375,5 +375,5 @@ index fafc4a1..f9bf77b 100644
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
}
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,8 +1,8 @@
|
||||
From d0f750269e6c667bf459ed53bb748a0f558eaa47 Mon Sep 17 00:00:00 2001
|
||||
From c8316aa8c5543faf138c83b50c93be6d58c82d1c Mon Sep 17 00:00:00 2001
|
||||
From: Andrew Wesie <awesie@gmail.com>
|
||||
Date: Mon, 1 May 2017 22:57:43 -0500
|
||||
Subject: [PATCH] bcrypt: Fix BCryptEncrypt with AES_GCM and no input and no
|
||||
output.
|
||||
Subject: [PATCH 27/36] bcrypt: Fix BCryptEncrypt with AES_GCM and no input and
|
||||
no output.
|
||||
|
||||
Signed-off-by: Andrew Wesie <awesie@gmail.com>
|
||||
---
|
||||
@ -11,10 +11,10 @@ Signed-off-by: Andrew Wesie <awesie@gmail.com>
|
||||
2 files changed, 19 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 6859788..bb92c04 100644
|
||||
index 22a653f7f2..95d21f7d0b 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
|
||||
@@ -1484,7 +1484,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
|
||||
*ret_len = input_len;
|
||||
if (flags & BCRYPT_BLOCK_PADDING) return STATUS_INVALID_PARAMETER;
|
||||
@ -24,10 +24,10 @@ index 6859788..bb92c04 100644
|
||||
|
||||
if (auth_info->pbAuthData && (status = key_set_auth_data( key, auth_info->pbAuthData, auth_info->cbAuthData )))
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index f9bf77b..ed73db5 100644
|
||||
index ade8058724..159be44714 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -646,6 +646,9 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -649,6 +649,9 @@ static void test_BCryptEncrypt(void)
|
||||
{0x9a,0x92,0x32,0x2c,0x61,0x2a,0xae,0xef,0x66,0x2a,0xfb,0x55,0xe9,0x48,0xdf,0xbd};
|
||||
static UCHAR expected_tag3[] =
|
||||
{0x17,0x9d,0xc0,0x7a,0xf0,0xcf,0xaa,0xd5,0x1c,0x11,0xc4,0x4b,0xd6,0xa3,0x3e,0x77};
|
||||
@ -37,7 +37,7 @@ index f9bf77b..ed73db5 100644
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO auth_info;
|
||||
UCHAR *buf, ciphertext[48], ivbuf[16], tag[16];
|
||||
BCRYPT_AUTH_TAG_LENGTHS_STRUCT tag_length;
|
||||
@@ -837,6 +840,21 @@ static void test_BCryptEncrypt(void)
|
||||
@@ -840,6 +843,21 @@ static void test_BCryptEncrypt(void)
|
||||
for (i = 0; i < 16; i++)
|
||||
ok(tag[i] == expected_tag3[i], "%u: %02x != %02x\n", i, tag[i], expected_tag3[i]);
|
||||
|
||||
@ -60,5 +60,5 @@ index f9bf77b..ed73db5 100644
|
||||
memcpy(ivbuf, iv, sizeof(iv));
|
||||
memset(ciphertext, 0, sizeof(ciphertext));
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,304 +0,0 @@
|
||||
From 3617913e722505d39009bc2dc2f32ba05289ff42 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 13 Aug 2017 04:28:43 +0200
|
||||
Subject: [PATCH] bcrypt: Partial implementation of BCryptImportKey and
|
||||
BCryptExportKey.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt.spec | 4 +-
|
||||
dlls/bcrypt/bcrypt_main.c | 101 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/bcrypt/tests/bcrypt.c | 46 +++++++++++++++++++++
|
||||
dlls/ncrypt/ncrypt.spec | 4 +-
|
||||
include/bcrypt.h | 14 +++++++
|
||||
5 files changed, 165 insertions(+), 4 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
|
||||
index fcd0f6d..28c2394 100644
|
||||
--- a/dlls/bcrypt/bcrypt.spec
|
||||
+++ b/dlls/bcrypt/bcrypt.spec
|
||||
@@ -20,7 +20,7 @@
|
||||
@ stub BCryptEnumContexts
|
||||
@ stub BCryptEnumProviders
|
||||
@ stub BCryptEnumRegisteredProviders
|
||||
-@ stub BCryptExportKey
|
||||
+@ stdcall BCryptExportKey(ptr ptr wstr ptr long ptr long)
|
||||
@ stub BCryptFinalizeKeyPair
|
||||
@ stdcall BCryptFinishHash(ptr ptr long long)
|
||||
@ stub BCryptFreeBuffer
|
||||
@@ -31,7 +31,7 @@
|
||||
@ stdcall BCryptGetProperty(ptr wstr ptr long ptr long)
|
||||
@ stdcall BCryptHash(ptr ptr long ptr long ptr long)
|
||||
@ stdcall BCryptHashData(ptr ptr long long)
|
||||
-@ stub BCryptImportKey
|
||||
+@ stdcall BCryptImportKey(ptr ptr wstr ptr ptr long ptr long long)
|
||||
@ stub BCryptImportKeyPair
|
||||
@ stdcall BCryptOpenAlgorithmProvider(ptr wstr wstr long)
|
||||
@ stub BCryptQueryContextConfiguration
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
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 )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+static NTSTATUS key_get_secret( struct key *key, UCHAR **secret, ULONG *len )
|
||||
+{
|
||||
+ *secret = key->secret;
|
||||
+ *len = key->secret_len;
|
||||
+ return STATUS_SUCCESS;
|
||||
+}
|
||||
+
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
if (key->handle) pgnutls_cipher_deinit( key->handle );
|
||||
@@ -1266,6 +1273,12 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
+static NTSTATUS key_get_secret( struct key *key, UCHAR **secret, ULONG *len )
|
||||
+{
|
||||
+ ERR( "support for keys not available at build time\n" );
|
||||
+ return STATUS_NOT_IMPLEMENTED;
|
||||
+}
|
||||
+
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
@@ -1334,6 +1347,94 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+NTSTATUS WINAPI BCryptImportKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE decrypt_key, LPCWSTR type,
|
||||
+ BCRYPT_KEY_HANDLE *key, UCHAR *object, ULONG object_len, UCHAR *input,
|
||||
+ ULONG input_len, ULONG flags )
|
||||
+{
|
||||
+ struct algorithm *alg = algorithm;
|
||||
+
|
||||
+ TRACE( "%p, %p, %s, %p, %p, %u, %p, %u, %u\n", algorithm, decrypt_key, debugstr_w(type), key, object,
|
||||
+ object_len, input, input_len, flags );
|
||||
+
|
||||
+ if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
|
||||
+ if (!key || !type || !input) return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ if (decrypt_key)
|
||||
+ {
|
||||
+ FIXME( "decrypting of key not yet supported\n" );
|
||||
+ return STATUS_NOT_IMPLEMENTED;
|
||||
+ }
|
||||
+
|
||||
+ if (!strcmpW( type, BCRYPT_KEY_DATA_BLOB ))
|
||||
+ {
|
||||
+ BCRYPT_KEY_DATA_BLOB_HEADER *key_header = (BCRYPT_KEY_DATA_BLOB_HEADER *)input;
|
||||
+
|
||||
+ if (input_len < sizeof(BCRYPT_KEY_DATA_BLOB_HEADER))
|
||||
+ return STATUS_BUFFER_TOO_SMALL;
|
||||
+
|
||||
+ if (key_header->dwMagic != BCRYPT_KEY_DATA_BLOB_MAGIC)
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ if (key_header->dwVersion != BCRYPT_KEY_DATA_BLOB_VERSION1)
|
||||
+ {
|
||||
+ FIXME( "unknown key data blob version %u\n", key_header->dwVersion );
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+ }
|
||||
+
|
||||
+ if (key_header->cbKeyData + sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) > input_len)
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ return BCryptGenerateSymmetricKey( algorithm, key, object, object_len,
|
||||
+ (UCHAR *)&key_header[1], key_header->cbKeyData, 0 );
|
||||
+ }
|
||||
+
|
||||
+ FIXME( "unsupported key type %s\n", debugstr_w(type) );
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+}
|
||||
+
|
||||
+NTSTATUS WINAPI BCryptExportKey( BCRYPT_KEY_HANDLE export_key, BCRYPT_KEY_HANDLE encrypt_key, LPCWSTR type,
|
||||
+ UCHAR *output, ULONG output_len, ULONG *size, ULONG flags )
|
||||
+{
|
||||
+ struct key *key = export_key;
|
||||
+ ULONG secret_len;
|
||||
+ NTSTATUS status;
|
||||
+ UCHAR *secret;
|
||||
+
|
||||
+ TRACE( "%p, %p, %s, %p, %u, %p, %u\n", key, encrypt_key, debugstr_w(type), output, output_len, size, flags );
|
||||
+
|
||||
+ if (!key || key->hdr.magic != MAGIC_KEY) return STATUS_INVALID_HANDLE;
|
||||
+ if (!output || !output_len || !size) return STATUS_INVALID_PARAMETER;
|
||||
+
|
||||
+ if (encrypt_key)
|
||||
+ {
|
||||
+ FIXME( "encryption of key not yet supported\n" );
|
||||
+ return STATUS_NOT_IMPLEMENTED;
|
||||
+ }
|
||||
+
|
||||
+ if ((status = key_get_secret( key, &secret, &secret_len )))
|
||||
+ return status;
|
||||
+
|
||||
+ if (!strcmpW( type, BCRYPT_KEY_DATA_BLOB ))
|
||||
+ {
|
||||
+ BCRYPT_KEY_DATA_BLOB_HEADER *key_header = (BCRYPT_KEY_DATA_BLOB_HEADER *)output;
|
||||
+ ULONG req_size = sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) + secret_len;
|
||||
+
|
||||
+ *size = req_size;
|
||||
+
|
||||
+ if (output_len < req_size)
|
||||
+ return STATUS_BUFFER_TOO_SMALL;
|
||||
+
|
||||
+ key_header->dwMagic = BCRYPT_KEY_DATA_BLOB_MAGIC;
|
||||
+ key_header->dwVersion = BCRYPT_KEY_DATA_BLOB_VERSION1;
|
||||
+ key_header->cbKeyData = secret_len;
|
||||
+ memcpy( &key_header[1], secret, secret_len );
|
||||
+ return STATUS_SUCCESS;
|
||||
+ }
|
||||
+
|
||||
+ FIXME( "unsupported key type %s\n", debugstr_w(type) );
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
+}
|
||||
+
|
||||
NTSTATUS WINAPI BCryptDestroyKey( BCRYPT_KEY_HANDLE handle )
|
||||
{
|
||||
struct key *key = handle;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index ed73db5..d52c79d 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -47,6 +47,9 @@ static NTSTATUS (WINAPI *pBCryptDecrypt)(BCRYPT_KEY_HANDLE, PUCHAR, ULONG, VOID
|
||||
ULONG *, ULONG);
|
||||
static NTSTATUS (WINAPI *pBCryptDuplicateKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE *, UCHAR *, ULONG, ULONG);
|
||||
static NTSTATUS (WINAPI *pBCryptDestroyKey)(BCRYPT_KEY_HANDLE);
|
||||
+static NTSTATUS (WINAPI *pBCryptImportKey)(BCRYPT_ALG_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, BCRYPT_KEY_HANDLE *,
|
||||
+ PUCHAR, ULONG, PUCHAR, ULONG, ULONG);
|
||||
+static NTSTATUS (WINAPI *pBCryptExportKey)(BCRYPT_KEY_HANDLE, BCRYPT_KEY_HANDLE, LPCWSTR, PUCHAR, ULONG, ULONG *, ULONG);
|
||||
|
||||
static void test_BCryptGenRandom(void)
|
||||
{
|
||||
@@ -1287,6 +1290,46 @@ static void test_BCryptDecrypt(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
}
|
||||
|
||||
+static void test_key_import_export(void)
|
||||
+{
|
||||
+ UCHAR buffer1[sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) + 16];
|
||||
+ UCHAR buffer2[sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) + 16];
|
||||
+ BCRYPT_KEY_DATA_BLOB_HEADER *key_data1 = (void*)buffer1;
|
||||
+ BCRYPT_ALG_HANDLE aes;
|
||||
+ BCRYPT_KEY_HANDLE key;
|
||||
+ NTSTATUS ret;
|
||||
+ ULONG size;
|
||||
+
|
||||
+ ret = pBCryptOpenAlgorithmProvider(&aes, BCRYPT_AES_ALGORITHM, NULL, 0);
|
||||
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
+
|
||||
+ key_data1->dwMagic = BCRYPT_KEY_DATA_BLOB_MAGIC;
|
||||
+ key_data1->dwVersion = BCRYPT_KEY_DATA_BLOB_VERSION1;
|
||||
+ key_data1->cbKeyData = 16;
|
||||
+ memset(&key_data1[1], 0x11, 16);
|
||||
+
|
||||
+ ret = pBCryptImportKey(aes, NULL, BCRYPT_KEY_DATA_BLOB, &key, NULL, 0, buffer1, sizeof(buffer1), 0);
|
||||
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
+
|
||||
+ size = 0;
|
||||
+ ret = pBCryptExportKey(key, NULL, BCRYPT_KEY_DATA_BLOB, buffer2, 1, &size, 0);
|
||||
+ ok(ret == STATUS_BUFFER_TOO_SMALL, "got %08x\n", ret);
|
||||
+ ok(size == sizeof(buffer2), "Expected sizeof(buffer2), got %u\n", size);
|
||||
+
|
||||
+ size = 0;
|
||||
+ memset(buffer2, 0xff, sizeof(buffer2));
|
||||
+ ret = pBCryptExportKey(key, NULL, BCRYPT_KEY_DATA_BLOB, buffer2, sizeof(buffer2), &size, 0);
|
||||
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
+ ok(size == sizeof(buffer2), "Expected sizeof(buffer2), got %u\n", size);
|
||||
+ ok(!memcmp(buffer1, buffer2, sizeof(buffer1)), "Expected exported key to match imported key\n");
|
||||
+
|
||||
+ ret = pBCryptDestroyKey(key);
|
||||
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
+
|
||||
+ ret = pBCryptCloseAlgorithmProvider(aes, 0);
|
||||
+ ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
+}
|
||||
+
|
||||
START_TEST(bcrypt)
|
||||
{
|
||||
HMODULE module;
|
||||
@@ -1315,6 +1358,8 @@ START_TEST(bcrypt)
|
||||
pBCryptDecrypt = (void *)GetProcAddress(module, "BCryptDecrypt");
|
||||
pBCryptDuplicateKey = (void *)GetProcAddress(module, "BCryptDuplicateKey");
|
||||
pBCryptDestroyKey = (void *)GetProcAddress(module, "BCryptDestroyKey");
|
||||
+ pBCryptImportKey = (void *)GetProcAddress(module, "BCryptImportKey");
|
||||
+ pBCryptExportKey = (void *)GetProcAddress(module, "BCryptExportKey");
|
||||
|
||||
test_BCryptGenRandom();
|
||||
test_BCryptGetFipsAlgorithmMode();
|
||||
@@ -1324,6 +1369,7 @@ START_TEST(bcrypt)
|
||||
test_BCryptGenerateSymmetricKey();
|
||||
test_BCryptEncrypt();
|
||||
test_BCryptDecrypt();
|
||||
+ test_key_import_export();
|
||||
|
||||
if (pBCryptHash) /* >= Win 10 */
|
||||
test_BcryptHash();
|
||||
diff --git a/dlls/ncrypt/ncrypt.spec b/dlls/ncrypt/ncrypt.spec
|
||||
index 68735eb..d0f0f56 100644
|
||||
--- a/dlls/ncrypt/ncrypt.spec
|
||||
+++ b/dlls/ncrypt/ncrypt.spec
|
||||
@@ -22,7 +22,7 @@
|
||||
@ stub BCryptEnumContexts
|
||||
@ stub BCryptEnumProviders
|
||||
@ stub BCryptEnumRegisteredProviders
|
||||
-@ stub BCryptExportKey
|
||||
+@ stdcall BCryptExportKey(ptr ptr wstr ptr long ptr long) bcrypt.BCryptExportKey
|
||||
@ stub BCryptFinalizeKeyPair
|
||||
@ stdcall BCryptFinishHash(ptr ptr long long) bcrypt.BCryptFinishHash
|
||||
@ stub BCryptFreeBuffer
|
||||
@@ -33,7 +33,7 @@
|
||||
@ stdcall BCryptGetProperty(ptr wstr ptr long ptr long) bcrypt.BCryptGetProperty
|
||||
@ stdcall BCryptHash(ptr ptr long ptr long ptr long) bcrypt.BCryptHash
|
||||
@ stdcall BCryptHashData(ptr ptr long long) bcrypt.BCryptHashData
|
||||
-@ stub BCryptImportKey
|
||||
+@ stdcall BCryptImportKey(ptr ptr wstr ptr ptr long ptr long long) bcrypt.BCryptImportKey
|
||||
@ stub BCryptImportKeyPair
|
||||
@ stub BCryptKeyDerivation
|
||||
@ stdcall BCryptOpenAlgorithmProvider(ptr wstr wstr long) bcrypt.BCryptOpenAlgorithmProvider
|
||||
diff --git a/include/bcrypt.h b/include/bcrypt.h
|
||||
index 1e468a3..81822af 100644
|
||||
--- a/include/bcrypt.h
|
||||
+++ b/include/bcrypt.h
|
||||
@@ -58,6 +58,10 @@ typedef LONG NTSTATUS;
|
||||
#define BCRYPT_PROVIDER_HANDLE (const WCHAR []){'P','r','o','v','i','d','e','r','H','a','n','d','l','e',0}
|
||||
#define BCRYPT_SIGNATURE_LENGTH (const WCHAR []){'S','i','g','n','a','t','u','r','e','L','e','n','g','t','h',0}
|
||||
|
||||
+#define BCRYPT_OPAQUE_KEY_BLOB (const WCHAR []){'O','p','a','q','u','e','K','e','y','B','l','o','b',0}
|
||||
+#define BCRYPT_KEY_DATA_BLOB (const WCHAR []){'K','e','y','D','a','t','a','B','l','o','b',0}
|
||||
+#define BCRYPT_AES_WRAP_KEY_BLOB (const WCHAR []){'R','f','c','3','5','6','5','K','e','y','W','r','a','p','B','l','o','b',0}
|
||||
+
|
||||
#define MS_PRIMITIVE_PROVIDER (const WCHAR [])\
|
||||
{'M','i','c','r','o','s','o','f','t',' ','P','r','i','m','i','t','i','v','e',' ','P','r','o','v','i','d','e','r',0}
|
||||
#define MS_PLATFORM_CRYPTO_PROVIDER (const WCHAR [])\
|
||||
@@ -94,6 +98,13 @@ typedef struct __BCRYPT_KEY_LENGTHS_STRUCT
|
||||
ULONG dwIncrement;
|
||||
} BCRYPT_KEY_LENGTHS_STRUCT, BCRYPT_AUTH_TAG_LENGTHS_STRUCT;
|
||||
|
||||
+typedef struct _BCRYPT_KEY_DATA_BLOB_HEADER
|
||||
+{
|
||||
+ ULONG dwMagic;
|
||||
+ ULONG dwVersion;
|
||||
+ ULONG cbKeyData;
|
||||
+} BCRYPT_KEY_DATA_BLOB_HEADER, *PBCRYPT_KEY_DATA_BLOB_HEADER;
|
||||
+
|
||||
typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
|
||||
{
|
||||
ULONG cbSize;
|
||||
@@ -139,6 +150,9 @@ typedef struct _CRYPT_PROVIDER_REG
|
||||
PCRYPT_IMAGE_REG pKM;
|
||||
} CRYPT_PROVIDER_REG, *PCRYPT_PROVIDER_REG;
|
||||
|
||||
+#define BCRYPT_KEY_DATA_BLOB_MAGIC 0x4d42444b
|
||||
+#define BCRYPT_KEY_DATA_BLOB_VERSION1 1
|
||||
+
|
||||
typedef PVOID BCRYPT_ALG_HANDLE;
|
||||
typedef PVOID BCRYPT_KEY_HANDLE;
|
||||
typedef PVOID BCRYPT_HANDLE;
|
||||
--
|
||||
1.9.1
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 7345fd134e82db7d3c53cf67bb4374496c1ed650 Mon Sep 17 00:00:00 2001
|
||||
From e5bac5f440059f09e04faf552c973280b048dac2 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sun, 13 Aug 2017 05:04:21 +0200
|
||||
Subject: [PATCH] bcrypt: Add support for 192 and 256 bit aes keys.
|
||||
Subject: [PATCH 28/36] bcrypt: Add support for 192 and 256 bit aes keys.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 14 ++++++++++++--
|
||||
@ -9,10 +9,10 @@ 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 f00a154..44c334f 100644
|
||||
index 95d21f7d0b..4faab160e7 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 )
|
||||
@@ -1044,11 +1044,21 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
WARN( "handle block size\n" );
|
||||
switch (key->mode)
|
||||
{
|
||||
@ -37,7 +37,7 @@ index f00a154..44c334f 100644
|
||||
FIXME( "algorithm %u not supported\n", key->alg_id );
|
||||
return GNUTLS_CIPHER_UNKNOWN;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index d52c79d..e4c9ea0 100644
|
||||
index 159be44714..a0906e9904 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -615,6 +615,9 @@ static void test_BCryptEncrypt(void)
|
||||
@ -94,5 +94,5 @@ index d52c79d..e4c9ea0 100644
|
||||
* AES - ECB mode *
|
||||
******************/
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,17 +1,29 @@
|
||||
From fccac8005af4ef28211ab1ce6ca67d9e069eb951 Mon Sep 17 00:00:00 2001
|
||||
From 2206bf14a18b797e0b9eb6eca0828feba58c118e Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 29 Sep 2017 18:31:55 +0200
|
||||
Subject: [PATCH] bcrypt: Preparation for asymmetric keys.
|
||||
Subject: [PATCH 29/36] bcrypt: Preparation for asymmetric keys.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 340 +++++++++++++++++++++++++++++++---------------
|
||||
1 file changed, 231 insertions(+), 109 deletions(-)
|
||||
dlls/bcrypt/bcrypt_main.c | 334 ++++++++++++++++++++++++++++++----------------
|
||||
1 file changed, 216 insertions(+), 118 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 44c334f..8568d35 100644
|
||||
index 4faab160e7..f81597e2c6 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -238,16 +238,17 @@ static const struct {
|
||||
@@ -81,11 +81,6 @@ static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void * tag, size_
|
||||
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
}
|
||||
|
||||
-static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size)
|
||||
-{
|
||||
- return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
-}
|
||||
-
|
||||
static int compat_gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void *ptext, size_t ptext_size)
|
||||
{
|
||||
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
@@ -251,16 +246,17 @@ static const struct {
|
||||
ULONG hash_length;
|
||||
ULONG block_bits;
|
||||
const WCHAR *alg_name;
|
||||
@ -38,8 +50,8 @@ index 44c334f..8568d35 100644
|
||||
};
|
||||
|
||||
struct algorithm
|
||||
@@ -894,10 +895,8 @@ static ULONG get_block_size( struct algorithm *alg )
|
||||
#endif
|
||||
@@ -898,35 +894,59 @@ NTSTATUS WINAPI BCryptHash( BCRYPT_ALG_HANDLE algorithm, UCHAR *secret, ULONG se
|
||||
}
|
||||
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H)
|
||||
-struct key
|
||||
@ -50,11 +62,50 @@ index 44c334f..8568d35 100644
|
||||
enum mode_id mode;
|
||||
ULONG block_size;
|
||||
gnutls_cipher_hd_t handle;
|
||||
@@ -905,7 +904,39 @@ struct key
|
||||
UCHAR *secret;
|
||||
ULONG secret_len;
|
||||
};
|
||||
|
||||
-static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
-#elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
struct key
|
||||
{
|
||||
- struct object hdr;
|
||||
- enum alg_id alg_id;
|
||||
+ struct object hdr;
|
||||
+ enum alg_id alg_id;
|
||||
+ union
|
||||
+ {
|
||||
+ struct key_symmetric s;
|
||||
+ } u;
|
||||
+};
|
||||
+#elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
+struct key_symmetric
|
||||
+{
|
||||
+ enum mode_id mode;
|
||||
ULONG block_size;
|
||||
CCCryptorRef ref_encrypt;
|
||||
CCCryptorRef ref_decrypt;
|
||||
UCHAR *secret;
|
||||
ULONG secret_len;
|
||||
};
|
||||
-#else
|
||||
struct key
|
||||
{
|
||||
- struct object hdr;
|
||||
+ struct object hdr;
|
||||
+ enum alg_id alg_id;
|
||||
+ union
|
||||
+ {
|
||||
+ struct key_symmetric s;
|
||||
+ } u;
|
||||
+};
|
||||
+#else
|
||||
+struct key_symmetric
|
||||
+{
|
||||
+ enum mode_id mode;
|
||||
ULONG block_size;
|
||||
UCHAR *secret;
|
||||
ULONG secret_len;
|
||||
};
|
||||
+struct key
|
||||
+{
|
||||
+ struct object hdr;
|
||||
@ -64,7 +115,33 @@ index 44c334f..8568d35 100644
|
||||
+ struct key_symmetric s;
|
||||
+ } u;
|
||||
+};
|
||||
+
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) || defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
@@ -941,15 +961,15 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
|
||||
if (!strcmpW( type, BCRYPT_KEY_DATA_BLOB ))
|
||||
{
|
||||
BCRYPT_KEY_DATA_BLOB_HEADER *header = (BCRYPT_KEY_DATA_BLOB_HEADER *)output;
|
||||
- ULONG req_size = sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) + key->secret_len;
|
||||
+ ULONG req_size = sizeof(BCRYPT_KEY_DATA_BLOB_HEADER) + key->u.s.secret_len;
|
||||
|
||||
*size = req_size;
|
||||
if (output_len < req_size) return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
header->dwMagic = BCRYPT_KEY_DATA_BLOB_MAGIC;
|
||||
header->dwVersion = BCRYPT_KEY_DATA_BLOB_VERSION1;
|
||||
- header->cbKeyData = key->secret_len;
|
||||
- memcpy( &header[1], key->secret, key->secret_len );
|
||||
+ header->cbKeyData = key->u.s.secret_len;
|
||||
+ memcpy( &header[1], key->u.s.secret, key->u.s.secret_len );
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@@ -959,7 +979,29 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H)
|
||||
-static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
+static inline BOOL key_is_symmetric( struct key *key )
|
||||
+{
|
||||
+ return alg_props[key->alg_id].symmetric;
|
||||
@ -91,7 +168,7 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
UCHAR *buffer;
|
||||
|
||||
@@ -921,15 +952,15 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
@@ -975,15 +1017,15 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
}
|
||||
|
||||
@ -112,7 +189,7 @@ index 44c334f..8568d35 100644
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -938,37 +969,48 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
@@ -992,37 +1034,48 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
{
|
||||
UCHAR *buffer;
|
||||
|
||||
@ -174,7 +251,7 @@ index 44c334f..8568d35 100644
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
else
|
||||
@@ -988,22 +1030,22 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
@@ -1042,22 +1095,22 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
{
|
||||
case ALG_ID_AES:
|
||||
WARN( "handle block size\n" );
|
||||
@ -204,7 +281,7 @@ index 44c334f..8568d35 100644
|
||||
return GNUTLS_CIPHER_UNKNOWN;
|
||||
default:
|
||||
FIXME( "algorithm %u not supported\n", key->alg_id );
|
||||
@@ -1011,17 +1053,17 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
@@ -1065,17 +1118,17 @@ static gnutls_cipher_algorithm_t get_gnutls_cipher( const struct key *key )
|
||||
}
|
||||
}
|
||||
|
||||
@ -226,7 +303,7 @@ index 44c334f..8568d35 100644
|
||||
}
|
||||
|
||||
if ((cipher = get_gnutls_cipher( key )) == GNUTLS_CIPHER_UNKNOWN)
|
||||
@@ -1033,12 +1075,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
@@ -1087,12 +1140,12 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
iv_len = sizeof(zero_iv);
|
||||
}
|
||||
|
||||
@ -242,7 +319,7 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
@@ -1047,11 +1089,11 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
@@ -1101,11 +1154,11 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -256,7 +333,7 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
@@ -1060,12 +1102,12 @@ static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len
|
||||
@@ -1114,12 +1167,12 @@ static NTSTATUS key_set_auth_data( struct key *key, UCHAR *auth_data, ULONG len
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -271,7 +348,7 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
@@ -1074,12 +1116,12 @@ static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
@@ -1128,12 +1181,12 @@ static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -286,12 +363,7 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
@@ -1088,11 +1130,11 @@ static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
-static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
+static NTSTATUS key_symmetric_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
@@ -1146,7 +1199,7 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
{
|
||||
int ret;
|
||||
|
||||
@ -300,38 +372,19 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
pgnutls_perror( ret );
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
@@ -1101,18 +1143,22 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
-static NTSTATUS key_get_secret( struct key *key, UCHAR **secret, ULONG *len )
|
||||
+static NTSTATUS key_symmetric_get_secret( struct key *key, UCHAR **secret, ULONG *len )
|
||||
{
|
||||
- *secret = key->secret;
|
||||
- *len = key->secret_len;
|
||||
+ *secret = key->u.s.secret;
|
||||
+ *len = key->u.s.secret_len;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1157,13 +1210,34 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
- if (key->handle) pgnutls_cipher_deinit( key->handle );
|
||||
- heap_free( key->secret );
|
||||
+ if (key_is_symmetric(key))
|
||||
+ {
|
||||
+ if (key->u.s.handle) pgnutls_cipher_deinit( key->u.s.handle );
|
||||
+ heap_free( key->u.s.secret );
|
||||
+ }
|
||||
+ if (key->u.s.handle) pgnutls_cipher_deinit( key->u.s.handle );
|
||||
+ heap_free( key->u.s.secret );
|
||||
heap_free( key );
|
||||
+
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
@@ -1127,6 +1173,28 @@ struct key
|
||||
ULONG secret_len;
|
||||
};
|
||||
|
||||
-static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
+static inline BOOL key_is_symmetric( struct key *key )
|
||||
+{
|
||||
+ return alg_props[key->alg_id].symmetric;
|
||||
@ -353,58 +406,48 @@ index 44c334f..8568d35 100644
|
||||
+ *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 )
|
||||
+static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
{
|
||||
UCHAR *buffer;
|
||||
@@ -1231,59 +1299,82 @@ struct key
|
||||
ULONG block_size;
|
||||
};
|
||||
|
||||
-static NTSTATUS key_init( struct key *key, struct algorithm *alg, UCHAR *secret, ULONG secret_len )
|
||||
+static inline BOOL key_is_symmetric( struct key *key )
|
||||
+{
|
||||
+ ERR( "support for keys not available at build time\n" );
|
||||
+ return FALSE;
|
||||
+}
|
||||
+
|
||||
+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 )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
- key->mode = MODE_ID_CBC;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
@@ -1190,7 +1264,7 @@ static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *s
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
-static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
+static NTSTATUS key_symmetric_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
- key_copy->mode = MODE_ID_CBC;
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
CCCryptorStatus status;
|
||||
|
||||
@@ -1223,7 +1297,7 @@ static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+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;
|
||||
+}
|
||||
+
|
||||
+
|
||||
static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *value, ULONG size, ULONG flags )
|
||||
-static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output,
|
||||
+static NTSTATUS key_symmetric_encrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output,
|
||||
ULONG output_len )
|
||||
{
|
||||
CCCryptorStatus status;
|
||||
@@ -1237,7 +1311,7 @@ static NTSTATUS key_encrypt( struct key *key, const UCHAR *input, ULONG input_le
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
-static NTSTATUS key_decrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output,
|
||||
+static NTSTATUS key_symmetric_decrypt( struct key *key, const UCHAR *input, ULONG input_len, UCHAR *output,
|
||||
ULONG output_len )
|
||||
{
|
||||
CCCryptorStatus status;
|
||||
@@ -1260,7 +1334,7 @@ static NTSTATUS key_destroy( struct key *key )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
#else
|
||||
-static NTSTATUS key_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
+static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, const UCHAR *secret, ULONG secret_len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
@@ -1279,26 +1353,26 @@ static NTSTATUS set_key_property( struct key *key, const WCHAR *prop, UCHAR *val
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
-static NTSTATUS key_set_params( struct key *key, UCHAR *iv, ULONG iv_len )
|
||||
@ -434,22 +477,7 @@ index 44c334f..8568d35 100644
|
||||
ULONG output_len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
-static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
+static NTSTATUS key_symmetric_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
-static NTSTATUS key_get_secret( struct key *key, UCHAR **secret, ULONG *len )
|
||||
+static NTSTATUS key_symmetric_get_secret( struct key *key, UCHAR **secret, ULONG *len )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
@@ -1318,7 +1409,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
||||
@@ -1346,7 +1420,7 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
||||
|
||||
key->hdr.magic = MAGIC_KEY;
|
||||
|
||||
@ -458,28 +486,7 @@ index 44c334f..8568d35 100644
|
||||
{
|
||||
heap_free( key );
|
||||
*handle = NULL;
|
||||
@@ -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;
|
||||
|
||||
+ if (!key_is_symmetric(key))
|
||||
+ {
|
||||
+ FIXME( "export of asymmetric keys not yet supported\n");
|
||||
+ return STATUS_NOT_IMPLEMENTED;
|
||||
+ }
|
||||
+
|
||||
if (encrypt_key)
|
||||
{
|
||||
FIXME( "encryption of key not yet supported\n" );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
- if ((status = key_get_secret( key, &secret, &secret_len )))
|
||||
+ if ((status = key_symmetric_get_secret( key, &secret, &secret_len )))
|
||||
return status;
|
||||
|
||||
if (!strcmpW( type, BCRYPT_KEY_DATA_BLOB ))
|
||||
@@ -1462,19 +1559,30 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1465,22 +1539,32 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
struct key *key = handle;
|
||||
ULONG bytes_left = input_len;
|
||||
UCHAR *buf, *src, *dst;
|
||||
@ -510,8 +517,11 @@ index 44c334f..8568d35 100644
|
||||
+ if (mode == MODE_ID_GCM)
|
||||
{
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding;
|
||||
- UCHAR tag[16];
|
||||
|
||||
@@ -1485,7 +1593,7 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if (!auth_info) return STATUS_INVALID_PARAMETER;
|
||||
if (!auth_info->pbNonce) return STATUS_INVALID_PARAMETER;
|
||||
@@ -1489,7 +1573,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" );
|
||||
|
||||
@ -520,7 +530,7 @@ index 44c334f..8568d35 100644
|
||||
return status;
|
||||
|
||||
*ret_len = input_len;
|
||||
@@ -1493,46 +1601,48 @@ NTSTATUS WINAPI BCryptEncrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1497,46 +1581,47 @@ 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;
|
||||
|
||||
@ -531,30 +541,30 @@ index 44c334f..8568d35 100644
|
||||
+ if ((status = key_symmetric_encrypt( key, input, input_len, output, output_len )))
|
||||
return status;
|
||||
|
||||
- return key_get_tag( key, auth_info->pbTag, auth_info->cbTag );
|
||||
+ return key_symmetric_get_tag( key, auth_info->pbTag, auth_info->cbTag );
|
||||
return key_get_tag( key, auth_info->pbTag, auth_info->cbTag );
|
||||
}
|
||||
|
||||
- if ((status = key_set_params( key, iv, iv_len ))) return status;
|
||||
+ if ((status = key_symmetric_set_params( key, iv, iv_len ))) return status;
|
||||
+ if ((status = key_symmetric_get_blocksize( key, &block_size ))) return status;
|
||||
+
|
||||
|
||||
*ret_len = input_len;
|
||||
|
||||
if (flags & BCRYPT_BLOCK_PADDING)
|
||||
- *ret_len = (input_len + key->block_size) & ~(key->block_size - 1);
|
||||
- else if (input_len & (key->block_size - 1))
|
||||
- return STATUS_INVALID_BUFFER_SIZE;
|
||||
+ *ret_len = (input_len + block_size) & ~(block_size - 1);
|
||||
+ else if (input_len & (block_size - 1))
|
||||
return STATUS_INVALID_BUFFER_SIZE;
|
||||
+ return STATUS_INVALID_BUFFER_SIZE;
|
||||
|
||||
if (!output) return STATUS_SUCCESS;
|
||||
if (output_len < *ret_len) return STATUS_BUFFER_TOO_SMALL;
|
||||
|
||||
- if (key->mode == MODE_ID_ECB && iv)
|
||||
- return STATUS_INVALID_PARAMETER;
|
||||
+ if (mode == MODE_ID_ECB && iv)
|
||||
return STATUS_INVALID_PARAMETER;
|
||||
+ return STATUS_INVALID_PARAMETER;
|
||||
|
||||
src = input;
|
||||
dst = output;
|
||||
@ -585,7 +595,7 @@ index 44c334f..8568d35 100644
|
||||
heap_free( buf );
|
||||
}
|
||||
|
||||
@@ -1546,19 +1656,30 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1550,28 +1635,40 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
struct key *key = handle;
|
||||
ULONG bytes_left = input_len;
|
||||
UCHAR *buf, *src, *dst;
|
||||
@ -616,8 +626,10 @@ index 44c334f..8568d35 100644
|
||||
+ if (mode == MODE_ID_GCM)
|
||||
{
|
||||
BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO *auth_info = padding;
|
||||
UCHAR tag[16];
|
||||
@@ -1568,7 +1689,7 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
+ UCHAR tag[16];
|
||||
|
||||
if (!auth_info) return STATUS_INVALID_PARAMETER;
|
||||
if (!auth_info->pbNonce) return STATUS_INVALID_PARAMETER;
|
||||
if (!auth_info->pbTag) return STATUS_INVALID_PARAMETER;
|
||||
if (auth_info->cbTag < 12 || auth_info->cbTag > 16) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
@ -626,7 +638,7 @@ index 44c334f..8568d35 100644
|
||||
return status;
|
||||
|
||||
*ret_len = input_len;
|
||||
@@ -1576,12 +1697,12 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
@@ -1579,9 +1676,9 @@ 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;
|
||||
|
||||
@ -637,12 +649,8 @@ index 44c334f..8568d35 100644
|
||||
+ if ((status = key_symmetric_decrypt( key, input, input_len, output, output_len )))
|
||||
return status;
|
||||
|
||||
- if ((status = key_get_tag( key, tag, sizeof(tag) )))
|
||||
+ if ((status = key_symmetric_get_tag( key, tag, sizeof(tag) )))
|
||||
return status;
|
||||
if (memcmp( tag, auth_info->pbTag, auth_info->cbTag ))
|
||||
return STATUS_AUTH_TAG_MISMATCH;
|
||||
@@ -1589,44 +1710,45 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
if ((status = key_get_tag( key, tag, sizeof(tag) )))
|
||||
@@ -1592,44 +1689,45 @@ NTSTATUS WINAPI BCryptDecrypt( BCRYPT_KEY_HANDLE handle, UCHAR *input, ULONG inp
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -706,5 +714,5 @@ index 44c334f..8568d35 100644
|
||||
else
|
||||
status = STATUS_UNSUCCESSFUL; /* FIXME: invalid padding */
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 080654bd51c431b745dd75bbe43cadd8f3974113 Mon Sep 17 00:00:00 2001
|
||||
From f21b177f19edb6610ce460bc09cf6cfe2318e96c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 29 Sep 2017 18:49:09 +0200
|
||||
Subject: [PATCH] include: Add ecdsa and asymmetric key related bcrypt
|
||||
Subject: [PATCH 30/36] include: Add ecdsa and asymmetric key related bcrypt
|
||||
definitions.
|
||||
|
||||
---
|
||||
@ -10,7 +10,7 @@ Subject: [PATCH] include: Add ecdsa and asymmetric key related bcrypt
|
||||
2 files changed, 30 insertions(+)
|
||||
|
||||
diff --git a/include/bcrypt.h b/include/bcrypt.h
|
||||
index 81822af..9e5cd58 100644
|
||||
index d0b29c7cdd..bf47576ab0 100644
|
||||
--- a/include/bcrypt.h
|
||||
+++ b/include/bcrypt.h
|
||||
@@ -61,6 +61,8 @@ typedef LONG NTSTATUS;
|
||||
@ -46,7 +46,7 @@ index 81822af..9e5cd58 100644
|
||||
typedef struct _BCRYPT_ALGORITHM_IDENTIFIER
|
||||
{
|
||||
LPWSTR pszName;
|
||||
@@ -122,6 +134,22 @@ typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
|
||||
@@ -115,6 +127,22 @@ typedef struct _BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO
|
||||
ULONG dwFlags;
|
||||
} BCRYPT_AUTHENTICATED_CIPHER_MODE_INFO, *PBCRYPT_AUTHENTICATED_CIPHER_MODE_INFO;
|
||||
|
||||
@ -70,7 +70,7 @@ index 81822af..9e5cd58 100644
|
||||
|
||||
#define BCRYPT_AUTH_MODE_CHAIN_CALLS_FLAG 0x00000001
|
||||
diff --git a/include/ntstatus.h b/include/ntstatus.h
|
||||
index 7026de7..735b6c2 100644
|
||||
index 7026de7f85..735b6c2c41 100644
|
||||
--- a/include/ntstatus.h
|
||||
+++ b/include/ntstatus.h
|
||||
@@ -990,6 +990,8 @@
|
||||
@ -83,5 +83,5 @@ index 7026de7..735b6c2 100644
|
||||
|
||||
#define RPC_NT_INVALID_STRING_BINDING ((NTSTATUS) 0xC0020001)
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,14 +1,14 @@
|
||||
From 97f00b37c8daf589826b88225db540348bc9f52b Mon Sep 17 00:00:00 2001
|
||||
From a3604695d31100eabebdbe41a1f0d89837599697 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 29 Sep 2017 18:50:04 +0200
|
||||
Subject: [PATCH] bcrypt/tests: Add basic test for ecdsa.
|
||||
Subject: [PATCH 31/36] bcrypt/tests: Add basic test for ecdsa.
|
||||
|
||||
---
|
||||
dlls/bcrypt/tests/bcrypt.c | 65 ++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 65 insertions(+)
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index e4c9ea0..b506d9e 100644
|
||||
index a0906e9904..9b04f62df2 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -50,6 +50,8 @@ static NTSTATUS (WINAPI *pBCryptDestroyKey)(BCRYPT_KEY_HANDLE);
|
||||
@ -20,7 +20,7 @@ index e4c9ea0..b506d9e 100644
|
||||
|
||||
static void test_BCryptGenRandom(void)
|
||||
{
|
||||
@@ -1362,6 +1364,66 @@ static void test_key_import_export(void)
|
||||
@@ -1367,6 +1369,66 @@ static void test_key_import_export(void)
|
||||
ok(ret == STATUS_SUCCESS, "got %08x\n", ret);
|
||||
}
|
||||
|
||||
@ -87,7 +87,7 @@ index e4c9ea0..b506d9e 100644
|
||||
START_TEST(bcrypt)
|
||||
{
|
||||
HMODULE module;
|
||||
@@ -1392,6 +1454,8 @@ START_TEST(bcrypt)
|
||||
@@ -1397,6 +1459,8 @@ START_TEST(bcrypt)
|
||||
pBCryptDestroyKey = (void *)GetProcAddress(module, "BCryptDestroyKey");
|
||||
pBCryptImportKey = (void *)GetProcAddress(module, "BCryptImportKey");
|
||||
pBCryptExportKey = (void *)GetProcAddress(module, "BCryptExportKey");
|
||||
@ -96,7 +96,7 @@ index e4c9ea0..b506d9e 100644
|
||||
|
||||
test_BCryptGenRandom();
|
||||
test_BCryptGetFipsAlgorithmMode();
|
||||
@@ -1402,6 +1466,7 @@ START_TEST(bcrypt)
|
||||
@@ -1407,6 +1471,7 @@ START_TEST(bcrypt)
|
||||
test_BCryptEncrypt();
|
||||
test_BCryptDecrypt();
|
||||
test_key_import_export();
|
||||
@ -105,5 +105,5 @@ index e4c9ea0..b506d9e 100644
|
||||
if (pBCryptHash) /* >= Win 10 */
|
||||
test_BcryptHash();
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
From 64827bb05687927e9f241fc53293e415d4772720 Mon Sep 17 00:00:00 2001
|
||||
From 8e5b9a28a3a15c84ff061b4f9981a07973460396 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 29 Sep 2017 19:18:58 +0200
|
||||
Subject: [PATCH] bcrypt: Implement importing of ecdsa keys.
|
||||
Subject: [PATCH 32/36] bcrypt: Implement importing of ecdsa keys.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt.spec | 4 +-
|
||||
dlls/bcrypt/bcrypt_main.c | 144 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
dlls/bcrypt/bcrypt_main.c | 161 +++++++++++++++++++++++++++++++++++++++++++--
|
||||
dlls/bcrypt/tests/bcrypt.c | 6 +-
|
||||
include/bcrypt.h | 2 +
|
||||
4 files changed, 148 insertions(+), 8 deletions(-)
|
||||
4 files changed, 163 insertions(+), 10 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt.spec b/dlls/bcrypt/bcrypt.spec
|
||||
index 28c2394..78824d7 100644
|
||||
index 28c2394ce4..78824d73b3 100644
|
||||
--- a/dlls/bcrypt/bcrypt.spec
|
||||
+++ b/dlls/bcrypt/bcrypt.spec
|
||||
@@ -32,7 +32,7 @@
|
||||
@ -33,10 +33,10 @@ index 28c2394..78824d7 100644
|
||||
@ stub GetCipherInterface
|
||||
@ stub GetHashInterface
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index 8568d35..0ec271e 100644
|
||||
index f81597e2c6..503712b4c3 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -220,7 +220,9 @@ enum alg_id
|
||||
@@ -228,7 +228,9 @@ enum alg_id
|
||||
ALG_ID_SHA1,
|
||||
ALG_ID_SHA256,
|
||||
ALG_ID_SHA384,
|
||||
@ -47,7 +47,7 @@ index 8568d35..0ec271e 100644
|
||||
};
|
||||
|
||||
enum mode_id
|
||||
@@ -248,7 +250,9 @@ static const struct {
|
||||
@@ -256,7 +258,9 @@ static const struct {
|
||||
/* ALG_ID_SHA1 */ { 278, 20, 512, BCRYPT_SHA1_ALGORITHM, FALSE },
|
||||
/* ALG_ID_SHA256 */ { 286, 32, 512, BCRYPT_SHA256_ALGORITHM, FALSE },
|
||||
/* ALG_ID_SHA384 */ { 382, 48, 1024, BCRYPT_SHA384_ALGORITHM, FALSE },
|
||||
@ -58,7 +58,7 @@ index 8568d35..0ec271e 100644
|
||||
};
|
||||
|
||||
struct algorithm
|
||||
@@ -327,6 +331,8 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
|
||||
@@ -335,6 +339,8 @@ 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;
|
||||
@ -67,27 +67,71 @@ index 8568d35..0ec271e 100644
|
||||
else
|
||||
{
|
||||
FIXME( "algorithm %s not supported\n", debugstr_w(id) );
|
||||
@@ -904,6 +910,12 @@ struct key_symmetric
|
||||
@@ -902,6 +908,11 @@ struct key_symmetric
|
||||
UCHAR *secret;
|
||||
ULONG secret_len;
|
||||
};
|
||||
|
||||
+struct key_asymmetric
|
||||
+{
|
||||
+ UCHAR *pubkey;
|
||||
+ ULONG pubkey_len;
|
||||
+};
|
||||
+
|
||||
struct key
|
||||
{
|
||||
struct object hdr;
|
||||
@@ -911,9 +923,37 @@ struct key
|
||||
@@ -909,6 +920,7 @@ struct key
|
||||
union
|
||||
{
|
||||
struct key_symmetric s;
|
||||
+ struct key_asymmetric a;
|
||||
} u;
|
||||
};
|
||||
|
||||
#elif defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1080
|
||||
@@ -921,6 +933,11 @@ struct key_symmetric
|
||||
UCHAR *secret;
|
||||
ULONG secret_len;
|
||||
};
|
||||
+struct key_asymmetric
|
||||
+{
|
||||
+ UCHAR *pubkey;
|
||||
+ ULONG pubkey_len;
|
||||
+};
|
||||
struct key
|
||||
{
|
||||
struct object hdr;
|
||||
@@ -928,6 +945,7 @@ struct key
|
||||
union
|
||||
{
|
||||
struct key_symmetric s;
|
||||
+ struct key_asymmetric a;
|
||||
} u;
|
||||
};
|
||||
#else
|
||||
@@ -938,6 +956,11 @@ struct key_symmetric
|
||||
UCHAR *secret;
|
||||
ULONG secret_len;
|
||||
};
|
||||
+struct key_asymmetric
|
||||
+{
|
||||
+ UCHAR *pubkey;
|
||||
+ ULONG pubkey_len;
|
||||
+};
|
||||
struct key
|
||||
{
|
||||
struct object hdr;
|
||||
@@ -945,6 +968,7 @@ struct key
|
||||
union
|
||||
{
|
||||
struct key_symmetric s;
|
||||
+ struct key_asymmetric a;
|
||||
} u;
|
||||
};
|
||||
#endif
|
||||
@@ -976,6 +1000,33 @@ static NTSTATUS key_export( struct key *key, const WCHAR *type, UCHAR *output, U
|
||||
FIXME( "unsupported key type %s\n", debugstr_w(type) );
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
+
|
||||
+static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, const UCHAR *pubkey, ULONG pubkey_len )
|
||||
+{
|
||||
+ UCHAR *buffer;
|
||||
@ -105,7 +149,7 @@ index 8568d35..0ec271e 100644
|
||||
+ return STATUS_NOT_SUPPORTED;
|
||||
+ }
|
||||
+
|
||||
+ if (!(buffer = HeapAlloc( GetProcessHeap(), 0, pubkey_len ))) return STATUS_NO_MEMORY;
|
||||
+ if (!(buffer = heap_alloc( pubkey_len ))) return STATUS_NO_MEMORY;
|
||||
+ memcpy( buffer, pubkey, pubkey_len );
|
||||
+
|
||||
+ key->alg_id = alg->id;
|
||||
@ -114,11 +158,10 @@ index 8568d35..0ec271e 100644
|
||||
+
|
||||
+ return STATUS_SUCCESS;
|
||||
+}
|
||||
+
|
||||
static inline BOOL key_is_symmetric( struct key *key )
|
||||
{
|
||||
return alg_props[key->alg_id].symmetric;
|
||||
@@ -987,7 +1027,13 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
#endif
|
||||
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H)
|
||||
@@ -1052,7 +1103,13 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -133,18 +176,31 @@ index 8568d35..0ec271e 100644
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1157,6 +1203,10 @@ static NTSTATUS key_destroy( struct key *key )
|
||||
if (key->u.s.handle) pgnutls_cipher_deinit( key->u.s.handle );
|
||||
heap_free( key->u.s.secret );
|
||||
}
|
||||
+ else
|
||||
+ {
|
||||
@@ -1211,7 +1268,10 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
if (key->u.s.handle) pgnutls_cipher_deinit( key->u.s.handle );
|
||||
- heap_free( key->u.s.secret );
|
||||
+ if(key_is_symmetric(key))
|
||||
+ heap_free( key->u.s.secret );
|
||||
+ else
|
||||
+ heap_free( key->u.a.pubkey );
|
||||
+ }
|
||||
heap_free( key );
|
||||
|
||||
return STATUS_SUCCESS;
|
||||
@@ -1317,6 +1367,12 @@ static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, UCHA
|
||||
}
|
||||
@@ -1329,7 +1389,10 @@ static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
if (key->ref_encrypt) CCCryptorRelease( key->ref_encrypt );
|
||||
if (key->ref_decrypt) CCCryptorRelease( key->ref_decrypt );
|
||||
- heap_free( key->secret );
|
||||
+ if(key_is_symmetric(key))
|
||||
+ heap_free( key->u.s.secret );
|
||||
+ else
|
||||
+ heap_free( key->u.a.pubkey );
|
||||
heap_free( key );
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1340,6 +1403,12 @@ static NTSTATUS key_symmetric_init( struct key *key, struct algorithm *alg, cons
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -157,8 +213,8 @@ index 8568d35..0ec271e 100644
|
||||
static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
|
||||
{
|
||||
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;
|
||||
@@ -1522,6 +1591,88 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
+NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HANDLE decrypt_key, const WCHAR *type,
|
||||
@ -247,10 +303,10 @@ index 8568d35..0ec271e 100644
|
||||
{
|
||||
struct key *key = handle;
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index b506d9e..c143ea7 100644
|
||||
index 9b04f62df2..3525fd9913 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -1399,7 +1399,7 @@ static void test_ECDSA(void)
|
||||
@@ -1404,7 +1404,7 @@ static void test_ECDSA(void)
|
||||
status = pBCryptOpenAlgorithmProvider(&alg, BCRYPT_ECDSA_P256_ALGORITHM, NULL, 0);
|
||||
if (status)
|
||||
{
|
||||
@ -259,7 +315,7 @@ index b506d9e..c143ea7 100644
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -1415,10 +1415,10 @@ static void test_ECDSA(void)
|
||||
@@ -1420,10 +1420,10 @@ static void test_ECDSA(void)
|
||||
ok(!status, "BCryptImportKeyPair failed: %08x\n", status);
|
||||
|
||||
status = pBCryptVerifySignature(key, NULL, certHash, sizeof(certHash) - 1, certSignature, sizeof(certSignature), 0);
|
||||
@ -273,7 +329,7 @@ index b506d9e..c143ea7 100644
|
||||
pBCryptDestroyKey(key);
|
||||
pBCryptCloseAlgorithmProvider(alg, 0);
|
||||
diff --git a/include/bcrypt.h b/include/bcrypt.h
|
||||
index 9e5cd58..bf0547c 100644
|
||||
index bf47576ab0..6804f2bff5 100644
|
||||
--- a/include/bcrypt.h
|
||||
+++ b/include/bcrypt.h
|
||||
@@ -210,8 +210,10 @@ NTSTATUS WINAPI BCryptGetFipsAlgorithmMode(BOOLEAN *);
|
||||
@ -288,5 +344,5 @@ index 9e5cd58..bf0547c 100644
|
||||
|
||||
#endif /* __WINE_BCRYPT_H */
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,8 @@
|
||||
From 2776e51e8bb9affd3464834e784c7c0b5dbfc2bc Mon Sep 17 00:00:00 2001
|
||||
From 20c72ec69349ff8ccc898f1a0e14dca808459f8f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 29 Sep 2017 20:31:00 +0200
|
||||
Subject: [PATCH] bcrypt: Implement BCryptVerifySignature for ecdsa signatures.
|
||||
Subject: [PATCH 33/36] bcrypt: Implement BCryptVerifySignature for ecdsa
|
||||
signatures.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 326 ++++++++++++++++++++++++++++++++++++++++++++-
|
||||
@ -9,7 +10,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 0ec271e..74704ea 100644
|
||||
index 503712b4c3..3f4e3b665a 100644
|
||||
--- a/dlls/bcrypt/bcrypt_main.c
|
||||
+++ b/dlls/bcrypt/bcrypt_main.c
|
||||
@@ -27,6 +27,7 @@
|
||||
@ -20,9 +21,9 @@ index 0ec271e..74704ea 100644
|
||||
#endif
|
||||
|
||||
#include "ntstatus.h"
|
||||
@@ -50,9 +51,26 @@ static HINSTANCE instance;
|
||||
#if defined(HAVE_GNUTLS_CIPHER_INIT) && !defined(HAVE_COMMONCRYPTO_COMMONCRYPTOR_H)
|
||||
WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
||||
@@ -53,9 +54,26 @@ WINE_DECLARE_DEBUG_CHANNEL(winediag);
|
||||
/* Not present in gnutls version < 3.0 */
|
||||
static int (*pgnutls_cipher_tag)(gnutls_cipher_hd_t handle, void * tag, size_t tag_size);
|
||||
|
||||
+#if GNUTLS_VERSION_MAJOR < 3
|
||||
+typedef enum
|
||||
@ -47,7 +48,7 @@ index 0ec271e..74704ea 100644
|
||||
|
||||
static void *libgnutls_handle;
|
||||
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
|
||||
@@ -65,12 +83,15 @@ MAKE_FUNCPTR(gnutls_global_init);
|
||||
@@ -68,12 +86,15 @@ MAKE_FUNCPTR(gnutls_global_init);
|
||||
MAKE_FUNCPTR(gnutls_global_set_log_function);
|
||||
MAKE_FUNCPTR(gnutls_global_set_log_level);
|
||||
MAKE_FUNCPTR(gnutls_perror);
|
||||
@ -62,8 +63,8 @@ index 0ec271e..74704ea 100644
|
||||
+#define GNUTLS_PK_ECC 4
|
||||
#endif
|
||||
|
||||
static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void *tag, size_t tag_size)
|
||||
@@ -83,6 +104,24 @@ static int compat_gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void *
|
||||
static int compat_gnutls_cipher_tag(gnutls_cipher_hd_t handle, void * tag, size_t tag_size)
|
||||
@@ -86,6 +107,24 @@ static int compat_gnutls_cipher_add_auth(gnutls_cipher_hd_t handle, const void *
|
||||
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
}
|
||||
|
||||
@ -88,7 +89,7 @@ index 0ec271e..74704ea 100644
|
||||
static void gnutls_log( int level, const char *msg )
|
||||
{
|
||||
TRACE( "<%d> %s", level, msg );
|
||||
@@ -114,6 +153,8 @@ static BOOL gnutls_initialize(void)
|
||||
@@ -117,6 +156,8 @@ static BOOL gnutls_initialize(void)
|
||||
LOAD_FUNCPTR(gnutls_global_set_log_function)
|
||||
LOAD_FUNCPTR(gnutls_global_set_log_level)
|
||||
LOAD_FUNCPTR(gnutls_perror)
|
||||
@ -97,9 +98,9 @@ index 0ec271e..74704ea 100644
|
||||
#undef LOAD_FUNCPTR
|
||||
|
||||
if (!(pgnutls_cipher_tag = wine_dlsym( libgnutls_handle, "gnutls_cipher_tag", NULL, 0 )))
|
||||
@@ -126,6 +167,21 @@ static BOOL gnutls_initialize(void)
|
||||
WARN("gnutls_cipher_add_auth not found\n");
|
||||
pgnutls_cipher_add_auth = compat_gnutls_cipher_add_auth;
|
||||
@@ -130,6 +171,21 @@ static BOOL gnutls_initialize(void)
|
||||
pgnutls_perror( ret );
|
||||
goto fail;
|
||||
}
|
||||
+ if (!(pgnutls_pubkey_import_ecc_raw = wine_dlsym( libgnutls_handle, "gnutls_pubkey_import_ecc_raw", NULL, 0 )))
|
||||
+ {
|
||||
@ -117,9 +118,9 @@ index 0ec271e..74704ea 100644
|
||||
+ pgnutls_pubkey_verify_hash2 = compat_gnutls_pubkey_verify_hash2;
|
||||
+ }
|
||||
|
||||
if ((ret = pgnutls_global_init()) != GNUTLS_E_SUCCESS)
|
||||
if (TRACE_ON( bcrypt ))
|
||||
{
|
||||
@@ -1196,6 +1252,264 @@ static NTSTATUS key_symmetric_get_secret( struct key *key, UCHAR **secret, ULONG
|
||||
@@ -1265,6 +1321,264 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -383,8 +384,8 @@ index 0ec271e..74704ea 100644
|
||||
+
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
if (key_is_symmetric(key))
|
||||
@@ -1436,6 +1750,13 @@ static NTSTATUS key_symmetric_get_secret( struct key *key, UCHAR **secret, ULONG
|
||||
if (key->u.s.handle) pgnutls_cipher_deinit( key->u.s.handle );
|
||||
@@ -1454,6 +1768,13 @@ static NTSTATUS key_get_tag( struct key *key, UCHAR *tag, ULONG len )
|
||||
return STATUS_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
@ -398,7 +399,7 @@ index 0ec271e..74704ea 100644
|
||||
static NTSTATUS key_destroy( struct key *key )
|
||||
{
|
||||
ERR( "support for keys not available at build time\n" );
|
||||
@@ -1671,13 +1992,14 @@ NTSTATUS WINAPI BCryptVerifySignature( BCRYPT_KEY_HANDLE handle, void *padding,
|
||||
@@ -1664,13 +1985,14 @@ NTSTATUS WINAPI BCryptVerifySignature( BCRYPT_KEY_HANDLE handle, void *padding,
|
||||
{
|
||||
struct key *key = handle;
|
||||
|
||||
@ -416,10 +417,10 @@ index 0ec271e..74704ea 100644
|
||||
|
||||
NTSTATUS WINAPI BCryptDestroyKey( BCRYPT_KEY_HANDLE handle )
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index c143ea7..f9587f8 100644
|
||||
index 3525fd9913..047ffb4e6f 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -1415,10 +1415,10 @@ static void test_ECDSA(void)
|
||||
@@ -1420,10 +1420,10 @@ static void test_ECDSA(void)
|
||||
ok(!status, "BCryptImportKeyPair failed: %08x\n", status);
|
||||
|
||||
status = pBCryptVerifySignature(key, NULL, certHash, sizeof(certHash) - 1, certSignature, sizeof(certSignature), 0);
|
||||
@ -433,5 +434,5 @@ index c143ea7..f9587f8 100644
|
||||
pBCryptDestroyKey(key);
|
||||
pBCryptCloseAlgorithmProvider(alg, 0);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From c3255fceabfc20372fe78b9e838e85cf5adbd824 Mon Sep 17 00:00:00 2001
|
||||
From 618918fc23fdcbdcf07204043ea468f6111d592a Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Tue, 10 Oct 2017 16:40:41 +0300
|
||||
Subject: [PATCH] bcrypt: Initial implementation for RSA key import and
|
||||
Subject: [PATCH 34/36] bcrypt: Initial implementation for RSA key import and
|
||||
signature verification.
|
||||
|
||||
---
|
||||
@ -10,10 +10,10 @@ 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 74704ea..c1232bf 100644
|
||||
index 3f4e3b665a..212b802ac1 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
|
||||
@@ -75,6 +75,9 @@ static int (*pgnutls_pubkey_verify_hash2)(gnutls_pubkey_t key, gnutls_sign_algor
|
||||
unsigned int flags, const gnutls_datum_t *hash,
|
||||
const gnutls_datum_t *signature);
|
||||
|
||||
@ -23,7 +23,7 @@ index 74704ea..c1232bf 100644
|
||||
static void *libgnutls_handle;
|
||||
#define MAKE_FUNCPTR(f) static typeof(f) * p##f
|
||||
MAKE_FUNCPTR(gnutls_cipher_decrypt2);
|
||||
@@ -122,6 +125,11 @@ static int compat_gnutls_pubkey_verify_hash2(gnutls_pubkey_t key, gnutls_sign_al
|
||||
@@ -125,6 +128,11 @@ static int compat_gnutls_pubkey_verify_hash2(gnutls_pubkey_t key, gnutls_sign_al
|
||||
return GNUTLS_E_UNKNOWN_CIPHER_TYPE;
|
||||
}
|
||||
|
||||
@ -35,7 +35,7 @@ index 74704ea..c1232bf 100644
|
||||
static void gnutls_log( int level, const char *msg )
|
||||
{
|
||||
TRACE( "<%d> %s", level, msg );
|
||||
@@ -182,6 +190,11 @@ static BOOL gnutls_initialize(void)
|
||||
@@ -186,6 +194,11 @@ static BOOL gnutls_initialize(void)
|
||||
WARN("gnutls_pubkey_verify_hash2 not found\n");
|
||||
pgnutls_pubkey_verify_hash2 = compat_gnutls_pubkey_verify_hash2;
|
||||
}
|
||||
@ -45,9 +45,9 @@ index 74704ea..c1232bf 100644
|
||||
+ pgnutls_pubkey_import_rsa_raw = compat_gnutls_pubkey_import_rsa_raw;
|
||||
+ }
|
||||
|
||||
if ((ret = pgnutls_global_init()) != GNUTLS_E_SUCCESS)
|
||||
if (TRACE_ON( bcrypt ))
|
||||
{
|
||||
@@ -273,6 +286,7 @@ enum alg_id
|
||||
@@ -281,6 +294,7 @@ enum alg_id
|
||||
ALG_ID_MD4,
|
||||
ALG_ID_MD5,
|
||||
ALG_ID_RNG,
|
||||
@ -55,7 +55,7 @@ index 74704ea..c1232bf 100644
|
||||
ALG_ID_SHA1,
|
||||
ALG_ID_SHA256,
|
||||
ALG_ID_SHA384,
|
||||
@@ -303,6 +317,7 @@ static const struct {
|
||||
@@ -311,6 +325,7 @@ static const struct {
|
||||
/* ALG_ID_MD4 */ { 270, 16, 512, BCRYPT_MD4_ALGORITHM, FALSE },
|
||||
/* ALG_ID_MD5 */ { 274, 16, 512, BCRYPT_MD5_ALGORITHM, FALSE },
|
||||
/* ALG_ID_RNG */ { 0, 0, 0, BCRYPT_RNG_ALGORITHM, FALSE },
|
||||
@ -63,7 +63,7 @@ index 74704ea..c1232bf 100644
|
||||
/* ALG_ID_SHA1 */ { 278, 20, 512, BCRYPT_SHA1_ALGORITHM, FALSE },
|
||||
/* ALG_ID_SHA256 */ { 286, 32, 512, BCRYPT_SHA256_ALGORITHM, FALSE },
|
||||
/* ALG_ID_SHA384 */ { 382, 48, 1024, BCRYPT_SHA384_ALGORITHM, FALSE },
|
||||
@@ -383,6 +398,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
|
||||
@@ -391,6 +406,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
|
||||
else if (!strcmpW( id, BCRYPT_MD4_ALGORITHM )) alg_id = ALG_ID_MD4;
|
||||
else if (!strcmpW( id, BCRYPT_MD5_ALGORITHM )) alg_id = ALG_ID_MD5;
|
||||
else if (!strcmpW( id, BCRYPT_RNG_ALGORITHM )) alg_id = ALG_ID_RNG;
|
||||
@ -71,7 +71,7 @@ index 74704ea..c1232bf 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;
|
||||
@@ -993,6 +1009,7 @@ static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, con
|
||||
@@ -1067,6 +1083,7 @@ static NTSTATUS key_asymmetric_init( struct key *key, struct algorithm *alg, con
|
||||
{
|
||||
case ALG_ID_ECDSA_P256:
|
||||
case ALG_ID_ECDSA_P384:
|
||||
@ -79,7 +79,7 @@ index 74704ea..c1232bf 100644
|
||||
break;
|
||||
|
||||
default:
|
||||
@@ -1398,6 +1415,34 @@ static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnut
|
||||
@@ -1467,6 +1484,34 @@ static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnut
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -114,7 +114,7 @@ index 74704ea..c1232bf 100644
|
||||
static NTSTATUS import_gnutls_pubkey( struct key *key, gnutls_pubkey_t *gnutls_key)
|
||||
{
|
||||
switch (key->alg_id)
|
||||
@@ -1405,6 +1450,8 @@ static NTSTATUS import_gnutls_pubkey( struct key *key, gnutls_pubkey_t *gnutls_
|
||||
@@ -1474,6 +1519,8 @@ static NTSTATUS import_gnutls_pubkey( struct key *key, gnutls_pubkey_t *gnutls_
|
||||
case ALG_ID_ECDSA_P256:
|
||||
case ALG_ID_ECDSA_P384:
|
||||
return import_gnutls_pubkey_ecc( key, gnutls_key );
|
||||
@ -123,7 +123,7 @@ index 74704ea..c1232bf 100644
|
||||
|
||||
default:
|
||||
FIXME("Algorithm %d not yet supported\n", key->alg_id);
|
||||
@@ -1434,6 +1481,14 @@ static NTSTATUS prepare_gnutls_signature_ecc( struct key *key, UCHAR *signature,
|
||||
@@ -1503,6 +1550,14 @@ static NTSTATUS prepare_gnutls_signature_ecc( struct key *key, UCHAR *signature,
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
|
||||
@ -138,7 +138,7 @@ index 74704ea..c1232bf 100644
|
||||
static NTSTATUS prepare_gnutls_signature( struct key *key, UCHAR *signature, ULONG signature_len,
|
||||
gnutls_datum_t *gnutls_signature )
|
||||
{
|
||||
@@ -1442,6 +1497,8 @@ static NTSTATUS prepare_gnutls_signature( struct key *key, UCHAR *signature, ULO
|
||||
@@ -1511,6 +1566,8 @@ static NTSTATUS prepare_gnutls_signature( struct key *key, UCHAR *signature, ULO
|
||||
case ALG_ID_ECDSA_P256:
|
||||
case ALG_ID_ECDSA_P384:
|
||||
return prepare_gnutls_signature_ecc( key, signature, signature_len, gnutls_signature );
|
||||
@ -147,7 +147,7 @@ index 74704ea..c1232bf 100644
|
||||
|
||||
default:
|
||||
FIXME( "Algorithm %d not yet supported\n", key->alg_id );
|
||||
@@ -1460,18 +1517,38 @@ static NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *ha
|
||||
@@ -1529,18 +1586,38 @@ static NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *ha
|
||||
NTSTATUS status;
|
||||
int ret;
|
||||
|
||||
@ -195,7 +195,7 @@ index 74704ea..c1232bf 100644
|
||||
}
|
||||
|
||||
switch (key->alg_id)
|
||||
@@ -1480,6 +1557,9 @@ static NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *ha
|
||||
@@ -1549,6 +1626,9 @@ static NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *ha
|
||||
case ALG_ID_ECDSA_P384:
|
||||
pk_algo = GNUTLS_PK_ECC;
|
||||
break;
|
||||
@ -205,7 +205,7 @@ index 74704ea..c1232bf 100644
|
||||
|
||||
default:
|
||||
FIXME( "Algorithm %d not yet supported\n", key->alg_id );
|
||||
@@ -1505,7 +1585,8 @@ static NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *ha
|
||||
@@ -1574,7 +1654,8 @@ static NTSTATUS key_asymmetric_verify( struct key *key, void *padding, UCHAR *ha
|
||||
gnutls_hash.size = hash_len;
|
||||
ret = pgnutls_pubkey_verify_hash2( gnutls_key, sign_algo, 0, &gnutls_hash, &gnutls_signature );
|
||||
|
||||
@ -215,7 +215,7 @@ index 74704ea..c1232bf 100644
|
||||
pgnutls_pubkey_deinit( gnutls_key );
|
||||
return (ret < 0) ? STATUS_INVALID_SIGNATURE : STATUS_SUCCESS;
|
||||
}
|
||||
@@ -1982,6 +2063,33 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN
|
||||
@@ -1975,6 +2056,33 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN
|
||||
*ret_key = key;
|
||||
return STATUS_SUCCESS;
|
||||
}
|
||||
@ -250,7 +250,7 @@ index 74704ea..c1232bf 100644
|
||||
FIXME( "unsupported key type %s\n", debugstr_w(type) );
|
||||
return STATUS_NOT_SUPPORTED;
|
||||
diff --git a/include/bcrypt.h b/include/bcrypt.h
|
||||
index bf0547c..89736d6 100644
|
||||
index 6804f2bff5..2a9a0d0986 100644
|
||||
--- a/include/bcrypt.h
|
||||
+++ b/include/bcrypt.h
|
||||
@@ -63,6 +63,8 @@ typedef LONG NTSTATUS;
|
||||
@ -270,7 +270,7 @@ index bf0547c..89736d6 100644
|
||||
#define BCRYPT_SHA1_ALGORITHM (const WCHAR []){'S','H','A','1',0}
|
||||
#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}
|
||||
@@ -140,6 +143,20 @@ typedef struct _BCRYPT_ECCKEY_BLOB
|
||||
@@ -133,6 +136,20 @@ typedef struct _BCRYPT_ECCKEY_BLOB
|
||||
ULONG cbKey;
|
||||
} BCRYPT_ECCKEY_BLOB, *PBCRYPT_ECCKEY_BLOB;
|
||||
|
||||
@ -292,5 +292,5 @@ index bf0547c..89736d6 100644
|
||||
{
|
||||
LPCWSTR pszAlgId;
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
From 385edce41cabb41837ecd4f1edbc1f5567d6983b Mon Sep 17 00:00:00 2001
|
||||
From 7532a9e64de3932bd9ec7c781170f6d6e4af6781 Mon Sep 17 00:00:00 2001
|
||||
From: Kimmo Myllyvirta <kimmo.myllyvirta@gmail.com>
|
||||
Date: Tue, 10 Oct 2017 16:41:09 +0300
|
||||
Subject: [PATCH] bcrypt/tests: Add simple test for RSA.
|
||||
Subject: [PATCH 35/36] bcrypt/tests: Add simple test for RSA.
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
@ -12,10 +12,10 @@ Based on patch from Bernhard Übelacker.
|
||||
1 file changed, 95 insertions(+)
|
||||
|
||||
diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c
|
||||
index f9587f8..e5bea89 100644
|
||||
index 047ffb4e6f..c0b936f6e5 100644
|
||||
--- a/dlls/bcrypt/tests/bcrypt.c
|
||||
+++ b/dlls/bcrypt/tests/bcrypt.c
|
||||
@@ -1424,6 +1424,100 @@ static void test_ECDSA(void)
|
||||
@@ -1429,6 +1429,100 @@ static void test_ECDSA(void)
|
||||
pBCryptCloseAlgorithmProvider(alg, 0);
|
||||
}
|
||||
|
||||
@ -116,7 +116,7 @@ index f9587f8..e5bea89 100644
|
||||
START_TEST(bcrypt)
|
||||
{
|
||||
HMODULE module;
|
||||
@@ -1467,6 +1561,7 @@ START_TEST(bcrypt)
|
||||
@@ -1472,6 +1566,7 @@ START_TEST(bcrypt)
|
||||
test_BCryptDecrypt();
|
||||
test_key_import_export();
|
||||
test_ECDSA();
|
||||
@ -125,5 +125,5 @@ index f9587f8..e5bea89 100644
|
||||
if (pBCryptHash) /* >= Win 10 */
|
||||
test_BcryptHash();
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
From 122b26c953e65e243abf5c2d6543fe9fc9869599 Mon Sep 17 00:00:00 2001
|
||||
From 432d0e95d84ade8b992e36a2935519d391826b86 Mon Sep 17 00:00:00 2001
|
||||
From: Sebastian Lackner <sebastian@fds-team.de>
|
||||
Date: Sat, 14 Oct 2017 22:44:13 +0200
|
||||
Subject: [PATCH] bcrypt: Store full ECCKEY_BLOB struct in BCryptImportKeyPair.
|
||||
Subject: [PATCH 36/36] bcrypt: Store full ECCKEY_BLOB struct in
|
||||
BCryptImportKeyPair.
|
||||
|
||||
---
|
||||
dlls/bcrypt/bcrypt_main.c | 12 +++++++-----
|
||||
1 file changed, 7 insertions(+), 5 deletions(-)
|
||||
|
||||
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
||||
index c1232bf..a805f64 100644
|
||||
index 212b802ac1..d683fca45b 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,
|
||||
@@ -1449,6 +1449,7 @@ static void buffer_append_asn1_r_s( struct buffer *buffer, BYTE *r, DWORD r_len,
|
||||
|
||||
static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnutls_key )
|
||||
{
|
||||
@ -19,7 +20,7 @@ index c1232bf..a805f64 100644
|
||||
gnutls_ecc_curve_t curve;
|
||||
gnutls_datum_t x, y;
|
||||
int ret;
|
||||
@@ -1400,10 +1401,11 @@ static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnut
|
||||
@@ -1469,10 +1470,11 @@ static NTSTATUS import_gnutls_pubkey_ecc( struct key *key, gnutls_pubkey_t *gnut
|
||||
return STATUS_INTERNAL_ERROR;
|
||||
}
|
||||
|
||||
@ -35,7 +36,7 @@ index c1232bf..a805f64 100644
|
||||
|
||||
if ((ret = pgnutls_pubkey_import_ecc_raw( *gnutls_key, curve, &x, &y )))
|
||||
{
|
||||
@@ -2054,7 +2056,7 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN
|
||||
@@ -2047,7 +2049,7 @@ NTSTATUS WINAPI BCryptImportKeyPair( BCRYPT_ALG_HANDLE algorithm, BCRYPT_KEY_HAN
|
||||
return STATUS_NO_MEMORY;
|
||||
|
||||
key->hdr.magic = MAGIC_KEY;
|
||||
@ -45,5 +46,5 @@ index c1232bf..a805f64 100644
|
||||
HeapFree( GetProcessHeap(), 0, key );
|
||||
return status;
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,38 +1,34 @@
|
||||
From daeefb5f46667a112242343f9ba95d905371bc78 Mon Sep 17 00:00:00 2001
|
||||
From e3c0ebb372539b2840298d064d8f3a51c02bff63 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 11 Jul 2017 23:59:58 +0200
|
||||
Subject: dwmapi: Add stubs for DwmSetIconicLivePreviewBitmap and
|
||||
DwmSetIconicThumbnail.
|
||||
Subject: [PATCH] dwmapi: Add stub for DwmSetIconicLivePreviewBitmap.
|
||||
|
||||
---
|
||||
dlls/dwmapi/dwmapi.spec | 4 ++--
|
||||
dlls/dwmapi/dwmapi_main.c | 18 ++++++++++++++++++
|
||||
2 files changed, 20 insertions(+), 2 deletions(-)
|
||||
dlls/dwmapi/dwmapi.spec | 2 +-
|
||||
dlls/dwmapi/dwmapi_main.c | 9 +++++++++
|
||||
2 files changed, 10 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/dwmapi/dwmapi.spec b/dlls/dwmapi/dwmapi.spec
|
||||
index d81df3d8418..37447195b36 100644
|
||||
index 697cefc071..37447195b3 100644
|
||||
--- a/dlls/dwmapi/dwmapi.spec
|
||||
+++ b/dlls/dwmapi/dwmapi.spec
|
||||
@@ -80,8 +80,8 @@
|
||||
@@ -80,7 +80,7 @@
|
||||
@ stdcall DwmRegisterThumbnail(long long ptr)
|
||||
# @ stub DwmRenderGesture
|
||||
@ stub DwmSetDxFrameDuration
|
||||
-@ stub DwmSetIconicLivePreviewBitmap
|
||||
-@ stub DwmSetIconicThumbnail
|
||||
+@ stdcall DwmSetIconicLivePreviewBitmap(long long ptr long)
|
||||
+@ stdcall DwmSetIconicThumbnail(long long long)
|
||||
@ stdcall DwmSetIconicThumbnail(long long long)
|
||||
@ stdcall DwmSetPresentParameters(ptr ptr)
|
||||
@ stdcall DwmSetWindowAttribute(long long ptr long)
|
||||
# @ stub DwmShowContact
|
||||
diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c
|
||||
index 8c3472a5294..0e6ba3bed1c 100644
|
||||
index 7ac0b2b790..0e6ba3bed1 100644
|
||||
--- a/dlls/dwmapi/dwmapi_main.c
|
||||
+++ b/dlls/dwmapi/dwmapi_main.c
|
||||
@@ -268,3 +268,21 @@ HRESULT WINAPI DwmSetPresentParameters(HWND hwnd, DWM_PRESENT_PARAMETERS *params
|
||||
FIXME("(%p %p) stub\n", hwnd, params);
|
||||
@@ -269,6 +269,15 @@ HRESULT WINAPI DwmSetPresentParameters(HWND hwnd, DWM_PRESENT_PARAMETERS *params
|
||||
return S_OK;
|
||||
};
|
||||
+
|
||||
|
||||
+/**********************************************************************
|
||||
+ * DwmSetIconicLivePreviewBitmap (DWMAPI.@)
|
||||
+ */
|
||||
@ -42,14 +38,9 @@ index 8c3472a5294..0e6ba3bed1c 100644
|
||||
+ return S_OK;
|
||||
+};
|
||||
+
|
||||
+/**********************************************************************
|
||||
+ * DwmSetIconicThumbnail (DWMAPI.@)
|
||||
+ */
|
||||
+HRESULT WINAPI DwmSetIconicThumbnail(HWND hwnd, HBITMAP hbmp, DWORD flags)
|
||||
+{
|
||||
+ FIXME("(%p %p %x) stub\n", hwnd, hbmp, flags);
|
||||
+ return S_OK;
|
||||
+};
|
||||
/**********************************************************************
|
||||
* DwmSetIconicThumbnail (DWMAPI.@)
|
||||
*/
|
||||
--
|
||||
2.14.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,44 +0,0 @@
|
||||
From a5276ddb1a933f10f4f9334a791404276d64cd43 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Wed, 28 Oct 2015 22:36:01 +0100
|
||||
Subject: hal: Implement KeQueryPerformanceCounter.
|
||||
|
||||
---
|
||||
dlls/hal/hal.c | 10 ++++++++++
|
||||
dlls/hal/hal.spec | 2 +-
|
||||
2 files changed, 11 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/hal/hal.c b/dlls/hal/hal.c
|
||||
index 0b2e422..be3a48b 100644
|
||||
--- a/dlls/hal/hal.c
|
||||
+++ b/dlls/hal/hal.c
|
||||
@@ -172,3 +172,13 @@ void WINAPI WRITE_PORT_ULONG(ULONG *port, ULONG value)
|
||||
{
|
||||
FIXME("(%p %d) stub!\n", port, value);
|
||||
}
|
||||
+
|
||||
+ULONGLONG WINAPI KeQueryPerformanceCounter(LARGE_INTEGER *frequency)
|
||||
+{
|
||||
+ LARGE_INTEGER counter;
|
||||
+
|
||||
+ TRACE("(%p)\n", frequency);
|
||||
+
|
||||
+ NtQueryPerformanceCounter(&counter, frequency);
|
||||
+ return counter.QuadPart;
|
||||
+}
|
||||
diff --git a/dlls/hal/hal.spec b/dlls/hal/hal.spec
|
||||
index c21806c..243c67b 100644
|
||||
--- a/dlls/hal/hal.spec
|
||||
+++ b/dlls/hal/hal.spec
|
||||
@@ -72,7 +72,7 @@
|
||||
@ stub KeFlushWriteBuffer
|
||||
@ stdcall KeGetCurrentIrql()
|
||||
@ stub KeLowerIrql
|
||||
-@ stub KeQueryPerformanceCounter
|
||||
+@ stdcall -ret64 KeQueryPerformanceCounter(ptr)
|
||||
@ stub KeRaiseIrql
|
||||
@ stub KeRaiseIrqlToDpcLevel
|
||||
@ stub KeRaiseIrqlToSynchLevel
|
||||
--
|
||||
2.8.0
|
||||
|
@ -1 +0,0 @@
|
||||
Fixes: [39500] Implement hal.KeQueryPerformanceCounter
|
@ -1,4 +1,4 @@
|
||||
From acbb7a912a0e0ee171f72683934dabf828f75a53 Mon Sep 17 00:00:00 2001
|
||||
From cd1b64a0a40a8ec7aaf2cc875fe138404eb009b9 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 13 Dec 2014 05:34:48 +0100
|
||||
Subject: [PATCH] ntdll: Implement loader redirection scheme.
|
||||
@ -8,10 +8,10 @@ Subject: [PATCH] ntdll: Implement loader redirection scheme.
|
||||
1 file changed, 45 insertions(+), 22 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index c637f0e..3f755fc 100644
|
||||
index 4dc57a1175..0036593b25 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -100,6 +100,7 @@ struct builtin_load_info
|
||||
@@ -102,6 +102,7 @@ struct builtin_load_info
|
||||
{
|
||||
const WCHAR *load_path;
|
||||
const WCHAR *filename;
|
||||
@ -19,7 +19,7 @@ index c637f0e..3f755fc 100644
|
||||
NTSTATUS status;
|
||||
WINE_MODREF *wm;
|
||||
};
|
||||
@@ -125,7 +126,8 @@ static WINE_MODREF *cached_modref;
|
||||
@@ -127,7 +128,8 @@ static WINE_MODREF *cached_modref;
|
||||
static WINE_MODREF *current_modref;
|
||||
static WINE_MODREF *last_failed_modref;
|
||||
|
||||
@ -29,7 +29,7 @@ index c637f0e..3f755fc 100644
|
||||
static NTSTATUS process_attach( WINE_MODREF *wm, LPVOID lpReserved );
|
||||
static FARPROC find_ordinal_export( HMODULE module, const IMAGE_EXPORT_DIRECTORY *exports,
|
||||
DWORD exp_size, DWORD ordinal, LPCWSTR load_path );
|
||||
@@ -449,7 +451,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
|
||||
@@ -480,7 +482,7 @@ static FARPROC find_forwarded_export( HMODULE module, const char *forward, LPCWS
|
||||
if (!(wm = find_basename_module( mod_name )))
|
||||
{
|
||||
TRACE( "delay loading %s for '%s'\n", debugstr_w(mod_name), forward );
|
||||
@ -38,7 +38,7 @@ index c637f0e..3f755fc 100644
|
||||
!(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
|
||||
{
|
||||
if (!imports_fixup_done && current_modref)
|
||||
@@ -619,7 +621,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
@@ -650,7 +652,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
{
|
||||
ascii_to_unicode( buffer, name, len );
|
||||
buffer[len] = 0;
|
||||
@ -47,7 +47,7 @@ index c637f0e..3f755fc 100644
|
||||
}
|
||||
else /* need to allocate a larger buffer */
|
||||
{
|
||||
@@ -627,7 +629,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
@@ -658,7 +660,7 @@ static BOOL import_dll( HMODULE module, const IMAGE_IMPORT_DESCRIPTOR *descr, LP
|
||||
if (!ptr) return FALSE;
|
||||
ascii_to_unicode( ptr, name, len );
|
||||
ptr[len] = 0;
|
||||
@ -56,7 +56,7 @@ index c637f0e..3f755fc 100644
|
||||
RtlFreeHeap( GetProcessHeap(), 0, ptr );
|
||||
}
|
||||
|
||||
@@ -912,7 +914,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
|
||||
@@ -943,7 +945,7 @@ static NTSTATUS fixup_imports_ilonly( WINE_MODREF *wm, LPCWSTR load_path, void *
|
||||
|
||||
prev = current_modref;
|
||||
current_modref = wm;
|
||||
@ -65,7 +65,7 @@ index c637f0e..3f755fc 100644
|
||||
current_modref = prev;
|
||||
if (status)
|
||||
{
|
||||
@@ -995,7 +997,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
|
||||
@@ -1026,7 +1028,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
|
||||
* Allocate a WINE_MODREF structure and add it to the process list
|
||||
* The loader_section must be locked while calling this function.
|
||||
*/
|
||||
@ -74,16 +74,16 @@ index c637f0e..3f755fc 100644
|
||||
{
|
||||
WINE_MODREF *wm;
|
||||
const WCHAR *p;
|
||||
@@ -1017,7 +1019,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
|
||||
wm->ldr.TimeDateStamp = 0;
|
||||
wm->ldr.ActivationContext = 0;
|
||||
@@ -1040,7 +1042,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
|
||||
wm->ldr.TlsIndex = -1;
|
||||
wm->ldr.LoadCount = 1;
|
||||
|
||||
- RtlCreateUnicodeString( &wm->ldr.FullDllName, filename );
|
||||
+ RtlCreateUnicodeString( &wm->ldr.FullDllName, fakemodule ? fakemodule : filename );
|
||||
if ((p = strrchrW( wm->ldr.FullDllName.Buffer, '\\' ))) p++;
|
||||
else p = wm->ldr.FullDllName.Buffer;
|
||||
RtlInitUnicodeString( &wm->ldr.BaseDllName, p );
|
||||
@@ -1722,7 +1724,7 @@ static void load_builtin_callback( void *module, const char *filename )
|
||||
@@ -1742,7 +1744,7 @@ static void load_builtin_callback( void *module, const char *filename )
|
||||
return;
|
||||
}
|
||||
|
||||
@ -92,18 +92,18 @@ index c637f0e..3f755fc 100644
|
||||
RtlFreeHeap( GetProcessHeap(), 0, fullname );
|
||||
if (!wm)
|
||||
{
|
||||
@@ -1923,8 +1925,8 @@ static BOOL is_valid_binary( const pe_image_info_t *info )
|
||||
@@ -1952,8 +1954,8 @@ static BOOL is_valid_binary( HMODULE module, const pe_image_info_t *info )
|
||||
/******************************************************************************
|
||||
* load_native_dll (internal)
|
||||
*/
|
||||
-static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
- DWORD flags, WINE_MODREF** pwm )
|
||||
- DWORD flags, WINE_MODREF** pwm, struct stat *st )
|
||||
+static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, LPCWSTR fakemodule,
|
||||
+ HANDLE file, DWORD flags, WINE_MODREF** pwm )
|
||||
+ HANDLE file, DWORD flags, WINE_MODREF** pwm, struct stat *st )
|
||||
{
|
||||
void *module;
|
||||
HANDLE mapping;
|
||||
@@ -1967,7 +1969,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
@@ -1996,7 +1998,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
|
||||
/* create the MODREF */
|
||||
|
||||
@ -112,7 +112,7 @@ index c637f0e..3f755fc 100644
|
||||
{
|
||||
if (module) NtUnmapViewOfSection( NtCurrentProcess(), module );
|
||||
return STATUS_NO_MEMORY;
|
||||
@@ -2029,8 +2031,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
@@ -2060,8 +2062,8 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, HANDLE file,
|
||||
/***********************************************************************
|
||||
* load_builtin_dll
|
||||
*/
|
||||
@ -123,7 +123,7 @@ index c637f0e..3f755fc 100644
|
||||
{
|
||||
char error[256], dllname[MAX_PATH];
|
||||
const WCHAR *name, *p;
|
||||
@@ -2050,6 +2052,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file,
|
||||
@@ -2081,6 +2083,7 @@ static NTSTATUS load_builtin_dll( LPCWSTR load_path, LPCWSTR path, HANDLE file,
|
||||
*/
|
||||
info.load_path = load_path;
|
||||
info.filename = NULL;
|
||||
@ -131,7 +131,7 @@ index c637f0e..3f755fc 100644
|
||||
info.status = STATUS_SUCCESS;
|
||||
info.wm = NULL;
|
||||
|
||||
@@ -2497,7 +2500,8 @@ overflow:
|
||||
@@ -2562,7 +2565,8 @@ overflow:
|
||||
* Load a PE style module according to the load order.
|
||||
* The loader_section must be locked while calling this function.
|
||||
*/
|
||||
@ -141,7 +141,7 @@ index c637f0e..3f755fc 100644
|
||||
{
|
||||
BOOL data = flags & (LOAD_LIBRARY_AS_DATAFILE | LOAD_LIBRARY_AS_DATAFILE_EXCLUSIVE);
|
||||
enum loadorder loadorder;
|
||||
@@ -2535,6 +2539,25 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2601,6 +2605,25 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
}
|
||||
|
||||
main_exe = get_modref( NtCurrentTeb()->Peb->ImageBaseAddress );
|
||||
@ -167,12 +167,12 @@ index c637f0e..3f755fc 100644
|
||||
loadorder = get_load_order( main_exe ? main_exe->ldr.BaseDllName.Buffer : NULL, filename );
|
||||
|
||||
if (handle && is_fake_dll( handle ))
|
||||
@@ -2557,22 +2580,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2623,22 +2646,22 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
if (!handle) nts = STATUS_DLL_NOT_FOUND;
|
||||
else
|
||||
{
|
||||
- nts = load_native_dll( load_path, filename, handle, flags, pwm );
|
||||
+ nts = load_native_dll( load_path, filename, fakemodule, handle, flags, pwm );
|
||||
- nts = load_native_dll( load_path, filename, handle, flags, pwm, &st );
|
||||
+ nts = load_native_dll( load_path, filename, fakemodule, handle, flags, pwm, &st );
|
||||
if (nts == STATUS_INVALID_IMAGE_NOT_MZ)
|
||||
/* not in PE format, maybe it's a builtin */
|
||||
- nts = load_builtin_dll( load_path, filename, handle, flags, pwm );
|
||||
@ -195,16 +195,16 @@ index c637f0e..3f755fc 100644
|
||||
if (nts == STATUS_SUCCESS && loadorder == LO_DEFAULT &&
|
||||
(MODULE_InitDLL( *pwm, DLL_WINE_PREATTACH, NULL ) != STATUS_SUCCESS))
|
||||
{
|
||||
@@ -2582,7 +2605,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2648,7 +2671,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
nts = STATUS_DLL_NOT_FOUND;
|
||||
}
|
||||
if (nts == STATUS_DLL_NOT_FOUND && loadorder != LO_BUILTIN)
|
||||
- nts = load_native_dll( load_path, filename, handle, flags, pwm );
|
||||
+ nts = load_native_dll( load_path, filename, fakemodule, handle, flags, pwm );
|
||||
- nts = load_native_dll( load_path, filename, handle, flags, pwm, &st );
|
||||
+ nts = load_native_dll( load_path, filename, fakemodule, handle, flags, pwm, &st );
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -2615,7 +2638,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
|
||||
@@ -2681,7 +2704,7 @@ NTSTATUS WINAPI DECLSPEC_HOTPATCH LdrLoadDll(LPCWSTR path_name, DWORD flags,
|
||||
RtlEnterCriticalSection( &loader_section );
|
||||
|
||||
if (!path_name) path_name = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
|
||||
@ -213,7 +213,7 @@ index c637f0e..3f755fc 100644
|
||||
|
||||
if (nts == STATUS_SUCCESS && !(wm->ldr.Flags & LDR_DONT_RESOLVE_REFS))
|
||||
{
|
||||
@@ -3645,7 +3668,7 @@ void __wine_process_init(void)
|
||||
@@ -3714,7 +3737,7 @@ void __wine_process_init(void)
|
||||
/* setup the load callback and create ntdll modref */
|
||||
wine_dll_set_callback( load_builtin_callback );
|
||||
|
||||
@ -223,5 +223,5 @@ index c637f0e..3f755fc 100644
|
||||
MESSAGE( "wine: could not load kernel32.dll, status %x\n", status );
|
||||
exit(1);
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,19 +1,19 @@
|
||||
From 5b8f46cbd6c338fe8fc080e5fea870627f266de1 Mon Sep 17 00:00:00 2001
|
||||
From ac83666eff8a7a92177d048f719d5494e32a098c Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Mon, 3 Apr 2017 05:30:27 +0200
|
||||
Subject: ntdll: Implement HashLinks field in LDR module data.
|
||||
Subject: [PATCH] ntdll: Implement HashLinks field in LDR module data.
|
||||
|
||||
---
|
||||
dlls/kernel32/tests/loader.c | 75 ++++++++++++++++++++++++++++++++++++++++++++
|
||||
dlls/ntdll/loader.c | 63 +++++++++++++++++++++++++++++++++++--
|
||||
dlls/ntdll/loader.c | 65 ++++++++++++++++++++++++++++++++++++++
|
||||
include/winternl.h | 6 ++--
|
||||
3 files changed, 140 insertions(+), 4 deletions(-)
|
||||
3 files changed, 144 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/dlls/kernel32/tests/loader.c b/dlls/kernel32/tests/loader.c
|
||||
index 1f6f3176760..f51ac62b976 100644
|
||||
index f1c33eef84..5ea7f5ecd8 100644
|
||||
--- a/dlls/kernel32/tests/loader.c
|
||||
+++ b/dlls/kernel32/tests/loader.c
|
||||
@@ -28,6 +28,7 @@
|
||||
@@ -29,6 +29,7 @@
|
||||
#include "windef.h"
|
||||
#include "winbase.h"
|
||||
#include "winternl.h"
|
||||
@ -21,7 +21,7 @@ index 1f6f3176760..f51ac62b976 100644
|
||||
#include "wine/test.h"
|
||||
#include "delayloadhandler.h"
|
||||
|
||||
@@ -3036,6 +3037,79 @@ static void test_InMemoryOrderModuleList(void)
|
||||
@@ -3546,6 +3547,79 @@ static void test_InMemoryOrderModuleList(void)
|
||||
ok(entry2 == mark2, "expected entry2 == mark2, got %p and %p\n", entry2, mark2);
|
||||
}
|
||||
|
||||
@ -101,17 +101,17 @@ index 1f6f3176760..f51ac62b976 100644
|
||||
START_TEST(loader)
|
||||
{
|
||||
int argc;
|
||||
@@ -3097,4 +3171,5 @@ START_TEST(loader)
|
||||
@@ -3610,4 +3684,5 @@ START_TEST(loader)
|
||||
test_import_resolution();
|
||||
test_ExitProcess();
|
||||
test_InMemoryOrderModuleList();
|
||||
+ test_HashLinks();
|
||||
}
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index 4ff69b674a3..691eb60e865 100644
|
||||
index 7d7c29ec1e..a2a72dd571 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -83,6 +83,9 @@ static const char * const reason_names[]
|
||||
@@ -86,6 +86,9 @@ static const char * const reason_names[] =
|
||||
|
||||
static const WCHAR dllW[] = {'.','d','l','l',0};
|
||||
|
||||
@ -121,10 +121,11 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
/* internal representation of 32bit modules. per process. */
|
||||
typedef struct _wine_modref
|
||||
{
|
||||
@@ -420,6 +423,52 @@ static BOOL load_mscoree( void )
|
||||
@@ -347,6 +350,52 @@ static inline ULONG_PTR allocate_stub( const char *dll, const char *name ) { ret
|
||||
#endif /* __i386__ */
|
||||
|
||||
|
||||
/*************************************************************************
|
||||
+/*************************************************************************
|
||||
+ * hash_basename
|
||||
+ *
|
||||
+ * Calculates the bucket index of a dll using the basename.
|
||||
@ -169,29 +170,24 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
+ InsertTailList( &hash_table[hash_basename(mod->BaseDllName.Buffer)], &mod->HashLinks );
|
||||
+ }
|
||||
+}
|
||||
+
|
||||
+/*************************************************************************
|
||||
+
|
||||
/*************************************************************************
|
||||
* get_modref
|
||||
*
|
||||
* Looks for the referenced HMODULE in the current process
|
||||
@@ -1063,7 +1112,6 @@ static WINE_MODREF *alloc_module( HMODUL
|
||||
wm->ldr.TlsIndex = -1;
|
||||
wm->ldr.LoadCount = 1;
|
||||
wm->ldr.SectionHandle = NULL;
|
||||
- wm->ldr.CheckSum = 0;
|
||||
wm->ldr.TimeDateStamp = 0;
|
||||
wm->ldr.ActivationContext = 0;
|
||||
|
||||
@@ -1084,6 +1132,8 @@ static WINE_MODREF *alloc_module( HMODUL
|
||||
@@ -1059,7 +1108,12 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename, LPCWSTR fak
|
||||
&wm->ldr.InLoadOrderModuleList);
|
||||
InsertTailList(&NtCurrentTeb()->Peb->LdrData->InMemoryOrderModuleList,
|
||||
&wm->ldr.InMemoryOrderModuleList);
|
||||
+ InsertTailList(&hash_table[hash_basename(wm->ldr.BaseDllName.Buffer)],
|
||||
+ &wm->ldr.HashLinks);
|
||||
+
|
||||
/* wait until init is called for inserting into InInitializationOrderModuleList */
|
||||
+ wm->ldr.InInitializationOrderModuleList.Flink = NULL;
|
||||
+ wm->ldr.InInitializationOrderModuleList.Blink = NULL;
|
||||
|
||||
/* wait until init is called for inserting into this list */
|
||||
wm->ldr.InInitializationOrderModuleList.Flink = NULL;
|
||||
@@ -1837,6 +1887,7 @@ static void load_builtin_callback( void
|
||||
if (!(nt->OptionalHeader.DllCharacteristics & IMAGE_DLLCHARACTERISTICS_NX_COMPAT))
|
||||
{
|
||||
@@ -1768,6 +1822,7 @@ static void load_builtin_callback( void *module, const char *filename )
|
||||
/* the module has only be inserted in the load & memory order lists */
|
||||
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
|
||||
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
|
||||
@ -199,7 +195,7 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
/* FIXME: free the modref */
|
||||
builtin_load_info->status = STATUS_DLL_NOT_FOUND;
|
||||
return;
|
||||
@@ -2079,6 +2130,7 @@ static NTSTATUS load_native_dll( LPCWSTR
|
||||
@@ -2024,6 +2079,7 @@ static NTSTATUS load_native_dll( LPCWSTR load_path, LPCWSTR name, LPCWSTR fakemo
|
||||
/* the module has only be inserted in the load & memory order lists */
|
||||
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
|
||||
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
|
||||
@ -207,7 +203,7 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
|
||||
/* FIXME: there are several more dangling references
|
||||
* left. Including dlls loaded by this dll before the
|
||||
@@ -3196,6 +3248,7 @@ static void free_modref( WINE_MODREF *wm
|
||||
@@ -3171,6 +3227,7 @@ static void free_modref( WINE_MODREF *wm )
|
||||
{
|
||||
RemoveEntryList(&wm->ldr.InLoadOrderModuleList);
|
||||
RemoveEntryList(&wm->ldr.InMemoryOrderModuleList);
|
||||
@ -215,7 +211,7 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
if (wm->ldr.InInitializationOrderModuleList.Flink)
|
||||
RemoveEntryList(&wm->ldr.InInitializationOrderModuleList);
|
||||
|
||||
@@ -3589,6 +3642,9 @@ void WINAPI LdrInitializeThunk( void *ke
|
||||
@@ -3568,6 +3625,9 @@ void WINAPI LdrInitializeThunk( void *kernel_start, ULONG_PTR unknown2,
|
||||
RemoveEntryList( &wm->ldr.InMemoryOrderModuleList );
|
||||
InsertHeadList( &peb->LdrData->InMemoryOrderModuleList, &wm->ldr.InMemoryOrderModuleList );
|
||||
|
||||
@ -225,7 +221,7 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
if ((status = virtual_alloc_thread_stack( NtCurrentTeb(), 0, 0, NULL )) != STATUS_SUCCESS)
|
||||
{
|
||||
ERR( "Main exe initialization for %s failed, status %x\n",
|
||||
@@ -3782,6 +3838,7 @@ void __wine_process_init(void)
|
||||
@@ -3717,6 +3777,7 @@ void __wine_process_init(void)
|
||||
NTSTATUS status;
|
||||
ANSI_STRING func_name;
|
||||
void (* DECLSPEC_NORETURN CDECL init_func)(void);
|
||||
@ -233,22 +229,22 @@ index 4ff69b674a3..691eb60e865 100644
|
||||
|
||||
main_exe_file = thread_init();
|
||||
|
||||
@@ -3790,6 +3847,10 @@ void __wine_process_init(void)
|
||||
umask( FILE_umask );
|
||||
@@ -3726,6 +3787,10 @@ void __wine_process_init(void)
|
||||
|
||||
load_global_options();
|
||||
+
|
||||
|
||||
+ /* initialize hash table */
|
||||
+ for (i = 0; i < HASH_MAP_SIZE; i++)
|
||||
+ InitializeListHead(&hash_table[i]);
|
||||
|
||||
+
|
||||
/* setup the load callback and create ntdll modref */
|
||||
wine_dll_set_callback( load_builtin_callback );
|
||||
|
||||
diff --git a/include/winternl.h b/include/winternl.h
|
||||
index 4e7d2e966c2..c70d1bd837e 100644
|
||||
index 8c7071071c..144c27a629 100644
|
||||
--- a/include/winternl.h
|
||||
+++ b/include/winternl.h
|
||||
@@ -2099,8 +2099,7 @@ typedef struct _LDR_MODULE
|
||||
@@ -2147,8 +2147,7 @@ typedef struct _LDR_MODULE
|
||||
ULONG Flags;
|
||||
SHORT LoadCount;
|
||||
SHORT TlsIndex;
|
||||
@ -258,7 +254,7 @@ index 4e7d2e966c2..c70d1bd837e 100644
|
||||
ULONG TimeDateStamp;
|
||||
HANDLE ActivationContext;
|
||||
PVOID PatchInformation;
|
||||
@@ -2110,6 +2109,9 @@ typedef struct _LDR_MODULE
|
||||
@@ -2158,6 +2157,9 @@ typedef struct _LDR_MODULE
|
||||
PVOID ContextInformation;
|
||||
ULONG_PTR OriginalBase;
|
||||
LARGE_INTEGER LoadTime;
|
||||
@ -269,4 +265,5 @@ index 4e7d2e966c2..c70d1bd837e 100644
|
||||
|
||||
/* those defines are (some of the) regular LDR_MODULE.Flags values */
|
||||
--
|
||||
2.14.1
|
||||
2.16.1
|
||||
|
||||
|
@ -1,17 +1,17 @@
|
||||
From 9f96f35a269a9d1c905f6334e64021a76bc7dc60 Mon Sep 17 00:00:00 2001
|
||||
From bedc791064d00169b152c16d8876ea2a20f2429f Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Sat, 18 Jul 2015 04:52:55 +0200
|
||||
Subject: ntdll: Check architecture before loading module.
|
||||
Subject: [PATCH] ntdll: Check architecture before loading module.
|
||||
|
||||
---
|
||||
dlls/ntdll/loader.c | 139 +++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 131 insertions(+), 8 deletions(-)
|
||||
dlls/ntdll/loader.c | 138 +++++++++++++++++++++++++++++++++++++++++++++++++---
|
||||
1 file changed, 131 insertions(+), 7 deletions(-)
|
||||
|
||||
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
|
||||
index bf1d365..86c88ef 100644
|
||||
index de2cc543bc..7ceaef2eac 100644
|
||||
--- a/dlls/ntdll/loader.c
|
||||
+++ b/dlls/ntdll/loader.c
|
||||
@@ -2078,6 +2078,108 @@ done:
|
||||
@@ -2186,6 +2186,108 @@ done:
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -119,18 +119,17 @@ index bf1d365..86c88ef 100644
|
||||
+}
|
||||
|
||||
/***********************************************************************
|
||||
* find_dll_file
|
||||
@@ -2085,7 +2187,8 @@ done:
|
||||
* Find the file (or already loaded module) for a given dll name.
|
||||
* open_dll_file
|
||||
@@ -2232,7 +2334,7 @@ static HANDLE open_dll_file( UNICODE_STRING *nt_name, WINE_MODREF **pwm, struct
|
||||
*/
|
||||
static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
||||
- WCHAR *filename, ULONG *size, WINE_MODREF **pwm, HANDLE *handle )
|
||||
+ WCHAR *filename, ULONG *size, WINE_MODREF **pwm, HANDLE *handle,
|
||||
+ BOOL check_arch)
|
||||
WCHAR *filename, ULONG *size, WINE_MODREF **pwm,
|
||||
- HANDLE *handle, struct stat *st )
|
||||
+ HANDLE *handle, struct stat *st, BOOL check_arch )
|
||||
{
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
IO_STATUS_BLOCK io;
|
||||
@@ -2131,12 +2234,15 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
||||
UNICODE_STRING nt_name;
|
||||
WCHAR *file_part, *ext, *dllname;
|
||||
@@ -2277,20 +2379,41 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
||||
|
||||
if (RtlDetermineDosPathNameType_U( libname ) == RELATIVE_PATH)
|
||||
{
|
||||
@ -144,17 +143,18 @@ index bf1d365..86c88ef 100644
|
||||
+ if (!len) break;
|
||||
+
|
||||
if (len >= *size) goto overflow;
|
||||
- if ((*pwm = find_fullname_module( filename )) || !handle) goto found;
|
||||
+ if ((*pwm = find_fullname_module( filename ))) goto found;
|
||||
if ((*pwm = find_fullname_module( filename ))) goto found;
|
||||
+ if (!handle) goto next;
|
||||
|
||||
if (!RtlDosPathNameToNtPathName_U( filename, &nt_name, NULL, NULL ))
|
||||
{
|
||||
@@ -2150,7 +2256,23 @@ static NTSTATUS find_dll_file( const WCHAR *load_path, const WCHAR *libname,
|
||||
attr.SecurityDescriptor = NULL;
|
||||
attr.SecurityQualityOfService = NULL;
|
||||
if (NtOpenFile( handle, GENERIC_READ|SYNCHRONIZE, &attr, &io, FILE_SHARE_READ|FILE_SHARE_DELETE, FILE_SYNCHRONOUS_IO_NONALERT|FILE_NON_DIRECTORY_FILE )) *handle = 0;
|
||||
RtlFreeHeap( GetProcessHeap(), 0, dllname );
|
||||
return STATUS_NO_MEMORY;
|
||||
}
|
||||
+
|
||||
*handle = open_dll_file( &nt_name, pwm, st );
|
||||
- goto found;
|
||||
+
|
||||
+ #ifdef CURRENT_ARCH
|
||||
+ if (*handle && check_arch)
|
||||
+ {
|
||||
@ -175,7 +175,7 @@ index bf1d365..86c88ef 100644
|
||||
}
|
||||
|
||||
/* not found */
|
||||
@@ -2207,6 +2329,7 @@ overflow:
|
||||
@@ -2340,6 +2463,7 @@ overflow:
|
||||
*/
|
||||
static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_MODREF** pwm )
|
||||
{
|
||||
@ -183,24 +183,24 @@ index bf1d365..86c88ef 100644
|
||||
enum loadorder loadorder;
|
||||
WCHAR buffer[64];
|
||||
WCHAR *filename;
|
||||
@@ -2222,7 +2345,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
@@ -2356,7 +2480,7 @@ static NTSTATUS load_dll( LPCWSTR load_path, LPCWSTR libname, DWORD flags, WINE_
|
||||
size = sizeof(buffer);
|
||||
for (;;)
|
||||
{
|
||||
- nts = find_dll_file( load_path, libname, filename, &size, pwm, &handle );
|
||||
+ nts = find_dll_file( load_path, libname, filename, &size, pwm, &handle, !data );
|
||||
- nts = find_dll_file( load_path, libname, filename, &size, pwm, &handle, &st );
|
||||
+ nts = find_dll_file( load_path, libname, filename, &size, pwm, &handle, &st, !data );
|
||||
if (nts == STATUS_SUCCESS) break;
|
||||
if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename );
|
||||
if (nts != STATUS_BUFFER_TOO_SMALL) return nts;
|
||||
@@ -2359,7 +2482,7 @@ NTSTATUS WINAPI LdrGetDllHandle( LPCWSTR load_path, ULONG flags, const UNICODE_S
|
||||
@@ -2495,7 +2619,7 @@ NTSTATUS WINAPI LdrGetDllHandle( LPCWSTR load_path, ULONG flags, const UNICODE_S
|
||||
size = sizeof(buffer);
|
||||
for (;;)
|
||||
{
|
||||
- status = find_dll_file( load_path, name->Buffer, filename, &size, &wm, NULL );
|
||||
+ status = find_dll_file( load_path, name->Buffer, filename, &size, &wm, NULL, TRUE );
|
||||
- status = find_dll_file( load_path, name->Buffer, filename, &size, &wm, &handle, &st );
|
||||
+ status = find_dll_file( load_path, name->Buffer, filename, &size, &wm, &handle, &st, TRUE );
|
||||
if (handle) NtClose( handle );
|
||||
if (filename != buffer) RtlFreeHeap( GetProcessHeap(), 0, filename );
|
||||
if (status != STATUS_BUFFER_TOO_SMALL) break;
|
||||
/* grow the buffer and retry */
|
||||
--
|
||||
2.7.0
|
||||
2.16.1
|
||||
|
||||
|
@ -1,17 +1,18 @@
|
||||
From f16058fd2551d42166df18a9d2dd784f57b35144 Mon Sep 17 00:00:00 2001
|
||||
From 3a7aece1f3a8784ec20ea11e045bd4610a428651 Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Sun, 28 May 2017 10:30:43 +0200
|
||||
Subject: ntdll/tests: Add tests for NtQueryVirtualMemory(MemorySectionName).
|
||||
Subject: [PATCH] ntdll/tests: Add tests for
|
||||
NtQueryVirtualMemory(MemorySectionName).
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/info.c | 35 +++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 35 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
|
||||
index f1de20698a5..1b54bd41320 100644
|
||||
index 1f1c675e9f..61a006f15e 100644
|
||||
--- a/dlls/ntdll/tests/info.c
|
||||
+++ b/dlls/ntdll/tests/info.c
|
||||
@@ -1751,6 +1751,8 @@ static void test_queryvirtualmemory(void)
|
||||
@@ -1795,6 +1795,8 @@ static void test_queryvirtualmemory(void)
|
||||
MEMORY_BASIC_INFORMATION mbi;
|
||||
char stackbuf[42];
|
||||
HMODULE module;
|
||||
@ -20,10 +21,10 @@ index f1de20698a5..1b54bd41320 100644
|
||||
|
||||
module = GetModuleHandleA( "ntdll.dll" );
|
||||
trace("Check flags of the PE header of NTDLL.DLL at %p\n", module);
|
||||
@@ -1824,6 +1826,39 @@ static void test_queryvirtualmemory(void)
|
||||
"mbi.Protect is 0x%x\n", mbi.Protect);
|
||||
}
|
||||
else skip( "bss is outside of module\n" ); /* this can happen on Mac OS */
|
||||
@@ -1872,6 +1874,39 @@ static void test_queryvirtualmemory(void)
|
||||
/* check error code when addr is higher than working set limit */
|
||||
status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)~0, MemoryBasicInformation, &mbi, sizeof(mbi), &readcount);
|
||||
ok(status == STATUS_INVALID_PARAMETER, "Expected STATUS_INVALID_PARAMETER, got %08x\n", status);
|
||||
+
|
||||
+ trace("Check section name of NTDLL.DLL with invalid size\n");
|
||||
+ module = GetModuleHandleA( "ntdll.dll" );
|
||||
@ -61,5 +62,5 @@ index f1de20698a5..1b54bd41320 100644
|
||||
|
||||
static void test_affinity(void)
|
||||
--
|
||||
2.12.2
|
||||
2.16.1
|
||||
|
||||
|
@ -1,65 +0,0 @@
|
||||
From 103ff9d293f7ffd9a96fb8801057ecc781352efc Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Tue, 7 Mar 2017 04:58:57 +0100
|
||||
Subject: ntdll: Fix error code when querying too large memory address.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/info.c | 23 +++++++++++++++++++++++
|
||||
dlls/ntdll/virtual.c | 2 +-
|
||||
2 files changed, 24 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/info.c b/dlls/ntdll/tests/info.c
|
||||
index 448bc64c28..407d230cfd 100644
|
||||
--- a/dlls/ntdll/tests/info.c
|
||||
+++ b/dlls/ntdll/tests/info.c
|
||||
@@ -2013,6 +2013,26 @@ static void test_query_data_alignment(void)
|
||||
ok(value == 64, "Expected 64, got %u\n", value);
|
||||
}
|
||||
|
||||
+static void test_working_set_limit(void)
|
||||
+{
|
||||
+ DWORD_PTR lower = 0, upper = ~(DWORD_PTR)0;
|
||||
+ MEMORY_BASIC_INFORMATION mbi;
|
||||
+ SIZE_T readcount;
|
||||
+ NTSTATUS status;
|
||||
+
|
||||
+ while (lower != upper)
|
||||
+ {
|
||||
+ DWORD_PTR check = (lower >> 1) + (upper >> 1) + (lower & upper & 1);
|
||||
+ status = pNtQueryVirtualMemory(NtCurrentProcess(), (void *)check, MemoryBasicInformation,
|
||||
+ &mbi, sizeof(MEMORY_BASIC_INFORMATION), &readcount);
|
||||
+ if (status == STATUS_INVALID_PARAMETER) upper = check;
|
||||
+ else lower = check + 1;
|
||||
+ }
|
||||
+
|
||||
+ trace("working set limit is %p\n", (void *)upper);
|
||||
+ ok(upper != ~(DWORD_PTR)0, "expected != ~(DWORD_PTR)0\n");
|
||||
+}
|
||||
+
|
||||
START_TEST(info)
|
||||
{
|
||||
char **argv;
|
||||
@@ -2148,4 +2168,7 @@ START_TEST(info)
|
||||
|
||||
trace("Starting test_query_data_alignment()\n");
|
||||
test_query_data_alignment();
|
||||
+
|
||||
+ trace("Starting test_working_set_limit()\n");
|
||||
+ test_working_set_limit();
|
||||
}
|
||||
diff --git a/dlls/ntdll/virtual.c b/dlls/ntdll/virtual.c
|
||||
index e826fa03c0..a6297115fe 100644
|
||||
--- a/dlls/ntdll/virtual.c
|
||||
+++ b/dlls/ntdll/virtual.c
|
||||
@@ -2306,7 +2306,7 @@ NTSTATUS WINAPI NtQueryVirtualMemory( HANDLE process, LPCVOID addr,
|
||||
|
||||
base = ROUND_ADDR( addr, page_mask );
|
||||
|
||||
- if (is_beyond_limit( base, 1, working_set_limit )) return STATUS_WORKING_SET_LIMIT_RANGE;
|
||||
+ if (is_beyond_limit( base, 1, working_set_limit )) return STATUS_INVALID_PARAMETER;
|
||||
|
||||
/* Find the view containing the address */
|
||||
|
||||
--
|
||||
2.11.0
|
||||
|
@ -52,7 +52,7 @@ usage()
|
||||
# Get the upstream commit sha
|
||||
upstream_commit()
|
||||
{
|
||||
echo "7b62a970e9ad3b4179394cf54f0232475fe2388a"
|
||||
echo "0a72708126f5b8fc06698172d973bb529944c3bf"
|
||||
}
|
||||
|
||||
# Show version information
|
||||
@ -738,9 +738,6 @@ patch_enable ()
|
||||
gdiplus-Performance-Improvements)
|
||||
enable_gdiplus_Performance_Improvements="$2"
|
||||
;;
|
||||
hal-KeQueryPerformanceCounter)
|
||||
enable_hal_KeQueryPerformanceCounter="$2"
|
||||
;;
|
||||
hnetcfg-INetFwAuthorizedApplication)
|
||||
enable_hnetcfg_INetFwAuthorizedApplication="$2"
|
||||
;;
|
||||
@ -3168,7 +3165,6 @@ fi
|
||||
# | include/bcrypt.h, include/ntstatus.h
|
||||
# |
|
||||
if test "$enable_bcrypt_Improvements" -eq 1; then
|
||||
patch_apply bcrypt-Improvements/0010-bcrypt-tests-Add-test-for-bugs-in-BCryptGetProperty.patch
|
||||
patch_apply bcrypt-Improvements/0011-bcrypt-tests-Add-tests-for-AES-GCM-mode.patch
|
||||
patch_apply bcrypt-Improvements/0012-bcrypt-Pass-object-to-get_-alg-hash-_property-instea.patch
|
||||
patch_apply bcrypt-Improvements/0013-bcrypt-Implement-BCryptSetProperty-for-algorithms.patch
|
||||
@ -3186,7 +3182,6 @@ if test "$enable_bcrypt_Improvements" -eq 1; then
|
||||
patch_apply bcrypt-Improvements/0025-bcrypt-Avoid-crash-in-tests-when-compiling-without-g.patch
|
||||
patch_apply bcrypt-Improvements/0026-bcrypt-Implement-support-for-ECB-chain-mode.patch
|
||||
patch_apply bcrypt-Improvements/0027-bcrypt-Fix-BCryptEncrypt-with-AES_GCM-and-no-input-a.patch
|
||||
patch_apply bcrypt-Improvements/0028-bcrypt-Partial-implementation-of-BCryptImportKey-and.patch
|
||||
patch_apply bcrypt-Improvements/0029-bcrypt-Add-support-for-192-and-256-bit-aes-keys.patch
|
||||
patch_apply bcrypt-Improvements/0030-bcrypt-Preparation-for-asymmetric-keys.patch
|
||||
patch_apply bcrypt-Improvements/0031-include-Add-ecdsa-and-asymmetric-key-related-bcrypt-.patch
|
||||
@ -3197,7 +3192,6 @@ if test "$enable_bcrypt_Improvements" -eq 1; then
|
||||
patch_apply bcrypt-Improvements/0036-bcrypt-tests-Add-simple-test-for-RSA.patch
|
||||
patch_apply bcrypt-Improvements/0037-bcrypt-Store-full-ECCKEY_BLOB-struct-in-BCryptImport.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "bcrypt/tests: Add test for bugs in BCryptGetProperty.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "bcrypt/tests: Add tests for AES GCM mode.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "bcrypt: Pass object to get_{alg,hash}_property instead of alg_id.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "bcrypt: Implement BCryptSetProperty for algorithms.", 1 },';
|
||||
@ -3215,7 +3209,6 @@ if test "$enable_bcrypt_Improvements" -eq 1; then
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "bcrypt: Avoid crash in tests when compiling without gnutls support.", 1 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "bcrypt: Implement support for ECB chain mode.", 1 },';
|
||||
printf '%s\n' '+ { "Andrew Wesie", "bcrypt: Fix BCryptEncrypt with AES_GCM and no input and no output.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "bcrypt: Partial implementation of BCryptImportKey and BCryptExportKey.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "bcrypt: Add support for 192 and 256 bit aes keys.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "bcrypt: Preparation for asymmetric keys.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "include: Add ecdsa and asymmetric key related bcrypt definitions.", 1 },';
|
||||
@ -4542,21 +4535,6 @@ if test "$enable_gdiplus_Performance_Improvements" -eq 1; then
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset hal-KeQueryPerformanceCounter
|
||||
# |
|
||||
# | This patchset fixes the following Wine bugs:
|
||||
# | * [#39500] Implement hal.KeQueryPerformanceCounter
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/hal/hal.c, dlls/hal/hal.spec
|
||||
# |
|
||||
if test "$enable_hal_KeQueryPerformanceCounter" -eq 1; then
|
||||
patch_apply hal-KeQueryPerformanceCounter/0001-hal-Implement-KeQueryPerformanceCounter.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Michael Müller", "hal: Implement KeQueryPerformanceCounter.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
# Patchset hnetcfg-INetFwAuthorizedApplication
|
||||
# |
|
||||
# | Modified files:
|
||||
@ -5971,7 +5949,6 @@ if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then
|
||||
patch_apply ntdll-NtQueryVirtualMemory/0006-ntdll-Allow-to-query-section-names-from-other-proces.patch
|
||||
patch_apply ntdll-NtQueryVirtualMemory/0007-kernel32-Implement-K32GetMappedFileName.-v2.patch
|
||||
patch_apply ntdll-NtQueryVirtualMemory/0008-ntdll-Resolve-drive-symlinks-before-returning-sectio.patch
|
||||
patch_apply ntdll-NtQueryVirtualMemory/0009-ntdll-Fix-error-code-when-querying-too-large-memory-.patch
|
||||
(
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Split logic for MemoryBasicInformation into a separate function.", 1 },';
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "ntdll: Implement NtQueryVirtualMemory(MemorySectionName).", 3 },';
|
||||
@ -5980,7 +5957,6 @@ if test "$enable_ntdll_NtQueryVirtualMemory" -eq 1; then
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Allow to query section names from other processes.", 2 },';
|
||||
printf '%s\n' '+ { "Dmitry Timoshkov", "kernel32: Implement K32GetMappedFileName.", 2 },';
|
||||
printf '%s\n' '+ { "Sebastian Lackner", "ntdll: Resolve drive symlinks before returning section name.", 1 },';
|
||||
printf '%s\n' '+ { "Michael Müller", "ntdll: Fix error code when querying too large memory address.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -1,14 +1,15 @@
|
||||
From 86a10d59fa0f11717c0194fc0111568f8a948173 Mon Sep 17 00:00:00 2001
|
||||
From 90841bbb1a05a2d2a016baf13ab0efb0b36d530b Mon Sep 17 00:00:00 2001
|
||||
From: Dmitry Timoshkov <dmitry@baikal.ru>
|
||||
Date: Wed, 20 Jul 2016 14:30:53 +0800
|
||||
Subject: gdiplus/tests: Add some tests for GdipInitializePalette. (v2)
|
||||
Subject: [PATCH] gdiplus/tests: Add some tests for
|
||||
GdipInitializePalette. (v2)
|
||||
|
||||
---
|
||||
dlls/gdiplus/tests/image.c | 146 +++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 146 insertions(+)
|
||||
|
||||
diff --git a/dlls/gdiplus/tests/image.c b/dlls/gdiplus/tests/image.c
|
||||
index b3b47b6..4a0ec96 100644
|
||||
index fd45ab31c4..6646fb046e 100644
|
||||
--- a/dlls/gdiplus/tests/image.c
|
||||
+++ b/dlls/gdiplus/tests/image.c
|
||||
@@ -34,6 +34,8 @@ static GpStatus (WINAPI *pGdipBitmapGetHistogramSize)(HistogramFormat,UINT*);
|
||||
@ -20,8 +21,8 @@ index b3b47b6..4a0ec96 100644
|
||||
#define expect(expected, got) ok((got) == (expected), "Expected %d, got %d\n", (UINT)(expected), (UINT)(got))
|
||||
#define expectf(expected, got) ok(fabs((expected) - (got)) < 0.0001, "Expected %f, got %f\n", (expected), (got))
|
||||
|
||||
@@ -5005,6 +5007,149 @@ static void test_png_color_formats(void)
|
||||
}
|
||||
@@ -5190,6 +5192,149 @@ static void test_GdipLoadImageFromStream(void)
|
||||
IStream_Release(stream);
|
||||
}
|
||||
|
||||
+static BYTE *init_bitmap(UINT *width, UINT *height, UINT *stride)
|
||||
@ -170,7 +171,7 @@ index b3b47b6..4a0ec96 100644
|
||||
START_TEST(image)
|
||||
{
|
||||
HMODULE mod = GetModuleHandleA("gdiplus.dll");
|
||||
@@ -5022,6 +5167,7 @@ START_TEST(image)
|
||||
@@ -5214,6 +5359,7 @@ START_TEST(image)
|
||||
pGdipBitmapGetHistogram = (void*)GetProcAddress(mod, "GdipBitmapGetHistogram");
|
||||
pGdipImageSetAbort = (void*)GetProcAddress(mod, "GdipImageSetAbort");
|
||||
|
||||
@ -179,5 +180,5 @@ index b3b47b6..4a0ec96 100644
|
||||
test_supported_encoders();
|
||||
test_CloneBitmapArea();
|
||||
--
|
||||
2.9.0
|
||||
2.16.1
|
||||
|
||||
|
@ -1,23 +1,23 @@
|
||||
From ba10f87693d73b3ae374e94f4b9e4e6b29220fe8 Mon Sep 17 00:00:00 2001
|
||||
From 6a156acdcf5ef4f39472d736878f860fe9fa8aa0 Mon Sep 17 00:00:00 2001
|
||||
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
|
||||
Date: Fri, 18 Aug 2017 23:51:59 +0200
|
||||
Subject: [PATCH] wined3d: Implement dual source blending.
|
||||
|
||||
---
|
||||
dlls/d3d11/tests/d3d11.c | 2 +-
|
||||
dlls/wined3d/context.c | 10 +++++++++-
|
||||
dlls/wined3d/context.c | 11 ++++++++++-
|
||||
dlls/wined3d/directx.c | 10 ++++++++++
|
||||
dlls/wined3d/glsl_shader.c | 45 ++++++++++++++++++++++++++++++++----------
|
||||
dlls/wined3d/shader.c | 2 ++
|
||||
dlls/wined3d/state.c | 14 +++++++++++--
|
||||
dlls/wined3d/wined3d_private.h | 24 ++++++++++++++++++++--
|
||||
7 files changed, 91 insertions(+), 16 deletions(-)
|
||||
7 files changed, 92 insertions(+), 16 deletions(-)
|
||||
|
||||
diff --git a/dlls/d3d11/tests/d3d11.c b/dlls/d3d11/tests/d3d11.c
|
||||
index 954324f..c148bf2 100644
|
||||
index 1a9053e50d..77dbdb5f80 100644
|
||||
--- a/dlls/d3d11/tests/d3d11.c
|
||||
+++ b/dlls/d3d11/tests/d3d11.c
|
||||
@@ -26116,7 +26116,7 @@ static void test_dual_blending(void)
|
||||
@@ -26215,7 +26215,7 @@ static void test_dual_blending(void)
|
||||
ID3D11DeviceContext_ClearRenderTargetView(context, rtv[1], white);
|
||||
ID3D11DeviceContext_Draw(context, 3, 0);
|
||||
|
||||
@ -27,10 +27,10 @@ index 954324f..c148bf2 100644
|
||||
|
||||
ID3D11BlendState_Release(blend_state);
|
||||
diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
|
||||
index 6e85336..e5dd5bb 100644
|
||||
index f51ad59c92..f72ac415cb 100644
|
||||
--- a/dlls/wined3d/context.c
|
||||
+++ b/dlls/wined3d/context.c
|
||||
@@ -3176,8 +3176,16 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
|
||||
@@ -3154,10 +3154,19 @@ static DWORD find_draw_buffers_mask(const struct wined3d_context *context, const
|
||||
else if (!context->render_offscreen)
|
||||
return context_generate_rt_mask_from_resource(rts[0]->resource);
|
||||
|
||||
@ -45,14 +45,17 @@ index 6e85336..e5dd5bb 100644
|
||||
+ rt_mask &= context->d3d_info->valid_dual_rt_mask;
|
||||
+ else
|
||||
+ rt_mask &= context->d3d_info->valid_rt_mask;
|
||||
rt_mask_bits = rt_mask;
|
||||
i = 0;
|
||||
while (rt_mask_bits)
|
||||
|
||||
mask = rt_mask;
|
||||
+ i = 0;
|
||||
while (mask)
|
||||
{
|
||||
i = wined3d_bit_scan(&mask);
|
||||
diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c
|
||||
index cc86118..e4110de 100644
|
||||
index a75be3039c..bd2bc5b410 100644
|
||||
--- a/dlls/wined3d/directx.c
|
||||
+++ b/dlls/wined3d/directx.c
|
||||
@@ -3538,6 +3538,12 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||
@@ -3541,6 +3541,12 @@ static void wined3d_adapter_init_limits(struct wined3d_gl_info *gl_info)
|
||||
gl_info->limits.buffers = min(MAX_RENDER_TARGET_VIEWS, gl_max);
|
||||
TRACE("Max draw buffers: %u.\n", gl_max);
|
||||
}
|
||||
@ -65,7 +68,7 @@ index cc86118..e4110de 100644
|
||||
if (gl_info->supported[ARB_MULTITEXTURE])
|
||||
{
|
||||
if (gl_info->supported[WINED3D_GL_LEGACY_CONTEXT])
|
||||
@@ -4319,6 +4325,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||
@@ -4323,6 +4329,10 @@ static BOOL wined3d_adapter_init_gl_caps(struct wined3d_adapter *adapter,
|
||||
for (i = 0; i < gl_info->limits.buffers; ++i)
|
||||
adapter->d3d_info.valid_rt_mask |= (1u << i);
|
||||
|
||||
@ -77,7 +80,7 @@ index cc86118..e4110de 100644
|
||||
{
|
||||
/* We do not want to deal with re-creating immutable texture storage for color keying emulation. */
|
||||
diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
|
||||
index a571405..670a50e 100644
|
||||
index a571405816..670a50e992 100644
|
||||
--- a/dlls/wined3d/glsl_shader.c
|
||||
+++ b/dlls/wined3d/glsl_shader.c
|
||||
@@ -3008,6 +3008,7 @@ static void shader_glsl_get_register_name(const struct wined3d_shader_register *
|
||||
@ -149,7 +152,7 @@ index a571405..670a50e 100644
|
||||
}
|
||||
}
|
||||
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
|
||||
index 66e1bbf..0513c9e 100644
|
||||
index 66e1bbf882..0513c9e205 100644
|
||||
--- a/dlls/wined3d/shader.c
|
||||
+++ b/dlls/wined3d/shader.c
|
||||
@@ -4011,6 +4011,8 @@ void find_ps_compile_args(const struct wined3d_state *state, const struct wined3
|
||||
@ -162,7 +165,7 @@ index 66e1bbf..0513c9e 100644
|
||||
|
||||
static HRESULT pixel_shader_init(struct wined3d_shader *shader, struct wined3d_device *device,
|
||||
diff --git a/dlls/wined3d/state.c b/dlls/wined3d/state.c
|
||||
index ace6f3e..2ce8c6f 100644
|
||||
index ace6f3e566..2ce8c6fd7e 100644
|
||||
--- a/dlls/wined3d/state.c
|
||||
+++ b/dlls/wined3d/state.c
|
||||
@@ -534,12 +534,14 @@ static void state_blend(struct wined3d_context *context, const struct wined3d_st
|
||||
@ -205,7 +208,7 @@ index ace6f3e..2ce8c6f 100644
|
||||
state->render_states[WINED3D_RS_SRCBLEND],
|
||||
state->render_states[WINED3D_RS_DESTBLEND], rt_format);
|
||||
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
|
||||
index 96ce567..17955d6 100644
|
||||
index 5c413549aa..cb76e0faf5 100644
|
||||
--- a/dlls/wined3d/wined3d_private.h
|
||||
+++ b/dlls/wined3d/wined3d_private.h
|
||||
@@ -194,6 +194,7 @@ struct wined3d_d3d_info
|
||||
@ -236,7 +239,7 @@ index 96ce567..17955d6 100644
|
||||
DWORD constant_update_mask;
|
||||
DWORD numbered_array_mask;
|
||||
GLenum tracking_parm; /* Which source is tracking current colour */
|
||||
@@ -2514,6 +2517,7 @@ struct wined3d_fbo_ops
|
||||
@@ -2512,6 +2515,7 @@ struct wined3d_fbo_ops
|
||||
struct wined3d_gl_limits
|
||||
{
|
||||
UINT buffers;
|
||||
@ -244,7 +247,7 @@ index 96ce567..17955d6 100644
|
||||
UINT lights;
|
||||
UINT textures;
|
||||
UINT texture_coords;
|
||||
@@ -2857,6 +2861,22 @@ struct wined3d_state
|
||||
@@ -2855,6 +2859,22 @@ struct wined3d_state
|
||||
struct wined3d_rasterizer_state *rasterizer_state;
|
||||
};
|
||||
|
||||
@ -268,5 +271,5 @@ index 96ce567..17955d6 100644
|
||||
{
|
||||
GLuint tex_2d;
|
||||
--
|
||||
1.9.1
|
||||
2.16.1
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user