mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-08-01 10:06:53 +03:00
Use enum for slot state in PSA-based cipher context
This commit is contained in:
@ -119,14 +119,26 @@ typedef struct
|
||||
} mbedtls_cipher_definition_t;
|
||||
|
||||
#if defined(MBEDTLS_USE_PSA_CRYPTO)
|
||||
typedef enum
|
||||
{
|
||||
MBEDTLS_CIPHER_PSA_KEY_UNSET = 0,
|
||||
MBEDTLS_CIPHER_PSA_KEY_OWNED, /* Used for PSA-based cipher contexts
|
||||
* which use raw key material internally
|
||||
* imported into a freshly allocated key slot,
|
||||
* and which hence need to destroy that key
|
||||
* slot when they are no longer needed. */
|
||||
MBEDTLS_CIPHER_PSA_KEY_NOT_OWNED, /* Used for PSA-based cipher contexts
|
||||
* which use a key from a key slot
|
||||
* provided by the user, and which hence
|
||||
* should not be destroyed when the
|
||||
* context is no longer needed. */
|
||||
} mbedtls_cipher_psa_key_ownership;
|
||||
|
||||
typedef struct
|
||||
{
|
||||
psa_algorithm_t alg;
|
||||
psa_key_slot_t slot;
|
||||
unsigned char slot_state; /*!< 0: The slot is unset.
|
||||
* 1: The slot is set and we own it.
|
||||
* 2: The slot is set but we don't own it. */
|
||||
|
||||
mbedtls_cipher_psa_key_ownership slot_state;
|
||||
} mbedtls_cipher_context_psa;
|
||||
#endif /* MBEDTLS_USE_PSA_CRYPTO */
|
||||
|
||||
|
Reference in New Issue
Block a user