mirror of
https://github.com/yuzu-emu/mbedtls.git
synced 2024-12-23 12:35:37 +00:00
Test mbedtls_ctr_drbg_set_nonce_len
Test mbedtls_ctr_drbg_set_nonce_len (good cases only, which is in keeping with the coverage of other functions).
This commit is contained in:
parent
4d2d4ff9b0
commit
c949de06ec
|
@ -1070,8 +1070,14 @@ CTR_DRBG CAVS 14.3 (AES-128 use df,True,128,64,0,0) #0
|
|||
depends_on:MBEDTLS_CTR_DRBG_USE_128_BIT_KEY
|
||||
ctr_drbg_validate_pr:"d4f1f4ae08bcb3e1":"5d4041942bcf68864a4997d8171f1f9fef55a769b7eaf03fe082029bb32a2b9d8239e865c0a42e14b964b9c09de85a20":"":"":"4155320287eedcf7d484c2c2a1e2eb64b9c9ce77c87202a1ae1616c7a5cfd1c687c7a0bfcc85bda48fdd4629fd330c22d0a76076f88fc7cd04037ee06b7af602"
|
||||
|
||||
CTR_DRBG entropy usage
|
||||
ctr_drbg_entropy_usage:
|
||||
CTR_DRBG entropy usage (entropy_nonce_len=0 by default)
|
||||
ctr_drbg_entropy_usage:-1
|
||||
|
||||
CTR_DRBG entropy usage (entropy_nonce_len=0)
|
||||
ctr_drbg_entropy_usage:0
|
||||
|
||||
CTR_DRBG entropy usage (entropy_nonce_len=7)
|
||||
ctr_drbg_entropy_usage:7
|
||||
|
||||
CTR_DRBG write/update seed file [#1]
|
||||
ctr_drbg_seed_file:"data_files/ctr_drbg_seed":0
|
||||
|
|
|
@ -190,7 +190,7 @@ void ctr_drbg_validate_reseed_first( data_t * add_init, data_t * entropy,
|
|||
|
||||
|
||||
/* BEGIN_CASE */
|
||||
void ctr_drbg_entropy_usage( )
|
||||
void ctr_drbg_entropy_usage( int entropy_nonce_len )
|
||||
{
|
||||
unsigned char out[16];
|
||||
unsigned char add[16];
|
||||
|
@ -206,9 +206,14 @@ void ctr_drbg_entropy_usage( )
|
|||
memset( out, 0, sizeof( out ) );
|
||||
memset( add, 0, sizeof( add ) );
|
||||
|
||||
if( entropy_nonce_len >= 0 )
|
||||
TEST_ASSERT( mbedtls_ctr_drbg_set_nonce_len( &ctx, entropy_nonce_len ) == 0 );
|
||||
|
||||
/* Init must use entropy */
|
||||
TEST_ASSERT( mbedtls_ctr_drbg_seed( &ctx, mbedtls_test_entropy_func, entropy, NULL, 0 ) == 0 );
|
||||
expected_idx += MBEDTLS_CTR_DRBG_ENTROPY_LEN;
|
||||
if( entropy_nonce_len >= 0 )
|
||||
expected_idx += entropy_nonce_len;
|
||||
TEST_EQUAL( test_offset_idx, expected_idx );
|
||||
|
||||
/* By default, PR is off and reseed_interval is large,
|
||||
|
|
Loading…
Reference in a new issue