Hans Leidekker : dssenh: Always duplicate container keys.
Alexandre Julliard
julliard at winehq.org
Tue Oct 20 15:57:17 CDT 2020
Module: wine
Branch: master
Commit: a71447565584265f37d3948e998680635f204da1
URL: https://source.winehq.org/git/wine.git/?a=commit;h=a71447565584265f37d3948e998680635f204da1
Author: Hans Leidekker <hans at codeweavers.com>
Date: Tue Oct 20 10:13:16 2020 +0200
dssenh: Always duplicate container keys.
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/dssenh/main.c | 30 +++++++++++++++++-------------
1 file changed, 17 insertions(+), 13 deletions(-)
diff --git a/dlls/dssenh/main.c b/dlls/dssenh/main.c
index e3771dc6f06..ffd1db92da4 100644
--- a/dlls/dssenh/main.c
+++ b/dlls/dssenh/main.c
@@ -433,11 +433,7 @@ static BOOL generate_key( struct container *container, ALG_ID algid, DWORD bitle
return FALSE;
}
- if (!store_key_container_keys( container ))
- {
- destroy_key( key );
- return FALSE;
- }
+ if (!store_key_container_keys( container )) return FALSE;
*ret_key = (HCRYPTKEY)key;
return TRUE;
@@ -494,7 +490,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE
HCRYPTKEY *ret_key )
{
struct container *container = (struct container *)hprov;
- struct key *key;
+ struct key *key, *exch_key, *sign_key;
BLOBHEADER *hdr;
DSSPUBKEY *pubkey;
const WCHAR *type;
@@ -549,12 +545,24 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE
{
case AT_KEYEXCHANGE:
case CALG_DH_SF:
- container->exch_key = key;
+ if (!(exch_key = duplicate_key( key )))
+ {
+ destroy_key( key );
+ return FALSE;
+ }
+ destroy_key( container->exch_key );
+ container->exch_key = exch_key;
break;
case AT_SIGNATURE:
case CALG_DSS_SIGN:
- container->sign_key = key;
+ if (!(sign_key = duplicate_key( key )))
+ {
+ destroy_key( key );
+ return FALSE;
+ }
+ destroy_key( container->sign_key );
+ container->sign_key = sign_key;
break;
default:
@@ -563,11 +571,7 @@ BOOL WINAPI CPImportKey( HCRYPTPROV hprov, const BYTE *data, DWORD len, HCRYPTKE
return FALSE;
}
- if (!store_key_container_keys( container ))
- {
- destroy_key( key );
- return FALSE;
- }
+ if (!store_key_container_keys( container )) return FALSE;
}
*ret_key = (HCRYPTKEY)key;
More information about the wine-cvs
mailing list