Commit 9ff16aa1 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

bcrypt: Return an error when BCryptFinalizeKeyPair() is called twice.

parent 545ec32d
......@@ -846,6 +846,7 @@ static NTSTATUS key_asymmetric_generate( void *args )
int ret;
if (!libgnutls_handle) return STATUS_INTERNAL_ERROR;
if (key_data(key)->privkey) return STATUS_INVALID_HANDLE;
switch (key->alg_id)
{
......
......@@ -2157,6 +2157,9 @@ static void test_RSA(void)
ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPRIVATE_BLOB, &key, rsaPrivateBlob, sizeof(rsaPrivateBlob), 0);
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_INVALID_HANDLE, "got %#lx\n", ret);
size = 0;
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaPrivateBlob));
ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, sizeof(rsaPrivateBlob), &size, 0);
......@@ -2565,6 +2568,9 @@ static void test_BCryptSignHash(void)
ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
ret = BCryptFinalizeKeyPair(key, 0);
ok(ret == STATUS_INVALID_HANDLE, "got %#lx\n", ret);
len = 0;
memset(sig, 0, sizeof(sig));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment