bcrypt: Return an error when BCryptFinalizeKeyPair() is called twice.
Signed-off-by: Hans Leidekker <hans@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
545ec32d28
commit
9ff16aa1cb
|
@ -846,6 +846,7 @@ static NTSTATUS key_asymmetric_generate( void *args )
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (!libgnutls_handle) return STATUS_INTERNAL_ERROR;
|
if (!libgnutls_handle) return STATUS_INTERNAL_ERROR;
|
||||||
|
if (key_data(key)->privkey) return STATUS_INVALID_HANDLE;
|
||||||
|
|
||||||
switch (key->alg_id)
|
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);
|
ret = BCryptImportKeyPair(alg, NULL, BCRYPT_RSAPRIVATE_BLOB, &key, rsaPrivateBlob, sizeof(rsaPrivateBlob), 0);
|
||||||
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
|
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
|
||||||
|
|
||||||
|
ret = BCryptFinalizeKeyPair(key, 0);
|
||||||
|
ok(ret == STATUS_INVALID_HANDLE, "got %#lx\n", ret);
|
||||||
|
|
||||||
size = 0;
|
size = 0;
|
||||||
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaPrivateBlob));
|
buf = HeapAlloc(GetProcessHeap(), 0, sizeof(rsaPrivateBlob));
|
||||||
ret = BCryptExportKey(key, NULL, BCRYPT_RSAPRIVATE_BLOB, buf, sizeof(rsaPrivateBlob), &size, 0);
|
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);
|
ret = BCryptFinalizeKeyPair(key, 0);
|
||||||
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
|
ok(ret == STATUS_SUCCESS, "got %#lx\n", ret);
|
||||||
|
|
||||||
|
ret = BCryptFinalizeKeyPair(key, 0);
|
||||||
|
ok(ret == STATUS_INVALID_HANDLE, "got %#lx\n", ret);
|
||||||
|
|
||||||
len = 0;
|
len = 0;
|
||||||
memset(sig, 0, sizeof(sig));
|
memset(sig, 0, sizeof(sig));
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue