Module: wine Branch: master Commit: e705dfc27f15164e8f2cdd17cf505c19d78415e2 URL: http://source.winehq.org/git/wine.git/?a=commit;h=e705dfc27f15164e8f2cdd17cf...
Author: Akihiro Sagawa sagawa.aki@gmail.com Date: Sun Apr 30 22:30:42 2017 +0900
rsaenh: Don't import a public key to a key container.
Signed-off-by: Akihiro Sagawa sagawa.aki@gmail.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/rsaenh/rsaenh.c | 21 ++++----------------- dlls/rsaenh/tests/rsaenh.c | 2 +- 2 files changed, 5 insertions(+), 18 deletions(-)
diff --git a/dlls/rsaenh/rsaenh.c b/dlls/rsaenh/rsaenh.c index ebafa0e..9af770d 100644 --- a/dlls/rsaenh/rsaenh.c +++ b/dlls/rsaenh/rsaenh.c @@ -2822,15 +2822,14 @@ static BOOL import_private_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDat /****************************************************************************** * import_public_key [Internal] * - * Import a BLOB'ed public key into a key container. + * Import a BLOB'ed public key. * * PARAMS - * hProv [I] Key container into which the public key is to be imported. + * hProv [I] A CSP. * pbData [I] Pointer to a buffer which holds the public key BLOB. * dwDataLen [I] Length of data in buffer at pbData. * dwFlags [I] One of: * CRYPT_EXPORTABLE: the imported key is marked exportable - * fStoreKey [I] If TRUE, the imported key is stored to the registry. * phKey [O] Handle to the imported key. * * @@ -2843,9 +2842,8 @@ static BOOL import_private_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDat * Failure: FALSE. */ static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, - DWORD dwFlags, BOOL fStoreKey, HCRYPTKEY *phKey) + DWORD dwFlags, HCRYPTKEY *phKey) { - KEYCONTAINER *pKeyContainer; CRYPTKEY *pCryptKey; const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; const RSAPUBKEY *pRSAPubKey = (const RSAPUBKEY*)(pBlobHeader+1); @@ -2858,8 +2856,6 @@ static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwData SetLastError(NTE_BAD_FLAGS); return FALSE; } - if (!(pKeyContainer = get_key_container(hProv))) - return FALSE;
if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) || (pRSAPubKey->magic != RSAENH_MAGIC_RSA1) || @@ -2881,15 +2877,6 @@ static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwData if (ret) { if (dwFlags & CRYPT_EXPORTABLE) pCryptKey->dwPermissions |= CRYPT_EXPORT; - switch (pBlobHeader->aiKeyAlg) - { - case AT_KEYEXCHANGE: - case CALG_RSA_KEYX: - TRACE("installing public key\n"); - release_and_install_key(hProv, *phKey, &pKeyContainer->hKeyExchangeKeyPair, - fStoreKey); - break; - } } return ret; } @@ -3103,7 +3090,7 @@ static BOOL import_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HC
case PUBLICKEYBLOB: return import_public_key(hProv, pbData, dwDataLen, dwFlags, - fStoreKey, phKey); + phKey);
case SIMPLEBLOB: return import_symmetric_key(hProv, pbData, dwDataLen, hPubKey, diff --git a/dlls/rsaenh/tests/rsaenh.c b/dlls/rsaenh/tests/rsaenh.c index 839527b..c9532b2 100644 --- a/dlls/rsaenh/tests/rsaenh.c +++ b/dlls/rsaenh/tests/rsaenh.c @@ -2642,7 +2642,7 @@ static void test_import_export(void) CryptDestroyKey(hPrivKey);
result = !memcmp(exported_key, exported_key2, dwDataLen); - todo_wine ok(result, "unexpected value\n"); + ok(result, "unexpected value\n"); if (!result && winetest_debug > 1) { trace("Expected public key (%u):\n", dwDataLen); trace_hex(exported_key, dwDataLen);