Resolve PR review comments

Address review comments:
1. add `mbedtls_cipher_init()` after freeing context, in test code
2. style comments
3. set `ctx->iv_size = 0` in case `IV == NULL && iv_len == 0`
This commit is contained in:
Ron Eldor 2017-10-01 17:04:54 +03:00 committed by Simon Butcher
parent 6f90ed82b9
commit bb4bbbbbb4
2 changed files with 6 additions and 2 deletions

View file

@ -106,7 +106,7 @@ void cipher_special_behaviours( )
mbedtls_cipher_init( &ctx );
memset( input, 0, sizeof( input ) );
memset( output, 0, sizeof( output ) );
#if defined (MBEDTLS_CIPHER_MODE_CBC)
#if defined(MBEDTLS_CIPHER_MODE_CBC)
memset( iv, 0, sizeof( iv ) );
/* Check and get info structures */
@ -124,6 +124,7 @@ void cipher_special_behaviours( )
== MBEDTLS_ERR_CIPHER_BAD_INPUT_DATA );
mbedtls_cipher_free( &ctx );
mbedtls_cipher_init( &ctx );
#endif /* MBEDTLS_CIPHER_MODE_CBC */
cipher_info = mbedtls_cipher_info_from_type( MBEDTLS_CIPHER_AES_128_ECB );
TEST_ASSERT( NULL != cipher_info );