Commit d4c511b9 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rsaenh: Removed no longer needed ALG_ID argument from helper functions.

parent 3e855644
......@@ -82,22 +82,20 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
return !status;
}
BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pbData,
DWORD dwDataLen)
BOOL update_hash_impl(HASH_CONTEXT *pHashContext, const BYTE *pbData, DWORD dwDataLen)
{
BCryptHashData(pHashContext->bcrypt_hash, (UCHAR*)pbData, dwDataLen, 0);
return TRUE;
}
BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHashValue)
BOOL finalize_hash_impl(HASH_CONTEXT *pHashContext, BYTE *pbHashValue)
{
BCryptFinishHash(pHashContext->bcrypt_hash, pbHashValue, RSAENH_MAX_HASH_SIZE, 0);
BCryptDestroyHash(pHashContext->bcrypt_hash);
return TRUE;
}
BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext,
HASH_CONTEXT *pDestHashContext)
BOOL duplicate_hash_impl(const HASH_CONTEXT *pSrcHashContext, HASH_CONTEXT *pDestHashContext)
{
return !BCryptDuplicateHash(pSrcHashContext->bcrypt_hash, &pDestHashContext->bcrypt_hash, NULL, 0, 0);
}
......
......@@ -43,10 +43,10 @@ typedef union tagKEY_CONTEXT {
} KEY_CONTEXT;
BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext) DECLSPEC_HIDDEN;
BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pbData,
BOOL update_hash_impl(HASH_CONTEXT *pHashContext, const BYTE *pbData,
DWORD dwDataLen) DECLSPEC_HIDDEN;
BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHashValue) DECLSPEC_HIDDEN;
BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext,
BOOL finalize_hash_impl(HASH_CONTEXT *pHashContext, BYTE *pbHashValue) DECLSPEC_HIDDEN;
BOOL duplicate_hash_impl(const HASH_CONTEXT *pSrcHashContext,
HASH_CONTEXT *pDestHashContext) DECLSPEC_HIDDEN;
BOOL new_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen) DECLSPEC_HIDDEN;
......
......@@ -635,7 +635,7 @@ static inline BOOL init_hash(CRYPTHASH *pCryptHash) {
if (!pAlgInfo) return FALSE;
pCryptHash->dwHashSize = pAlgInfo->dwDefaultLen >> 3;
init_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context);
update_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context,
update_hash_impl(&pCryptHash->context,
pCryptHash->pHMACInfo->pbInnerString,
pCryptHash->pHMACInfo->cbInnerString);
}
......@@ -671,8 +671,7 @@ static inline void update_hash(CRYPTHASH *pCryptHash, const BYTE *pbData, DWORD
{
case CALG_HMAC:
if (pCryptHash->pHMACInfo)
update_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context,
pbData, dwDataLen);
update_hash_impl(&pCryptHash->context, pbData, dwDataLen);
break;
case CALG_MAC:
......@@ -685,7 +684,7 @@ static inline void update_hash(CRYPTHASH *pCryptHash, const BYTE *pbData, DWORD
break;
default:
update_hash_impl(pCryptHash->aiAlgid, &pCryptHash->context, pbData, dwDataLen);
update_hash_impl(&pCryptHash->context, pbData, dwDataLen);
}
}
......@@ -707,17 +706,15 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash) {
if (pCryptHash->pHMACInfo) {
BYTE abHashValue[RSAENH_MAX_HASH_SIZE];
finalize_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context,
pCryptHash->abHashValue);
finalize_hash_impl(&pCryptHash->context, pCryptHash->abHashValue);
memcpy(abHashValue, pCryptHash->abHashValue, pCryptHash->dwHashSize);
init_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context);
update_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context,
update_hash_impl(&pCryptHash->context,
pCryptHash->pHMACInfo->pbOuterString,
pCryptHash->pHMACInfo->cbOuterString);
update_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context,
update_hash_impl(&pCryptHash->context,
abHashValue, pCryptHash->dwHashSize);
finalize_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context,
pCryptHash->abHashValue);
finalize_hash_impl(&pCryptHash->context, pCryptHash->abHashValue);
}
break;
......@@ -728,7 +725,7 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash) {
break;
default:
finalize_hash_impl(pCryptHash->aiAlgid, &pCryptHash->context, pCryptHash->abHashValue);
finalize_hash_impl(&pCryptHash->context, pCryptHash->abHashValue);
}
}
......@@ -2069,7 +2066,7 @@ BOOL WINAPI RSAENH_CPDuplicateHash(HCRYPTPROV hUID, HCRYPTHASH hHash, DWORD *pdw
if (*phHash != (HCRYPTHASH)INVALID_HANDLE_VALUE)
{
*pDestHash = *pSrcHash;
duplicate_hash_impl(pSrcHash->aiAlgid, &pSrcHash->context, &pDestHash->context);
duplicate_hash_impl(&pSrcHash->context, &pDestHash->context);
copy_hmac_info(&pDestHash->pHMACInfo, pSrcHash->pHMACInfo);
copy_data_blob(&pDestHash->tpPRFParams.blobLabel, &pSrcHash->tpPRFParams.blobLabel);
copy_data_blob(&pDestHash->tpPRFParams.blobSeed, &pSrcHash->tpPRFParams.blobSeed);
......
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