bcrypt: Support BCRYPT_HASH_REUSABLE_FLAG in BCryptOpenAlgorithmProvider.

Signed-off-by: Hans Leidekker <hans@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Hans Leidekker 2020-02-11 10:47:34 +01:00 committed by Alexandre Julliard
parent 3d69d71e9e
commit 215c171891
2 changed files with 6 additions and 5 deletions

View File

@ -154,7 +154,7 @@ struct algorithm
struct object hdr;
enum alg_id id;
enum mode_id mode;
BOOL hmac;
ULONG flags;
};
#if defined(HAVE_GNUTLS_CIPHER_INIT)

View File

@ -216,7 +216,7 @@ NTSTATUS WINAPI BCryptGenRandom(BCRYPT_ALG_HANDLE handle, UCHAR *buffer, ULONG c
NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR id, LPCWSTR implementation, DWORD flags )
{
const DWORD supported_flags = BCRYPT_ALG_HANDLE_HMAC_FLAG;
const DWORD supported_flags = BCRYPT_ALG_HANDLE_HMAC_FLAG | BCRYPT_HASH_REUSABLE_FLAG;
struct algorithm *alg;
enum alg_id alg_id;
ULONG i;
@ -254,7 +254,7 @@ NTSTATUS WINAPI BCryptOpenAlgorithmProvider( BCRYPT_ALG_HANDLE *handle, LPCWSTR
alg->hdr.magic = MAGIC_ALG;
alg->id = alg_id;
alg->mode = MODE_ID_CBC;
alg->hmac = flags & BCRYPT_ALG_HANDLE_HMAC_FLAG;
alg->flags = flags;
*handle = alg;
return STATUS_SUCCESS;
@ -692,8 +692,9 @@ NTSTATUS WINAPI BCryptCreateHash( BCRYPT_ALG_HANDLE algorithm, BCRYPT_HASH_HANDL
if (!(hash = heap_alloc_zero( sizeof(*hash) ))) return STATUS_NO_MEMORY;
hash->hdr.magic = MAGIC_HASH;
hash->alg_id = alg->id;
if (alg->hmac) hash->flags = HASH_FLAG_HMAC;
if (flags & BCRYPT_HASH_REUSABLE_FLAG) hash->flags |= HASH_FLAG_REUSABLE;
if (alg->flags & BCRYPT_ALG_HANDLE_HMAC_FLAG) hash->flags = HASH_FLAG_HMAC;
if ((alg->flags & BCRYPT_HASH_REUSABLE_FLAG) || (flags & BCRYPT_HASH_REUSABLE_FLAG))
hash->flags |= HASH_FLAG_REUSABLE;
if (secretlen && !(hash->secret = heap_alloc( secretlen )))
{