mki length feats in a uint16_t
Signed-off-by: Johan Pascal <johan.pascal@belledonne-communications.com>
diff --git a/include/mbedtls/ssl.h b/include/mbedtls/ssl.h
index 085d270..066522f 100644
--- a/include/mbedtls/ssl.h
+++ b/include/mbedtls/ssl.h
@@ -888,10 +888,10 @@
{
/*! The SRTP profile that was negotiated. */
mbedtls_ssl_srtp_profile chosen_dtls_srtp_profile;
+ /*! The length of mki_value. */
+ uint16_t mki_len;
/*! The mki_value used, with max size of 256 bytes. */
unsigned char mki_value[MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH];
- /*! The length of mki_value. */
- size_t mki_len;
}
mbedtls_dtls_srtp_info;
@@ -3233,7 +3233,7 @@
*/
int mbedtls_ssl_dtls_srtp_set_mki_value( mbedtls_ssl_context *ssl,
unsigned char *mki_value,
- size_t mki_len );
+ uint16_t mki_len );
/**
* \brief Get the negotiated DTLS-SRTP Protection Profile.
* This function should be called after the handshake is
diff --git a/library/ssl_cli.c b/library/ssl_cli.c
index 185997d..3954768 100644
--- a/library/ssl_cli.c
+++ b/library/ssl_cli.c
@@ -761,10 +761,8 @@
unsigned char *buf, size_t *olen )
{
unsigned char *p = buf;
- size_t protection_profiles_index = 0;
- size_t mki_len = 0;
- size_t ext_len = 0;
- uint16_t profile_value = 0;
+ size_t protection_profiles_index = 0, ext_len = 0;
+ uint16_t mki_len = 0, profile_value = 0;
*olen = 0;
@@ -1843,8 +1841,7 @@
* SRTPProtectionProfile SRTPProtectionProfiles<2..2^16-1>;
*
*/
- if( ssl->conf->dtls_srtp_mki_support == MBEDTLS_SSL_DTLS_SRTP_MKI_SUPPORTED &&
- ssl->dtls_srtp_info.mki_len != 0 )
+ if( ssl->conf->dtls_srtp_mki_support == MBEDTLS_SSL_DTLS_SRTP_MKI_SUPPORTED )
{
mki_len = ssl->dtls_srtp_info.mki_len;
}
diff --git a/library/ssl_srv.c b/library/ssl_srv.c
index 9dc08d2..5c56a70 100644
--- a/library/ssl_srv.c
+++ b/library/ssl_srv.c
@@ -783,7 +783,8 @@
{
mbedtls_ssl_srtp_profile client_protection = MBEDTLS_TLS_SRTP_UNSET;
size_t i,j;
- size_t profile_length,mki_length;
+ size_t profile_length;
+ uint16_t mki_length;
/*! 2 bytes for profile length and 1 byte for mki len */
const size_t size_of_lengths = 3;
diff --git a/library/ssl_tls.c b/library/ssl_tls.c
index f6b56f1..9a66984 100644
--- a/library/ssl_tls.c
+++ b/library/ssl_tls.c
@@ -4717,7 +4717,7 @@
int mbedtls_ssl_dtls_srtp_set_mki_value( mbedtls_ssl_context *ssl,
unsigned char *mki_value,
- size_t mki_len )
+ uint16_t mki_len )
{
if ( mki_len > MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH )
{