Commit 2d0653e2 authored by Qian Hong's avatar Qian Hong Committed by Alexandre Julliard

rsaenh: Restore key state even after decrypting a block of bad data.

parent b84e11ec
...@@ -2380,11 +2380,13 @@ BOOL WINAPI RSAENH_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash, ...@@ -2380,11 +2380,13 @@ BOOL WINAPI RSAENH_CPDecrypt(HCRYPTPROV hProv, HCRYPTKEY hKey, HCRYPTHASH hHash,
*pdwDataLen -= pbData[*pdwDataLen-1]; *pdwDataLen -= pbData[*pdwDataLen-1];
else { else {
SetLastError(NTE_BAD_DATA); SetLastError(NTE_BAD_DATA);
setup_key(pCryptKey);
return FALSE; return FALSE;
} }
} }
else { else {
SetLastError(NTE_BAD_DATA); SetLastError(NTE_BAD_DATA);
setup_key(pCryptKey);
return FALSE; return FALSE;
} }
} }
......
...@@ -840,7 +840,6 @@ static void test_3des112(void) ...@@ -840,7 +840,6 @@ static void test_3des112(void)
result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen); result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen);
ok(result, "%08x\n", GetLastError()); ok(result, "%08x\n", GetLastError());
ok(dwLen==cTestData[i].enclen,"length incorrect, got %d, expected %d\n",dwLen,cTestData[i].enclen); ok(dwLen==cTestData[i].enclen,"length incorrect, got %d, expected %d\n",dwLen,cTestData[i].enclen);
todo_wine
ok(memcmp(pbData,cTestData[i].decstr,cTestData[1].enclen)==0,"decryption incorrect %d\n",i); ok(memcmp(pbData,cTestData[i].decstr,cTestData[1].enclen)==0,"decryption incorrect %d\n",i);
if((dwLen != cTestData[i].enclen) || if((dwLen != cTestData[i].enclen) ||
memcmp(pbData,cTestData[i].decstr,cTestData[i].enclen)) memcmp(pbData,cTestData[i].decstr,cTestData[i].enclen))
...@@ -1019,7 +1018,6 @@ static void test_3des(void) ...@@ -1019,7 +1018,6 @@ static void test_3des(void)
result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen); result = CryptDecrypt(hKey, 0, TRUE, 0, pbData, &dwLen);
ok(result, "%08x\n", GetLastError()); ok(result, "%08x\n", GetLastError());
ok(dwLen==cTestData[i].enclen,"length incorrect, got %d, expected %d\n",dwLen,cTestData[i].enclen); ok(dwLen==cTestData[i].enclen,"length incorrect, got %d, expected %d\n",dwLen,cTestData[i].enclen);
todo_wine
ok(memcmp(pbData,cTestData[i].decstr,cTestData[1].enclen)==0,"decryption incorrect %d\n",i); ok(memcmp(pbData,cTestData[i].decstr,cTestData[1].enclen)==0,"decryption incorrect %d\n",i);
if((dwLen != cTestData[i].enclen) || if((dwLen != cTestData[i].enclen) ||
memcmp(pbData,cTestData[i].decstr,cTestData[i].enclen)) memcmp(pbData,cTestData[i].decstr,cTestData[i].enclen))
......
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