Adapt to the new key allocation mechanism
This commit is contained in:
parent
9e0feff117
commit
c750932f2c
14 changed files with 65 additions and 79 deletions
|
@ -137,7 +137,7 @@ typedef enum
|
|||
typedef struct
|
||||
{
|
||||
psa_algorithm_t alg;
|
||||
psa_key_slot_t slot;
|
||||
psa_key_handle_t slot;
|
||||
mbedtls_cipher_psa_key_ownership slot_state;
|
||||
} mbedtls_cipher_context_psa;
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
|
|
@ -273,7 +273,7 @@ int mbedtls_pk_setup( mbedtls_pk_context *ctx, const mbedtls_pk_info_t *info );
|
|||
* ECC key pair.
|
||||
* \return #MBEDTLS_ERR_PK_ALLOC_FAILED on allocation failure.
|
||||
*/
|
||||
int mbedtls_pk_setup_opaque( mbedtls_pk_context *ctx, const psa_key_slot_t key );
|
||||
int mbedtls_pk_setup_opaque( mbedtls_pk_context *ctx, const psa_key_handle_t key );
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
#if defined(MBEDTLS_PK_RSA_ALT_SUPPORT)
|
||||
|
@ -761,7 +761,7 @@ int mbedtls_pk_load_file( const char *path, unsigned char **buf, size_t *n );
|
|||
* \return An Mbed TLS error code otherwise.
|
||||
*/
|
||||
int mbedtls_pk_wrap_as_opaque( mbedtls_pk_context *pk,
|
||||
psa_key_slot_t *slot,
|
||||
psa_key_handle_t *slot,
|
||||
psa_algorithm_t hash_alg );
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
|
|
|
@ -42,21 +42,6 @@
|
|||
#include "md.h"
|
||||
#include "pk.h"
|
||||
|
||||
/* Slot allocation */
|
||||
|
||||
static inline psa_status_t mbedtls_psa_get_free_key_slot( psa_key_slot_t *key )
|
||||
{
|
||||
for( psa_key_slot_t slot = 1; slot <= 32; slot++ )
|
||||
{
|
||||
if( psa_get_key_information( slot, NULL, NULL ) == PSA_ERROR_EMPTY_SLOT )
|
||||
{
|
||||
*key = slot;
|
||||
return( PSA_SUCCESS );
|
||||
}
|
||||
}
|
||||
return( PSA_ERROR_INSUFFICIENT_MEMORY );
|
||||
}
|
||||
|
||||
/* Translations for symmetric crypto. */
|
||||
|
||||
static inline psa_key_type_t mbedtls_psa_translate_cipher_type(
|
||||
|
|
|
@ -929,11 +929,11 @@ struct mbedtls_ssl_config
|
|||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
psa_key_slot_t psk_opaque; /*!< PSA key slot holding opaque PSK.
|
||||
* This field should only be set via
|
||||
* mbedtls_ssl_conf_psk_opaque().
|
||||
* If either no PSK or a raw PSK have
|
||||
* been configured, this has value \c 0. */
|
||||
psa_key_handle_t psk_opaque; /*!< PSA key slot holding opaque PSK.
|
||||
* This field should only be set via
|
||||
* mbedtls_ssl_conf_psk_opaque().
|
||||
* If either no PSK or a raw PSK have
|
||||
* been configured, this has value \c 0. */
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
unsigned char *psk; /*!< The raw pre-shared key. This field should
|
||||
|
@ -2144,7 +2144,7 @@ int mbedtls_ssl_conf_psk( mbedtls_ssl_config *conf,
|
|||
* \return An \c MBEDTLS_ERR_SSL_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_conf_psk_opaque( mbedtls_ssl_config *conf,
|
||||
psa_key_slot_t psk,
|
||||
psa_key_handle_t psk,
|
||||
const unsigned char *psk_identity,
|
||||
size_t psk_identity_len );
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
@ -2184,7 +2184,7 @@ int mbedtls_ssl_set_hs_psk( mbedtls_ssl_context *ssl,
|
|||
* \return An \c MBEDTLS_ERR_SSL_XXX error code on failure.
|
||||
*/
|
||||
int mbedtls_ssl_set_hs_psk_opaque( mbedtls_ssl_context *ssl,
|
||||
psa_key_slot_t psk );
|
||||
psa_key_handle_t psk );
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
/**
|
||||
|
|
|
@ -284,7 +284,7 @@ struct mbedtls_ssl_handshake_params
|
|||
#endif
|
||||
#if defined(MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED)
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
psa_key_slot_t psk_opaque; /*!< Opaque PSK from the callback */
|
||||
psa_key_handle_t psk_opaque; /*!< Opaque PSK from the callback */
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
unsigned char *psk; /*!< PSK from the callback */
|
||||
size_t psk_len; /*!< Length of PSK from callback */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue