pub unsafe extern "C" fn Hacl_Chacha20Poly1305_256_aead_decrypt(
k: *mut u8,
n: *mut u8,
aadlen: u32,
aad: *mut u8,
mlen: u32,
m: *mut u8,
cipher: *mut u8,
mac: *mut u8,
) -> u32
Expand description
Decrypt a ciphertext cipher
with key k
.
The arguments k
, n
, aadlen
, and aad
are same in encryption/decryption.
Note: Encryption and decryption can be executed in-place, i.e., m
and cipher
can point to the same memory.
If decryption succeeds, the resulting plaintext is stored in m
and the function returns the success code 0.
If decryption fails, the array m
remains unchanged and the function returns the error code 1.
@param k Pointer to 32 bytes of memory where the AEAD key is read from.
@param n Pointer to 12 bytes of memory where the AEAD nonce is read from.
@param aadlen Length of the associated data.
@param aad Pointer to aadlen
bytes of memory where the associated data is read from.
@param mlen Length of the ciphertext.
@param m Pointer to mlen
bytes of memory where the message is written to.
@param cipher Pointer to mlen
bytes of memory where the ciphertext is read from.
@param mac Pointer to 16 bytes of memory where the mac is read from.
@returns 0 on succeess; 1 on failure.