Commit 2367415d authored by Eric Pouech's avatar Eric Pouech Committed by Alexandre Julliard

dssenh: Use SecureZeroMemory to clear magic fields.

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