nrfxlib API 3.3.99
Loading...
Searching...
No Matches

◆ ocrypto_chacha20_encode()

void ocrypto_chacha20_encode ( uint8_t * c,
const uint8_t * m,
size_t m_len,
const uint8_t * n,
size_t n_len,
const uint8_t key[(32)],
uint32_t count )

#include <crypto/nrf_oberon/include/ocrypto_chacha20.h>

ChaCha20 cipher stream encoder/decoder.

The message m is encrypted by applying the XOR operation with a pseudo random cipher stream derived from the encryption key key, the nonce n, and the initial block counter count.

For decryption, the ciphertext is used as input message m and the resulting decrypted message is written to c.

Parameters
[out]cGenerated ciphertext. Same length as input message.
mInput message.
m_lenLength of c and m.
nNonce (or IV).
n_lenNonce length. n_len = 8, 12, or 24.
keyEncryption key.
countInitial block counter.
Remarks
c may be same as m.
When reusing an encryption key key for a different message m, a different nonce n or initial block counter count must be used.
If n_len = 24, the XChaCha20 algorithm is used.