Add test_suite_entropy
This commit is contained in:
parent
4dd73925ab
commit
2c25eb0b0a
5 changed files with 44 additions and 1 deletions
1
tests/.gitignore
vendored
1
tests/.gitignore
vendored
|
@ -3,3 +3,4 @@
|
|||
data_files/mpi_write
|
||||
data_files/hmac_drbg_seed
|
||||
data_files/ctr_drbg_seed
|
||||
data_files/entropy_seed
|
||||
|
|
|
@ -61,6 +61,7 @@ add_test_suite(dhm)
|
|||
add_test_suite(ecp)
|
||||
add_test_suite(ecdh)
|
||||
add_test_suite(ecdsa)
|
||||
add_test_suite(entropy)
|
||||
add_test_suite(error)
|
||||
add_test_suite(gcm gcm.aes128_en)
|
||||
add_test_suite(gcm gcm.aes192_en)
|
||||
|
|
|
@ -46,7 +46,7 @@ APPS = test_suite_aes.ecb test_suite_aes.cbc \
|
|||
test_suite_des test_suite_dhm \
|
||||
test_suite_ecdh test_suite_ecdsa \
|
||||
test_suite_ecp \
|
||||
test_suite_error \
|
||||
test_suite_error test_suite_entropy \
|
||||
test_suite_gcm.aes128_de \
|
||||
test_suite_gcm.aes192_de \
|
||||
test_suite_gcm.aes256_de \
|
||||
|
@ -272,6 +272,10 @@ test_suite_ecp: test_suite_ecp.c $(DEP)
|
|||
echo " CC $@.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
|
||||
|
||||
test_suite_entropy: test_suite_entropy.c $(DEP)
|
||||
echo " CC $@.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
|
||||
|
||||
test_suite_error: test_suite_error.c $(DEP)
|
||||
echo " CC $@.c"
|
||||
$(CC) $(CFLAGS) $(OFLAGS) $@.c $(LDFLAGS) -o $@
|
||||
|
|
8
tests/suites/test_suite_entropy.data
Normal file
8
tests/suites/test_suite_entropy.data
Normal file
|
@ -0,0 +1,8 @@
|
|||
Entropy write/update seed file
|
||||
entropy_seed_file:"data_files/entropy_seed":0
|
||||
|
||||
Entropy write/update seed file
|
||||
entropy_seed_file:"no_such_dir/file":POLARSSL_ERR_ENTROPY_FILE_IO_ERROR
|
||||
|
||||
Entropy self test
|
||||
entropy_selftest:
|
29
tests/suites/test_suite_entropy.function
Normal file
29
tests/suites/test_suite_entropy.function
Normal file
|
@ -0,0 +1,29 @@
|
|||
/* BEGIN_HEADER */
|
||||
#include <polarssl/entropy.h>
|
||||
/* END_HEADER */
|
||||
|
||||
/* BEGIN_DEPENDENCIES
|
||||
* depends_on:POLARSSL_ENTROPY_C
|
||||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_FS_IO */
|
||||
void entropy_seed_file( char *path, int ret )
|
||||
{
|
||||
entropy_context ctx;
|
||||
|
||||
entropy_init( &ctx );
|
||||
|
||||
TEST_ASSERT( entropy_write_seed_file( &ctx, path ) == ret );
|
||||
TEST_ASSERT( entropy_update_seed_file( &ctx, path ) == ret );
|
||||
|
||||
entropy_free( &ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE depends_on:POLARSSL_SELF_TEST */
|
||||
void entropy_selftest( )
|
||||
{
|
||||
TEST_ASSERT( entropy_self_test( 0 ) == 0 );
|
||||
}
|
||||
/* END_CASE */
|
Loading…
Reference in a new issue