1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-08-07 06:42:56 +03:00

Adapt programs / test suites

This commit is contained in:
Paul Bakker
2014-06-18 16:44:11 +02:00
parent 8f870b047c
commit a317a98221
33 changed files with 76 additions and 12 deletions

View File

@@ -83,6 +83,9 @@ void entropy_init( entropy_context *ctx )
void entropy_free( entropy_context *ctx )
{
#if defined(POLARSSL_HAVEGE_C)
havege_free( &ctx->havege_data );
#endif
polarssl_zeroize( ctx, sizeof( entropy_context ) );
#if defined(POLARSSL_THREADING_C)
polarssl_mutex_free( &ctx->mutex );

View File

@@ -43,6 +43,11 @@
#include <string.h>
/* Implementation that should never be optimized out by the compiler */
static void polarssl_zeroize( void *v, size_t n ) {
volatile unsigned char *p = v; while( n-- ) *p++ = 0;
}
/* ------------------------------------------------------------------------
* On average, one iteration accesses two 8-word blocks in the havege WALK
* table, and generates 16 words in the RES array.
@@ -200,6 +205,14 @@ void havege_init( havege_state *hs )
havege_fill( hs );
}
void havege_free( havege_state *hs )
{
if( hs == NULL )
return;
polarssl_zeroize( hs, sizeof( havege_state ) );
}
/*
* HAVEGE rand function
*/