SRTP profiles definition use macros only

Signed-off-by: Johan Pascal <johan.pascal@belledonne-communications.com>
This commit is contained in:
Johan Pascal 2020-09-22 12:25:52 +02:00
parent 4f099264b5
commit 43f9490a52
8 changed files with 105 additions and 149 deletions

View file

@ -1096,50 +1096,23 @@ int mbedtls_ssl_check_sig_hash( const mbedtls_ssl_context *ssl,
#endif
#if defined(MBEDTLS_SSL_DTLS_SRTP)
static inline uint16_t mbedtls_ssl_get_srtp_profile_iana_value
( mbedtls_ssl_srtp_profile profile )
{
uint16_t profile_value = 0xffff;
switch( profile )
{
case MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_80:
profile_value = MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80;
break;
case MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_32:
profile_value = MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32;
break;
case MBEDTLS_SRTP_NULL_HMAC_SHA1_80:
profile_value = MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80;
break;
case MBEDTLS_SRTP_NULL_HMAC_SHA1_32:
profile_value = MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32;
break;
default: break;
}
return( profile_value );
}
#if defined(MBEDTLS_DEBUG_C)
const char *mbedtls_ssl_get_srtp_profile_as_string ( mbedtls_ssl_srtp_profile profile );
#endif /* MBEDTLS_DEBUG_C */
static inline mbedtls_ssl_srtp_profile mbedtls_ssl_get_srtp_profile_value
( uint16_t srtp_iana_value )
static inline mbedtls_ssl_srtp_profile mbedtls_ssl_check_srtp_profile_value
( const uint16_t srtp_profile_value )
{
mbedtls_ssl_srtp_profile profile_value = MBEDTLS_SRTP_UNSET_PROFILE;
switch( srtp_iana_value )
switch( srtp_profile_value )
{
case MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_80:
profile_value = MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_80;
break;
case MBEDTLS_TLS_SRTP_AES128_CM_HMAC_SHA1_32:
profile_value = MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_32;
break;
case MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_80:
profile_value = MBEDTLS_SRTP_NULL_HMAC_SHA1_80;
break;
case MBEDTLS_TLS_SRTP_NULL_HMAC_SHA1_32:
profile_value = MBEDTLS_SRTP_NULL_HMAC_SHA1_32;
break;
return srtp_profile_value;
default: break;
}
return( profile_value );
return( MBEDTLS_TLS_SRTP_UNSET );
}
#endif