nrfxlib API 2.8.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.

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.

Calling the function a second time with the generated ciphertext as input message m decrypts it back to the original message.

Parameters
[out]cGenerated ciphertext. Same length as input message.
mInput message.
m_lenLength of c and m.
nNonce.
n_lenNonce length. 0 <= n_len <= ocrypto_chacha20_NONCE_BYTES_MAX.
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.