dssenh: Use SecureZeroMemory to clear magic fields.

Signed-off-by: Eric Pouech <epouech@codeweavers.com>
This commit is contained in:
Eric Pouech 2023-11-07 19:10:13 +01:00 committed by Alexandre Julliard
parent 68edddc98b
commit 2367415d32

View file

@ -162,7 +162,8 @@ static void destroy_key( struct key *key )
{
if (!key) return;
BCryptDestroyKey( key->handle );
key->magic = 0;
/* Ensure compiler doesn't optimize out the assignment with 0. */
SecureZeroMemory( &key->magic, sizeof(key->magic) );
free( key );
}
@ -213,7 +214,8 @@ static void destroy_container( struct container *container )
if (!container) return;
destroy_key( container->exch_key );
destroy_key( container->sign_key );
container->magic = 0;
/* Ensure compiler doesn't optimize out the assignment with 0. */
SecureZeroMemory( &container->magic, sizeof(container->magic) );
free( container );
}
@ -821,7 +823,8 @@ static void destroy_hash( struct hash *hash )
{
if (!hash) return;
BCryptDestroyHash( hash->handle );
hash->magic = 0;
/* Ensure compiler doesn't optimize out the assignment with 0. */
SecureZeroMemory( &hash->magic, sizeof(hash->magic) );
free( hash );
}