Renamed test_offset to prevent clash with one in ctr_drbg.c

This commit is contained in:
Paul Bakker 2013-11-26 17:45:20 +01:00
parent 7aa0375b78
commit 3ddfa663a5

View file

@ -1,12 +1,12 @@
/* BEGIN_HEADER */ /* BEGIN_HEADER */
#include <polarssl/ctr_drbg.h> #include <polarssl/ctr_drbg.h>
int test_offset; int test_offset_idx;
int entropy_func( void *data, unsigned char *buf, size_t len ) int entropy_func( void *data, unsigned char *buf, size_t len )
{ {
unsigned char *p = (unsigned char *) data; unsigned char *p = (unsigned char *) data;
memcpy( buf, p + test_offset, len ); memcpy( buf, p + test_offset_idx, len );
test_offset += 32; test_offset_idx += 32;
return( 0 ); return( 0 );
} }
/* END_HEADER */ /* END_HEADER */
@ -37,7 +37,7 @@ void ctr_drbg_validate_pr( char *add_init_string, char *entropy_string,
add1_len = unhexify( add1, add1_string ); add1_len = unhexify( add1, add1_string );
add2_len = unhexify( add2, add2_string ); add2_len = unhexify( add2, add2_string );
test_offset = 0; test_offset_idx = 0;
TEST_ASSERT( ctr_drbg_init_entropy_len( &ctx, entropy_func, entropy, add_init, add_init_len, 32 ) == 0 ); TEST_ASSERT( ctr_drbg_init_entropy_len( &ctx, entropy_func, entropy, add_init, add_init_len, 32 ) == 0 );
ctr_drbg_set_prediction_resistance( &ctx, CTR_DRBG_PR_ON ); ctr_drbg_set_prediction_resistance( &ctx, CTR_DRBG_PR_ON );
@ -71,7 +71,7 @@ void ctr_drbg_validate_nopr( char *add_init_string, char *entropy_string,
add_reseed_len = unhexify( add_reseed, add_reseed_string ); add_reseed_len = unhexify( add_reseed, add_reseed_string );
add2_len = unhexify( add2, add2_string ); add2_len = unhexify( add2, add2_string );
test_offset = 0; test_offset_idx = 0;
TEST_ASSERT( ctr_drbg_init_entropy_len( &ctx, entropy_func, entropy, add_init, add_init_len, 32 ) == 0 ); TEST_ASSERT( ctr_drbg_init_entropy_len( &ctx, entropy_func, entropy, add_init, add_init_len, 32 ) == 0 );
TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add1, add1_len ) == 0 ); TEST_ASSERT( ctr_drbg_random_with_add( &ctx, buf, 16, add1, add1_len ) == 0 );