Commit 1cc58867 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

rsaenh: Honor the CRYPT_EXPORTABLE flag to CryptAcquireContext and CryptGenKey.

parent cc1e6eed
...@@ -755,7 +755,8 @@ static inline void setup_key(CRYPTKEY *pCryptKey) { ...@@ -755,7 +755,8 @@ static inline void setup_key(CRYPTKEY *pCryptKey) {
* hProv [I] Handle to the provider to which the created key will belong. * hProv [I] Handle to the provider to which the created key will belong.
* aiAlgid [I] The new key shall use the crypto algorithm idenfied by aiAlgid. * aiAlgid [I] The new key shall use the crypto algorithm idenfied by aiAlgid.
* dwFlags [I] Upper 16 bits give the key length. * dwFlags [I] Upper 16 bits give the key length.
* Lower 16 bits: CRYPT_CREATE_SALT, CRYPT_NO_SALT * Lower 16 bits: CRYPT_EXPORTABLE, CRYPT_CREATE_SALT,
* CRYPT_NO_SALT
* ppCryptKey [O] Pointer to the created key * ppCryptKey [O] Pointer to the created key
* *
* RETURNS * RETURNS
...@@ -836,6 +837,8 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK ...@@ -836,6 +837,8 @@ static HCRYPTKEY new_key(HCRYPTPROV hProv, ALG_ID aiAlgid, DWORD dwFlags, CRYPTK
pCryptKey->dwModeBits = 0; pCryptKey->dwModeBits = 0;
pCryptKey->dwPermissions = CRYPT_ENCRYPT | CRYPT_DECRYPT | CRYPT_READ | CRYPT_WRITE | pCryptKey->dwPermissions = CRYPT_ENCRYPT | CRYPT_DECRYPT | CRYPT_READ | CRYPT_WRITE |
CRYPT_MAC; CRYPT_MAC;
if (dwFlags & CRYPT_EXPORTABLE)
pCryptKey->dwPermissions |= CRYPT_EXPORT;
pCryptKey->dwKeyLen = dwKeyLen >> 3; pCryptKey->dwKeyLen = dwKeyLen >> 3;
pCryptKey->dwEffectiveKeyLen = 0; pCryptKey->dwEffectiveKeyLen = 0;
if ((dwFlags & CRYPT_CREATE_SALT) || (dwKeyLen == 40 && !(dwFlags & CRYPT_NO_SALT))) if ((dwFlags & CRYPT_CREATE_SALT) || (dwKeyLen == 40 && !(dwFlags & CRYPT_NO_SALT)))
......
...@@ -2137,7 +2137,6 @@ static void test_key_permissions(void) ...@@ -2137,7 +2137,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,"
......
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