Commit 86dd877f authored by Bruno Jesus's avatar Bruno Jesus Committed by Alexandre Julliard

rsaenh: The RC2 algorithm from Base provider supports only 40 bit keys.

parent a8b1fee2
......@@ -3495,22 +3495,29 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
case KP_EFFECTIVE_KEYLEN:
switch (pCryptKey->aiAlgid) {
case CALG_RC2:
{
DWORD keylen;
KEYCONTAINER *pKeyContainer = get_key_container(pCryptKey->hProv);
if (!pbData)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
else if (!*(DWORD *)pbData || *(DWORD *)pbData > 1024)
keylen = *(DWORD *)pbData;
if (!keylen || keylen > 1024 || (keylen != 40 &&
pKeyContainer->dwPersonality == RSAENH_PERSONALITY_BASE))
{
SetLastError(NTE_BAD_DATA);
return FALSE;
}
else
{
pCryptKey->dwEffectiveKeyLen = *(DWORD *)pbData;
pCryptKey->dwEffectiveKeyLen = keylen;
setup_key(pCryptKey);
}
break;
}
default:
SetLastError(NTE_BAD_TYPE);
return FALSE;
......
......@@ -1529,7 +1529,6 @@ static void test_rc2(void)
if (!BASE_PROV)
ok(result, "expected success, got error 0x%08X\n", GetLastError());
else
todo_wine
ok(!result, "expected error\n");
dwLen = sizeof(dwKeyLen);
......
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