rsaenh: Don't return salt for algorithms that don't support it.

oldstable
Juan Lang 2010-03-30 12:05:25 -07:00 committed by Alexandre Julliard
parent c5a6b7b366
commit 1991ff2a0c
2 changed files with 10 additions and 4 deletions

View File

@ -3513,8 +3513,16 @@ BOOL WINAPI RSAENH_CPGetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
pCryptKey->dwBlockLen);
case KP_SALT:
return copy_param(pbData, pdwDataLen,
&pCryptKey->abKeyValue[pCryptKey->dwKeyLen], pCryptKey->dwSaltLen);
switch (pCryptKey->aiAlgid) {
case CALG_RC2:
case CALG_RC4:
return copy_param(pbData, pdwDataLen,
&pCryptKey->abKeyValue[pCryptKey->dwKeyLen],
pCryptKey->dwSaltLen);
default:
SetLastError(NTE_BAD_KEY);
return FALSE;
}
case KP_PADDING:
dwValue = PKCS5_PADDING;

View File

@ -744,7 +744,6 @@ static void test_aes(int keylen)
/* AES provider doesn't support salt */
result = CryptGetKeyParam(hKey, KP_SALT, NULL, &dwLen, 0);
todo_wine
ok(!result && (GetLastError() == NTE_BAD_KEY || GetLastError() == ERROR_NO_TOKEN /* Win7 */),
"expected NTE_BAD_KEY or ERROR_NO_TOKEN, got %08x\n", GetLastError());
@ -1742,7 +1741,6 @@ static void test_rsa_encrypt(void)
/* An RSA key doesn't support salt */
result = CryptGetKeyParam(hRSAKey, KP_SALT, NULL, &dwLen, 0);
todo_wine
ok(!result && GetLastError() == NTE_BAD_KEY,
"expected NTE_BAD_KEY, got %08x\n", GetLastError());