From: Dmitry Timoshkov dmitry@baikal.ru
Signed-off-by: Dmitry Timoshkov dmitry@baikal.ru --- dlls/bcrypt/bcrypt_main.c | 11 +++-------- dlls/bcrypt/tests/bcrypt.c | 4 ---- 2 files changed, 3 insertions(+), 12 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c index 04422fdbaae..2e06fdc07cc 100644 --- a/dlls/bcrypt/bcrypt_main.c +++ b/dlls/bcrypt/bcrypt_main.c @@ -1521,10 +1521,10 @@ static NTSTATUS key_symmetric_encrypt( struct key *key, UCHAR *input, ULONG inp }
/* AES Key Wrap Algorithm (RFC3394) */ -static NTSTATUS aes_wrap( const UCHAR *secret, ULONG secret_len, const UCHAR *plain, UCHAR *cipher ) +static NTSTATUS aes_wrap( const UCHAR *secret, ULONG secret_len, const UCHAR *plain, ULONG plain_len, UCHAR *cipher ) { UCHAR *a, *r, b[16]; - ULONG len, t, i, j, n = secret_len / 8; + ULONG len, t, i, j, n = plain_len / 8; struct key *key;
a = cipher; @@ -1634,17 +1634,12 @@ static NTSTATUS key_export( struct key *key, struct key *encrypt_key, const WCHA ULONG req_size = key->u.s.secret_len + 8;
if (!encrypt_key) return STATUS_INVALID_PARAMETER; - if (key->u.s.secret_len > BLOCK_LENGTH_AES) - { - FIXME( "key length %u not supported yet\n", key->u.s.secret_len ); - return STATUS_NOT_IMPLEMENTED; - }
*size = req_size; if (output) { if (output_len < req_size) return STATUS_BUFFER_TOO_SMALL; - if ((status = aes_wrap( encrypt_key->u.s.secret, encrypt_key->u.s.secret_len, key->u.s.secret, output ))) + if ((status = aes_wrap( encrypt_key->u.s.secret, encrypt_key->u.s.secret_len, key->u.s.secret, key->u.s.secret_len, output ))) return status; } return STATUS_SUCCESS; diff --git a/dlls/bcrypt/tests/bcrypt.c b/dlls/bcrypt/tests/bcrypt.c index 038f81efacb..ccf4f315452 100644 --- a/dlls/bcrypt/tests/bcrypt.c +++ b/dlls/bcrypt/tests/bcrypt.c @@ -2112,15 +2112,11 @@ static void test_key_import_export(void)
size = 0; ret = BCryptExportKey(key2, key, BCRYPT_AES_WRAP_KEY_BLOB, NULL, 0, &size, 0); - todo_wine ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); - todo_wine ok(size == sizeof(buffer3), "got %lu\n", size);
ret = BCryptExportKey(key2, key, BCRYPT_AES_WRAP_KEY_BLOB, buffer3, size, &size, 0); - todo_wine ok(ret == STATUS_SUCCESS, "got %#lx\n", ret); - todo_wine ok(!memcmp(buffer3, encrypted_blob, sizeof(encrypted_blob)), "blobs didn't match\n");
key3 = NULL;