SharkSSL C/C++ Reference
TLS, cryptography, certificates, and PSA integration
SharkSSL PSA provider APIs

Detailed Description

The supplied PSA implementation and its storage/driver integration.

See SharkSSL PSA Crypto provider.

Files

file  crypto.h
 See Choose a SharkSSL API for build scope and the owning API layer.
 
file  SharkSslPSADriver.h
 See Choose a SharkSSL API for build scope and the owning API layer.
 
file  SharkSslPSAFileStorage.h
 See Choose a SharkSSL API for build scope and the owning API layer.
 
file  SharkSslPSAStorage.h
 See Choose a SharkSSL API for build scope and the owning API layer.
 

Functions

psa_status_t psa_crypto_init (void)
 Initialize the provider random source. More...
 
psa_status_t psa_generate_random (uint8_t *output, size_t output_size)
 Fill a caller buffer from the provider random source. More...
 
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)
 Compute a complete SHA-256, SHA-384 or SHA-512 digest. More...
 
psa_status_t psa_hash_compare (psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *hash, size_t hash_length)
 Hash input and compare it with an expected digest. More...
 
psa_hash_operation_t psa_hash_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_hash_setup (psa_hash_operation_t *operation, psa_algorithm_t alg)
 Start an enabled SHA-256/384/512 operation. More...
 
psa_status_t psa_hash_update (psa_hash_operation_t *operation, const uint8_t *input, size_t input_length)
 Append bytes to an active hash operation. More...
 
psa_status_t psa_hash_finish (psa_hash_operation_t *operation, uint8_t *hash, size_t hash_size, size_t *hash_length)
 Finish an active hash and write its complete digest. More...
 
psa_status_t psa_hash_verify (psa_hash_operation_t *operation, const uint8_t *hash, size_t hash_length)
 Finish a hash and compare its digest with the expected bytes. More...
 
psa_status_t psa_hash_abort (psa_hash_operation_t *operation)
 Clear a hash operation, whether active or inactive. More...
 
psa_status_t psa_hash_suspend (psa_hash_operation_t *operation, uint8_t *hash_state, size_t hash_state_size, size_t *hash_state_length)
 Serialize an active hash state and make the operation inactive. More...
 
psa_status_t psa_hash_resume (psa_hash_operation_t *operation, const uint8_t *hash_state, size_t hash_state_length)
 Restore a supported serialized hash into an inactive operation. More...
 
psa_status_t psa_hash_clone (const psa_hash_operation_t *source_operation, psa_hash_operation_t *target_operation)
 Clone an active hash into a distinct inactive operation. More...
 
psa_mac_operation_t psa_mac_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_mac_compute (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *mac, size_t mac_size, size_t *mac_length)
 Compute a one-shot HMAC using a borrowed key handle. More...
 
psa_status_t psa_mac_verify (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *mac, size_t mac_length)
 Verify a one-shot HMAC using a borrowed key handle. More...
 
psa_status_t psa_mac_sign_setup (psa_mac_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start a multipart HMAC signing operation. More...
 
psa_status_t psa_mac_verify_setup (psa_mac_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start a multipart HMAC verification operation. More...
 
psa_status_t psa_mac_update (psa_mac_operation_t *operation, const uint8_t *input, size_t input_length)
 Append message bytes to an active HMAC operation. More...
 
psa_status_t psa_mac_sign_finish (psa_mac_operation_t *operation, uint8_t *mac, size_t mac_size, size_t *mac_length)
 Complete an HMAC signing operation and release its key dependency. More...
 
psa_status_t psa_mac_verify_finish (psa_mac_operation_t *operation, const uint8_t *mac, size_t mac_length)
 Complete HMAC verification and release operation resources. More...
 
psa_status_t psa_mac_abort (psa_mac_operation_t *operation)
 Abort an HMAC operation and release its key dependency. More...
 
psa_status_t psa_aead_encrypt (psa_key_id_t key, 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)
 Encrypt and authenticate a complete message, appending the tag. More...
 
psa_status_t psa_aead_decrypt (psa_key_id_t key, 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)
 Authenticate and decrypt a complete ciphertext with its appended tag. More...
 
psa_aead_operation_t psa_aead_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_aead_encrypt_setup (psa_aead_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start multipart authenticated encryption. More...
 
psa_status_t psa_aead_decrypt_setup (psa_aead_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start multipart authenticated decryption. More...
 
psa_status_t psa_aead_set_lengths (psa_aead_operation_t *operation, size_t ad_length, size_t plaintext_length)
 Declare total AAD and plaintext lengths before setting a nonce. More...
 
psa_status_t psa_aead_generate_nonce (psa_aead_operation_t *operation, uint8_t *nonce, size_t nonce_size, size_t *nonce_length)
 Generate and install a nonce for an encryption operation. More...
 
psa_status_t psa_aead_set_nonce (psa_aead_operation_t *operation, const uint8_t *nonce, size_t nonce_length)
 Install the nonce before AAD or payload processing. More...
 
psa_status_t psa_aead_update_ad (psa_aead_operation_t *operation, const uint8_t *input, size_t input_length)
 Append additional authenticated data before any payload update. More...
 
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)
 Process a fragment of AEAD payload. More...
 
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 authenticated encryption and write the separate tag. More...
 
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 authenticated decryption and verify the separate tag. More...
 
psa_status_t psa_aead_abort (psa_aead_operation_t *operation)
 Abort AEAD and release its key dependency and operation secrets. More...
 
psa_cipher_operation_t psa_cipher_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_cipher_encrypt_setup (psa_cipher_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start multipart AES encryption. More...
 
psa_status_t psa_cipher_decrypt_setup (psa_cipher_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start multipart AES decryption. More...
 
psa_status_t psa_cipher_generate_iv (psa_cipher_operation_t *operation, uint8_t *iv, size_t iv_size, size_t *iv_length)
 Generate and install a 16-byte IV for CBC/CTR encryption. More...
 
psa_status_t psa_cipher_set_iv (psa_cipher_operation_t *operation, const uint8_t *iv, size_t iv_length)
 Install a borrowed 16-byte CBC/CTR IV. More...
 
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)
 Process the next cipher fragment. More...
 
psa_status_t psa_cipher_finish (psa_cipher_operation_t *operation, uint8_t *output, size_t output_size, size_t *output_length)
 Finish a multipart cipher operation. More...
 
psa_status_t psa_cipher_abort (psa_cipher_operation_t *operation)
 Abort a cipher operation and release its key dependency. More...
 
psa_status_t psa_cipher_encrypt (psa_key_id_t key, 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 complete input, prefixing a generated IV for CBC/CTR. More...
 
psa_status_t psa_cipher_decrypt (psa_key_id_t key, 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 complete input including its CBC/CTR IV prefix. More...
 
psa_key_attributes_t psa_key_attributes_init (void)
 Return initialized inactive key-attribute storage. More...
 
void psa_reset_key_attributes (psa_key_attributes_t *attributes)
 Reset caller-owned attributes to their empty defaults. More...
 
void psa_set_key_type (psa_key_attributes_t *attributes, psa_key_type_t type)
 Set the type field in caller-owned key attributes. More...
 
psa_key_type_t psa_get_key_type (const psa_key_attributes_t *attributes)
 Read the type field in caller-owned key attributes. More...
 
void psa_set_key_bits (psa_key_attributes_t *attributes, size_t bits)
 Set the bits field in caller-owned key attributes. More...
 
size_t psa_get_key_bits (const psa_key_attributes_t *attributes)
 Read the bits field in caller-owned key attributes. More...
 
void psa_set_key_lifetime (psa_key_attributes_t *attributes, psa_key_lifetime_t lifetime)
 Set the lifetime field in caller-owned key attributes. More...
 
psa_key_lifetime_t psa_get_key_lifetime (const psa_key_attributes_t *attributes)
 Read the lifetime field in caller-owned key attributes. More...
 
void psa_set_key_id (psa_key_attributes_t *attributes, psa_key_id_t id)
 Set the id field in caller-owned key attributes. More...
 
psa_key_id_t psa_get_key_id (const psa_key_attributes_t *attributes)
 Read the id field in caller-owned key attributes. More...
 
void psa_set_key_usage_flags (psa_key_attributes_t *attributes, psa_key_usage_t usage_flags)
 Set the usage flags field in caller-owned key attributes. More...
 
psa_key_usage_t psa_get_key_usage_flags (const psa_key_attributes_t *attributes)
 Read the usage flags field in caller-owned key attributes. More...
 
void psa_set_key_algorithm (psa_key_attributes_t *attributes, psa_algorithm_t alg)
 Set the algorithm field in caller-owned key attributes. More...
 
psa_algorithm_t psa_get_key_algorithm (const psa_key_attributes_t *attributes)
 Read the algorithm field in caller-owned key attributes. More...
 
psa_status_t psa_get_key_attributes (psa_key_id_t key, psa_key_attributes_t *attributes)
 Copy a key handle's public attributes into caller storage. More...
 
psa_status_t psa_check_key_usage (psa_key_id_t key, psa_algorithm_t alg, psa_key_usage_t usage)
 Check one supported operation role against a key and its policy. More...
 
psa_status_t psa_import_key (const psa_key_attributes_t *attributes, const uint8_t *data, size_t data_length, psa_key_id_t *key)
 Import encoded key material under caller-selected attributes. More...
 
psa_status_t psa_attach_key (const psa_key_attributes_t *attributes, const uint8_t *label, size_t label_length, psa_key_id_t *key)
 Attach an opaque driver-provisioned volatile key. More...
 
psa_status_t psa_generate_key (const psa_key_attributes_t *attributes, psa_key_id_t *key)
 Generate a supported key under caller-selected attributes. More...
 
psa_status_t psa_generate_key_custom (const psa_key_attributes_t *attributes, const psa_custom_key_parameters_t *custom, const uint8_t *custom_data, size_t custom_data_length, psa_key_id_t *key)
 Generate a key with supported production parameters. More...
 
psa_status_t psa_copy_key (psa_key_id_t source_key, const psa_key_attributes_t *attributes, psa_key_id_t *target_key)
 Create a key copy with equal or narrower policy. More...
 
psa_status_t psa_export_key (psa_key_id_t key, uint8_t *data, size_t data_size, size_t *data_length)
 Export key material in its PSA encoding. More...
 
psa_status_t psa_wrap_key (psa_key_id_t wrapping_key, psa_algorithm_t alg, psa_key_id_t key, uint8_t *data, size_t data_size, size_t *data_length)
 Wrap an exportable key with AES-KW or AES-KWP. More...
 
psa_status_t psa_unwrap_key (const psa_key_attributes_t *attributes, psa_key_id_t wrapping_key, psa_algorithm_t alg, const uint8_t *data, size_t data_length, psa_key_id_t *key)
 Authenticate a wrapped key and import it under supplied attributes. More...
 
psa_status_t psa_export_public_key (psa_key_id_t key, uint8_t *data, size_t data_size, size_t *data_length)
 Export the public part of a supported asymmetric key. More...
 
psa_status_t psa_raw_key_agreement (psa_algorithm_t alg, psa_key_id_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 ECDH and return the raw shared secret bytes. More...
 
psa_status_t psa_key_agreement (psa_key_id_t private_key, const uint8_t *peer_key, size_t peer_key_length, psa_algorithm_t alg, const psa_key_attributes_t *attributes, psa_key_id_t *key)
 Perform ECDH and store the shared secret as a new key. More...
 
psa_status_t psa_encapsulate (psa_key_id_t key, psa_algorithm_t alg, const psa_key_attributes_t *attributes, psa_key_id_t *output_key, uint8_t *ciphertext, size_t ciphertext_size, size_t *ciphertext_length)
 Encapsulate a P-256 ECIES SEC1 shared secret into a new key. More...
 
psa_status_t psa_decapsulate (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *ciphertext, size_t ciphertext_length, const psa_key_attributes_t *attributes, psa_key_id_t *output_key)
 Recover a P-256 ECIES SEC1 shared secret into a new key. More...
 
psa_status_t psa_sign_message (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *input, size_t input_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Create a supported RSA/ECDSA signature over a message. More...
 
psa_status_t psa_sign_hash (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Create a supported RSA/ECDSA signature over a supplied digest. More...
 
psa_status_t psa_verify_message (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *signature, size_t signature_length)
 Verify a supported RSA/ECDSA signature over a message. More...
 
psa_status_t psa_verify_hash (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *signature, size_t signature_length)
 Verify a supported RSA/ECDSA signature over a supplied digest. More...
 
psa_status_t psa_sign_message_with_context (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *context, size_t context_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Create a supported RSA/ECDSA signature over a message with an explicit context argument. More...
 
psa_status_t psa_verify_message_with_context (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *input, size_t input_length, const uint8_t *context, size_t context_length, const uint8_t *signature, size_t signature_length)
 Verify a supported RSA/ECDSA signature over a message with an explicit context argument. More...
 
psa_status_t psa_sign_hash_with_context (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *context, size_t context_length, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Create a supported RSA/ECDSA signature over a supplied digest with an explicit context argument. More...
 
psa_status_t psa_verify_hash_with_context (psa_key_id_t key, psa_algorithm_t alg, const uint8_t *hash, size_t hash_length, const uint8_t *context, size_t context_length, const uint8_t *signature, size_t signature_length)
 Verify a supported RSA/ECDSA signature over a supplied digest with an explicit context argument. More...
 
psa_sign_operation_t psa_sign_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_sign_setup (psa_sign_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg)
 Start a multipart message-signature creation operation. More...
 
psa_status_t psa_sign_set_context (psa_sign_operation_t *operation, const uint8_t *context, size_t context_length)
 Set the multipart signature context before any message update. More...
 
psa_status_t psa_sign_update (psa_sign_operation_t *operation, const uint8_t *input, size_t input_length)
 Append a message fragment to multipart signature processing. More...
 
psa_status_t psa_sign_finish (psa_sign_operation_t *operation, uint8_t *signature, size_t signature_size, size_t *signature_length)
 Complete multipart message-signature creation. More...
 
psa_status_t psa_sign_abort (psa_sign_operation_t *operation)
 Abort a multipart signature creation operation. More...
 
psa_verify_operation_t psa_verify_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_verify_setup (psa_verify_operation_t *operation, psa_key_id_t key, psa_algorithm_t alg, const uint8_t *signature, size_t signature_length)
 Start a multipart message-signature verification operation. More...
 
psa_status_t psa_verify_set_context (psa_verify_operation_t *operation, const uint8_t *context, size_t context_length)
 Set the multipart signature context before any message update. More...
 
psa_status_t psa_verify_update (psa_verify_operation_t *operation, const uint8_t *input, size_t input_length)
 Append a message fragment for multipart signature verification. More...
 
psa_status_t psa_verify_finish (psa_verify_operation_t *operation)
 Complete multipart message-signature verification. More...
 
psa_status_t psa_verify_abort (psa_verify_operation_t *operation)
 Abort a multipart signature verification operation. More...
 
psa_status_t psa_asymmetric_encrypt (psa_key_id_t key, 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 RSA-OAEP or RSAES-PKCS1-v1_5. More...
 
psa_status_t psa_asymmetric_decrypt (psa_key_id_t key, 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 padded RSA ciphertext with a private key. More...
 
psa_status_t psa_destroy_key (psa_key_id_t key)
 Destroy a volatile key or remove a locally persistent key. More...
 
psa_status_t psa_purge_key (psa_key_id_t key)
 Evict a persistent key from the in-memory cache without deleting its stored record. More...
 
psa_key_derivation_operation_t psa_key_derivation_operation_init (void)
 Return initialized inactive operation storage. More...
 
psa_status_t psa_key_derivation_setup (psa_key_derivation_operation_t *operation, psa_algorithm_t alg)
 Start a supported derivation operation. More...
 
psa_status_t psa_key_derivation_get_capacity (const psa_key_derivation_operation_t *operation, size_t *capacity)
 Read the number of derivation output bytes still available. More...
 
psa_status_t psa_key_derivation_set_capacity (psa_key_derivation_operation_t *operation, size_t capacity)
 Reduce the remaining derivation output capacity. More...
 
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)
 Supply borrowed bytes for the next derivation input step. More...
 
psa_status_t psa_key_derivation_input_key (psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, psa_key_id_t key)
 Supply a key handle for a derivation input step. More...
 
psa_status_t psa_key_derivation_key_agreement (psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, psa_key_id_t private_key, const uint8_t *peer_key, size_t peer_key_length)
 Feed ECDH directly into a combined ECDH/KDF operation. More...
 
psa_status_t psa_key_derivation_input_integer (psa_key_derivation_operation_t *operation, psa_key_derivation_step_t step, uint64_t value)
 Supply an integer derivation parameter. More...
 
psa_status_t psa_key_derivation_output_bytes (psa_key_derivation_operation_t *operation, uint8_t *output, size_t output_length)
 Read and consume the next derived bytes. More...
 
psa_status_t psa_key_derivation_output_key (const psa_key_attributes_t *attributes, psa_key_derivation_operation_t *operation, psa_key_id_t *key)
 Create a key from the next derived bytes. More...
 
psa_status_t psa_key_derivation_output_key_custom (const psa_key_attributes_t *attributes, psa_key_derivation_operation_t *operation, const psa_custom_key_parameters_t *custom, const uint8_t *custom_data, size_t custom_data_length, psa_key_id_t *key)
 Create a derived key with default production parameters. More...
 
psa_status_t psa_key_derivation_verify_bytes (psa_key_derivation_operation_t *operation, const uint8_t *expected_output, size_t output_length)
 Consume derived bytes and compare them with expected bytes. More...
 
psa_status_t psa_key_derivation_verify_key (psa_key_derivation_operation_t *operation, psa_key_id_t expected)
 Compare derived bytes with a PASSWORD_HASH key. More...
 
psa_status_t psa_key_derivation_abort (psa_key_derivation_operation_t *operation)
 Clear derivation secrets and release all key dependencies. More...
 

Function Documentation

◆ psa_aead_abort()

psa_status_t psa_aead_abort ( psa_aead_operation_t *  operation)

Abort AEAD and release its key dependency and operation secrets.

Does not erase plaintext already returned to application buffers. Accepts an initialized inactive operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_decrypt()

psa_status_t psa_aead_decrypt ( psa_key_id_t  key,
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 
)

Authenticate and decrypt a complete ciphertext with its appended tag.

Requires DECRYPT permission. Ciphertext length includes the tag; allow at least ciphertext length minus tag length for output. Plaintext is copied out only on successful authentication; mismatch returns PSA_ERROR_INVALID_SIGNATURE. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
nonceconst uint8_t *; Nonce buffer, caller-owned output for generation or borrowed input otherwise. Length must match the selected AEAD algorithm.
nonce_lengthsize_t; Input/requested byte count for nonce, subject to the algorithm limits above.
additional_dataconst uint8_t *; Borrowed AAD bytes; may be NULL only when additional_data_length is 0.
additional_data_lengthsize_t; Input/requested byte count for additional data, subject to the algorithm limits above.
ciphertextconst uint8_t *; Ciphertext buffer: caller-owned output on encryption/encapsulation, borrowed input on decryption/decapsulation. Single-part AEAD includes the appended tag; multipart uses a separate tag.
ciphertext_lengthsize_t; Input/requested byte count for ciphertext, subject to the algorithm limits above.
plaintextuint8_t *; Plaintext buffer: borrowed input on encryption, caller-owned output on decryption. Do not use tentative multipart output until verification succeeds.
plaintext_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
plaintext_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_decrypt_setup()

psa_status_t psa_aead_decrypt_setup ( psa_aead_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start multipart authenticated decryption.

Requires an inactive initialized operation and DECRYPT permission. Keep all update output confidential and tentative until verify succeeds; discard it on failure. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_encrypt()

psa_status_t psa_aead_encrypt ( psa_key_id_t  key,
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 
)

Encrypt and authenticate a complete message, appending the tag.

Requires ENCRYPT permission. Supports AES-GCM, AES-CCM and ChaCha20-Poly1305 as configured; see the provider guide for nonce, tag and payload limits. Allow plaintext length plus tag length in the output. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
nonceconst uint8_t *; Nonce buffer, caller-owned output for generation or borrowed input otherwise. Length must match the selected AEAD algorithm.
nonce_lengthsize_t; Input/requested byte count for nonce, subject to the algorithm limits above.
additional_dataconst uint8_t *; Borrowed AAD bytes; may be NULL only when additional_data_length is 0.
additional_data_lengthsize_t; Input/requested byte count for additional data, subject to the algorithm limits above.
plaintextconst uint8_t *; Plaintext buffer: borrowed input on encryption, caller-owned output on decryption. Do not use tentative multipart output until verification succeeds.
plaintext_lengthsize_t; Input/requested byte count for plaintext, subject to the algorithm limits above.
ciphertextuint8_t *; Ciphertext buffer: caller-owned output on encryption/encapsulation, borrowed input on decryption/decapsulation. Single-part AEAD includes the appended tag; multipart uses a separate tag.
ciphertext_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
ciphertext_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_encrypt_setup()

psa_status_t psa_aead_encrypt_setup ( psa_aead_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start multipart authenticated encryption.

Requires an inactive initialized operation and ENCRYPT permission. Set lengths before the nonce, then supply all AAD before payload. The operation retains a key dependency. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_finish()

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 authenticated encryption and write the separate tag.

No residual ciphertext is emitted by this provider. Tag capacity must hold the selected tag length. Success clears operation resources; abort after failure. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
ciphertextuint8_t *; Ciphertext buffer: caller-owned output on encryption/encapsulation, borrowed input on decryption/decapsulation. Single-part AEAD includes the appended tag; multipart uses a separate tag.
ciphertext_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
ciphertext_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
taguint8_t *; Separate authentication tag; caller-owned output for finish or borrowed expected bytes for verify.
tag_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
tag_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_generate_nonce()

psa_status_t psa_aead_generate_nonce ( psa_aead_operation_t *  operation,
uint8_t *  nonce,
size_t  nonce_size,
size_t *  nonce_length 
)

Generate and install a nonce for an encryption operation.

GCM and ChaCha20-Poly1305 use 12 bytes. CCM chooses 11-13 bytes from the declared payload length. Call after any required set_lengths and before AAD/payload. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
nonceuint8_t *; Nonce buffer, caller-owned output for generation or borrowed input otherwise. Length must match the selected AEAD algorithm.
nonce_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
nonce_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_operation_init()

psa_aead_operation_t psa_aead_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_aead_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_aead_set_lengths()

psa_status_t psa_aead_set_lengths ( psa_aead_operation_t *  operation,
size_t  ad_length,
size_t  plaintext_length 
)

Declare total AAD and plaintext lengths before setting a nonce.

Mandatory for CCM, optional for GCM and ChaCha20-Poly1305. Declared lengths are enforced. AAD is limited to 65535 bytes; further algorithm limits are in the provider guide. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
ad_lengthsize_t; Declared total additional authenticated data length in bytes, at most 65535.
plaintext_lengthsize_t; Input/requested byte count for plaintext, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_set_nonce()

psa_status_t psa_aead_set_nonce ( psa_aead_operation_t *  operation,
const uint8_t *  nonce,
size_t  nonce_length 
)

Install the nonce before AAD or payload processing.

GCM and ChaCha20-Poly1305 require 12 bytes; CCM accepts 7-13 and requires lengths first. Never reuse an encryption nonce with the same key. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
nonceconst uint8_t *; Nonce buffer, caller-owned output for generation or borrowed input otherwise. Length must match the selected AEAD algorithm.
nonce_lengthsize_t; Input/requested byte count for nonce, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_update()

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 
)

Process a fragment of AEAD payload.

This provider writes one output byte per input byte. Exact in-place or disjoint buffers are supported; partial overlap is rejected. Decryption output is unauthenticated until psa_aead_verify succeeds. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_update_ad()

psa_status_t psa_aead_update_ad ( psa_aead_operation_t *  operation,
const uint8_t *  input,
size_t  input_length 
)

Append additional authenticated data before any payload update.

Even a zero-length payload update ends the AAD phase. Enforce the declared AAD total when supplied; abort after errors. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_aead_verify()

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 authenticated decryption and verify the separate tag.

No residual plaintext is emitted. Only success authenticates all earlier update output. On failure discard that output; the provider cannot erase previously returned buffers. Abort before reuse after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_aead_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
plaintextuint8_t *; Plaintext buffer: borrowed input on encryption, caller-owned output on decryption. Do not use tentative multipart output until verification succeeds.
plaintext_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
plaintext_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
tagconst uint8_t *; Separate authentication tag; caller-owned output for finish or borrowed expected bytes for verify.
tag_lengthsize_t; Input/requested byte count for tag, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_asymmetric_decrypt()

psa_status_t psa_asymmetric_decrypt ( psa_key_id_t  key,
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 padded RSA ciphertext with a private key.

Requires DECRYPT permission and a supported 2048/3072-bit pair. Input is exactly one modulus-width block. OAEP labels must match encryption; PKCS1v1.5 requires an empty label. Treat all failures as decryption failure. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
saltconst uint8_t *; Borrowed RSA-OAEP label, or NULL when salt_length is 0; PKCS1v1.5 encryption requires zero length.
salt_lengthsize_t; Input/requested byte count for salt, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_asymmetric_encrypt()

psa_status_t psa_asymmetric_encrypt ( psa_key_id_t  key,
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 RSA-OAEP or RSAES-PKCS1-v1_5.

Requires ENCRYPT permission and a supported 2048/3072-bit key. OAEP uses the supplied label and permits modulusBytes - 2*hashBytes - 2 plaintext bytes; PKCS1v1.5 permits modulusBytes - 11 and requires an empty label. Output is one modulus-width block. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
saltconst uint8_t *; Borrowed RSA-OAEP label, or NULL when salt_length is 0; PKCS1v1.5 encryption requires zero length.
salt_lengthsize_t; Input/requested byte count for salt, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_attach_key()

psa_status_t psa_attach_key ( const psa_key_attributes_t *  attributes,
const uint8_t *  label,
size_t  label_length,
psa_key_id_t *  key 
)

Attach an opaque driver-provisioned volatile key.

Requires a registered matching driver/location and supported HMAC, PASSWORD or PEPPER attributes. The label is borrowed during the driver attachment callback; the provider retains the returned opaque driver handle, not the label. No secret key bytes are imported here. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
labelconst uint8_t *; Borrowed opaque driver label passed during attachment; NULL is allowed only for zero label_length. The registered driver defines the label format and limits.
label_lengthsize_t; Input/requested byte count for label, subject to the algorithm limits above.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_check_key_usage()

psa_status_t psa_check_key_usage ( psa_key_id_t  key,
psa_algorithm_t  alg,
psa_key_usage_t  usage 
)

Check one supported operation role against a key and its policy.

Validates type, size, usage and algorithm. This is a policy query and does not perform the operation. DERIVE_PUBLIC queries the supported public ECDH role as described in the provider guide. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
usagepsa_key_usage_t; One supported PSA_KEY_USAGE_* operation flag to query, not a combined mask.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_abort()

psa_status_t psa_cipher_abort ( psa_cipher_operation_t *  operation)

Abort a cipher operation and release its key dependency.

Accepts an initialized inactive operation; storage remains caller-owned. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_decrypt()

psa_status_t psa_cipher_decrypt ( psa_key_id_t  key,
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 complete input including its CBC/CTR IV prefix.

Requires DECRYPT permission. CBC/CTR input starts with a 16-byte IV. ECB/CBC payload must be a multiple of 16 bytes. Output capacity of input length is sufficient. This cipher API does not authenticate the message. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_decrypt_setup()

psa_status_t psa_cipher_decrypt_setup ( psa_cipher_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start multipart AES decryption.

Supports the same modes as encryption and requires DECRYPT permission. Set the 16-byte CBC/CTR IV before updates; ECB uses none. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_encrypt()

psa_status_t psa_cipher_encrypt ( psa_key_id_t  key,
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 complete input, prefixing a generated IV for CBC/CTR.

Requires ENCRYPT permission. ECB/CBC input must be a multiple of 16 bytes; CTR accepts arbitrary byte counts. Reserve input length plus 16 output bytes for CBC/CTR, or input length for ECB. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_encrypt_setup()

psa_status_t psa_cipher_encrypt_setup ( psa_cipher_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start multipart AES encryption.

Supports AES-128/256 ECB_NO_PADDING, CBC_NO_PADDING and CTR. Requires ENCRYPT permission and an inactive operation. Set/generate a 16-byte IV for CBC/CTR; ECB uses none. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_finish()

psa_status_t psa_cipher_finish ( psa_cipher_operation_t *  operation,
uint8_t *  output,
size_t  output_size,
size_t *  output_length 
)

Finish a multipart cipher operation.

A partial final ECB/CBC block returns failure because these modes have no padding. Successful completion releases the operation; abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_generate_iv()

psa_status_t psa_cipher_generate_iv ( psa_cipher_operation_t *  operation,
uint8_t *  iv,
size_t  iv_size,
size_t *  iv_length 
)

Generate and install a 16-byte IV for CBC/CTR encryption.

Call once after setup and before update. This API does not support an IV for ECB. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
ivuint8_t *; 16-byte IV buffer for CBC/CTR; caller-owned output for generate_iv or borrowed input for set_iv.
iv_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
iv_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_operation_init()

psa_cipher_operation_t psa_cipher_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_cipher_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_cipher_set_iv()

psa_status_t psa_cipher_set_iv ( psa_cipher_operation_t *  operation,
const uint8_t *  iv,
size_t  iv_length 
)

Install a borrowed 16-byte CBC/CTR IV.

Call after setup and before update. Do not repeat an encryption IV/counter sequence with the same key. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
ivconst uint8_t *; 16-byte IV buffer for CBC/CTR; caller-owned output for generate_iv or borrowed input for set_iv.
iv_lengthsize_t; Input/requested byte count for iv, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_cipher_update()

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 
)

Process the next cipher fragment.

CTR emits each input byte. ECB/CBC may buffer a partial 16-byte block; allow input_length plus 15 output bytes. Exact in-place block processing requires no buffered partial block. Abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_cipher_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_copy_key()

psa_status_t psa_copy_key ( psa_key_id_t  source_key,
const psa_key_attributes_t *  attributes,
psa_key_id_t *  target_key 
)

Create a key copy with equal or narrower policy.

Source requires COPY permission. Type and size are retained, usage and algorithm policies are intersected, and source ownership is unchanged. The caller owns the destination handle. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
source_keypsa_key_id_t; Borrowed source key handle with COPY permission; remains owned by the caller.
attributesconst psa_key_attributes_t *; Required initialized destination attributes. Type NONE and bit size 0 inherit the source values; explicit values must match. Usage and algorithm policy are intersected with the source policy. Lifetime and identifier select the destination storage.
target_keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_crypto_init()

psa_status_t psa_crypto_init ( void  )

Initialize the provider random source.

Call before cryptographic use. Repeated successful initialization is allowed; platform RNG setup remains an application responsibility. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_status_t: PSA_SUCCESS on successful or already-completed initialization; a negative PSA error if the random source or synchronization fails.

◆ psa_decapsulate()

psa_status_t psa_decapsulate ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  ciphertext,
size_t  ciphertext_length,
const psa_key_attributes_t *  attributes,
psa_key_id_t *  output_key 
)

Recover a P-256 ECIES SEC1 shared secret into a new key.

Requires a private key with DECRYPT permission and a 65-byte valid ephemeral SEC1 point. Creates a 32-byte DERIVE or HMAC key. The encapsulation itself does not authenticate the peer or message. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
ciphertextconst uint8_t *; Ciphertext buffer: caller-owned output on encryption/encapsulation, borrowed input on decryption/decapsulation. Single-part AEAD includes the appended tag; multipart uses a separate tag.
ciphertext_lengthsize_t; Input/requested byte count for ciphertext, subject to the algorithm limits above.
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
output_keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_destroy_key()

psa_status_t psa_destroy_key ( psa_key_id_t  key)

Destroy a volatile key or remove a locally persistent key.

Releases cached secret material and invokes storage removal for persistent keys. Existing operations depend on the key remaining valid; complete or abort them before destruction. Do not use the handle after success. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Handle to destroy, or PSA_KEY_ID_NULL for a successful no-op. Do not use the handle after successful destruction.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_encapsulate()

psa_status_t psa_encapsulate ( psa_key_id_t  key,
psa_algorithm_t  alg,
const psa_key_attributes_t *  attributes,
psa_key_id_t *  output_key,
uint8_t *  ciphertext,
size_t  ciphertext_size,
size_t *  ciphertext_length 
)

Encapsulate a P-256 ECIES SEC1 shared secret into a new key.

Requires ENCRYPT permission. Writes a 65-byte ephemeral SEC1 point and creates a 32-byte DERIVE or HMAC key. This ciphertext is unauthenticated; derive application keys and authenticate the message separately. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
output_keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
ciphertextuint8_t *; Ciphertext buffer: caller-owned output on encryption/encapsulation, borrowed input on decryption/decapsulation. Single-part AEAD includes the appended tag; multipart uses a separate tag.
ciphertext_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
ciphertext_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_export_key()

psa_status_t psa_export_key ( psa_key_id_t  key,
uint8_t *  data,
size_t  data_size,
size_t *  data_length 
)

Export key material in its PSA encoding.

Secret/private export requires EXPORT permission. The key remains owned by the caller. Clear exported secret material after use; use psa_export_public_key to export only the public part. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
datauint8_t *; Key or derivation bytes, borrowed on input and caller-owned on output. Encoding/meaning is determined by the operation and key type.
data_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
data_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_export_public_key()

psa_status_t psa_export_public_key ( psa_key_id_t  key,
uint8_t *  data,
size_t  data_size,
size_t *  data_length 
)

Export the public part of a supported asymmetric key.

No EXPORT permission is needed. ECC output uses the supported raw/SEC1 encoding; RSA output is PKCS#1 RSAPublicKey DER. Does not transfer key ownership. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
datauint8_t *; Key or derivation bytes, borrowed on input and caller-owned on output. Encoding/meaning is determined by the operation and key type.
data_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
data_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_generate_key()

psa_status_t psa_generate_key ( const psa_key_attributes_t *  attributes,
psa_key_id_t *  key 
)

Generate a supported key under caller-selected attributes.

The caller owns the new handle. Type, bit length, usage, algorithm, lifetime and optional persistent identifier must be supported; see the provider guide for the enabled symmetric/ECC/RSA generation subset. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_generate_key_custom()

psa_status_t psa_generate_key_custom ( const psa_key_attributes_t *  attributes,
const psa_custom_key_parameters_t *  custom,
const uint8_t *  custom_data,
size_t  custom_data_length,
psa_key_id_t *  key 
)

Generate a key with supported production parameters.

Requires zero custom flags. Empty custom data uses defaults; RSA additionally accepts little-endian exponent 65537. Other valid exponents are unsupported; malformed exponents or custom data for other key types are invalid. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
customconst psa_custom_key_parameters_t *; Required production-parameter structure with flags=0.
custom_dataconst uint8_t *; Borrowed custom bytes; NULL for an empty input. Only RSA generation accepts nonempty supported custom data.
custom_data_lengthsize_t; Input/requested byte count for custom data, subject to the algorithm limits above.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_generate_random()

psa_status_t psa_generate_random ( uint8_t *  output,
size_t  output_size 
)

Fill a caller buffer from the provider random source.

A zero-size request succeeds without accessing output. Discard all requested bytes on failure. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
outputuint8_t *; Caller-owned buffer of output_size bytes; may be NULL only when output_size is 0.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_get_key_algorithm()

psa_algorithm_t psa_get_key_algorithm ( const psa_key_attributes_t *  attributes)

Read the algorithm field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
Returns
psa_algorithm_t: Current stored field value.

◆ psa_get_key_attributes()

psa_status_t psa_get_key_attributes ( psa_key_id_t  key,
psa_key_attributes_t *  attributes 
)

Copy a key handle's public attributes into caller storage.

Does not export secret material or transfer ownership. The output is reset before lookup; manage it separately from the key. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
attributespsa_key_attributes_t *; Required caller-owned output structure. Reset to empty defaults before lookup; filled with public attributes on success. No prior initialization is needed by this provider.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_get_key_bits()

size_t psa_get_key_bits ( const psa_key_attributes_t *  attributes)

Read the bits field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
Returns
size_t: Current stored field value.

◆ psa_get_key_id()

psa_key_id_t psa_get_key_id ( const psa_key_attributes_t *  attributes)

Read the id field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
Returns
psa_key_id_t: Current stored field value.

◆ psa_get_key_lifetime()

psa_key_lifetime_t psa_get_key_lifetime ( const psa_key_attributes_t *  attributes)

Read the lifetime field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
Returns
psa_key_lifetime_t: Current stored field value.

◆ psa_get_key_type()

psa_key_type_t psa_get_key_type ( const psa_key_attributes_t *  attributes)

Read the type field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
Returns
psa_key_type_t: Current stored field value.

◆ psa_get_key_usage_flags()

psa_key_usage_t psa_get_key_usage_flags ( const psa_key_attributes_t *  attributes)

Read the usage flags field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
Returns
psa_key_usage_t: Current stored field value.

◆ psa_hash_abort()

psa_status_t psa_hash_abort ( psa_hash_operation_t *  operation)

Clear a hash operation, whether active or inactive.

The storage remains caller-owned and can be set up again. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS on cleanup; PSA_ERROR_INVALID_ARGUMENT for NULL.

◆ psa_hash_clone()

psa_status_t psa_hash_clone ( const psa_hash_operation_t *  source_operation,
psa_hash_operation_t *  target_operation 
)

Clone an active hash into a distinct inactive operation.

Source remains usable; finish or abort each operation independently. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
source_operationconst psa_hash_operation_t *; Required active source operation, borrowed and unchanged.
target_operationpsa_hash_operation_t *; Required distinct initialized inactive target; caller owns its storage and subsequent operation.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_compare()

psa_status_t psa_hash_compare ( psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
const uint8_t *  hash,
size_t  hash_length 
)

Hash input and compare it with an expected digest.

Supports the enabled SHA-256/384/512 algorithms; mismatch returns PSA_ERROR_INVALID_SIGNATURE. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
hashconst uint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_lengthsize_t; Input/requested byte count for hash, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_compute()

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 
)

Compute a complete SHA-256, SHA-384 or SHA-512 digest.

SHA-384/512 require their build options. Output capacity must hold the full digest; input is borrowed for this call. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
hashuint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
hash_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_finish()

psa_status_t psa_hash_finish ( psa_hash_operation_t *  operation,
uint8_t *  hash,
size_t  hash_size,
size_t *  hash_length 
)

Finish an active hash and write its complete digest.

Capacity must hold the full digest. Success clears the operation; abort after an error before reuse. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
hashuint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
hash_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_operation_init()

psa_hash_operation_t psa_hash_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_hash_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_hash_resume()

psa_status_t psa_hash_resume ( psa_hash_operation_t *  operation,
const uint8_t *  hash_state,
size_t  hash_state_length 
)

Restore a supported serialized hash into an inactive operation.

Accept only state from a trusted source. Invalid encoding leaves an inactive destination unchanged. Resume does not authenticate the serialized bytes. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
hash_stateconst uint8_t *; Serialized hash-state buffer, caller-owned output for suspend or borrowed input for resume.
hash_state_lengthsize_t; Input/requested byte count for hash state, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_setup()

psa_status_t psa_hash_setup ( psa_hash_operation_t *  operation,
psa_algorithm_t  alg 
)

Start an enabled SHA-256/384/512 operation.

The destination must be initialized and inactive. Append with psa_hash_update, then finish/verify or abort. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_suspend()

psa_status_t psa_hash_suspend ( psa_hash_operation_t *  operation,
uint8_t *  hash_state,
size_t  hash_state_size,
size_t *  hash_state_length 
)

Serialize an active hash state and make the operation inactive.

Use at most 107 bytes for SHA-256 or 211 for SHA-384/512. The encoding carries algorithm, total length, intermediate words and unprocessed bytes; it is not authenticated. Protect it according to the sensitivity of the input. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
hash_stateuint8_t *; Serialized hash-state buffer, caller-owned output for suspend or borrowed input for resume.
hash_state_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
hash_state_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_update()

psa_status_t psa_hash_update ( psa_hash_operation_t *  operation,
const uint8_t *  input,
size_t  input_length 
)

Append bytes to an active hash operation.

Input may be split across calls. The operation tracks and checks the hash length limit; abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_hash_verify()

psa_status_t psa_hash_verify ( psa_hash_operation_t *  operation,
const uint8_t *  hash,
size_t  hash_length 
)

Finish a hash and compare its digest with the expected bytes.

Mismatch returns PSA_ERROR_INVALID_SIGNATURE. Abort after an error; do not append after completion. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_hash_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
hashconst uint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_lengthsize_t; Input/requested byte count for hash, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_import_key()

psa_status_t psa_import_key ( const psa_key_attributes_t *  attributes,
const uint8_t *  data,
size_t  data_length,
psa_key_id_t *  key 
)

Import encoded key material under caller-selected attributes.

Creates a new handle; the caller owns its lifetime. Symmetric keys use raw bytes, supported ECC keys use PSA raw/SEC1 encodings and RSA uses canonical PKCS#1 DER. See the provider guide for exact type/size and persistence limits. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
dataconst uint8_t *; Key or derivation bytes, borrowed on input and caller-owned on output. Encoding/meaning is determined by the operation and key type.
data_lengthsize_t; Input/requested byte count for data, subject to the algorithm limits above.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_agreement()

psa_status_t psa_key_agreement ( psa_key_id_t  private_key,
const uint8_t *  peer_key,
size_t  peer_key_length,
psa_algorithm_t  alg,
const psa_key_attributes_t *  attributes,
psa_key_id_t *  key 
)

Perform ECDH and store the shared secret as a new key.

Supports X25519/P-256/P-384 with the output types and policies listed in the provider guide. The new handle is owned by the caller; use a KDF before application encryption. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
private_keypsa_key_id_t; Borrowed private ECDH key handle with a compatible derivation policy.
peer_keyconst uint8_t *; Required borrowed peer public key: raw 32-byte X25519 or uncompressed SEC1 point of 65/97 bytes for P-256/P-384.
peer_key_lengthsize_t; Input/requested byte count for peer key, subject to the algorithm limits above.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_attributes_init()

psa_key_attributes_t psa_key_attributes_init ( void  )

Return initialized inactive key-attribute storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_key_attributes_t: Initialized value owned by the caller; no failure status.

◆ psa_key_derivation_abort()

psa_status_t psa_key_derivation_abort ( psa_key_derivation_operation_t *  operation)

Clear derivation secrets and release all key dependencies.

Accepts an initialized inactive operation. Abort after completion or failure before reusing the storage. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_get_capacity()

psa_status_t psa_key_derivation_get_capacity ( const psa_key_derivation_operation_t *  operation,
size_t *  capacity 
)

Read the number of derivation output bytes still available.

Requires an active operation; does not consume output. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationconst psa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
capacitysize_t *; Remaining allowed derived-output length in bytes; required output pointer for get_capacity, requested reduced limit for set_capacity.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_input_bytes()

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 
)

Supply borrowed bytes for the next derivation input step.

The step and order must match the chosen algorithm. The operation copies/absorbs the input. Direct secret/password bytes permit byte output but do not authorize creation of an output key. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
steppsa_key_derivation_step_t; Algorithm-specific PSA_KEY_DERIVATION_INPUT_* step, supplied in the order documented by the provider guide.
dataconst uint8_t *; Key or derivation bytes, borrowed on input and caller-owned on output. Encoding/meaning is determined by the operation and key type.
data_lengthsize_t; Input/requested byte count for data, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_input_integer()

psa_status_t psa_key_derivation_input_integer ( psa_key_derivation_operation_t *  operation,
psa_key_derivation_step_t  step,
uint64_t  value 
)

Supply an integer derivation parameter.

This provider accepts PBKDF2 COST from 1 through UINT32_MAX, in the required input order; unsupported steps or algorithms fail. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
steppsa_key_derivation_step_t; Algorithm-specific PSA_KEY_DERIVATION_INPUT_* step, supplied in the order documented by the provider guide.
valueuint64_t; PBKDF2 iteration cost, from 1 through UINT32_MAX.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_input_key()

psa_status_t psa_key_derivation_input_key ( psa_key_derivation_operation_t *  operation,
psa_key_derivation_step_t  step,
psa_key_id_t  key 
)

Supply a key handle for a derivation input step.

Secret key inputs require DERIVE or VERIFY_DERIVATION and matching policy. Verification-only dependencies prohibit byte/key output. The operation retains key dependencies until abort. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
steppsa_key_derivation_step_t; Algorithm-specific PSA_KEY_DERIVATION_INPUT_* step, supplied in the order documented by the provider guide.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_key_agreement()

psa_status_t psa_key_derivation_key_agreement ( psa_key_derivation_operation_t *  operation,
psa_key_derivation_step_t  step,
psa_key_id_t  private_key,
const uint8_t *  peer_key,
size_t  peer_key_length 
)

Feed ECDH directly into a combined ECDH/KDF operation.

Requires a configured combined algorithm and a supported private key/policy. No temporary public key handle is returned. Input step and remaining input order follow the selected KDF. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
steppsa_key_derivation_step_t; Algorithm-specific PSA_KEY_DERIVATION_INPUT_* step, supplied in the order documented by the provider guide.
private_keypsa_key_id_t; Borrowed private ECDH key handle with a compatible derivation policy.
peer_keyconst uint8_t *; Required borrowed peer public key: raw 32-byte X25519 or uncompressed SEC1 point of 65/97 bytes for P-256/P-384.
peer_key_lengthsize_t; Input/requested byte count for peer key, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_operation_init()

psa_key_derivation_operation_t psa_key_derivation_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_key_derivation_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_key_derivation_output_bytes()

psa_status_t psa_key_derivation_output_bytes ( psa_key_derivation_operation_t *  operation,
uint8_t *  output,
size_t  output_length 
)

Read and consume the next derived bytes.

All required inputs must be supplied and their policies must permit output. The request cannot exceed remaining capacity. The operation stays active until abort. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_lengthsize_t; Input/requested byte count for output, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_output_key()

psa_status_t psa_key_derivation_output_key ( const psa_key_attributes_t *  attributes,
psa_key_derivation_operation_t *  operation,
psa_key_id_t *  key 
)

Create a key from the next derived bytes.

Requires a key-backed derivation authorizing output. Supported output types/sizes and persistence rules are in the provider guide. The caller owns the new handle; the operation remains active. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_output_key_custom()

psa_status_t psa_key_derivation_output_key_custom ( const psa_key_attributes_t *  attributes,
psa_key_derivation_operation_t *  operation,
const psa_custom_key_parameters_t *  custom,
const uint8_t *  custom_data,
size_t  custom_data_length,
psa_key_id_t *  key 
)

Create a derived key with default production parameters.

Only zero custom flags and empty custom data are accepted; asymmetric key derivation is not supported. Otherwise follows psa_key_derivation_output_key. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
customconst psa_custom_key_parameters_t *; Required production-parameter structure with flags=0.
custom_dataconst uint8_t *; Borrowed custom bytes; NULL for an empty input. Only RSA generation accepts nonempty supported custom data.
custom_data_lengthsize_t; Input/requested byte count for custom data, subject to the algorithm limits above.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_set_capacity()

psa_status_t psa_key_derivation_set_capacity ( psa_key_derivation_operation_t *  operation,
size_t  capacity 
)

Reduce the remaining derivation output capacity.

Capacity cannot be increased beyond the operation's current limit. Set it before the output it is intended to restrict. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
capacitysize_t; Remaining allowed derived-output length in bytes; required output pointer for get_capacity, requested reduced limit for set_capacity.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_setup()

psa_status_t psa_key_derivation_setup ( psa_key_derivation_operation_t *  operation,
psa_algorithm_t  alg 
)

Start a supported derivation operation.

Requires inactive initialized storage. Supports configured HKDF variants, PBKDF2-HMAC, TLS 1.2 PRF/PSK-to-MS, SP 800-108 counter HMAC and supported combined ECDH/KDF algorithms. Input order and limits are defined in the provider guide. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_verify_bytes()

psa_status_t psa_key_derivation_verify_bytes ( psa_key_derivation_operation_t *  operation,
const uint8_t *  expected_output,
size_t  output_length 
)

Consume derived bytes and compare them with expected bytes.

Accepts derivations authorized for verification only. Mismatch returns PSA_ERROR_INVALID_SIGNATURE; the request must fit remaining capacity. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
expected_outputconst uint8_t *; Required borrowed expected derivation bytes of output_length bytes.
output_lengthsize_t; Input/requested byte count for output, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_key_derivation_verify_key()

psa_status_t psa_key_derivation_verify_key ( psa_key_derivation_operation_t *  operation,
psa_key_id_t  expected 
)

Compare derived bytes with a PASSWORD_HASH key.

The expected key requires VERIFY_DERIVATION but need not be exportable. Its length determines output consumed. Mismatch returns PSA_ERROR_INVALID_SIGNATURE. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_key_derivation_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
expectedpsa_key_id_t; Borrowed PASSWORD_HASH key handle with VERIFY_DERIVATION permission.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_abort()

psa_status_t psa_mac_abort ( psa_mac_operation_t *  operation)

Abort an HMAC operation and release its key dependency.

Accepts an initialized inactive operation; storage remains caller-owned. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_mac_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_compute()

psa_status_t psa_mac_compute ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
uint8_t *  mac,
size_t  mac_size,
size_t *  mac_length 
)

Compute a one-shot HMAC using a borrowed key handle.

Requires SIGN_MESSAGE and a matching HMAC policy. Supports enabled SHA-256/384/512, full digests or 4-byte-to-full-length truncation, and 1-64-byte keys. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
macuint8_t *; MAC buffer: caller-owned output for compute/sign_finish, borrowed expected MAC for verification.
mac_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
mac_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_operation_init()

psa_mac_operation_t psa_mac_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_mac_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_mac_sign_finish()

psa_status_t psa_mac_sign_finish ( psa_mac_operation_t *  operation,
uint8_t *  mac,
size_t  mac_size,
size_t *  mac_length 
)

Complete an HMAC signing operation and release its key dependency.

Output capacity must hold the MAC length selected at setup. Success clears operation state; abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_mac_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
macuint8_t *; MAC buffer: caller-owned output for compute/sign_finish, borrowed expected MAC for verification.
mac_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
mac_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_sign_setup()

psa_status_t psa_mac_sign_setup ( psa_mac_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start a multipart HMAC signing operation.

Requires an inactive initialized operation and SIGN_MESSAGE permission. The operation retains a dependency on the key until finish/abort. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_mac_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_update()

psa_status_t psa_mac_update ( psa_mac_operation_t *  operation,
const uint8_t *  input,
size_t  input_length 
)

Append message bytes to an active HMAC operation.

May be called repeatedly before finish. Abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_mac_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_verify()

psa_status_t psa_mac_verify ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
const uint8_t *  mac,
size_t  mac_length 
)

Verify a one-shot HMAC using a borrowed key handle.

Requires VERIFY_MESSAGE and a matching HMAC policy. Mismatch returns PSA_ERROR_INVALID_SIGNATURE. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
macconst uint8_t *; MAC buffer: caller-owned output for compute/sign_finish, borrowed expected MAC for verification.
mac_lengthsize_t; Input/requested byte count for mac, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_verify_finish()

psa_status_t psa_mac_verify_finish ( psa_mac_operation_t *  operation,
const uint8_t *  mac,
size_t  mac_length 
)

Complete HMAC verification and release operation resources.

Expected length must match the setup algorithm. Mismatch returns PSA_ERROR_INVALID_SIGNATURE; abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_mac_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
macconst uint8_t *; MAC buffer: caller-owned output for compute/sign_finish, borrowed expected MAC for verification.
mac_lengthsize_t; Input/requested byte count for mac, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_mac_verify_setup()

psa_status_t psa_mac_verify_setup ( psa_mac_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start a multipart HMAC verification operation.

Requires an inactive initialized operation and VERIFY_MESSAGE permission. The operation retains a dependency on the key until finish/abort. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_mac_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_purge_key()

psa_status_t psa_purge_key ( psa_key_id_t  key)

Evict a persistent key from the in-memory cache without deleting its stored record.

The provider leaves an existing volatile key unchanged. A persistent key may be loaded again on later use. This is not key destruction. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_raw_key_agreement()

psa_status_t psa_raw_key_agreement ( psa_algorithm_t  alg,
psa_key_id_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 ECDH and return the raw shared secret bytes.

Requires DERIVE permission and matching ECDH policy. X25519/P-256 return 32 bytes; P-384 returns 48. Feed this secret to an appropriate KDF and clear it after use. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
private_keypsa_key_id_t; Borrowed private ECDH key handle with a compatible derivation policy.
peer_keyconst uint8_t *; Required borrowed peer public key: raw 32-byte X25519 or uncompressed SEC1 point of 65/97 bytes for P-256/P-384.
peer_key_lengthsize_t; Input/requested byte count for peer key, subject to the algorithm limits above.
outputuint8_t *; Required caller-owned writable output buffer; use contents only after success.
output_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
output_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_reset_key_attributes()

void psa_reset_key_attributes ( psa_key_attributes_t *  attributes)

Reset caller-owned attributes to their empty defaults.

Does not destroy any key described by those attributes. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Caller-owned attributes to clear, or NULL for no action.

◆ psa_set_key_algorithm()

void psa_set_key_algorithm ( psa_key_attributes_t *  attributes,
psa_algorithm_t  alg 
)

Set the algorithm field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
algpsa_algorithm_t; Permitted concrete algorithm or supported policy wildcard; default PSA_ALG_NONE permits no cryptographic operation.

◆ psa_set_key_bits()

void psa_set_key_bits ( psa_key_attributes_t *  attributes,
size_t  bits 
)

Set the bits field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
bitssize_t; Requested key size in bits; use a supported type/size combination.

◆ psa_set_key_id()

void psa_set_key_id ( psa_key_attributes_t *  attributes,
psa_key_id_t  id 
)

Set the id field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. Setting an identifier changes a volatile lifetime to default persistence at the same location. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
idpsa_key_id_t; Application persistent-key identifier within PSA_KEY_ID_USER_MIN..PSA_KEY_ID_USER_MAX.

◆ psa_set_key_lifetime()

void psa_set_key_lifetime ( psa_key_attributes_t *  attributes,
psa_key_lifetime_t  lifetime 
)

Set the lifetime field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. Setting a volatile lifetime clears the identifier. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
lifetimepsa_key_lifetime_t; PSA lifetime combining supported persistence and location; volatile is the default.

◆ psa_set_key_type()

void psa_set_key_type ( psa_key_attributes_t *  attributes,
psa_key_type_t  type 
)

Set the type field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
typepsa_key_type_t; PSA_KEY_TYPE_* selector for the intended key.

◆ psa_set_key_usage_flags()

void psa_set_key_usage_flags ( psa_key_attributes_t *  attributes,
psa_key_usage_t  usage_flags 
)

Set the usage flags field in caller-owned key attributes.

This does not query or modify an existing key. Creation/import validates supported types, sizes and policies. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributespsa_key_attributes_t *; Required initialized caller-owned attribute structure; no key material is accessed.
usage_flagspsa_key_usage_t; Bitwise OR of supported PSA_KEY_USAGE_* permissions; default 0 grants none.

◆ psa_sign_abort()

psa_status_t psa_sign_abort ( psa_sign_operation_t *  operation)

Abort a multipart signature creation operation.

Requires the PSA 1.5 profile. Clears operation state and releases the key dependency; accepts an initialized inactive operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_sign_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_finish()

psa_status_t psa_sign_finish ( psa_sign_operation_t *  operation,
uint8_t *  signature,
size_t  signature_size,
size_t *  signature_length 
)

Complete multipart message-signature creation.

Requires the PSA 1.5 profile. Successful completion clears state and releases the key dependency; abort after an error. Output capacity must hold the RSA modulus width or the raw ECDSA signature. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_sign_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
signatureuint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
signature_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_hash()

psa_status_t psa_sign_hash ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  hash,
size_t  hash_length,
uint8_t *  signature,
size_t  signature_size,
size_t *  signature_length 
)

Create a supported RSA/ECDSA signature over a supplied digest.

Requires SIGN_HASH permission; hash-bound algorithms require the matching digest size. ECDSA_ANY and RSA PKCS1v1.5 RAW use the documented arbitrary-digest/T-byte contracts. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Output length is zero on failure; the key remains owned by the caller. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
hashconst uint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_lengthsize_t; Input/requested byte count for hash, subject to the algorithm limits above.
signatureuint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
signature_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_hash_with_context()

psa_status_t psa_sign_hash_with_context ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  hash,
size_t  hash_length,
const uint8_t *  context,
size_t  context_length,
uint8_t *  signature,
size_t  signature_size,
size_t *  signature_length 
)

Create a supported RSA/ECDSA signature over a supplied digest with an explicit context argument.

Requires SIGN_HASH permission; hash-bound algorithms require the matching digest size. ECDSA_ANY and RSA PKCS1v1.5 RAW use the documented arbitrary-digest/T-byte contracts. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Output length is zero on failure; the key remains owned by the caller. All supported RSA/ECDSA algorithms require an empty context; a nonzero context length returns PSA_ERROR_INVALID_ARGUMENT before cryptographic processing. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
hashconst uint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_lengthsize_t; Input/requested byte count for hash, subject to the algorithm limits above.
contextconst uint8_t *; Borrowed context buffer. This provider requires context_length=0; NULL is allowed.
context_lengthsize_t; Input/requested byte count for context, subject to the algorithm limits above.
signatureuint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
signature_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_message()

psa_status_t psa_sign_message ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
uint8_t *  signature,
size_t  signature_size,
size_t *  signature_length 
)

Create a supported RSA/ECDSA signature over a message.

Hashes the input internally; requires SIGN_MESSAGE permission. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Output length is zero on failure; the key remains owned by the caller. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
signatureuint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
signature_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_message_with_context()

psa_status_t psa_sign_message_with_context ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
const uint8_t *  context,
size_t  context_length,
uint8_t *  signature,
size_t  signature_size,
size_t *  signature_length 
)

Create a supported RSA/ECDSA signature over a message with an explicit context argument.

Hashes the input internally; requires SIGN_MESSAGE permission. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Output length is zero on failure; the key remains owned by the caller. All supported RSA/ECDSA algorithms require an empty context; a nonzero context length returns PSA_ERROR_INVALID_ARGUMENT before cryptographic processing. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
contextconst uint8_t *; Borrowed context buffer. This provider requires context_length=0; NULL is allowed.
context_lengthsize_t; Input/requested byte count for context, subject to the algorithm limits above.
signatureuint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
signature_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_operation_init()

psa_sign_operation_t psa_sign_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_sign_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_sign_set_context()

psa_status_t psa_sign_set_context ( psa_sign_operation_t *  operation,
const uint8_t *  context,
size_t  context_length 
)

Set the multipart signature context before any message update.

Requires the PSA 1.5 profile and an active operation. May be called once; only zero context length is supported for RSA/ECDSA. Abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_sign_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
contextconst uint8_t *; Borrowed context buffer. This provider requires context_length=0; NULL is allowed.
context_lengthsize_t; Input/requested byte count for context, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_setup()

psa_status_t psa_sign_setup ( psa_sign_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg 
)

Start a multipart message-signature creation operation.

Requires the PSA 1.5 profile, inactive initialized storage and SIGN_MESSAGE permission. Supports enabled hash-bound RSA/ECDSA algorithms, not raw/wildcard operations. A key dependency is retained until completion/abort. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_sign_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_sign_update()

psa_status_t psa_sign_update ( psa_sign_operation_t *  operation,
const uint8_t *  input,
size_t  input_length 
)

Append a message fragment to multipart signature processing.

Requires the PSA 1.5 profile and an active operation. Message hashing is incremental. Context, if used, must already be set; abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_sign_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_unwrap_key()

psa_status_t psa_unwrap_key ( const psa_key_attributes_t *  attributes,
psa_key_id_t  wrapping_key,
psa_algorithm_t  alg,
const uint8_t *  data,
size_t  data_length,
psa_key_id_t *  key 
)

Authenticate a wrapped key and import it under supplied attributes.

Requires UNWRAP permission with matching AES-KW/KWP policy. Integrity failure returns PSA_ERROR_INVALID_SIGNATURE and creates no key. The caller owns a successful output handle. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
attributesconst psa_key_attributes_t *; Required initialized key attributes specifying type, bit size, usage, algorithm and lifetime. Persistent keys also need a supported identifier and registered storage. Borrowed for creation, caller-owned output for attribute queries.
wrapping_keypsa_key_id_t; Borrowed AES-128/256 key handle with matching KW/KWP policy and WRAP or UNWRAP permission as appropriate.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
dataconst uint8_t *; Key or derivation bytes, borrowed on input and caller-owned on output. Encoding/meaning is determined by the operation and key type.
data_lengthsize_t; Input/requested byte count for data, subject to the algorithm limits above.
keypsa_key_id_t *; Required output handle pointer, set to PSA_KEY_ID_NULL on failure. On success the caller owns the new key and its lifetime.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_abort()

psa_status_t psa_verify_abort ( psa_verify_operation_t *  operation)

Abort a multipart signature verification operation.

Requires the PSA 1.5 profile. Clears operation state and releases the key dependency; accepts an initialized inactive operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_verify_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_finish()

psa_status_t psa_verify_finish ( psa_verify_operation_t *  operation)

Complete multipart message-signature verification.

Requires the PSA 1.5 profile. Successful completion clears state and releases the key dependency; abort after an error. Verification mismatch returns PSA_ERROR_INVALID_SIGNATURE. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_verify_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_hash()

psa_status_t psa_verify_hash ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  hash,
size_t  hash_length,
const uint8_t *  signature,
size_t  signature_length 
)

Verify a supported RSA/ECDSA signature over a supplied digest.

Requires VERIFY_HASH permission; hash-bound algorithms require the matching digest size. ECDSA_ANY and RSA PKCS1v1.5 RAW use the documented arbitrary-digest/T-byte contracts. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Mismatch returns PSA_ERROR_INVALID_SIGNATURE; input buffers are unchanged. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
hashconst uint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_lengthsize_t; Input/requested byte count for hash, subject to the algorithm limits above.
signatureconst uint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_lengthsize_t; Input/requested byte count for signature, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_hash_with_context()

psa_status_t psa_verify_hash_with_context ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  hash,
size_t  hash_length,
const uint8_t *  context,
size_t  context_length,
const uint8_t *  signature,
size_t  signature_length 
)

Verify a supported RSA/ECDSA signature over a supplied digest with an explicit context argument.

Requires VERIFY_HASH permission; hash-bound algorithms require the matching digest size. ECDSA_ANY and RSA PKCS1v1.5 RAW use the documented arbitrary-digest/T-byte contracts. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Mismatch returns PSA_ERROR_INVALID_SIGNATURE; input buffers are unchanged. All supported RSA/ECDSA algorithms require an empty context; a nonzero context length returns PSA_ERROR_INVALID_ARGUMENT before cryptographic processing. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
hashconst uint8_t *; Digest buffer: caller-owned output for compute/finish, borrowed expected/input digest for compare/verify/sign.
hash_lengthsize_t; Input/requested byte count for hash, subject to the algorithm limits above.
contextconst uint8_t *; Borrowed context buffer. This provider requires context_length=0; NULL is allowed.
context_lengthsize_t; Input/requested byte count for context, subject to the algorithm limits above.
signatureconst uint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_lengthsize_t; Input/requested byte count for signature, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_message()

psa_status_t psa_verify_message ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
const uint8_t *  signature,
size_t  signature_length 
)

Verify a supported RSA/ECDSA signature over a message.

Hashes the input internally; requires VERIFY_MESSAGE permission. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Mismatch returns PSA_ERROR_INVALID_SIGNATURE; input buffers are unchanged. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
signatureconst uint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_lengthsize_t; Input/requested byte count for signature, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_message_with_context()

psa_status_t psa_verify_message_with_context ( psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  input,
size_t  input_length,
const uint8_t *  context,
size_t  context_length,
const uint8_t *  signature,
size_t  signature_length 
)

Verify a supported RSA/ECDSA signature over a message with an explicit context argument.

Hashes the input internally; requires VERIFY_MESSAGE permission. RSA signatures occupy the modulus width; ECDSA signatures are raw fixed-width r||s. Mismatch returns PSA_ERROR_INVALID_SIGNATURE; input buffers are unchanged. All supported RSA/ECDSA algorithms require an empty context; a nonzero context length returns PSA_ERROR_INVALID_ARGUMENT before cryptographic processing. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
contextconst uint8_t *; Borrowed context buffer. This provider requires context_length=0; NULL is allowed.
context_lengthsize_t; Input/requested byte count for context, subject to the algorithm limits above.
signatureconst uint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_lengthsize_t; Input/requested byte count for signature, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_operation_init()

psa_verify_operation_t psa_verify_operation_init ( void  )

Return initialized inactive operation storage.

Equivalent to the corresponding static initializer. It allocates no key or operation resources; do not assign it over a live operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Returns
psa_verify_operation_t: Initialized value owned by the caller; no failure status.

◆ psa_verify_set_context()

psa_status_t psa_verify_set_context ( psa_verify_operation_t *  operation,
const uint8_t *  context,
size_t  context_length 
)

Set the multipart signature context before any message update.

Requires the PSA 1.5 profile and an active operation. May be called once; only zero context length is supported for RSA/ECDSA. Abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_verify_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
contextconst uint8_t *; Borrowed context buffer. This provider requires context_length=0; NULL is allowed.
context_lengthsize_t; Input/requested byte count for context, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_setup()

psa_status_t psa_verify_setup ( psa_verify_operation_t *  operation,
psa_key_id_t  key,
psa_algorithm_t  alg,
const uint8_t *  signature,
size_t  signature_length 
)

Start a multipart message-signature verification operation.

Requires the PSA 1.5 profile, inactive initialized storage and VERIFY_MESSAGE permission. Supports enabled hash-bound RSA/ECDSA algorithms, not raw/wildcard operations. A key dependency is retained until completion/abort. The expected signature is copied into the operation. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_verify_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
signatureconst uint8_t *; Signature bytes; caller-owned output for signing, borrowed expected bytes for verification. RSA uses modulus-width bytes; ECDSA uses raw r||s.
signature_lengthsize_t; Input/requested byte count for signature, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_verify_update()

psa_status_t psa_verify_update ( psa_verify_operation_t *  operation,
const uint8_t *  input,
size_t  input_length 
)

Append a message fragment for multipart signature verification.

Requires the PSA 1.5 profile and an active operation. Message hashing is incremental. Context, if used, must already be set; abort after an error. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
operationpsa_verify_operation_t *; Required caller-owned operation. Initialize with its operation_init function or *_OPERATION_INIT macro before first use; obey the state and call order described above.
inputconst uint8_t *; Borrowed input bytes of input_length bytes; NULL is allowed only for a zero-length request where the algorithm permits empty input.
input_lengthsize_t; Input/requested byte count for input, subject to the algorithm limits above.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.

◆ psa_wrap_key()

psa_status_t psa_wrap_key ( psa_key_id_t  wrapping_key,
psa_algorithm_t  alg,
psa_key_id_t  key,
uint8_t *  data,
size_t  data_size,
size_t *  data_length 
)

Wrap an exportable key with AES-KW or AES-KWP.

The target needs EXPORT and the wrapping key needs WRAP with a matching algorithm. AES wrapping keys are 128/256 bits; target types, lengths and output bounds are listed in the provider guide. Both handles remain owned by the caller. See SharkSSL PSA Crypto provider for build options, supported algorithms and limits.

Parameters
wrapping_keypsa_key_id_t; Borrowed AES-128/256 key handle with matching KW/KWP policy and WRAP or UNWRAP permission as appropriate.
algpsa_algorithm_t; Concrete supported PSA algorithm selector matching the key policy, where a key is used; see the supported subset in the provider guide.
keypsa_key_id_t; Borrowed existing key handle with the operation's required type, permission and algorithm policy; ownership is unchanged.
datauint8_t *; Key or derivation bytes, borrowed on input and caller-owned on output. Encoding/meaning is determined by the operation and key type.
data_sizesize_t; Writable capacity of the associated output buffer in bytes; it must satisfy the operation-specific bound above.
data_lengthsize_t *; Required output byte-count pointer. Contents of the associated output buffer are valid only on success.
Returns
psa_status_t: PSA_SUCCESS (0) on success; a negative PSA_ERROR_* on invalid arguments/state, unsupported configuration, policy/handle failure, insufficient capacity or provider/storage/RNG failure, as applicable. Output is usable only on success.