mirror of
https://github.com/reactos/wine.git
synced 2025-02-05 03:26:33 +00:00
rsaenh: Fix CryptSetKeyParam for KP_PERMISSIONS.
This commit is contained in:
parent
1cc5886771
commit
0eb9ae17fe
@ -2824,8 +2824,26 @@ BOOL WINAPI RSAENH_CPSetKeyParam(HCRYPTPROV hProv, HCRYPTKEY hKey, DWORD dwParam
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
case KP_PERMISSIONS:
|
case KP_PERMISSIONS:
|
||||||
pCryptKey->dwPermissions = *(DWORD*)pbData;
|
{
|
||||||
|
DWORD perms = *(DWORD *)pbData;
|
||||||
|
|
||||||
|
if ((perms & CRYPT_EXPORT) &&
|
||||||
|
!(pCryptKey->dwPermissions & CRYPT_EXPORT))
|
||||||
|
{
|
||||||
|
SetLastError(NTE_BAD_DATA);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else if (!(perms & CRYPT_EXPORT) &&
|
||||||
|
(pCryptKey->dwPermissions & CRYPT_EXPORT))
|
||||||
|
{
|
||||||
|
/* Clearing the export permission appears to be ignored,
|
||||||
|
* see tests.
|
||||||
|
*/
|
||||||
|
perms |= CRYPT_EXPORT;
|
||||||
|
}
|
||||||
|
pCryptKey->dwPermissions = perms;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
case KP_IV:
|
case KP_IV:
|
||||||
memcpy(pCryptKey->abInitVector, pbData, pCryptKey->dwBlockLen);
|
memcpy(pCryptKey->abInitVector, pbData, pCryptKey->dwBlockLen);
|
||||||
|
@ -1581,7 +1581,6 @@ static void test_rsa_encrypt(void)
|
|||||||
dwVal |= CRYPT_EXPORT;
|
dwVal |= CRYPT_EXPORT;
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
result = CryptSetKeyParam(hRSAKey, KP_PERMISSIONS, (BYTE *)&dwVal, 0);
|
result = CryptSetKeyParam(hRSAKey, KP_PERMISSIONS, (BYTE *)&dwVal, 0);
|
||||||
todo_wine
|
|
||||||
ok(!result && GetLastError() == NTE_BAD_DATA,
|
ok(!result && GetLastError() == NTE_BAD_DATA,
|
||||||
"expected NTE_BAD_DATA, got %08x\n", GetLastError());
|
"expected NTE_BAD_DATA, got %08x\n", GetLastError());
|
||||||
|
|
||||||
@ -1614,7 +1613,6 @@ static void test_rsa_encrypt(void)
|
|||||||
dwVal |= CRYPT_EXPORT;
|
dwVal |= CRYPT_EXPORT;
|
||||||
SetLastError(0xdeadbeef);
|
SetLastError(0xdeadbeef);
|
||||||
result = CryptSetKeyParam(hRSAKey, KP_PERMISSIONS, (BYTE *)&dwVal, 0);
|
result = CryptSetKeyParam(hRSAKey, KP_PERMISSIONS, (BYTE *)&dwVal, 0);
|
||||||
todo_wine
|
|
||||||
ok(!result && GetLastError() == NTE_BAD_DATA,
|
ok(!result && GetLastError() == NTE_BAD_DATA,
|
||||||
"expected NTE_BAD_DATA, got %08x\n", GetLastError());
|
"expected NTE_BAD_DATA, got %08x\n", GetLastError());
|
||||||
|
|
||||||
@ -2157,7 +2155,6 @@ static void test_key_permissions(void)
|
|||||||
dwLen = sizeof(DWORD);
|
dwLen = sizeof(DWORD);
|
||||||
result = CryptGetKeyParam(hKey1, KP_PERMISSIONS, (BYTE*)&dwVal, &dwLen, 0);
|
result = CryptGetKeyParam(hKey1, KP_PERMISSIONS, (BYTE*)&dwVal, &dwLen, 0);
|
||||||
ok(result, "%08x\n", GetLastError());
|
ok(result, "%08x\n", GetLastError());
|
||||||
todo_wine
|
|
||||||
ok(dwVal ==
|
ok(dwVal ==
|
||||||
(CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT),
|
(CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT),
|
||||||
"expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
|
"expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
|
||||||
@ -2178,7 +2175,6 @@ static void test_key_permissions(void)
|
|||||||
dwLen = sizeof(DWORD);
|
dwLen = sizeof(DWORD);
|
||||||
result = CryptGetKeyParam(hKey2, KP_PERMISSIONS, (BYTE*)&dwVal, &dwLen, 0);
|
result = CryptGetKeyParam(hKey2, KP_PERMISSIONS, (BYTE*)&dwVal, &dwLen, 0);
|
||||||
ok(result, "%08x\n", GetLastError());
|
ok(result, "%08x\n", GetLastError());
|
||||||
todo_wine
|
|
||||||
ok(dwVal ==
|
ok(dwVal ==
|
||||||
(CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT),
|
(CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT),
|
||||||
"expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
|
"expected CRYPT_MAC|CRYPT_WRITE|CRYPT_READ|CRYPT_EXPORT|CRYPT_DECRYPT|CRYPT_ENCRYPT,"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user