[RSAENH] Sync with Wine Staging 2.9. CORE-13362

e705dfc rsaenh: Don't import a public key to a key container.

svn path=/trunk/; revision=74843
This commit is contained in:
Amine Khaldi 2017-06-03 22:38:03 +00:00
parent 3a2d3f54c7
commit 81bce5b365
2 changed files with 5 additions and 18 deletions

View file

@ -2826,15 +2826,14 @@ static BOOL import_private_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDat
/****************************************************************************** /******************************************************************************
* import_public_key [Internal] * import_public_key [Internal]
* *
* Import a BLOB'ed public key into a key container. * Import a BLOB'ed public key.
* *
* PARAMS * 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. * pbData [I] Pointer to a buffer which holds the public key BLOB.
* dwDataLen [I] Length of data in buffer at pbData. * dwDataLen [I] Length of data in buffer at pbData.
* dwFlags [I] One of: * dwFlags [I] One of:
* CRYPT_EXPORTABLE: the imported key is marked exportable * 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. * phKey [O] Handle to the imported key.
* *
* *
@ -2847,9 +2846,8 @@ static BOOL import_private_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDat
* Failure: FALSE. * Failure: FALSE.
*/ */
static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, 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; CRYPTKEY *pCryptKey;
const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData; const BLOBHEADER *pBlobHeader = (const BLOBHEADER*)pbData;
const RSAPUBKEY *pRSAPubKey = (const RSAPUBKEY*)(pBlobHeader+1); const RSAPUBKEY *pRSAPubKey = (const RSAPUBKEY*)(pBlobHeader+1);
@ -2862,8 +2860,6 @@ static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwData
SetLastError(NTE_BAD_FLAGS); SetLastError(NTE_BAD_FLAGS);
return FALSE; return FALSE;
} }
if (!(pKeyContainer = get_key_container(hProv)))
return FALSE;
if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) || if ((dwDataLen < sizeof(BLOBHEADER) + sizeof(RSAPUBKEY)) ||
(pRSAPubKey->magic != RSAENH_MAGIC_RSA1) || (pRSAPubKey->magic != RSAENH_MAGIC_RSA1) ||
@ -2885,15 +2881,6 @@ static BOOL import_public_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwData
if (ret) { if (ret) {
if (dwFlags & CRYPT_EXPORTABLE) if (dwFlags & CRYPT_EXPORTABLE)
pCryptKey->dwPermissions |= CRYPT_EXPORT; 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; return ret;
} }
@ -3107,7 +3094,7 @@ static BOOL import_key(HCRYPTPROV hProv, const BYTE *pbData, DWORD dwDataLen, HC
case PUBLICKEYBLOB: case PUBLICKEYBLOB:
return import_public_key(hProv, pbData, dwDataLen, dwFlags, return import_public_key(hProv, pbData, dwDataLen, dwFlags,
fStoreKey, phKey); phKey);
case SIMPLEBLOB: case SIMPLEBLOB:
return import_symmetric_key(hProv, pbData, dwDataLen, hPubKey, return import_symmetric_key(hProv, pbData, dwDataLen, hPubKey,

View file

@ -162,7 +162,7 @@ reactos/dll/win32/riched20 # Synced to WineStaging-2.9
reactos/dll/win32/riched32 # Synced to WineStaging-1.9.11 reactos/dll/win32/riched32 # Synced to WineStaging-1.9.11
reactos/dll/win32/rpcrt4 # Synced to WineStaging-2.2 reactos/dll/win32/rpcrt4 # Synced to WineStaging-2.2
reactos/dll/win32/rsabase # Synced to WineStaging-1.9.11 reactos/dll/win32/rsabase # Synced to WineStaging-1.9.11
reactos/dll/win32/rsaenh # Synced to WineStaging-1.9.11 reactos/dll/win32/rsaenh # Synced to WineStaging-2.9
reactos/dll/win32/sccbase # Synced to WineStaging-1.9.11 reactos/dll/win32/sccbase # Synced to WineStaging-1.9.11
reactos/dll/win32/schannel # Synced to WineStaging-1.9.11 reactos/dll/win32/schannel # Synced to WineStaging-1.9.11
reactos/dll/win32/scrrun # Synced to WineStaging-2.2 reactos/dll/win32/scrrun # Synced to WineStaging-2.2