Commit 786c57d3 authored by Juan Lang's avatar Juan Lang Committed by Alexandre Julliard

rsaenh: Only set key length on successful retrieval of hash value.

parent 7f0db794
...@@ -4216,6 +4216,7 @@ BOOL WINAPI RSAENH_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa ...@@ -4216,6 +4216,7 @@ BOOL WINAPI RSAENH_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa
if (pCryptKey->aiAlgid == CALG_HMAC && !pCryptKey->dwKeyLen) { if (pCryptKey->aiAlgid == CALG_HMAC && !pCryptKey->dwKeyLen) {
HCRYPTHASH hKeyHash; HCRYPTHASH hKeyHash;
DWORD keyLen;
if (!RSAENH_CPCreateHash(hProv, ((PHMAC_INFO)pbData)->HashAlgid, 0, 0, if (!RSAENH_CPCreateHash(hProv, ((PHMAC_INFO)pbData)->HashAlgid, 0, 0,
&hKeyHash)) &hKeyHash))
...@@ -4226,13 +4227,14 @@ BOOL WINAPI RSAENH_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa ...@@ -4226,13 +4227,14 @@ BOOL WINAPI RSAENH_CPSetHashParam(HCRYPTPROV hProv, HCRYPTHASH hHash, DWORD dwPa
RSAENH_CPDestroyHash(hProv, hKeyHash); RSAENH_CPDestroyHash(hProv, hKeyHash);
return FALSE; return FALSE;
} }
pCryptKey->dwKeyLen = sizeof(pCryptKey->abKeyValue); keyLen = sizeof(pCryptKey->abKeyValue);
if (!RSAENH_CPGetHashParam(hProv, hKeyHash, HP_HASHVAL, pCryptKey->abKeyValue, if (!RSAENH_CPGetHashParam(hProv, hKeyHash, HP_HASHVAL, pCryptKey->abKeyValue,
&pCryptKey->dwKeyLen, 0)) &keyLen, 0))
{ {
RSAENH_CPDestroyHash(hProv, hKeyHash); RSAENH_CPDestroyHash(hProv, hKeyHash);
return FALSE; return FALSE;
} }
pCryptKey->dwKeyLen = keyLen;
RSAENH_CPDestroyHash(hProv, hKeyHash); RSAENH_CPDestroyHash(hProv, hKeyHash);
} }
for (i=0; i<RSAENH_MIN(pCryptKey->dwKeyLen,pCryptHash->pHMACInfo->cbInnerString); i++) { for (i=0; i<RSAENH_MIN(pCryptKey->dwKeyLen,pCryptHash->pHMACInfo->cbInnerString); i++) {
......
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