Fix return type of example key export callbacks
Signed-off-by: Hanno Becker <hanno.becker@arm.com>
This commit is contained in:
parent
d8f32e72b4
commit
296fefeb98
1 changed files with 26 additions and 34 deletions
|
@ -25,7 +25,7 @@
|
|||
*/
|
||||
|
||||
#if defined(MBEDTLS_SSL_EXPORT_KEYS)
|
||||
int eap_tls_key_derivation( void *p_expkey,
|
||||
void eap_tls_key_derivation( void *p_expkey,
|
||||
mbedtls_ssl_key_export_type secret_type,
|
||||
const unsigned char *secret,
|
||||
size_t secret_len,
|
||||
|
@ -37,19 +37,17 @@ int eap_tls_key_derivation( void *p_expkey,
|
|||
|
||||
/* We're only interested in the TLS 1.2 master secret */
|
||||
if( secret_type != MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET )
|
||||
return( 0 );
|
||||
return;
|
||||
if( secret_len != sizeof( keys->master_secret ) )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
return;
|
||||
|
||||
memcpy( keys->master_secret, secret, sizeof( keys->master_secret ) );
|
||||
memcpy( keys->randbytes, client_random, 32 );
|
||||
memcpy( keys->randbytes + 32, server_random, 32 );
|
||||
keys->tls_prf_type = tls_prf_type;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
|
||||
int nss_keylog_export( void *p_expkey,
|
||||
void nss_keylog_export( void *p_expkey,
|
||||
mbedtls_ssl_key_export_type secret_type,
|
||||
const unsigned char *secret,
|
||||
size_t secret_len,
|
||||
|
@ -61,11 +59,10 @@ int nss_keylog_export( void *p_expkey,
|
|||
size_t const client_random_len = 32;
|
||||
size_t len = 0;
|
||||
size_t j;
|
||||
int ret = 0;
|
||||
|
||||
/* We're only interested in the TLS 1.2 master secret */
|
||||
if( secret_type != MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET )
|
||||
return( 0 );
|
||||
return;
|
||||
|
||||
((void) p_expkey);
|
||||
((void) server_random);
|
||||
|
@ -102,13 +99,11 @@ int nss_keylog_export( void *p_expkey,
|
|||
|
||||
if( ( f = fopen( opt.nss_keylog_file, "a" ) ) == NULL )
|
||||
{
|
||||
ret = -1;
|
||||
goto exit;
|
||||
}
|
||||
|
||||
if( fwrite( nss_keylog_line, 1, len, f ) != len )
|
||||
{
|
||||
ret = -1;
|
||||
fclose( f );
|
||||
goto exit;
|
||||
}
|
||||
|
@ -119,11 +114,10 @@ int nss_keylog_export( void *p_expkey,
|
|||
exit:
|
||||
mbedtls_platform_zeroize( nss_keylog_line,
|
||||
sizeof( nss_keylog_line ) );
|
||||
return( ret );
|
||||
}
|
||||
|
||||
#if defined( MBEDTLS_SSL_DTLS_SRTP )
|
||||
int dtls_srtp_key_derivation( void *p_expkey,
|
||||
void dtls_srtp_key_derivation( void *p_expkey,
|
||||
mbedtls_ssl_key_export_type secret_type,
|
||||
const unsigned char *secret,
|
||||
size_t secret_len,
|
||||
|
@ -135,16 +129,14 @@ int dtls_srtp_key_derivation( void *p_expkey,
|
|||
|
||||
/* We're only interested in the TLS 1.2 master secret */
|
||||
if( secret_type != MBEDTLS_SSL_KEY_EXPORT_TLS12_MASTER_SECRET )
|
||||
return( 0 );
|
||||
return;
|
||||
if( secret_len != sizeof( keys->master_secret ) )
|
||||
return( MBEDTLS_ERR_SSL_BAD_INPUT_DATA );
|
||||
return;
|
||||
|
||||
memcpy( keys->master_secret, secret, sizeof( keys->master_secret ) );
|
||||
memcpy( keys->randbytes, client_random, 32 );
|
||||
memcpy( keys->randbytes + 32, server_random, 32 );
|
||||
keys->tls_prf_type = tls_prf_type;
|
||||
|
||||
return( 0 );
|
||||
}
|
||||
#endif /* MBEDTLS_SSL_DTLS_SRTP */
|
||||
|
||||
|
|
Loading…
Reference in a new issue