Style and typos

Signed-off-by: Johan Pascal <johan.pascal@belledonne-communications.com>
This commit is contained in:
Johan Pascal 2020-10-28 17:05:47 +01:00
parent 2258a4f481
commit 5ef72d214f
6 changed files with 21 additions and 17 deletions

View file

@ -1909,7 +1909,8 @@ static int ssl_parse_use_srtp_ext( mbedtls_ssl_context *ssl,
*/ */
for( i=0; i < ssl->conf->dtls_srtp_profile_list_len; i++) for( i=0; i < ssl->conf->dtls_srtp_profile_list_len; i++)
{ {
if( server_protection == ssl->conf->dtls_srtp_profile_list[i] ) { if( server_protection == ssl->conf->dtls_srtp_profile_list[i] )
{
ssl->dtls_srtp_info.chosen_dtls_srtp_profile = ssl->conf->dtls_srtp_profile_list[i]; ssl->dtls_srtp_info.chosen_dtls_srtp_profile = ssl->conf->dtls_srtp_profile_list[i];
MBEDTLS_SSL_DEBUG_MSG( 3, ( "selected srtp profile: %s", MBEDTLS_SSL_DEBUG_MSG( 3, ( "selected srtp profile: %s",
mbedtls_ssl_get_srtp_profile_as_string( mbedtls_ssl_get_srtp_profile_as_string(

View file

@ -885,7 +885,7 @@ static int ssl_parse_use_srtp_ext( mbedtls_ssl_context *ssl,
{ {
ssl->dtls_srtp_info.mki_len = mki_length; ssl->dtls_srtp_info.mki_len = mki_length;
memcpy(ssl->dtls_srtp_info.mki_value, buf, mki_length); memcpy( ssl->dtls_srtp_info.mki_value, buf, mki_length );
MBEDTLS_SSL_DEBUG_BUF( 3, "using mki", ssl->dtls_srtp_info.mki_value, MBEDTLS_SSL_DEBUG_BUF( 3, "using mki", ssl->dtls_srtp_info.mki_value,
ssl->dtls_srtp_info.mki_len ); ssl->dtls_srtp_info.mki_len );
@ -2065,10 +2065,10 @@ read_record_header:
case MBEDTLS_TLS_EXT_USE_SRTP: case MBEDTLS_TLS_EXT_USE_SRTP:
MBEDTLS_SSL_DEBUG_MSG( 3, ( "found use_srtp extension" ) ); MBEDTLS_SSL_DEBUG_MSG( 3, ( "found use_srtp extension" ) );
if ( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
{ {
ret = ssl_parse_use_srtp_ext( ssl, ext + 4, ext_size ); ret = ssl_parse_use_srtp_ext( ssl, ext + 4, ext_size );
if ( ret != 0 ) if( ret != 0 )
return( ret ); return( ret );
} }
break; break;
@ -2992,7 +2992,7 @@ static int ssl_write_server_hello( mbedtls_ssl_context *ssl )
#endif #endif
#if defined(MBEDTLS_SSL_DTLS_SRTP) #if defined(MBEDTLS_SSL_DTLS_SRTP)
if ( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM ) if( ssl->conf->transport == MBEDTLS_SSL_TRANSPORT_DATAGRAM )
{ {
ssl_write_use_srtp_ext( ssl, p + 2 + ext_len, &olen ); ssl_write_use_srtp_ext( ssl, p + 2 + ext_len, &olen );
ext_len += olen; ext_len += olen;

View file

@ -4700,7 +4700,7 @@ int mbedtls_ssl_dtls_srtp_set_mki_value( mbedtls_ssl_context *ssl,
unsigned char *mki_value, unsigned char *mki_value,
uint16_t mki_len ) uint16_t mki_len )
{ {
if ( mki_len > MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH ) if( mki_len > MBEDTLS_TLS_SRTP_MAX_MKI_LENGTH )
{ {
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA ); return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
} }
@ -4727,7 +4727,7 @@ int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf,
list_size <= MBEDTLS_TLS_SRTP_MAX_PROFILE_LIST_LENGTH; list_size <= MBEDTLS_TLS_SRTP_MAX_PROFILE_LIST_LENGTH;
p++ ) p++ )
{ {
if ( mbedtls_ssl_check_srtp_profile_value( *p ) != MBEDTLS_TLS_SRTP_UNSET ) if( mbedtls_ssl_check_srtp_profile_value( *p ) != MBEDTLS_TLS_SRTP_UNSET )
{ {
list_size++; list_size++;
} }
@ -4738,7 +4738,7 @@ int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf,
} }
} }
if ( list_size > MBEDTLS_TLS_SRTP_MAX_PROFILE_LIST_LENGTH ) if( list_size > MBEDTLS_TLS_SRTP_MAX_PROFILE_LIST_LENGTH )
{ {
conf->dtls_srtp_profile_list = NULL; conf->dtls_srtp_profile_list = NULL;
conf->dtls_srtp_profile_list_len = 0; conf->dtls_srtp_profile_list_len = 0;
@ -4751,18 +4751,20 @@ int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf,
return( 0 ); return( 0 );
} }
void mbedtls_ssl_get_dtls_srtp_negotiation_result( const mbedtls_ssl_context *ssl, mbedtls_dtls_srtp_info *dtls_srtp_info ) void mbedtls_ssl_get_dtls_srtp_negotiation_result( const mbedtls_ssl_context *ssl,
mbedtls_dtls_srtp_info *dtls_srtp_info )
{ {
dtls_srtp_info->chosen_dtls_srtp_profile = ssl->dtls_srtp_info.chosen_dtls_srtp_profile; dtls_srtp_info->chosen_dtls_srtp_profile = ssl->dtls_srtp_info.chosen_dtls_srtp_profile;
/* do not copy the mki value if there is no chosen profile */ /* do not copy the mki value if there is no chosen profile */
if ( dtls_srtp_info->chosen_dtls_srtp_profile == MBEDTLS_TLS_SRTP_UNSET ) if( dtls_srtp_info->chosen_dtls_srtp_profile == MBEDTLS_TLS_SRTP_UNSET )
{ {
dtls_srtp_info->mki_len = 0; dtls_srtp_info->mki_len = 0;
} }
else else
{ {
dtls_srtp_info->mki_len = ssl->dtls_srtp_info.mki_len; dtls_srtp_info->mki_len = ssl->dtls_srtp_info.mki_len;
memcpy( dtls_srtp_info->mki_value, ssl->dtls_srtp_info.mki_value, ssl->dtls_srtp_info.mki_len ); memcpy( dtls_srtp_info->mki_value, ssl->dtls_srtp_info.mki_value,
ssl->dtls_srtp_info.mki_len );
} }
} }
#endif /* MBEDTLS_SSL_DTLS_SRTP */ #endif /* MBEDTLS_SSL_DTLS_SRTP */

View file

@ -2341,7 +2341,8 @@ int main( int argc, char *argv[] )
{ {
if( opt.force_srtp_profile != 0 ) if( opt.force_srtp_profile != 0 )
{ {
const mbedtls_ssl_srtp_profile forced_profile[] = { opt.force_srtp_profile, MBEDTLS_TLS_SRTP_UNSET }; const mbedtls_ssl_srtp_profile forced_profile[] =
{ opt.force_srtp_profile, MBEDTLS_TLS_SRTP_UNSET };
ret = mbedtls_ssl_conf_dtls_srtp_protection_profiles ( &conf, forced_profile ); ret = mbedtls_ssl_conf_dtls_srtp_protection_profiles ( &conf, forced_profile );
} }
else else
@ -2810,7 +2811,7 @@ int main( int argc, char *argv[] )
} }
else else
{ {
mbedtls_printf( " DTLS-SRTP no mki value negociated" ); mbedtls_printf( " DTLS-SRTP no mki value negotiated" );
} }
mbedtls_printf( "\n" ); mbedtls_printf( "\n" );
} }

View file

@ -3921,7 +3921,7 @@ handshake:
} }
else else
{ {
mbedtls_printf( " DTLS-SRTP no mki value negociated" ); mbedtls_printf( " DTLS-SRTP no mki value negotiated" );
} }
mbedtls_printf( "\n" ); mbedtls_printf( "\n" );

View file

@ -8875,14 +8875,14 @@ run_test "DTLS-SRTP all profiles supported. server doesn't support mki." \
-s "selected srtp profile" \ -s "selected srtp profile" \
-s "server hello, adding use_srtp extension" \ -s "server hello, adding use_srtp extension" \
-s "DTLS-SRTP key material is"\ -s "DTLS-SRTP key material is"\
-s "DTLS-SRTP no mki value negociated"\ -s "DTLS-SRTP no mki value negotiated"\
-S "dumping 'using mki' (8 bytes)" \ -S "dumping 'using mki' (8 bytes)" \
-c "client hello, adding use_srtp extension" \ -c "client hello, adding use_srtp extension" \
-c "found use_srtp extension" \ -c "found use_srtp extension" \
-c "found srtp profile" \ -c "found srtp profile" \
-c "selected srtp profile" \ -c "selected srtp profile" \
-c "DTLS-SRTP key material is"\ -c "DTLS-SRTP key material is"\
-c "DTLS-SRTP no mki value negociated"\ -c "DTLS-SRTP no mki value negotiated"\
-g "find_in_both '^ *Keying material: [0-9A-F]*$'"\ -g "find_in_both '^ *Keying material: [0-9A-F]*$'"\
-c "dumping 'sending mki' (8 bytes)" \ -c "dumping 'sending mki' (8 bytes)" \
-C "dumping 'received mki' (8 bytes)" \ -C "dumping 'received mki' (8 bytes)" \
@ -9069,7 +9069,7 @@ run_test "DTLS-SRTP all profiles supported. server doesn't support mki. openssl
-c "found srtp profile" \ -c "found srtp profile" \
-c "selected srtp profile" \ -c "selected srtp profile" \
-c "DTLS-SRTP key material is"\ -c "DTLS-SRTP key material is"\
-c "DTLS-SRTP no mki value negociated"\ -c "DTLS-SRTP no mki value negotiated"\
-c "dumping 'sending mki' (8 bytes)" \ -c "dumping 'sending mki' (8 bytes)" \
-C "dumping 'received mki' (8 bytes)" \ -C "dumping 'received mki' (8 bytes)" \
-C "error" -C "error"