Improve info() function in cipher_aead_demo

Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
This commit is contained in:
Manuel Pégourié-Gonnard 2022-02-08 11:29:59 +01:00
parent 64754e1b8d
commit 5e6c884315

View file

@ -167,8 +167,9 @@ exit:
*/
static void aead_info( const mbedtls_cipher_context_t *ctx, size_t tag_len )
{
// no convenient way to get the just cipher type (for example, AES)
const char *ciph = "???";
mbedtls_cipher_type_t type = mbedtls_cipher_get_type( ctx );
const mbedtls_cipher_info_t *info = mbedtls_cipher_info_from_type( type );
const char *ciph = mbedtls_cipher_info_get_name( info );
int key_bits = mbedtls_cipher_get_key_bitlen( ctx );
mbedtls_cipher_mode_t mode = mbedtls_cipher_get_cipher_mode( ctx );