mirror of
https://github.com/yuzu-emu/mbedtls
synced 2024-11-24 13:28:16 +00:00
Add coverage for CTR-DRBG corner case function behaviours
This commit is contained in:
parent
ec5ceb65d6
commit
185ccf7070
2 changed files with 31 additions and 0 deletions
|
@ -727,6 +727,9 @@ ctr_drbg_seed_file:"data_files/ctr_drbg_seed":0
|
|||
CTR_DRBG write/update seed file
|
||||
ctr_drbg_seed_file:"no_such_dir/file":MBEDTLS_ERR_CTR_DRBG_FILE_IO_ERROR
|
||||
|
||||
CTR_DRBG Special Behaviours
|
||||
ctr_drbg_special_behaviours:
|
||||
|
||||
CTR_DRBG self test
|
||||
ctr_drbg_selftest:
|
||||
|
||||
|
|
|
@ -16,6 +16,34 @@ int mbedtls_entropy_func( void *data, unsigned char *buf, size_t len )
|
|||
* END_DEPENDENCIES
|
||||
*/
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ctr_drbg_special_behaviours( )
|
||||
{
|
||||
mbedtls_ctr_drbg_context ctx;
|
||||
unsigned char output[512];
|
||||
unsigned char additional[512];
|
||||
|
||||
mbedtls_ctr_drbg_init( &ctx );
|
||||
memset( output, 0, sizeof( output ) );
|
||||
memset( additional, 0, sizeof( additional ) );
|
||||
|
||||
TEST_ASSERT( mbedtls_ctr_drbg_random_with_add( &ctx,
|
||||
output, MBEDTLS_CTR_DRBG_MAX_REQUEST + 1,
|
||||
additional, 16 ) ==
|
||||
MBEDTLS_ERR_CTR_DRBG_REQUEST_TOO_BIG );
|
||||
TEST_ASSERT( mbedtls_ctr_drbg_random_with_add( &ctx,
|
||||
output, 16,
|
||||
additional, MBEDTLS_CTR_DRBG_MAX_INPUT + 1 ) ==
|
||||
MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
||||
|
||||
TEST_ASSERT( mbedtls_ctr_drbg_reseed( &ctx, additional,
|
||||
MBEDTLS_CTR_DRBG_MAX_SEED_INPUT + 1 ) ==
|
||||
MBEDTLS_ERR_CTR_DRBG_INPUT_TOO_BIG );
|
||||
exit:
|
||||
mbedtls_ctr_drbg_free( &ctx );
|
||||
}
|
||||
/* END_CASE */
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ctr_drbg_validate_pr( char *add_init_string, char *entropy_string,
|
||||
char *add1_string, char *add2_string,
|
||||
|
|
Loading…
Reference in a new issue