pub unsafe extern "C" fn psa_aead_decrypt(
    key: mbedtls_svc_key_id_t,
    alg: psa_algorithm_t,
    nonce: *const u8,
    nonce_length: usize,
    additional_data: *const u8,
    additional_data_length: usize,
    ciphertext: *const u8,
    ciphertext_length: usize,
    plaintext: *mut u8,
    plaintext_size: usize,
    plaintext_length: *mut usize
) -> psa_status_t
Expand description

Process an authenticated decryption operation.

\param key Identifier of the key to use for the operation. It must allow the usage #PSA_KEY_USAGE_DECRYPT. \param alg The AEAD algorithm to compute (\c PSA_ALG_XXX value such that #PSA_ALG_IS_AEAD(\p alg) is true). \param[in] nonce Nonce or IV to use. \param nonce_length Size of the \p nonce buffer in bytes. \param[in] additional_data Additional data that has been authenticated but not encrypted. \param additional_data_length Size of \p additional_data in bytes. \param[in] ciphertext Data that has been authenticated and encrypted. For algorithms where the encrypted data and the authentication tag are defined as separate inputs, the buffer must contain the encrypted data followed by the authentication tag. \param ciphertext_length Size of \p ciphertext in bytes. \param[out] plaintext Output buffer for the decrypted data. \param plaintext_size Size of the \p plaintext buffer in bytes. This must be appropriate for the selected algorithm and key: - A sufficient output size is #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\c key_type, \p alg, \p ciphertext_length) where \c key_type is the type of \p key. - #PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(\p ciphertext_length) evaluates to the maximum plaintext size of any supported AEAD decryption. \param[out] plaintext_length On success, the size of the output in the \p plaintext buffer.

\retval #PSA_SUCCESS Success. \retval #PSA_ERROR_INVALID_HANDLE \emptydescription \retval #PSA_ERROR_INVALID_SIGNATURE The ciphertext is not authentic. \retval #PSA_ERROR_NOT_PERMITTED \emptydescription \retval #PSA_ERROR_INVALID_ARGUMENT \p key is not compatible with \p alg. \retval #PSA_ERROR_NOT_SUPPORTED \p alg is not supported or is not an AEAD algorithm. \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \retval #PSA_ERROR_BUFFER_TOO_SMALL \p plaintext_size is too small. #PSA_AEAD_DECRYPT_OUTPUT_SIZE(\c key_type, \p alg, \p ciphertext_length) or #PSA_AEAD_DECRYPT_OUTPUT_MAX_SIZE(\p ciphertext_length) can be used to determine the required buffer size. \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \emptydescription \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription \retval #PSA_ERROR_BAD_STATE The library has not been previously initialized by psa_crypto_init(). It is implementation-dependent whether a failure to initialize results in this error code.