Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

Secure Element Authenticated Encryption with Additional Data

Secure Element Authenticated Encryption with Additional Data

Authenticated Encryption with Additional Data (AEAD) operations with secure elements must be done in one function call. More...

Data Structures

struct  psa_drv_se_aead_t
 A struct containing all of the function pointers needed to implement secure element Authenticated Encryption with Additional Data operations. More...

Typedefs

typedef psa_status_t(* psa_drv_se_aead_encrypt_t )(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, const uint8_t *p_nonce, size_t nonce_length, const uint8_t *p_additional_data, size_t additional_data_length, const uint8_t *p_plaintext, size_t plaintext_length, uint8_t *p_ciphertext, size_t ciphertext_size, size_t *p_ciphertext_length)
 A function that performs a secure element authenticated encryption operation.
typedef psa_status_t(* psa_drv_se_aead_decrypt_t )(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, const uint8_t *p_nonce, size_t nonce_length, const uint8_t *p_additional_data, size_t additional_data_length, const uint8_t *p_ciphertext, size_t ciphertext_length, uint8_t *p_plaintext, size_t plaintext_size, size_t *p_plaintext_length)
 A function that peforms a secure element authenticated decryption operation.

Detailed Description

Authenticated Encryption with Additional Data (AEAD) operations with secure elements must be done in one function call.

While this creates a burden for implementers as there must be sufficient space in memory for the entire message, it prevents decrypted data from being made available before the authentication operation is complete and the data is known to be authentic.


Typedef Documentation

typedef psa_status_t(* psa_drv_se_aead_decrypt_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, const uint8_t *p_nonce, size_t nonce_length, const uint8_t *p_additional_data, size_t additional_data_length, const uint8_t *p_ciphertext, size_t ciphertext_length, uint8_t *p_plaintext, size_t plaintext_size, size_t *p_plaintext_length)

A function that peforms a secure element authenticated decryption operation.

Parameters:
[in,out]drv_contextThe driver context structure.
[in]key_slotSlot containing the key to use
[in]algorithmThe AEAD algorithm to compute (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(`alg`) is true)
[in]p_nonceNonce or IV to use
[in]nonce_lengthSize of the `p_nonce` buffer in bytes
[in]p_additional_dataAdditional data that has been authenticated but not encrypted
[in]additional_data_lengthSize of `p_additional_data` in bytes
[in]p_ciphertextData that has been authenticated and encrypted. For algorithms where the encrypted data and the authentication tag are defined as separate inputs, the buffer must contain the encrypted data followed by the authentication tag.
[in]ciphertext_lengthSize of `p_ciphertext` in bytes
[out]p_plaintextOutput buffer for the decrypted data
[in]plaintext_sizeSize of the `p_plaintext` buffer in bytes
[out]p_plaintext_lengthOn success, the size of the output in the `p_plaintext` buffer
Return values:
PSA_SUCCESSSuccess.

Definition at line 775 of file crypto_se_driver.h.

typedef psa_status_t(* psa_drv_se_aead_encrypt_t)(psa_drv_se_context_t *drv_context, psa_key_slot_number_t key_slot, psa_algorithm_t algorithm, const uint8_t *p_nonce, size_t nonce_length, const uint8_t *p_additional_data, size_t additional_data_length, const uint8_t *p_plaintext, size_t plaintext_length, uint8_t *p_ciphertext, size_t ciphertext_size, size_t *p_ciphertext_length)

A function that performs a secure element authenticated encryption operation.

Parameters:
[in,out]drv_contextThe driver context structure.
[in]key_slotSlot containing the key to use.
[in]algorithmThe AEAD algorithm to compute (PSA_ALG_XXX value such that PSA_ALG_IS_AEAD(`alg`) is true)
[in]p_nonceNonce or IV to use
[in]nonce_lengthSize of the `p_nonce` buffer in bytes
[in]p_additional_dataAdditional data that will be authenticated but not encrypted
[in]additional_data_lengthSize of `p_additional_data` in bytes
[in]p_plaintextData that will be authenticated and encrypted
[in]plaintext_lengthSize of `p_plaintext` in bytes
[out]p_ciphertextOutput buffer for the authenticated and encrypted data. The additional data is not part of this output. For algorithms where the encrypted data and the authentication tag are defined as separate outputs, the authentication tag is appended to the encrypted data.
[in]ciphertext_sizeSize of the `p_ciphertext` buffer in bytes
[out]p_ciphertext_lengthOn success, the size of the output in the `p_ciphertext` buffer
Return values:
PSA_SUCCESSSuccess.

Definition at line 733 of file crypto_se_driver.h.