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:
Ron Eldor 2018-12-06 17:12:49 +02:00 committed by Johan Pascal
parent a978804a1b
commit 089c9fe9fa
5 changed files with 123 additions and 122 deletions

View file

@ -3257,15 +3257,16 @@ mbedtls_ssl_srtp_profile mbedtls_ssl_get_dtls_srtp_protection_profile
*
* \param ssl SSL context tobe used.
* \param key Buffer to hold the generated key material.
* \param key_len [in/out] key buffer size. outputs the actual number
* of bytes written.
* \param key_buffer_len Key buffer size.
* \param olen the actual number of bytes written to key.
*
* \return 0 on success, #MBEDTLS_ERR_SSL_BUFFER_TOO_SMALL if
* the key buffer is too small to hold the generated key.
*/
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 );
/**
* \brief Utility function to get information on DTLS-SRTP profile.