Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

advapi32: CryptCreateHash actually sets ERROR_INVALID_PARAMETER if th…

…e CSP handle is 0.
  • Loading branch information...
commit 16dc83578a97eb68c739d8ee8fb7611b3b4fe3b4 1 parent 454467d
Johan Gill authored julliard committed
Showing with 4 additions and 6 deletions.
  1. +1 −6 dlls/advapi32/crypt.c
  2. +3 −0  dlls/advapi32/tests/crypt.c
View
7 dlls/advapi32/crypt.c
@@ -720,12 +720,7 @@ BOOL WINAPI CryptCreateHash (HCRYPTPROV hProv, ALG_ID Algid, HCRYPTKEY hKey,
TRACE("(0x%lx, 0x%x, 0x%lx, %08x, %p)\n", hProv, Algid, hKey, dwFlags, phHash);
- if (!prov)
- {
- SetLastError(ERROR_INVALID_HANDLE);
- return FALSE;
- }
- if (!phHash || prov->dwMagic != MAGIC_CRYPTPROV ||
+ if (!prov || !phHash || prov->dwMagic != MAGIC_CRYPTPROV ||
(key && key->dwMagic != MAGIC_CRYPTKEY))
{
SetLastError(ERROR_INVALID_PARAMETER);
View
3  dlls/advapi32/tests/crypt.c
@@ -238,6 +238,9 @@ static void test_incorrect_api_usage(void)
if (!result) return;
pCryptDestroyHash(hHash);
+ result = pCryptCreateHash(0, CALG_SHA, 0, 0, &hHash);
+ ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
+
result = pCryptGenKey(0, CALG_RC4, 0, &hKey);
ok (!result && GetLastError() == ERROR_INVALID_PARAMETER, "%d\n", GetLastError());
Please sign in to comment.
Something went wrong with that request. Please try again.