Introduce params structs
This will allow for greater flexibility in the future and a big refactor in ChaCha20-Poly1305.
This commit is contained in:
parent
23735c2902
commit
ccc2836fa8
42
lilcrypto.h
42
lilcrypto.h
@ -43,6 +43,48 @@
|
|||||||
#define LC_XCHACHA20_NONCELEN 24
|
#define LC_XCHACHA20_NONCELEN 24
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Arguments.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* Authentication */
|
||||||
|
|
||||||
|
struct lc_hmac_params {
|
||||||
|
size_t keylen;
|
||||||
|
const uint8_t *key;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct lc_poly1305_params {
|
||||||
|
const uint8_t key[LC_POLY1305_KEYLEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
/* Ciphers. */
|
||||||
|
|
||||||
|
struct lc_chacha20_params {
|
||||||
|
const uint8_t key[LC_CHACHA20_KEYLEN];
|
||||||
|
const uint8_t nonce[LC_CHACHA20_NONCELEN];
|
||||||
|
uint32_t counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct lc_xchacha20_params {
|
||||||
|
const uint8_t key[LC_XCHACHA20_KEYLEN];
|
||||||
|
const uint8_t nonce[LC_XCHACHA20_NONCELEN];
|
||||||
|
uint32_t counter;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* AEAD. */
|
||||||
|
|
||||||
|
struct lc_chacha20_poly1305_params {
|
||||||
|
const uint8_t key[LC_CHACHA20_KEYLEN];
|
||||||
|
const uint8_t nonce[LC_CHACHA20_NONCELEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
struct lc_xchacha20_poly1305_params {
|
||||||
|
const uint8_t key[LC_XCHACHA20_KEYLEN];
|
||||||
|
const uint8_t nonce[LC_XCHACHA20_NONCELEN];
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Constant-time operations.
|
* Constant-time operations.
|
||||||
*/
|
*/
|
||||||
|
Loading…
Reference in New Issue
Block a user