fix various issues
- code style - variable initialize - update comments Signed-off-by: Jerry Yu <jerry.h.yu@arm.com>
This commit is contained in:
parent
2185c0f2e9
commit
c5a23a0f12
3 changed files with 16 additions and 18 deletions
|
@ -1572,10 +1572,9 @@ int mbedtls_ssl_tls13_export_handshake_psk( mbedtls_ssl_context *ssl,
|
|||
unsigned char **psk,
|
||||
size_t *psk_len )
|
||||
{
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
psa_key_attributes_t key_attributes = PSA_KEY_ATTRIBUTES_INIT;
|
||||
psa_status_t status;
|
||||
psa_status_t status = PSA_ERROR_CORRUPTION_DETECTED;
|
||||
|
||||
*psk_len = 0;
|
||||
*psk = NULL;
|
||||
|
@ -1585,16 +1584,12 @@ int mbedtls_ssl_tls13_export_handshake_psk( mbedtls_ssl_context *ssl,
|
|||
|
||||
status = psa_get_key_attributes( ssl->handshake->psk_opaque, &key_attributes );
|
||||
if( status != PSA_SUCCESS )
|
||||
{
|
||||
return( psa_ssl_status_to_mbedtls( status ) );
|
||||
}
|
||||
|
||||
*psk_len = PSA_BITS_TO_BYTES( psa_get_key_bits( &key_attributes ) );
|
||||
*psk = mbedtls_calloc( 1, *psk_len );
|
||||
if( *psk == NULL )
|
||||
{
|
||||
return( MBEDTLS_ERR_SSL_ALLOC_FAILED );
|
||||
}
|
||||
|
||||
status = psa_export_key( ssl->handshake->psk_opaque,
|
||||
(uint8_t *)*psk, *psk_len, psk_len );
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue