2018-03-02 22:55:37 -08:00
|
|
|
From b9fd0d5d4e698d60126714217a950295914e6680 Mon Sep 17 00:00:00 2001
|
2016-12-25 13:40:45 -08:00
|
|
|
From: Sebastian Lackner <sebastian@fds-team.de>
|
|
|
|
Date: Mon, 26 Dec 2016 16:20:57 +0100
|
2018-02-28 17:28:01 -08:00
|
|
|
Subject: [PATCH 25/36] bcrypt: Avoid crash in tests when compiling without
|
|
|
|
gnutls support.
|
2016-12-25 13:40:45 -08:00
|
|
|
|
|
|
|
---
|
2018-02-20 16:20:15 -08:00
|
|
|
dlls/bcrypt/bcrypt_main.c | 11 +++++++++++
|
|
|
|
1 file changed, 11 insertions(+)
|
2016-12-25 13:40:45 -08:00
|
|
|
|
|
|
|
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
|
2018-03-02 22:55:37 -08:00
|
|
|
index e4ebcf91ed..98c49e7331 100644
|
2016-12-25 13:40:45 -08:00
|
|
|
--- a/dlls/bcrypt/bcrypt_main.c
|
|
|
|
+++ b/dlls/bcrypt/bcrypt_main.c
|
2018-03-02 22:55:37 -08:00
|
|
|
@@ -1302,12 +1302,19 @@ NTSTATUS WINAPI BCryptGenerateSymmetricKey( BCRYPT_ALG_HANDLE algorithm, BCRYPT_
|
2016-12-25 13:40:45 -08:00
|
|
|
if (!alg || alg->hdr.magic != MAGIC_ALG) return STATUS_INVALID_HANDLE;
|
|
|
|
if (object) FIXME( "ignoring object buffer\n" );
|
|
|
|
|
2018-02-20 16:20:15 -08:00
|
|
|
+
|
|
|
|
if (!(key = heap_alloc( sizeof(*key) ))) return STATUS_NO_MEMORY;
|
2016-12-25 13:40:45 -08:00
|
|
|
+ {
|
|
|
|
+ *handle = NULL;
|
|
|
|
+ return STATUS_NO_MEMORY;
|
|
|
|
+ }
|
2018-02-20 16:20:15 -08:00
|
|
|
+
|
2016-12-25 13:40:45 -08:00
|
|
|
key->hdr.magic = MAGIC_KEY;
|
|
|
|
|
|
|
|
if ((status = key_init( key, alg, secret, secret_len )))
|
|
|
|
{
|
2018-02-20 16:20:15 -08:00
|
|
|
heap_free( key );
|
2016-12-25 13:40:45 -08:00
|
|
|
+ *handle = NULL;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
2018-03-02 22:55:37 -08:00
|
|
|
@@ -1390,11 +1397,15 @@ NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE
|
2016-12-25 13:40:45 -08:00
|
|
|
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) )))
|
|
|
|
+ {
|
|
|
|
+ *handle_copy = NULL;
|
|
|
|
return STATUS_NO_MEMORY;
|
|
|
|
+ }
|
|
|
|
|
|
|
|
if ((status = key_duplicate( key_orig, key_copy )))
|
|
|
|
{
|
|
|
|
HeapFree( GetProcessHeap(), 0, key_copy );
|
|
|
|
+ *handle_copy = NULL;
|
|
|
|
return status;
|
|
|
|
}
|
|
|
|
|
|
|
|
--
|
2018-02-28 17:28:01 -08:00
|
|
|
2.16.1
|
2016-12-25 13:40:45 -08:00
|
|
|
|