mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-12-24 17:41:01 +03:00
Improve readability
Improve readability of the code: 1. move common code to `ssl_internal.h` as `static inline`. 2. Add comments. 3. Use local variables for extension size. 4. Change function signature, by adding buffer size and output length. 5. Take server srtp profile out of the loop. Signed-off-by: Johan Pascal <johan.pascal@belledonne-communications.com>
This commit is contained in:
@@ -4838,18 +4838,19 @@ mbedtls_ssl_srtp_profile
|
||||
|
||||
int mbedtls_ssl_get_dtls_srtp_key_material( const mbedtls_ssl_context *ssl,
|
||||
unsigned char *key,
|
||||
size_t *key_len )
|
||||
size_t key_buffer_len,
|
||||
size_t *olen )
|
||||
{
|
||||
|
||||
/* check output buffer size */
|
||||
if( *key_len < ssl->dtls_srtp_info.dtls_srtp_keys_len )
|
||||
if( key_buffer_len < ssl->dtls_srtp_info.dtls_srtp_keys_len )
|
||||
{
|
||||
return( MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL );
|
||||
}
|
||||
|
||||
memcpy( key, ssl->dtls_srtp_info.dtls_srtp_keys,
|
||||
ssl->dtls_srtp_info.dtls_srtp_keys_len );
|
||||
*key_len = ssl->dtls_srtp_info.dtls_srtp_keys_len;
|
||||
*olen = ssl->dtls_srtp_info.dtls_srtp_keys_len;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user