rsaenh: Fail if CRYPT_IPSEC_HMAC_KEY is passed to CryptImportKey.

This commit is contained in:
Juan Lang 2009-10-21 13:42:37 -07:00 committed by Alexandre Julliard
parent a1502846af
commit a48aae26e6
2 changed files with 10 additions and 1 deletions

View File

@ -949,7 +949,7 @@ static void test_rc2_keylen(void)
} key_blob;
HCRYPTPROV provider;
HCRYPTKEY hkey;
HCRYPTKEY hkey = 0;
BOOL ret;
SetLastError(0xdeadbeef);
@ -970,6 +970,7 @@ static void test_rc2_keylen(void)
sizeof(BLOBHEADER)+sizeof(DWORD)+key_blob.key_size,
0, CRYPT_IPSEC_HMAC_KEY, &hkey);
/* CRYPT_IPSEC_HMAC_KEY is not supported on W2K and lower */
todo_wine
ok(ret ||
broken(!ret && GetLastError() == NTE_BAD_FLAGS),
"CryptImportKey error %08x\n", GetLastError());
@ -1007,6 +1008,7 @@ static void test_rc2_keylen(void)
sizeof(BLOBHEADER)+sizeof(DWORD)+key_blob.key_size,
0, CRYPT_IPSEC_HMAC_KEY, &hkey);
/* CRYPT_IPSEC_HMAC_KEY is not supported on W2K and lower */
todo_wine
ok(ret ||
broken(!ret && GetLastError() == NTE_BAD_FLAGS),
"CryptImportKey error %08x\n", GetLastError());
@ -1027,6 +1029,7 @@ static void test_rc2_keylen(void)
ret = pCryptImportKey(provider, (BYTE*)&key_blob,
sizeof(BLOBHEADER)+sizeof(DWORD)+key_blob.key_size,
0, CRYPT_IPSEC_HMAC_KEY, &hkey);
todo_wine
ok(ret ||
broken(!ret && GetLastError() == NTE_BAD_FLAGS),
"CryptImportKey error %08x\n", GetLastError());

View File

@ -3011,6 +3011,12 @@ BOOL WINAPI RSAENH_CPImportKey(HCRYPTPROV hProv, CONST BYTE *pbData, DWORD dwDat
TRACE("(hProv=%08lx, pbData=%p, dwDataLen=%d, hPubKey=%08lx, dwFlags=%08x, phKey=%p)\n",
hProv, pbData, dwDataLen, hPubKey, dwFlags, phKey);
if (dwFlags & CRYPT_IPSEC_HMAC_KEY)
{
FIXME("unimplemented for CRYPT_IPSEC_HMAC_KEY\n");
SetLastError(NTE_BAD_FLAGS);
return FALSE;
}
return import_key(hProv, pbData, dwDataLen, hPubKey, dwFlags, TRUE, phKey);
}