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

Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Jacek Caban 2017-12-07 19:47:21 +01:00 committed by Alexandre Julliard
parent 3e8556447c
commit d4c511b9f2
3 changed files with 15 additions and 20 deletions

View File

@ -82,22 +82,20 @@ BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
return !status; return !status;
} }
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)
DWORD dwDataLen)
{ {
BCryptHashData(pHashContext->bcrypt_hash, (UCHAR*)pbData, dwDataLen, 0); BCryptHashData(pHashContext->bcrypt_hash, (UCHAR*)pbData, dwDataLen, 0);
return TRUE; 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); BCryptFinishHash(pHashContext->bcrypt_hash, pbHashValue, RSAENH_MAX_HASH_SIZE, 0);
BCryptDestroyHash(pHashContext->bcrypt_hash); BCryptDestroyHash(pHashContext->bcrypt_hash);
return TRUE; return TRUE;
} }
BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext, BOOL duplicate_hash_impl(const HASH_CONTEXT *pSrcHashContext, HASH_CONTEXT *pDestHashContext)
HASH_CONTEXT *pDestHashContext)
{ {
return !BCryptDuplicateHash(pSrcHashContext->bcrypt_hash, &pDestHashContext->bcrypt_hash, NULL, 0, 0); return !BCryptDuplicateHash(pSrcHashContext->bcrypt_hash, &pDestHashContext->bcrypt_hash, NULL, 0, 0);
} }

View File

@ -43,10 +43,10 @@ typedef union tagKEY_CONTEXT {
} KEY_CONTEXT; } KEY_CONTEXT;
BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext) DECLSPEC_HIDDEN; 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; DWORD dwDataLen) DECLSPEC_HIDDEN;
BOOL finalize_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, BYTE *pbHashValue) DECLSPEC_HIDDEN; BOOL finalize_hash_impl(HASH_CONTEXT *pHashContext, BYTE *pbHashValue) DECLSPEC_HIDDEN;
BOOL duplicate_hash_impl(ALG_ID aiAlgid, const HASH_CONTEXT *pSrcHashContext, BOOL duplicate_hash_impl(const HASH_CONTEXT *pSrcHashContext,
HASH_CONTEXT *pDestHashContext) DECLSPEC_HIDDEN; HASH_CONTEXT *pDestHashContext) DECLSPEC_HIDDEN;
BOOL new_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen) DECLSPEC_HIDDEN; BOOL new_key_impl(ALG_ID aiAlgid, KEY_CONTEXT *pKeyContext, DWORD dwKeyLen) DECLSPEC_HIDDEN;

View File

@ -635,7 +635,7 @@ static inline BOOL init_hash(CRYPTHASH *pCryptHash) {
if (!pAlgInfo) return FALSE; if (!pAlgInfo) return FALSE;
pCryptHash->dwHashSize = pAlgInfo->dwDefaultLen >> 3; pCryptHash->dwHashSize = pAlgInfo->dwDefaultLen >> 3;
init_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context); 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->pbInnerString,
pCryptHash->pHMACInfo->cbInnerString); pCryptHash->pHMACInfo->cbInnerString);
} }
@ -671,8 +671,7 @@ static inline void update_hash(CRYPTHASH *pCryptHash, const BYTE *pbData, DWORD
{ {
case CALG_HMAC: case CALG_HMAC:
if (pCryptHash->pHMACInfo) if (pCryptHash->pHMACInfo)
update_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context, update_hash_impl(&pCryptHash->context, pbData, dwDataLen);
pbData, dwDataLen);
break; break;
case CALG_MAC: case CALG_MAC:
@ -685,7 +684,7 @@ static inline void update_hash(CRYPTHASH *pCryptHash, const BYTE *pbData, DWORD
break; break;
default: 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) { if (pCryptHash->pHMACInfo) {
BYTE abHashValue[RSAENH_MAX_HASH_SIZE]; BYTE abHashValue[RSAENH_MAX_HASH_SIZE];
finalize_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context, finalize_hash_impl(&pCryptHash->context, pCryptHash->abHashValue);
pCryptHash->abHashValue);
memcpy(abHashValue, pCryptHash->abHashValue, pCryptHash->dwHashSize); memcpy(abHashValue, pCryptHash->abHashValue, pCryptHash->dwHashSize);
init_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context); 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->pbOuterString,
pCryptHash->pHMACInfo->cbOuterString); pCryptHash->pHMACInfo->cbOuterString);
update_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context, update_hash_impl(&pCryptHash->context,
abHashValue, pCryptHash->dwHashSize); abHashValue, pCryptHash->dwHashSize);
finalize_hash_impl(pCryptHash->pHMACInfo->HashAlgid, &pCryptHash->context, finalize_hash_impl(&pCryptHash->context, pCryptHash->abHashValue);
pCryptHash->abHashValue);
} }
break; break;
@ -728,7 +725,7 @@ static inline void finalize_hash(CRYPTHASH *pCryptHash) {
break; break;
default: 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) if (*phHash != (HCRYPTHASH)INVALID_HANDLE_VALUE)
{ {
*pDestHash = *pSrcHash; *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_hmac_info(&pDestHash->pHMACInfo, pSrcHash->pHMACInfo);
copy_data_blob(&pDestHash->tpPRFParams.blobLabel, &pSrcHash->tpPRFParams.blobLabel); copy_data_blob(&pDestHash->tpPRFParams.blobLabel, &pSrcHash->tpPRFParams.blobLabel);
copy_data_blob(&pDestHash->tpPRFParams.blobSeed, &pSrcHash->tpPRFParams.blobSeed); copy_data_blob(&pDestHash->tpPRFParams.blobSeed, &pSrcHash->tpPRFParams.blobSeed);