mirror of
git://source.winehq.org/git/wine.git
synced 2024-09-01 11:33:38 +00:00
rsaenh: Use BCrypt algorithm pseudo-handles.
This commit is contained in:
parent
4918be2c59
commit
6db0fc5ce8
|
@ -36,48 +36,32 @@ BOOL WINAPI SystemFunction036(PVOID pbBuffer, ULONG dwLen);
|
|||
|
||||
BOOL init_hash_impl(ALG_ID aiAlgid, BCRYPT_HASH_HANDLE *hash_handle)
|
||||
{
|
||||
BCRYPT_ALG_HANDLE provider;
|
||||
NTSTATUS status;
|
||||
|
||||
switch (aiAlgid)
|
||||
{
|
||||
case CALG_MD2:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_MD2_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_MD2_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
case CALG_MD4:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_MD4_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_MD4_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
case CALG_MD5:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_MD5_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_MD5_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
case CALG_SHA:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA1_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_SHA1_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
case CALG_SHA_256:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA256_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_SHA256_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
case CALG_SHA_384:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA384_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_SHA384_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
case CALG_SHA_512:
|
||||
status = BCryptOpenAlgorithmProvider(&provider, BCRYPT_SHA512_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0);
|
||||
break;
|
||||
return !BCryptCreateHash(BCRYPT_SHA512_ALG_HANDLE, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
|
||||
default:
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
if (status) return FALSE;
|
||||
|
||||
status = BCryptCreateHash(provider, hash_handle, NULL, 0, NULL, 0, 0);
|
||||
BCryptCloseAlgorithmProvider(provider, 0);
|
||||
return !status;
|
||||
}
|
||||
|
||||
BOOL update_hash_impl(BCRYPT_HASH_HANDLE hash_handle, const BYTE *pbData, DWORD dwDataLen)
|
||||
|
|
Loading…
Reference in a new issue