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

This commit is contained in:
Bruno Jesus 2014-07-30 23:21:11 -03:00 committed by Alexandre Julliard
parent a8b1fee2ea
commit 86dd877f4e
2 changed files with 9 additions and 3 deletions

View File

@ -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;

View File

@ -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);