Commit 14ac2f60 authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

rsaenh: Do not use stack variables out of frame (Coverity).

Based on patch by Marcus Meissner. Signed-off-by: 's avatarJacek Caban <jacek@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org>
parent f706d9f0
...@@ -50,52 +50,48 @@ BOOL WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen); ...@@ -50,52 +50,48 @@ BOOL WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen);
BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext) BOOL init_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext)
{ {
const WCHAR *algid = NULL; BCRYPT_ALG_HANDLE provider;
NTSTATUS status;
switch (aiAlgid) switch (aiAlgid)
{ {
case CALG_MD2: case CALG_MD2:
md2_init(&pHashContext->md2); md2_init(&pHashContext->md2);
break; return TRUE;
case CALG_MD4: case CALG_MD4:
MD4Init(&pHashContext->md4); MD4Init(&pHashContext->md4);
break; return TRUE;
case CALG_MD5: case CALG_MD5:
MD5Init(&pHashContext->md5); MD5Init(&pHashContext->md5);
break; return TRUE;
case CALG_SHA: case CALG_SHA:
A_SHAInit(&pHashContext->sha); A_SHAInit(&pHashContext->sha);
break; return TRUE;
case CALG_SHA_256: case CALG_SHA_256:
algid = BCRYPT_SHA256_ALGORITHM; status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA256_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
break; break;
case CALG_SHA_384: case CALG_SHA_384:
algid = BCRYPT_SHA384_ALGORITHM; status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA384_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
break; break;
case CALG_SHA_512: case CALG_SHA_512:
algid = BCRYPT_SHA512_ALGORITHM; status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA512_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
break; break;
}
if (algid) default:
{ return TRUE;
BCRYPT_ALG_HANDLE provider; }
NTSTATUS status;
status = BCryptOpenAlgorithmProvider(&provider, algid, MS_PRIMITIVE_PROVIDER, 0);
if (status) return FALSE; if (status) return FALSE;
status = BCryptCreateHash(provider, &pHashContext->bcrypt_hash, NULL, 0, NULL, 0, 0); status = BCryptCreateHash(provider, &pHashContext->bcrypt_hash, NULL, 0, NULL, 0, 0);
BCryptCloseAlgorithmProvider(provider, 0); BCryptCloseAlgorithmProvider(provider, 0);
if (status) return FALSE; return !status;
}
return TRUE;
} }
BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pbData, BOOL update_hash_impl(ALG_ID aiAlgid, HASH_CONTEXT *pHashContext, const BYTE *pbData,
......
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