Function nrfxlib_sys::ocrypto_chacha20_poly1305_decrypt
source · pub unsafe extern "C" fn ocrypto_chacha20_poly1305_decrypt(
tag: *const u8,
m: *mut u8,
c: *const u8,
c_len: usize,
a: *const u8,
a_len: usize,
n: *const u8,
n_len: usize,
k: *const u8
) -> c_int
Expand description
AEAD ChaCha20-Poly1305 decrypt.
If the authentication tag * tag
- is valid for the ciphertext * c
- , the
additional authenticated data * a
- , the encryption key * k
- and the nonce
-
n
- , the ciphertext is decrypted and put into *m
- . The decrypted message -
m
- has the same length *c_len
- as the original ciphertext. -
tag
- Received authentication tag. -
m
- Decoded message. Same length as received ciphertext. -
c
- Received ciphertext. -
c_len
- Length of *c
- and *m
- . -
a
- Received additional authenticated data. -
a_len
- Length of *a
- . May be 0. -
n
- Nonce. -
n_len
- Length of *n
- . 0 <= *n_len
- <= *ocrypto_chacha20_poly1305_NONCE_BYTES_MAX
- . -
k
- Encryption key.
Returns 0 If * tag
- is valid.
Returns -1 Otherwise.
@remark * m
- may be same as * c
- .