Introduced entropy_free()

This commit is contained in:
Paul Bakker 2013-09-28 15:23:03 +02:00
parent c55988406f
commit 1ffefaca1e
28 changed files with 38 additions and 0 deletions

View File

@ -116,6 +116,13 @@ entropy_context;
*/ */
void entropy_init( entropy_context *ctx ); void entropy_init( entropy_context *ctx );
/**
* \brief Free the data in the context
*
* \param ctx Entropy context to free
*/
void entropy_free( entropy_context *ctx );
/** /**
* \brief Adds an entropy source to poll * \brief Adds an entropy source to poll
* *

View File

@ -64,6 +64,11 @@ void entropy_init( entropy_context *ctx )
#endif /* POLARSSL_NO_DEFAULT_ENTROPY_SOURCES */ #endif /* POLARSSL_NO_DEFAULT_ENTROPY_SOURCES */
} }
void entropy_free( entropy_context *ctx )
{
((void) ctx);
}
int entropy_add_source( entropy_context *ctx, int entropy_add_source( entropy_context *ctx,
f_source_ptr f_source, void *p_source, f_source_ptr f_source, void *p_source,
size_t threshold ) size_t threshold )

View File

@ -275,6 +275,7 @@ exit:
net_close( server_fd ); net_close( server_fd );
rsa_free( &rsa ); rsa_free( &rsa );
dhm_free( &dhm ); dhm_free( &dhm );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -143,6 +143,7 @@ int main( int argc, char *argv[] )
exit: exit:
mpi_free( &G ); mpi_free( &P ); mpi_free( &Q ); mpi_free( &G ); mpi_free( &P ); mpi_free( &Q );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );

View File

@ -276,6 +276,7 @@ exit:
net_close( client_fd ); net_close( client_fd );
rsa_free( &rsa ); rsa_free( &rsa );
dhm_free( &dhm ); dhm_free( &dhm );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -179,6 +179,7 @@ exit:
ecdsa_free( &ctx_verify ); ecdsa_free( &ctx_verify );
ecdsa_free( &ctx_sign ); ecdsa_free( &ctx_sign );
entropy_free( &entropy );
return( ret ); return( ret );
} }

View File

@ -269,6 +269,7 @@ exit:
} }
pk_free( &key ); pk_free( &key );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -136,6 +136,7 @@ int main( int argc, char *argv[] )
ret = 0; ret = 0;
exit: exit:
entropy_free( &entropy );
#if defined(POLARSSL_ERROR_C) #if defined(POLARSSL_ERROR_C)
polarssl_strerror( ret, (char *) buf, sizeof(buf) ); polarssl_strerror( ret, (char *) buf, sizeof(buf) );

View File

@ -136,6 +136,7 @@ int main( int argc, char *argv[] )
printf( "\n . Done (created \"%s\")\n\n", "result-enc.txt" ); printf( "\n . Done (created \"%s\")\n\n", "result-enc.txt" );
exit: exit:
entropy_free( &entropy );
#if defined(POLARSSL_ERROR_C) #if defined(POLARSSL_ERROR_C)
polarssl_strerror( ret, (char *) buf, sizeof(buf) ); polarssl_strerror( ret, (char *) buf, sizeof(buf) );

View File

@ -149,6 +149,7 @@ int main( int argc, char *argv[] )
exit: exit:
pk_free( &pk ); pk_free( &pk );
entropy_free( &entropy );
#if defined(POLARSSL_ERROR_C) #if defined(POLARSSL_ERROR_C)
polarssl_strerror( ret, (char *) buf, sizeof(buf) ); polarssl_strerror( ret, (char *) buf, sizeof(buf) );

View File

@ -160,6 +160,7 @@ int main( int argc, char *argv[] )
ret = 0; ret = 0;
exit: exit:
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -148,6 +148,7 @@ int main( int argc, char *argv[] )
printf( "\n . Done (created \"%s\")\n\n", "result-enc.txt" ); printf( "\n . Done (created \"%s\")\n\n", "result-enc.txt" );
exit: exit:
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -150,6 +150,7 @@ exit:
fclose( fpriv ); fclose( fpriv );
rsa_free( &rsa ); rsa_free( &rsa );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );

View File

@ -156,6 +156,7 @@ int main( int argc, char *argv[] )
exit: exit:
pk_free( &pk ); pk_free( &pk );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -81,6 +81,7 @@ int main( int argc, char *argv[] )
cleanup: cleanup:
fclose( f ); fclose( f );
entropy_free( &entropy );
return( ret ); return( ret );
} }

View File

@ -111,6 +111,7 @@ cleanup:
printf("\n"); printf("\n");
fclose( f ); fclose( f );
entropy_free( &entropy );
return( ret ); return( ret );
} }

View File

@ -277,6 +277,7 @@ exit:
x509_crt_free( &cacert ); x509_crt_free( &cacert );
net_close( server_fd ); net_close( server_fd );
ssl_free( &ssl ); ssl_free( &ssl );
entropy_free( &entropy );
memset( &ssl, 0, sizeof( ssl ) ); memset( &ssl, 0, sizeof( ssl ) );

View File

@ -913,6 +913,7 @@ exit:
#endif #endif
ssl_session_free( &saved_session ); ssl_session_free( &saved_session );
ssl_free( &ssl ); ssl_free( &ssl );
entropy_free( &entropy );
memset( &ssl, 0, sizeof( ssl ) ); memset( &ssl, 0, sizeof( ssl ) );

View File

@ -361,6 +361,7 @@ exit:
x509_crt_free( &srvcert ); x509_crt_free( &srvcert );
pk_free( &pkey ); pk_free( &pkey );
ssl_free( &ssl ); ssl_free( &ssl );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );

View File

@ -791,6 +791,7 @@ exit:
x509_crt_free( &cacert ); x509_crt_free( &cacert );
pk_free( &pkey ); pk_free( &pkey );
ssl_free( &ssl ); ssl_free( &ssl );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -367,6 +367,7 @@ exit:
#if defined(POLARSSL_SSL_CACHE_C) #if defined(POLARSSL_SSL_CACHE_C)
ssl_cache_free( &cache ); ssl_cache_free( &cache );
#endif #endif
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " Press Enter to exit this program.\n" ); printf( " Press Enter to exit this program.\n" );

View File

@ -963,6 +963,7 @@ exit:
#endif #endif
ssl_free( &ssl ); ssl_free( &ssl );
entropy_free( &entropy );
#if defined(POLARSSL_SSL_CACHE_C) #if defined(POLARSSL_SSL_CACHE_C)
ssl_cache_free( &cache ); ssl_cache_free( &cache );

View File

@ -252,6 +252,7 @@ int main( int argc, char *argv[] )
printf( "String value (PolarSSL Private Encrypt, OpenSSL Public Decrypt): '%s'\n", o_priv_decrypted ); printf( "String value (PolarSSL Private Encrypt, OpenSSL Public Decrypt): '%s'\n", o_priv_decrypted );
exit: exit:
entropy_free( &entropy );
#ifdef WIN32 #ifdef WIN32
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -401,6 +401,7 @@ exit:
x509_crt_free( &srvcert ); x509_crt_free( &srvcert );
pk_free( &pkey ); pk_free( &pkey );
ssl_free( &ssl ); ssl_free( &ssl );
entropy_free( &entropy );
net_close( client_fd ); net_close( client_fd );
return( ret ); return( ret );

View File

@ -449,6 +449,7 @@ exit:
x509_crt_free( &cacert ); x509_crt_free( &cacert );
x509_crt_free( &clicert ); x509_crt_free( &clicert );
pk_free( &pkey ); pk_free( &pkey );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -329,6 +329,7 @@ exit:
x509write_csr_free( &req ); x509write_csr_free( &req );
pk_free( &key ); pk_free( &key );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -650,6 +650,7 @@ exit:
pk_free( &loaded_subject_key ); pk_free( &loaded_subject_key );
pk_free( &loaded_issuer_key ); pk_free( &loaded_issuer_key );
mpi_free( &serial ); mpi_free( &serial );
entropy_free( &entropy );
#if defined(_WIN32) #if defined(_WIN32)
printf( " + Press Enter to exit this program.\n" ); printf( " + Press Enter to exit this program.\n" );

View File

@ -528,6 +528,7 @@ void rsa_gen_key( int nrbits, int exponent, int result)
} }
rsa_free( &ctx ); rsa_free( &ctx );
entropy_free( &entropy );
} }
/* END_CASE */ /* END_CASE */