nrfxlib API 2.7.99
Loading...
Searching...
No Matches

◆ ocrypto_chacha20_poly1305_decrypt()

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.

Parameters
tagReceived authentication tag.
[out]mDecoded message. Same length as received ciphertext.
cReceived ciphertext.
c_lenLength of c and m.
aReceived additional authenticated data.
a_lenLength of a. May be 0.
nNonce.
n_lenLength of n. 0 <= n_len <= ocrypto_chacha20_poly1305_NONCE_BYTES_MAX.
kEncryption key.
Return values
0If tag is valid.
-1Otherwise.
Remarks
m may be same as c.