libcrux_hacl

Function Hacl_AEAD_Chacha20Poly1305_Simd256_decrypt

Source
pub unsafe extern "C" fn Hacl_AEAD_Chacha20Poly1305_Simd256_decrypt(
    output: *mut u8,
    input: *mut u8,
    input_len: u32,
    data: *mut u8,
    data_len: u32,
    key: *mut u8,
    nonce: *mut u8,
    tag: *mut u8,
) -> u32
Expand description

Decrypt a ciphertext input with key key.

The arguments key, nonce, data, and data_len are same in encryption/decryption. Note: Encryption and decryption can be executed in-place, i.e., input and output can point to the same memory.

If decryption succeeds, the resulting plaintext is stored in output and the function returns the success code 0. If decryption fails, the array output remains unchanged and the function returns the error code 1.

@param output Pointer to input_len bytes of memory where the message is written to. @param input Pointer to input_len bytes of memory where the ciphertext is read from. @param input_len Length of the ciphertext. @param data Pointer to data_len bytes of memory where the associated data is read from. @param data_len Length of the associated data. @param key Pointer to 32 bytes of memory where the AEAD key is read from. @param nonce Pointer to 12 bytes of memory where the AEAD nonce is read from. @param tag Pointer to 16 bytes of memory where the mac is read from.

@returns 0 on succeess; 1 on failure.