Function esp_idf_svc::sys::psa_cipher_decrypt

source ยท
pub unsafe extern "C" fn psa_cipher_decrypt(
    key: u32,
    alg: u32,
    input: *const u8,
    input_length: usize,
    output: *mut u8,
    output_size: usize,
    output_length: *mut usize,
) -> i32
Expand description

Decrypt a message using a symmetric cipher.

This function decrypts a message encrypted with a symmetric cipher.

\param key Identifier of the key to use for the operation. It must remain valid until the operation terminates. It must allow the usage #PSA_KEY_USAGE_DECRYPT. \param alg The cipher algorithm to compute (\c PSA_ALG_XXX value such that #PSA_ALG_IS_CIPHER(\p alg) is true). \param[in] input Buffer containing the message to decrypt. This consists of the IV followed by the ciphertext proper. \param input_length Size of the \p input buffer in bytes. \param[out] output Buffer where the plaintext is to be written. \param output_size Size of the \p output buffer in bytes. \param[out] output_length On success, the number of bytes that make up the output.

\retval #PSA_SUCCESS Success. \retval #PSA_ERROR_INVALID_HANDLE \emptydescription \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 a cipher algorithm. \retval #PSA_ERROR_BUFFER_TOO_SMALL \emptydescription \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \retval #PSA_ERROR_COMMUNICATION_FAILURE \emptydescription \retval #PSA_ERROR_HARDWARE_FAILURE \emptydescription \retval #PSA_ERROR_STORAGE_FAILURE \emptydescription \retval #PSA_ERROR_CORRUPTION_DETECTED \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.