Add enum casts in ssl_helpers.c

Signed-off-by: Agathiyan Bragadeesh <agathiyan.bragadeesh2@arm.com>
This commit is contained in:
Agathiyan Bragadeesh 2023-07-12 11:21:54 +01:00
parent 01ed84a1f3
commit 2f017a8356

View file

@ -1020,10 +1020,10 @@ static void set_ciphersuite(mbedtls_ssl_config *conf, const char *cipher,
TEST_ASSERT(ciphersuite_info->max_tls_version >= conf->min_tls_version); TEST_ASSERT(ciphersuite_info->max_tls_version >= conf->min_tls_version);
if (conf->max_tls_version > ciphersuite_info->max_tls_version) { if (conf->max_tls_version > ciphersuite_info->max_tls_version) {
conf->max_tls_version = ciphersuite_info->max_tls_version; conf->max_tls_version = (mbedtls_ssl_protocol_version) ciphersuite_info->max_tls_version;
} }
if (conf->min_tls_version < ciphersuite_info->min_tls_version) { if (conf->min_tls_version < ciphersuite_info->min_tls_version) {
conf->min_tls_version = ciphersuite_info->min_tls_version; conf->min_tls_version = (mbedtls_ssl_protocol_version) ciphersuite_info->min_tls_version;
} }
mbedtls_ssl_conf_ciphersuites(conf, forced_ciphersuite); mbedtls_ssl_conf_ciphersuites(conf, forced_ciphersuite);
@ -1140,7 +1140,7 @@ int mbedtls_test_ssl_build_transforms(mbedtls_ssl_transform *t_in,
maclen = 0; maclen = 0;
/* Pick cipher */ /* Pick cipher */
cipher_info = mbedtls_cipher_info_from_type(cipher_type); cipher_info = mbedtls_cipher_info_from_type((mbedtls_cipher_type_t) cipher_type);
CHK(cipher_info != NULL); CHK(cipher_info != NULL);
CHK(cipher_info->iv_size <= 16); CHK(cipher_info->iv_size <= 16);
CHK(cipher_info->key_bitlen % 8 == 0); CHK(cipher_info->key_bitlen % 8 == 0);
@ -1198,10 +1198,10 @@ int mbedtls_test_ssl_build_transforms(mbedtls_ssl_transform *t_in,
if (cipher_info->mode == MBEDTLS_MODE_CBC || if (cipher_info->mode == MBEDTLS_MODE_CBC ||
cipher_info->mode == MBEDTLS_MODE_STREAM) { cipher_info->mode == MBEDTLS_MODE_STREAM) {
#if !defined(MBEDTLS_USE_PSA_CRYPTO) #if !defined(MBEDTLS_USE_PSA_CRYPTO)
mbedtls_md_info_t const *md_info = mbedtls_md_info_from_type(hash_id); mbedtls_md_info_t const *md_info = mbedtls_md_info_from_type((mbedtls_md_type_t) hash_id);
CHK(md_info != NULL); CHK(md_info != NULL);
#endif #endif
maclen = mbedtls_md_get_size_from_type(hash_id); maclen = mbedtls_md_get_size_from_type((mbedtls_md_type_t) hash_id);
CHK(maclen != 0); CHK(maclen != 0);
/* Pick hash keys */ /* Pick hash keys */
CHK((md0 = mbedtls_calloc(1, maclen)) != NULL); CHK((md0 = mbedtls_calloc(1, maclen)) != NULL);