mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2024-12-29 09:21:19 +00:00
Do not return a structure, use a return parameter
Signed-off-by: Johan Pascal <johan.pascal@belledonne-communications.com>
This commit is contained in:
parent
0dbcd1d3f0
commit
2258a4f481
@ -3257,27 +3257,25 @@ 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 );
|
||||||
/**
|
/**
|
||||||
* \brief Get the negotiated DTLS-SRTP informations:
|
* \brief Get the negotiated DTLS-SRTP informations:
|
||||||
* Protection profile and MKI value.
|
* Protection profile and MKI value.
|
||||||
*
|
*
|
||||||
* \warning This function must be called after the handshake is
|
* \warning This function must be called after the handshake is
|
||||||
* completed. The value returned by this function must
|
* completed. The value returned by this function must
|
||||||
* not be trusted or acted upon before the handshake completes.
|
* not be trusted or acted upon before the handshake completes.
|
||||||
*
|
*
|
||||||
* \param ssl The SSL context to query.
|
* \param ssl The SSL context to query.
|
||||||
*
|
* \param dtls_srtp_info The negotiated DTLS-SRTP informations:
|
||||||
* \return The negotiated DTLS-SRTP informations:
|
* - Protection profile in use.
|
||||||
* - Protection profile in use.
|
* A direct mapping of the iana defined value for protection
|
||||||
* A direct mapping of the iana defined value for protection
|
* profile on an uint16_t.
|
||||||
* profile on an uint16_t.
|
http://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml
|
||||||
* http://www.iana.org/assignments/srtp-protection/srtp-protection.xhtml
|
* #MBEDTLS_TLS_SRTP_UNSET if the use of SRTP was not negotiated
|
||||||
* #MBEDTLS_TLS_SRTP_UNSET if the use of SRTP was not negotiated
|
* or peer's Hello packet was not parsed yet.
|
||||||
* or peer's Hello packet was not parsed yet.
|
* - mki size and value( if size is > 0 ).
|
||||||
* - mki size and value (if size is > 0). These informations are valid only
|
|
||||||
* if the protection profile returned is not MBEDTLS_TLS_SRTP_UNSET.
|
|
||||||
*/
|
*/
|
||||||
mbedtls_dtls_srtp_info mbedtls_ssl_get_dtls_srtp_negotiation_result
|
void mbedtls_ssl_get_dtls_srtp_negotiation_result( const mbedtls_ssl_context *ssl,
|
||||||
( const mbedtls_ssl_context *ssl );
|
mbedtls_dtls_srtp_info *dtls_srtp_info );
|
||||||
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -4751,16 +4751,19 @@ int mbedtls_ssl_conf_dtls_srtp_protection_profiles( mbedtls_ssl_config *conf,
|
|||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
mbedtls_dtls_srtp_info
|
void mbedtls_ssl_get_dtls_srtp_negotiation_result( const mbedtls_ssl_context *ssl, mbedtls_dtls_srtp_info *dtls_srtp_info )
|
||||||
mbedtls_ssl_get_dtls_srtp_negotiation_result( const mbedtls_ssl_context *ssl )
|
|
||||||
{
|
{
|
||||||
mbedtls_dtls_srtp_info ret = ssl->dtls_srtp_info;
|
dtls_srtp_info->chosen_dtls_srtp_profile = ssl->dtls_srtp_info.chosen_dtls_srtp_profile;
|
||||||
/* discard the mki if there is no chosen profile */
|
/* do not copy the mki value if there is no chosen profile */
|
||||||
if ( ret.chosen_dtls_srtp_profile == MBEDTLS_TLS_SRTP_UNSET )
|
if ( dtls_srtp_info->chosen_dtls_srtp_profile == MBEDTLS_TLS_SRTP_UNSET )
|
||||||
{
|
{
|
||||||
ret.mki_len = 0;
|
dtls_srtp_info->mki_len = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
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 );
|
||||||
}
|
}
|
||||||
return( ret );
|
|
||||||
}
|
}
|
||||||
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
||||||
|
|
||||||
|
@ -2754,8 +2754,8 @@ int main( int argc, char *argv[] )
|
|||||||
else if( opt.use_srtp != 0 )
|
else if( opt.use_srtp != 0 )
|
||||||
{
|
{
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
mbedtls_dtls_srtp_info dtls_srtp_negotiation_result =
|
mbedtls_dtls_srtp_info dtls_srtp_negotiation_result;
|
||||||
mbedtls_ssl_get_dtls_srtp_negotiation_result( &ssl );
|
mbedtls_ssl_get_dtls_srtp_negotiation_result( &ssl, &dtls_srtp_negotiation_result );
|
||||||
|
|
||||||
if( ( dtls_srtp_negotiation_result.chosen_dtls_srtp_profile
|
if( ( dtls_srtp_negotiation_result.chosen_dtls_srtp_profile
|
||||||
== MBEDTLS_TLS_SRTP_UNSET ) )
|
== MBEDTLS_TLS_SRTP_UNSET ) )
|
||||||
|
@ -3865,8 +3865,8 @@ handshake:
|
|||||||
else if( opt.use_srtp != 0 )
|
else if( opt.use_srtp != 0 )
|
||||||
{
|
{
|
||||||
size_t j = 0;
|
size_t j = 0;
|
||||||
mbedtls_dtls_srtp_info dtls_srtp_negotiation_result =
|
mbedtls_dtls_srtp_info dtls_srtp_negotiation_result;
|
||||||
mbedtls_ssl_get_dtls_srtp_negotiation_result( &ssl );
|
mbedtls_ssl_get_dtls_srtp_negotiation_result( &ssl, &dtls_srtp_negotiation_result );
|
||||||
|
|
||||||
if( ( dtls_srtp_negotiation_result.chosen_dtls_srtp_profile
|
if( ( dtls_srtp_negotiation_result.chosen_dtls_srtp_profile
|
||||||
== MBEDTLS_TLS_SRTP_UNSET ) )
|
== MBEDTLS_TLS_SRTP_UNSET ) )
|
||||||
|
Loading…
Reference in New Issue
Block a user