Function esp_idf_sys::psa_asymmetric_decrypt

source ยท
pub unsafe extern "C" fn psa_asymmetric_decrypt(
    key: mbedtls_svc_key_id_t,
    alg: psa_algorithm_t,
    input: *const u8,
    input_length: usize,
    salt: *const u8,
    salt_length: usize,
    output: *mut u8,
    output_size: usize,
    output_length: *mut usize,
) -> psa_status_t
Expand description

\brief Decrypt a short message with a private key.

\param key Identifier of the key to use for the operation. It must be an asymmetric key pair. It must allow the usage #PSA_KEY_USAGE_DECRYPT. \param alg An asymmetric encryption algorithm that is compatible with the type of \p key. \param[in] input The message to decrypt. \param input_length Size of the \p input buffer in bytes. \param[in] salt A salt or label, if supported by the encryption algorithm. If the algorithm does not support a salt, pass \c NULL. If the algorithm supports an optional salt and you do not want to pass a salt, pass \c NULL.

                         - For #PSA_ALG_RSA_PKCS1V15_CRYPT, no salt is
                           supported.

\param salt_length Size of the \p salt buffer in bytes. If \p salt is \c NULL, pass 0. \param[out] output Buffer where the decrypted message is to be written. \param output_size Size of the \c output buffer in bytes. \param[out] output_length On success, the number of bytes that make up the returned output.

\retval #PSA_SUCCESS \emptydescription \retval #PSA_ERROR_INVALID_HANDLE \emptydescription \retval #PSA_ERROR_NOT_PERMITTED \emptydescription \retval #PSA_ERROR_BUFFER_TOO_SMALL The size of the \p output buffer is too small. You can determine a sufficient buffer size by calling #PSA_ASYMMETRIC_DECRYPT_OUTPUT_SIZE(\c key_type, \c key_bits, \p alg) where \c key_type and \c key_bits are the type and bit-size respectively of \p key. \retval #PSA_ERROR_NOT_SUPPORTED \emptydescription \retval #PSA_ERROR_INVALID_ARGUMENT \emptydescription \retval #PSA_ERROR_INSUFFICIENT_MEMORY \emptydescription \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_INSUFFICIENT_ENTROPY \emptydescription \retval #PSA_ERROR_INVALID_PADDING \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.