ssl_context_info: add guards for CIPHER_C
mbedtls_cipher_info_from_type() is only available when CIPHER_C is
defined. So when it is not we just print the cipher type decimal
value on the output instead of the cipher's name.
Signed-off-by: Valerio Setti <valerio.setti@nordicsemi.no>
diff --git a/programs/ssl/ssl_context_info.c b/programs/ssl/ssl_context_info.c
index 9744c58..fca6afd 100644
--- a/programs/ssl/ssl_context_info.c
+++ b/programs/ssl/ssl_context_info.c
@@ -559,7 +559,6 @@
if (ciphersuite_info == NULL) {
printf_err("Cannot find ciphersuite info\n");
} else {
- const mbedtls_cipher_info_t *cipher_info;
#if defined(MBEDTLS_MD_C)
const mbedtls_md_info_t *md_info;
#endif
@@ -567,12 +566,18 @@
printf("\tciphersuite : %s\n", ciphersuite_info->name);
printf("\tcipher flags : 0x%02X\n", ciphersuite_info->flags);
+#if defined(MBEDTLS_CIPHER_C)
+ const mbedtls_cipher_info_t *cipher_info;
cipher_info = mbedtls_cipher_info_from_type(ciphersuite_info->cipher);
if (cipher_info == NULL) {
printf_err("Cannot find cipher info\n");
} else {
printf("\tcipher : %s\n", cipher_info->name);
}
+#else /* MBEDTLS_CIPHER_C */
+ printf("\tcipher type : %d\n", ciphersuite_info->cipher);
+#endif /* MBEDTLS_CIPHER_C */
+
#if defined(MBEDTLS_MD_C)
md_info = mbedtls_md_info_from_type(ciphersuite_info->mac);
if (md_info == NULL) {