Commit 1991ff2a authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

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

parent c5a6b7b3
......@@ -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;
......
......@@ -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());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment