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

Type declaration and APIs for the Chacha20 stream cipher algorithm. More...

Macros

#define ocrypto_chacha20_KEY_BYTES   (32)
 
#define ocrypto_chacha20_NONCE_BYTES_MAX   (12)
 

Functions

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)
 

Incremental ChaCha20 Encoder.

This group of functions can be used to incrementally compute the ChaCha20 encryption for a given message and key, by segmenting a message into smaller chunks.

Use pattern:

Encoding/Decoding:

ocrypto_chacha20_init(ctx, n, n_len, key, count);
ocrypto_chacha20_update(ctx, c, m, m_len);
...
ocrypto_chacha20_update(ctx, c, m, m_len);
void ocrypto_chacha20_init(ocrypto_chacha20_ctx *ctx, const uint8_t *n, size_t n_len, const uint8_t key[(32)], uint32_t count)
void ocrypto_chacha20_update(ocrypto_chacha20_ctx *ctx, uint8_t *c, const uint8_t *m, size_t m_len)
void ocrypto_chacha20_init (ocrypto_chacha20_ctx *ctx, const uint8_t *n, size_t n_len, const uint8_t key[(32)], uint32_t count)
 
void ocrypto_chacha20_update (ocrypto_chacha20_ctx *ctx, uint8_t *c, const uint8_t *m, size_t m_len)
 

Detailed Description

Type declaration and APIs for the Chacha20 stream cipher algorithm.

ChaCha20 is a stream cipher developed by Daniel J. Bernstein based on the 20-round cipher Salsa20/20.

A 256-bit key is expanded into 2^64 randomly accessible streams, each containing 2^64 randomly accessible 64-byte (512-bit) blocks.

The changes from Salsa20/20 to ChaCha20 are designed to improve diffusion per round, conjecturally increasing resistance to cryptanalysis, while preserving - and often improving - time per round.

See also
RFC 8439 - ChaCha20 and Poly1305 for IETF Protocols
The ChaCha family of stream ciphers