Hans Leidekker : bcrypt: Call key_destroy() instead of BCryptDestroyKey().
Alexandre Julliard
julliard at winehq.org
Mon Mar 21 17:20:24 CDT 2022
Module: wine
Branch: master
Commit: 9176251af425ba494c0334c5659aa47941ee7c85
URL: https://source.winehq.org/git/wine.git/?a=commit;h=9176251af425ba494c0334c5659aa47941ee7c85
Author: Hans Leidekker <hans at codeweavers.com>
Date: Mon Mar 21 09:50:07 2022 +0100
bcrypt: Call key_destroy() instead of BCryptDestroyKey().
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/bcrypt/bcrypt_main.c | 40 +++++++++++++++++++---------------------
1 file changed, 19 insertions(+), 21 deletions(-)
diff --git a/dlls/bcrypt/bcrypt_main.c b/dlls/bcrypt/bcrypt_main.c
index fe16f9269c9..ab9cf67923d 100644
--- a/dlls/bcrypt/bcrypt_main.c
+++ b/dlls/bcrypt/bcrypt_main.c
@@ -1324,6 +1324,22 @@ static NTSTATUS key_symmetric_decrypt( struct key *key, UCHAR *input, ULONG inpu
return status;
}
+static void key_destroy( struct key *key )
+{
+ if (key_is_symmetric( key ))
+ {
+ UNIX_CALL( key_symmetric_destroy, key );
+ free( key->u.s.vector );
+ free( key->u.s.secret );
+ DeleteCriticalSection( &key->u.s.cs );
+ }
+ else
+ UNIX_CALL( key_asymmetric_destroy, key );
+
+ key->hdr.magic = 0;
+ free( key );
+}
+
static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYPT_KEY_HANDLE *ret_key, UCHAR *input,
ULONG input_len )
{
@@ -1403,7 +1419,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
params.len = input_len;
if ((status = UNIX_CALL( key_import_ecc, ¶ms )))
{
- BCryptDestroyKey( key );
+ key_destroy( key );
return status;
}
@@ -1438,7 +1454,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
params.len = input_len;
if ((status = UNIX_CALL( key_import_rsa, ¶ms )))
{
- BCryptDestroyKey( key );
+ key_destroy( key );
return status;
}
@@ -1489,7 +1505,7 @@ static NTSTATUS key_import_pair( struct algorithm *alg, const WCHAR *type, BCRYP
params.len = input_len;
if ((status = UNIX_CALL( key_import_dsa_capi, ¶ms )))
{
- BCryptDestroyKey( key );
+ key_destroy( key );
return status;
}
@@ -1724,24 +1740,6 @@ static NTSTATUS key_duplicate( struct key *key_orig, struct key *key_copy )
return STATUS_SUCCESS;
}
-static void key_destroy( struct key *key )
-{
- if (key_is_symmetric( key ))
- {
- UNIX_CALL( key_symmetric_destroy, key );
- free( key->u.s.vector );
- free( key->u.s.secret );
- DeleteCriticalSection( &key->u.s.cs );
- }
- else
- {
- UNIX_CALL( key_asymmetric_destroy, key );
- free( key->u.a.pubkey );
- }
- key->hdr.magic = 0;
- free( key );
-}
-
NTSTATUS WINAPI BCryptDuplicateKey( BCRYPT_KEY_HANDLE handle, BCRYPT_KEY_HANDLE *handle_copy,
UCHAR *object, ULONG object_len, ULONG flags )
{
More information about the wine-cvs
mailing list