1
0
mirror of https://github.com/Mbed-TLS/mbedtls.git synced 2025-07-29 11:41:15 +03:00

Introduce PSA_KEY_HANDLE_INIT macro

Signed-off-by: Ronald Cron <ronald.cron@arm.com>
This commit is contained in:
Ronald Cron
2020-07-30 17:48:03 +02:00
parent 98a54ddbd6
commit 91e9515424
19 changed files with 145 additions and 141 deletions

View File

@ -543,7 +543,7 @@ static int ecdsa_verify_wrap( void *ctx_arg, mbedtls_md_type_t md_alg,
mbedtls_ecdsa_context *ctx = ctx_arg;
int ret = MBEDTLS_ERR_ERROR_CORRUPTION_DETECTED;
psa_key_attributes_t attributes = PSA_KEY_ATTRIBUTES_INIT;
psa_key_handle_t key_handle = 0;
psa_key_handle_t key_handle = PSA_KEY_HANDLE_INIT;
psa_status_t status;
mbedtls_pk_context key;
int key_len;

View File

@ -2185,7 +2185,7 @@ exit:
if( status != PSA_SUCCESS )
{
psa_fail_key_creation( slot, driver );
*handle = 0;
*handle = PSA_KEY_HANDLE_INIT;
}
return( status );
}
@ -2197,7 +2197,7 @@ psa_status_t mbedtls_psa_register_se_key(
psa_status_t status;
psa_key_slot_t *slot = NULL;
psa_se_drv_table_entry_t *driver = NULL;
psa_key_handle_t handle = 0;
psa_key_handle_t handle = PSA_KEY_HANDLE_INIT;
/* Leaving attributes unspecified is not currently supported.
* It could make sense to query the key type and size from the
@ -2290,7 +2290,7 @@ exit:
if( status != PSA_SUCCESS )
{
psa_fail_key_creation( target_slot, driver );
*target_handle = 0;
*target_handle = PSA_KEY_HANDLE_INIT;
}
return( status );
}
@ -5390,7 +5390,7 @@ psa_status_t psa_key_derivation_output_key( const psa_key_attributes_t *attribut
if( status != PSA_SUCCESS )
{
psa_fail_key_creation( slot, driver );
*handle = 0;
*handle = PSA_KEY_HANDLE_INIT;
}
return( status );
}
@ -6232,7 +6232,7 @@ exit:
if( status != PSA_SUCCESS )
{
psa_fail_key_creation( slot, driver );
*handle = 0;
*handle = PSA_KEY_HANDLE_INIT;
}
return( status );
}

View File

@ -245,13 +245,13 @@ psa_status_t psa_open_key( mbedtls_svc_key_id_t key, psa_key_handle_t *handle )
if( status != PSA_SUCCESS )
{
psa_wipe_key_slot( slot );
*handle = 0;
*handle = PSA_KEY_HANDLE_INIT;
}
return( status );
#else /* defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) */
(void) key;
*handle = 0;
*handle = PSA_KEY_HANDLE_INIT;
return( PSA_ERROR_NOT_SUPPORTED );
#endif /* !defined(MBEDTLS_PSA_CRYPTO_STORAGE_C) */
}

View File

@ -3802,7 +3802,7 @@ static int ssl_write_client_key_exchange( mbedtls_ssl_context *ssl )
status = psa_destroy_key( handshake->ecdh_psa_privkey );
if( status != PSA_SUCCESS )
return( MBEDTLS_ERR_SSL_HW_ACCEL_FAILED );
handshake->ecdh_psa_privkey = 0;
handshake->ecdh_psa_privkey = PSA_KEY_HANDLE_INIT;
}
else
#endif /* MBEDTLS_USE_PSA_CRYPTO &&

View File

@ -507,7 +507,7 @@ static int tls_prf_generic( mbedtls_md_type_t md_type,
{
psa_status_t status;
psa_algorithm_t alg;
psa_key_handle_t master_slot = 0;
psa_key_handle_t master_slot = PSA_KEY_HANDLE_INIT;
psa_key_derivation_operation_t derivation =
PSA_KEY_DERIVATION_OPERATION_INIT;
@ -4348,7 +4348,7 @@ static void ssl_conf_remove_psk( mbedtls_ssl_config *conf )
{
/* The maintenance of the PSK key slot is the
* user's responsibility. */
conf->psk_opaque = 0;
conf->psk_opaque = PSA_KEY_HANDLE_INIT;
}
/* This and the following branch should never
* be taken simultaenously as we maintain the
@ -4434,7 +4434,7 @@ static void ssl_remove_psk( mbedtls_ssl_context *ssl )
#if defined(MBEDTLS_USE_PSA_CRYPTO)
if( ssl->handshake->psk_opaque != 0 )
{
ssl->handshake->psk_opaque = 0;
ssl->handshake->psk_opaque = PSA_KEY_HANDLE_INIT;
}
else
#endif /* MBEDTLS_USE_PSA_CRYPTO */