![]() |
nrfxlib API 3.3.99
|
| 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.
| [out] | c | Generated ciphertext. Same length as input message. |
| m | Input message. | |
| m_len | Length of c and m. | |
| n | Nonce (or IV). | |
| n_len | Nonce length. n_len = 8, 12, or 24. | |
| key | Encryption key. | |
| count | Initial block counter. |
c may be same as m.key for a different message m, a different nonce n or initial block counter count must be used. n_len = 24, the XChaCha20 algorithm is used.