From 701984d3001573233f06fcc6c23577519fa03fed Mon Sep 17 00:00:00 2001 From: Johan Pascal Date: Thu, 9 Feb 2017 09:56:05 +0700 Subject: [PATCH] Comply with mbedtls naming rules Signed-off-by: Johan Pascal --- include/mbedtls/ssl.h | 14 ++++++++------ library/ssl_cli.c | 2 +- library/ssl_srv.c | 2 +- library/ssl_tls.c | 6 +++--- library/version_features.c | 3 +++ 5 files changed, 16 insertions(+), 11 deletions(-) diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h index e93617c96a..e3459cd566 100644 --- a/include/mbedtls/ssl.h +++ b/include/mbedtls/ssl.h @@ -865,13 +865,15 @@ typedef void mbedtls_ssl_async_cancel_t( mbedtls_ssl_context *ssl ); /* * List of SRTP profiles for DTLS-SRTP */ -enum mbedtls_DTLS_SRTP_protection_profiles { +typedef enum +{ MBEDTLS_SRTP_UNSET_PROFILE, MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_80, MBEDTLS_SRTP_AES128_CM_HMAC_SHA1_32, MBEDTLS_SRTP_NULL_HMAC_SHA1_80, MBEDTLS_SRTP_NULL_HMAC_SHA1_32, -}; +} +mbedtls_dtls_srtp_protection_profiles; #endif /* MBEDTLS_SSL_DTLS_SRTP */ /* @@ -1084,7 +1086,7 @@ struct mbedtls_ssl_config /* * use_srtp extension */ - enum mbedtls_DTLS_SRTP_protection_profiles *dtls_srtp_profiles_list; /*!< ordered list of supported srtp profile */ + mbedtls_dtls_srtp_protection_profiles *dtls_srtp_profiles_list; /*!< ordered list of supported srtp profile */ size_t dtls_srtp_profiles_list_len; /*!< number of supported profiles */ #endif /* MBEDTLS_SSL_DTLS_SRTP */ @@ -1333,7 +1335,7 @@ struct mbedtls_ssl_context /* * use_srtp extension */ - enum mbedtls_DTLS_SRTP_protection_profiles chosen_dtls_srtp_profile; /*!< negotiated SRTP profile */ + mbedtls_dtls_srtp_protection_profiles chosen_dtls_srtp_profile; /*!< negotiated SRTP profile */ unsigned char *dtls_srtp_keys; /*!< master keys and master salt for SRTP generated during handshake */ size_t dtls_srtp_keys_len; /*!< length in bytes of master keys and master salt for SRTP generated during handshake */ #endif /* MBEDTLS_SSL_DTLS_SRTP */ @@ -3171,7 +3173,7 @@ const char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl ); * * \return 0 on success, or MBEDTLS_ERR_SSL_BAD_INPUT_DATA. */ -int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf, const enum mbedtls_DTLS_SRTP_protection_profiles *profiles, size_t profiles_number); +int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf, const mbedtls_dtls_srtp_protection_profiles *profiles, size_t profiles_number); /** * \brief Get the negotiated DTLS-SRTP Protection Profile. @@ -3182,7 +3184,7 @@ int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf, co * * \return Protection Profile enum member, MBEDTLS_SRTP_UNSET_PROFILE if no protocol was negotiated. */ -enum mbedtls_DTLS_SRTP_protection_profiles mbedtls_ssl_get_dtls_srtp_protection_profile( const mbedtls_ssl_context *ssl); +mbedtls_dtls_srtp_protection_profiles mbedtls_ssl_get_dtls_srtp_protection_profile( const mbedtls_ssl_context *ssl); /** * \brief Get the generated DTLS-SRTP key material. diff --git a/library/ssl_cli.c b/library/ssl_cli.c index 50bc5e39a4..a15bb30335 100644 --- a/library/ssl_cli.c +++ b/library/ssl_cli.c @@ -1792,7 +1792,7 @@ static int ssl_parse_alpn_ext( mbedtls_ssl_context *ssl, static int ssl_parse_use_srtp_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { - enum mbedtls_DTLS_SRTP_protection_profiles server_protection = MBEDTLS_SRTP_UNSET_PROFILE; + mbedtls_dtls_srtp_protection_profiles server_protection = MBEDTLS_SRTP_UNSET_PROFILE; size_t i; uint16_t server_protection_profile_value = 0; diff --git a/library/ssl_srv.c b/library/ssl_srv.c index ee2ae89bca..1336848e73 100644 --- a/library/ssl_srv.c +++ b/library/ssl_srv.c @@ -780,7 +780,7 @@ static int ssl_parse_alpn_ext( mbedtls_ssl_context *ssl, static int ssl_parse_use_srtp_ext( mbedtls_ssl_context *ssl, const unsigned char *buf, size_t len ) { - enum mbedtls_DTLS_SRTP_protection_profiles client_protection = MBEDTLS_SRTP_UNSET_PROFILE; + mbedtls_dtls_srtp_protection_profiles client_protection = MBEDTLS_SRTP_UNSET_PROFILE; size_t i,j; uint16_t profile_length; diff --git a/library/ssl_tls.c b/library/ssl_tls.c index 2b9f78a94d..18ad504462 100644 --- a/library/ssl_tls.c +++ b/library/ssl_tls.c @@ -4716,7 +4716,7 @@ const char *mbedtls_ssl_get_alpn_protocol( const mbedtls_ssl_context *ssl ) #endif /* MBEDTLS_SSL_ALPN */ #if defined(MBEDTLS_SSL_DTLS_SRTP) -int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf, const enum mbedtls_DTLS_SRTP_protection_profiles *profiles, size_t profiles_number) +int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf, const mbedtls_dtls_srtp_protection_profiles *profiles, size_t profiles_number) { size_t i; /* check in put validity : must be a list of profiles from enumeration */ @@ -4726,7 +4726,7 @@ int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf, co } mbedtls_free(conf->dtls_srtp_profiles_list); - conf->dtls_srtp_profiles_list = (enum mbedtls_DTLS_SRTP_protection_profiles *)mbedtls_calloc(1, profiles_number*sizeof(enum mbedtls_DTLS_SRTP_protection_profiles)); + conf->dtls_srtp_profiles_list = (mbedtls_dtls_srtp_protection_profiles *)mbedtls_calloc(1, profiles_number*sizeof(mbedtls_dtls_srtp_protection_profiles)); for (i=0; ichosen_dtls_srtp_profile); } diff --git a/library/version_features.c b/library/version_features.c index 62b05537c9..42ccaf9540 100644 --- a/library/version_features.c +++ b/library/version_features.c @@ -534,6 +534,9 @@ static const char * const features[] = { #if defined(MBEDTLS_SSL_DTLS_HELLO_VERIFY) "MBEDTLS_SSL_DTLS_HELLO_VERIFY", #endif /* MBEDTLS_SSL_DTLS_HELLO_VERIFY */ +#if defined(MBEDTLS_SSL_DTLS_SRTP) + "MBEDTLS_SSL_DTLS_SRTP", +#endif /* MBEDTLS_SSL_DTLS_SRTP */ #if defined(MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE) "MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE", #endif /* MBEDTLS_SSL_DTLS_CLIENT_PORT_REUSE */