nrfxlib API 0.1.0
Loading...
Searching...
No Matches

◆ ocrypto_chacha20_init()

void ocrypto_chacha20_init ( ocrypto_chacha20_ctx *  ctx,
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 encoder initialization.

The generator state ctx is initialized by this function.

Parameters
[out]ctxEncoder state.
nNonce. May be NULL.
n_lenNonce length. 0 <= n_len <= ocrypto_chacha20_NONCE_BYTES_MAX.
keyAuthentication key. May be NULL.
countInitial block counter, usually 0 or 1.
Remarks
If key is NULL only n and count are set. If n is NULL only key is set. Both key and n must be set before update is called.
When reusing an encryption key key for a different message, a different nonce n or initial block counter count must be used.