#./fio-stl/152 chacha20poly1305.h
7 public symbols.
#Functions
#fio_chacha20_poly1305_enc
void fio_chacha20_poly1305_enc(void *restrict mac, void *restrict data, size_t len, const void *ad, /* additional data */ size_t adlen, const void *key, const void *nonce)Performs an in-place encryption of data using ChaCha20 with additional
data, producing a 16 byte message authentication code (MAC) using Poly1305.
keyMUST point to a 256 bit long memory address (32 Bytes).nonceMUST point to a 96 bit long memory address (12 Bytes).adMAY be omitted, will NOT be encrypted.dataMAY be omitted, WILL be encrypted.macMUST point to a buffer with (at least) 16 available bytes.
Symbol type: function
#fio_chacha20_poly1305_dec
int fio_chacha20_poly1305_dec(void *restrict mac, void *restrict data, size_t len, const void *ad, /* additional data */ size_t adlen, const void *key, const void *nonce)Performs an in-place decryption of data using ChaCha20 after authenticating
the message authentication code (MAC) using Poly1305.
keyMUST point to a 256 bit long memory address (32 Bytes).nonceMUST point to a 96 bit long memory address (12 Bytes).adMAY be omitted ONLY IF originally omitted.dataMAY be omitted, WILL be decrypted.macMUST point to a buffer where the 16 byte MAC is placed.
Returns -1 on error (authentication failed).
Symbol type: function
#fio_xchacha20_poly1305_enc
void fio_xchacha20_poly1305_enc(void *restrict mac, void *restrict data, size_t len, const void *ad, /* additional data */ size_t adlen, const void *key, const void *nonce)Performs an in-place encryption of data using XChaCha20 with additional
data, producing a 16 byte message authentication code (MAC) using Poly1305.
XChaCha20 uses a 192-bit (24 byte) nonce, making it safe to use with randomly-generated nonces without risk of nonce collision.
keyMUST point to a 256 bit long memory address (32 Bytes).nonceMUST point to a 192 bit long memory address (24 Bytes).adMAY be omitted, will NOT be encrypted.dataMAY be omitted, WILL be encrypted.macMUST point to a buffer with (at least) 16 available bytes.
Symbol type: function
#fio_xchacha20_poly1305_dec
int fio_xchacha20_poly1305_dec(void *restrict mac, void *restrict data, size_t len, const void *ad, /* additional data */ size_t adlen, const void *key, const void *nonce)Performs an in-place decryption of data using XChaCha20 after
authenticating the message authentication code (MAC) using Poly1305.
keyMUST point to a 256 bit long memory address (32 Bytes).nonceMUST point to a 192 bit long memory address (24 Bytes).adMAY be omitted ONLY IF originally omitted.dataMAY be omitted, WILL be decrypted.macMUST point to a buffer where the 16 byte MAC is placed.
Returns -1 on error (authentication failed).
Symbol type: function
#fio_xchacha20
void fio_xchacha20(void *restrict data, size_t len, const void *key, const void *nonce, uint32_t counter)Performs an in-place encryption/decryption of data using XChaCha20.
XChaCha20 uses a 192-bit (24 byte) nonce, making it safe to use with randomly-generated nonces without risk of nonce collision.
keyMUST point to a 256 bit long memory address (32 Bytes).nonceMUST point to a 192 bit long memory address (24 Bytes).counteris the block counter, usually 0 unlessdatais mid-cyphertext.
Symbol type: function
#fio_chacha20
void fio_chacha20(void *restrict data, size_t len, const void *key, const void *nonce, uint32_t counter)Performs an in-place encryption/decryption of data using ChaCha20.
keyMUST point to a 256 bit long memory address (32 Bytes).nonceMUST point to a 96 bit long memory address (12 Bytes).counteris the block counter, usually 1 unlessdatais mid-cyphertext.
Symbol type: function
#fio_poly1305_auth
void fio_poly1305_auth(void *restrict mac_dest, void *restrict message, size_t len, const void *ad, size_t ad_len, const void *key256bits)Given a Poly1305 256bit (32 byte) key, writes the authentication code for the
poly message and additional data into mac_dest.
mac_destMUST point to a buffer with (at least) 16 available bytes.messageMAY be omitted.adMAY be omitted (additional data).keyMUST point to a 256 bit long memory address (32 Bytes).
Symbol type: function