nrfxlib API 0.1.0
|
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.
[out] | c | Generated ciphertext. Same length as input message. |
m | Input message. | |
m_len | Length of c and m . | |
n | Nonce. | |
n_len | Nonce length. 0 <= n_len <= ocrypto_chacha20_NONCE_BYTES_MAX . | |
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.