1
0
mirror of https://github.com/wine-mirror/wine synced 2024-07-08 03:45:57 +00:00

rsaenh: Pass exact size to BCryptFinishHash().

This commit is contained in:
Hans Leidekker 2022-11-01 15:08:30 +01:00 committed by Alexandre Julliard
parent 6705a71045
commit 4e3b287093
3 changed files with 6 additions and 6 deletions

View File

@ -70,9 +70,9 @@ BOOL update_hash_impl(BCRYPT_HASH_HANDLE hash_handle, const BYTE *pbData, DWORD
return TRUE;
}
BOOL finalize_hash_impl(BCRYPT_HASH_HANDLE hash_handle, BYTE *pbHashValue)
BOOL finalize_hash_impl(BCRYPT_HASH_HANDLE hash_handle, BYTE *hash_value, DWORD hash_size)
{
BCryptFinishHash(hash_handle, pbHashValue, RSAENH_MAX_HASH_SIZE, 0);
BCryptFinishHash(hash_handle, hash_value, hash_size, 0);
BCryptDestroyHash(hash_handle);
return TRUE;
}

View File

@ -41,7 +41,7 @@ typedef union tagKEY_CONTEXT {
BOOL init_hash_impl(ALG_ID aiAlgid, BCRYPT_HASH_HANDLE *hash_handle) DECLSPEC_HIDDEN;
BOOL update_hash_impl(BCRYPT_HASH_HANDLE hash_handle, const BYTE *pbData,
DWORD dwDataLen) DECLSPEC_HIDDEN;
BOOL finalize_hash_impl(BCRYPT_HASH_HANDLE hash_handle, BYTE *pbHashValue) DECLSPEC_HIDDEN;
BOOL finalize_hash_impl(BCRYPT_HASH_HANDLE hash_handle, BYTE *hash_value, DWORD hash_size) DECLSPEC_HIDDEN;
BOOL duplicate_hash_impl(BCRYPT_HASH_HANDLE src_hash_handle,
BCRYPT_HASH_HANDLE *dest_hash_handle) DECLSPEC_HIDDEN;

View File

@ -816,7 +816,7 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash)
if (pCryptHash->pHMACInfo) {
BYTE abHashValue[RSAENH_MAX_HASH_SIZE];
finalize_hash_impl(pCryptHash->hash_handle, pCryptHash->abHashValue);
finalize_hash_impl(pCryptHash->hash_handle, pCryptHash->abHashValue, pCryptHash->dwHashSize);
memcpy(abHashValue, pCryptHash->abHashValue, pCryptHash->dwHashSize);
init_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->hash_handle);
update_hash_impl(pCryptHash->hash_handle,
@ -824,7 +824,7 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash)
pCryptHash->pHMACInfo->cbOuterString);
update_hash_impl(pCryptHash->hash_handle,
abHashValue, pCryptHash->dwHashSize);
finalize_hash_impl(pCryptHash->hash_handle, pCryptHash->abHashValue);
finalize_hash_impl(pCryptHash->hash_handle, pCryptHash->abHashValue, pCryptHash->dwHashSize);
pCryptHash->hash_handle = NULL;
}
break;
@ -842,7 +842,7 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash)
break;
default:
finalize_hash_impl(pCryptHash->hash_handle, pCryptHash->abHashValue);
finalize_hash_impl(pCryptHash->hash_handle, pCryptHash->abHashValue, pCryptHash->dwHashSize);
pCryptHash->hash_handle = NULL;
}
}