nrfxlib API 0.1.0
|
int ocrypto_chacha20_poly1305_decrypt | ( | const uint8_t | tag[(16)], |
uint8_t * | m, | ||
const uint8_t * | c, | ||
size_t | c_len, | ||
const uint8_t * | a, | ||
size_t | a_len, | ||
const uint8_t * | n, | ||
size_t | n_len, | ||
const uint8_t | k[(32)] | ||
) |
#include <crypto/nrf_oberon/include/ocrypto_chacha20_poly1305.h>
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. | |
[out] | 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. |
0 | If tag is valid. |
-1 | Otherwise. |
m
may be same as c
.