Kenji Arai / mbed-os_TYBLE16

Dependents:   TYBLE16_simple_data_logger TYBLE16_MP3_Air

Embed: (wiki syntax)

« Back to documentation index

crypto.h File Reference

crypto.h File Reference

Platform Security Architecture cryptography module. More...

Go to the source code of this file.

Typedefs

typedef _unsigned_integral_type_ psa_key_handle_t
 Key handle.
typedef struct psa_hash_operation_s psa_hash_operation_t
 The type of the state data structure for multipart hash operations.
typedef struct psa_mac_operation_s psa_mac_operation_t
 The type of the state data structure for multipart MAC operations.
typedef struct
psa_cipher_operation_s 
psa_cipher_operation_t
 The type of the state data structure for multipart cipher operations.
typedef struct psa_aead_operation_s psa_aead_operation_t
 The type of the state data structure for multipart AEAD operations.
typedef struct psa_key_derivation_s psa_key_derivation_operation_t
 The type of the state data structure for key derivation operations.

Functions

psa_status_t psa_crypto_init (void)
 Library initialization.
static psa_key_attributes_t psa_key_attributes_init (void)
 Return an initial value for a key attributes structure.
static void psa_set_key_id (psa_key_attributes_t *attributes, psa_key_id_t id)
 Declare a key as persistent and set its key identifier.
static void psa_set_key_lifetime (psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime)
 Set the location of a persistent key.
static psa_key_id_t psa_get_key_id (const psa_key_attributes_t *attributes)
 Retrieve the key identifier from key attributes.
static psa_key_lifetime_t psa_get_key_lifetime (const psa_key_attributes_t *attributes)
 Retrieve the lifetime from key attributes.
static void psa_set_key_usage_flags (psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
 Declare usage flags for a key.
static psa_key_usage_t psa_get_key_usage_flags (const psa_key_attributes_t *attributes)
 Retrieve the usage flags from key attributes.
static void psa_set_key_algorithm (psa_key_attributes_t *attributes, psa_algorithm_t alg)
 Declare the permitted algorithm policy for a key.
static psa_algorithm_t psa_get_key_algorithm (const psa_key_attributes_t *attributes)
 Retrieve the algorithm policy from key attributes.
static void psa_set_key_type (psa_key_attributes_t *attributes, psa_key_type_t type)
 Declare the type of a key.
static void psa_set_key_bits (psa_key_attributes_t *attributes, size_t bits)
 Declare the size of a key.
static psa_key_type_t psa_get_key_type (const psa_key_attributes_t *attributes)
 Retrieve the key type from key attributes.
static size_t psa_get_key_bits (const psa_key_attributes_t *attributes)
 Retrieve the key size from key attributes.
psa_status_t psa_get_key_attributes (psa_key_handle_t handle, psa_key_attributes_t *attributes)
 Retrieve the attributes of a key.
void psa_reset_key_attributes (psa_key_attributes_t *attributes)
 Reset a key attribute structure to a freshly initialized state.
psa_status_t psa_open_key (psa_key_id_t id, psa_key_handle_t *handle)
 Open a handle to an existing persistent key.
psa_status_t psa_close_key (psa_key_handle_t handle)
 Close a key handle.
psa_status_t psa_copy_key (psa_key_handle_t source_handle, const psa_key_attributes_t *attributes, psa_key_handle_t *target_handle)
 Make a copy of a key.
psa_status_t psa_destroy_key (psa_key_handle_t handle)
 Destroy a key.
psa_status_t psa_import_key (const psa_key_attributes_t *attributes, const uint8_t *data, size_t data_length, psa_key_handle_t *handle)
 Import a key in binary format.
psa_status_t psa_export_key (psa_key_handle_t handle, uint8_t *data, size_t data_size, size_t *data_length)
 Export a key in binary format.
psa_status_t psa_export_public_key (psa_key_handle_t handle, uint8_t *data, size_t data_size, size_t *data_length)
 Export a public key or the public part of a key pair in binary format.
psa_status_t psa_hash_compute (psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *hash, size_t hash_size, size_t *hash_length)
 Calculate the hash (digest) of a message.
psa_status_t psa_hash_compare (psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *hash, const size_t hash_length)
 Calculate the hash (digest) of a message and compare it with a reference value.
static psa_hash_operation_t psa_hash_operation_init (void)
 Return an initial value for a hash operation object.
psa_status_t psa_hash_setup (psa_hash_operation_t *operation, psa_algorithm_t alg)
 Set up a multipart hash operation.
psa_status_t psa_hash_update (psa_hash_operation_t *operation, const uint8_t *input, size_t input_length)
 Add a message fragment to a multipart hash operation.
psa_status_t psa_hash_finish (psa_hash_operation_t *operation, uint8_t *hash, size_t hash_size, size_t *hash_length)
 Finish the calculation of the hash of a message.
psa_status_t psa_hash_verify (psa_hash_operation_t *operation, const uint8_t *hash, size_t hash_length)
 Finish the calculation of the hash of a message and compare it with an expected value.
psa_status_t psa_hash_abort (psa_hash_operation_t *operation)
 Abort a hash operation.
psa_status_t psa_hash_clone (const psa_hash_operation_t *source_operation, psa_hash_operation_t *target_operation)
 Clone a hash operation.
psa_status_t psa_mac_compute (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *mac, size_t mac_size, size_t *mac_length)
 Calculate the MAC (message authentication code) of a message.
psa_status_t psa_mac_verify (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *mac, const size_t mac_length)
 Calculate the MAC of a message and compare it with a reference value.
static psa_mac_operation_t psa_mac_operation_init (void)
 Return an initial value for a MAC operation object.
psa_status_t psa_mac_sign_setup (psa_mac_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
 Set up a multipart MAC calculation operation.
psa_status_t psa_mac_verify_setup (psa_mac_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
 Set up a multipart MAC verification operation.
psa_status_t psa_mac_update (psa_mac_operation_t *operation, const uint8_t *input, size_t input_length)
 Add a message fragment to a multipart MAC operation.
psa_status_t psa_mac_sign_finish (psa_mac_operation_t *operation, uint8_t *mac, size_t mac_size, size_t *mac_length)
 Finish the calculation of the MAC of a message.
psa_status_t psa_mac_verify_finish (psa_mac_operation_t *operation, const uint8_t *mac, size_t mac_length)
 Finish the calculation of the MAC of a message and compare it with an expected value.
psa_status_t psa_mac_abort (psa_mac_operation_t *operation)
 Abort a MAC operation.
psa_status_t psa_cipher_encrypt (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
 Encrypt a message using a symmetric cipher.
psa_status_t psa_cipher_decrypt (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
 Decrypt a message using a symmetric cipher.
static psa_cipher_operation_t psa_cipher_operation_init (void)
 Return an initial value for a cipher operation object.
psa_status_t psa_cipher_encrypt_setup (psa_cipher_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
 Set the key for a multipart symmetric encryption operation.
psa_status_t psa_cipher_decrypt_setup (psa_cipher_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
 Set the key for a multipart symmetric decryption operation.
psa_status_t psa_cipher_generate_iv (psa_cipher_operation_t *operation, uint8_t *iv, size_t iv_size, size_t *iv_length)
 Generate an IV for a symmetric encryption operation.
psa_status_t psa_cipher_set_iv (psa_cipher_operation_t *operation, const uint8_t *iv, size_t iv_length)
 Set the IV for a symmetric encryption or decryption operation.
psa_status_t psa_cipher_update (psa_cipher_operation_t *operation, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
 Encrypt or decrypt a message fragment in an active cipher operation.
psa_status_t psa_cipher_finish (psa_cipher_operation_t *operation, uint8_t *output, size_t output_size, size_t *output_length)
 Finish encrypting or decrypting a message in a cipher operation.
psa_status_t psa_cipher_abort (psa_cipher_operation_t *operation)
 Abort a cipher operation.
psa_status_t psa_aead_encrypt (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *nonce, size_t nonce_length, const uint8_t *additional_data, size_t additional_data_length, const uint8_t *plaintext, size_t plaintext_length, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length)
 Process an authenticated encryption operation.
psa_status_t psa_aead_decrypt (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *nonce, size_t nonce_length, const uint8_t *additional_data, size_t additional_data_length, const uint8_t *ciphertext, size_t ciphertext_length, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length)
 Process an authenticated decryption operation.
static psa_aead_operation_t psa_aead_operation_init (void)
 Return an initial value for an AEAD operation object.
psa_status_t psa_aead_encrypt_setup (psa_aead_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
 Set the key for a multipart authenticated encryption operation.
psa_status_t psa_aead_decrypt_setup (psa_aead_operation_t *operation, psa_key_handle_t handle, psa_algorithm_t alg)
 Set the key for a multipart authenticated decryption operation.
psa_status_t psa_aead_generate_nonce (psa_aead_operation_t *operation, uint8_t *nonce, size_t nonce_size, size_t *nonce_length)
 Generate a random nonce for an authenticated encryption operation.
psa_status_t psa_aead_set_nonce (psa_aead_operation_t *operation, const uint8_t *nonce, size_t nonce_length)
 Set the nonce for an authenticated encryption or decryption operation.
psa_status_t psa_aead_set_lengths (psa_aead_operation_t *operation, size_t ad_length, size_t plaintext_length)
 Declare the lengths of the message and additional data for AEAD.
psa_status_t psa_aead_update_ad (psa_aead_operation_t *operation, const uint8_t *input, size_t input_length)
 Pass additional data to an active AEAD operation.
psa_status_t psa_aead_update (psa_aead_operation_t *operation, const uint8_t *input, size_t input_length, uint8_t *output, size_t output_size, size_t *output_length)
 Encrypt or decrypt a message fragment in an active AEAD operation.
psa_status_t psa_aead_finish (psa_aead_operation_t *operation, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length, uint8_t *tag, size_t tag_size, size_t *tag_length)
 Finish encrypting a message in an AEAD operation.
psa_status_t psa_aead_verify (psa_aead_operation_t *operation, uint8_t *plaintext, size_t plaintext_size, size_t *plaintext_length, const uint8_t *tag, size_t tag_length)
 Finish authenticating and decrypting a message in an AEAD operation.
psa_status_t psa_aead_abort (psa_aead_operation_t *operation)
 Abort an AEAD operation.
psa_status_t psa_asymmetric_sign (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Sign a hash or short message with a private key.
psa_status_t psa_asymmetric_verify (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length)
 Verify the signature a hash or short message using a public key.
psa_status_t psa_asymmetric_encrypt (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *salt, size_t salt_length, uint8_t *output, size_t output_size, size_t *output_length)
 Encrypt a short message with a public key.
psa_status_t psa_asymmetric_decrypt (psa_key_handle_t handle, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *salt, size_t salt_length, uint8_t *output, size_t output_size, size_t *output_length)
 Decrypt a short message with a private key.
static
psa_key_derivation_operation_t 
psa_key_derivation_operation_init (void)
 Return an initial value for a key derivation operation object.
psa_status_t psa_key_derivation_setup (psa_key_derivation_operation_t *operation, psa_algorithm_t alg)
 Set up a key derivation operation.
psa_status_t psa_key_derivation_get_capacity (const psa_key_derivation_operation_t *operation, size_t *capacity)
 Retrieve the current capacity of a key derivation operation.
psa_status_t psa_key_derivation_set_capacity (psa_key_derivation_operation_t *operation, size_t capacity)
 Set the maximum capacity of a key derivation operation.
psa_status_t psa_key_derivation_input_bytes (psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, const uint8_t *data, size_t data_length)
 Provide an input for key derivation or key agreement.
psa_status_t psa_key_derivation_input_key (psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, psa_key_handle_t handle)
 Provide an input for key derivation in the form of a key.
psa_status_t psa_key_derivation_key_agreement (psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, psa_key_handle_t private_key, const uint8_t *peer_key, size_t peer_key_length)
 Perform a key agreement and use the shared secret as input to a key derivation.
psa_status_t psa_key_derivation_output_bytes (psa_key_derivation_operation_t *operation, uint8_t *output, size_t output_length)
 Read some data from a key derivation operation.
psa_status_t psa_key_derivation_output_key (const psa_key_attributes_t *attributes, psa_key_derivation_operation_t *operation, psa_key_handle_t *handle)
 Derive a key from an ongoing key derivation operation.
psa_status_t psa_key_derivation_abort (psa_key_derivation_operation_t *operation)
 Abort a key derivation operation.
psa_status_t psa_raw_key_agreement (psa_algorithm_t alg, psa_key_handle_t private_key, const uint8_t *peer_key, size_t peer_key_length, uint8_t *output, size_t output_size, size_t *output_length)
 Perform a key agreement and return the raw shared secret.
psa_status_t psa_generate_random (uint8_t *output, size_t output_size)
 Generate random bytes.
psa_status_t psa_generate_key (const psa_key_attributes_t *attributes, psa_key_handle_t *handle)
 Generate a key or key pair.

Detailed Description

Platform Security Architecture cryptography module.

Definition in file crypto.h.