Improve info() function in cipher_aead_demo
Signed-off-by: Manuel Pégourié-Gonnard <manuel.pegourie-gonnard@arm.com>
diff --git a/programs/cipher/cipher_aead_demo.c b/programs/cipher/cipher_aead_demo.c
index 069c2ee..c92eab0 100644
--- a/programs/cipher/cipher_aead_demo.c
+++ b/programs/cipher/cipher_aead_demo.c
@@ -167,8 +167,9 @@
*/
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 );