23 #ifndef LWCRYPTO_SPARKLE_H
24 #define LWCRYPTO_SPARKLE_H
56 #define SCHWAEMM_256_128_KEY_SIZE 16
61 #define SCHWAEMM_256_128_TAG_SIZE 16
66 #define SCHWAEMM_256_128_NONCE_SIZE 32
71 #define SCHWAEMM_192_192_KEY_SIZE 24
76 #define SCHWAEMM_192_192_TAG_SIZE 24
81 #define SCHWAEMM_192_192_NONCE_SIZE 24
86 #define SCHWAEMM_128_128_KEY_SIZE 16
91 #define SCHWAEMM_128_128_TAG_SIZE 16
96 #define SCHWAEMM_128_128_NONCE_SIZE 16
101 #define SCHWAEMM_256_256_KEY_SIZE 32
106 #define SCHWAEMM_256_256_TAG_SIZE 32
111 #define SCHWAEMM_256_256_NONCE_SIZE 32
116 #define ESCH_256_HASH_SIZE 32
121 #define ESCH_384_HASH_SIZE 48
159 unsigned char state[48];
160 unsigned char block[16];
173 unsigned char state[64];
174 unsigned char block[16];
203 (
unsigned char *c,
unsigned long long *clen,
204 const unsigned char *m,
unsigned long long mlen,
205 const unsigned char *ad,
unsigned long long adlen,
206 const unsigned char *nsec,
207 const unsigned char *npub,
208 const unsigned char *k);
233 (
unsigned char *m,
unsigned long long *mlen,
235 const unsigned char *c,
unsigned long long clen,
236 const unsigned char *ad,
unsigned long long adlen,
237 const unsigned char *npub,
238 const unsigned char *k);
262 (
unsigned char *c,
unsigned long long *clen,
263 const unsigned char *m,
unsigned long long mlen,
264 const unsigned char *ad,
unsigned long long adlen,
265 const unsigned char *nsec,
266 const unsigned char *npub,
267 const unsigned char *k);
292 (
unsigned char *m,
unsigned long long *mlen,
294 const unsigned char *c,
unsigned long long clen,
295 const unsigned char *ad,
unsigned long long adlen,
296 const unsigned char *npub,
297 const unsigned char *k);
321 (
unsigned char *c,
unsigned long long *clen,
322 const unsigned char *m,
unsigned long long mlen,
323 const unsigned char *ad,
unsigned long long adlen,
324 const unsigned char *nsec,
325 const unsigned char *npub,
326 const unsigned char *k);
351 (
unsigned char *m,
unsigned long long *mlen,
353 const unsigned char *c,
unsigned long long clen,
354 const unsigned char *ad,
unsigned long long adlen,
355 const unsigned char *npub,
356 const unsigned char *k);
380 (
unsigned char *c,
unsigned long long *clen,
381 const unsigned char *m,
unsigned long long mlen,
382 const unsigned char *ad,
unsigned long long adlen,
383 const unsigned char *nsec,
384 const unsigned char *npub,
385 const unsigned char *k);
410 (
unsigned char *m,
unsigned long long *mlen,
412 const unsigned char *c,
unsigned long long clen,
413 const unsigned char *ad,
unsigned long long adlen,
414 const unsigned char *npub,
415 const unsigned char *k);
429 (
unsigned char *out,
const unsigned char *in,
unsigned long long inlen);
451 unsigned long long inlen);
476 (
unsigned char *out,
const unsigned char *in,
unsigned long long inlen);
498 unsigned long long inlen);
void esch_384_hash_finalize(esch_384_hash_state_t *state, unsigned char *out)
Returns the final hash value from an Esch384 hashing operation.
Definition: sparkle.c:1113
Meta-information about an AEAD cipher.
Definition: aead-common.h:185
Definitions that are common across AEAD schemes.
void esch_384_hash_update(esch_384_hash_state_t *state, const unsigned char *in, unsigned long long inlen)
Updates an Esch384 state with more input data.
Definition: sparkle.c:1091
int schwaemm_192_192_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm192-192.
Definition: sparkle.c:368
int schwaemm_256_256_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm256-256.
Definition: sparkle.c:752
void esch_256_hash_init(esch_256_hash_state_t *state)
Initializes the state for an Esch256 hashing operation.
Definition: sparkle.c:954
int schwaemm_128_128_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm128-128.
Definition: sparkle.c:557
Meta-information about a hash algorithm that is related to an AEAD.
Definition: aead-common.h:204
unsigned char count
Definition: sparkle.h:175
int schwaemm_192_192_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm192-192.
Definition: sparkle.c:431
int schwaemm_256_256_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm256-256.
Definition: sparkle.c:815
void esch_256_hash_update(esch_256_hash_state_t *state, const unsigned char *in, unsigned long long inlen)
Updates an Esch256 state with more input data.
Definition: sparkle.c:960
State information for the Esch384 incremental hash mode.
Definition: sparkle.h:170
int esch_256_hash(unsigned char *out, const unsigned char *in, unsigned long long inlen)
Hashes a block of input data with Esch256 to generate a hash value.
Definition: sparkle.c:924
void esch_384_hash_init(esch_384_hash_state_t *state)
Initializes the state for an Esch384 hashing operation.
Definition: sparkle.c:1085
aead_hash_algorithm_t const esch_256_hash_algorithm
Meta-information block for the Esch256 hash algorithm.
Definition: sparkle.c:67
unsigned char count
Definition: sparkle.h:161
int esch_384_hash(unsigned char *out, const unsigned char *in, unsigned long long inlen)
Hashes a block of input data with Esch384 to generate a hash value.
Definition: sparkle.c:1053
int schwaemm_256_128_aead_encrypt(unsigned char *c, unsigned long long *clen, const unsigned char *m, unsigned long long mlen, const unsigned char *ad, unsigned long long adlen, const unsigned char *nsec, const unsigned char *npub, const unsigned char *k)
Encrypts and authenticates a packet with Schwaemm256-128.
Definition: sparkle.c:176
int schwaemm_256_128_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm256-128.
Definition: sparkle.c:239
State information for the Esch256 incremental hash mode.
Definition: sparkle.h:156
unsigned long long align
Definition: sparkle.h:177
unsigned long long align
Definition: sparkle.h:163
aead_cipher_t const schwaemm_128_128_cipher
Meta-information block for the Schwaemm128-128 cipher.
Definition: sparkle.c:47
aead_cipher_t const schwaemm_192_192_cipher
Meta-information block for the Schwaemm192-192 cipher.
Definition: sparkle.c:37
aead_cipher_t const schwaemm_256_256_cipher
Meta-information block for the Schwaemm256-256 cipher.
Definition: sparkle.c:57
aead_cipher_t const schwaemm_256_128_cipher
Meta-information block for the Schwaemm256-128 cipher.
Definition: sparkle.c:27
int schwaemm_128_128_aead_decrypt(unsigned char *m, unsigned long long *mlen, unsigned char *nsec, const unsigned char *c, unsigned long long clen, const unsigned char *ad, unsigned long long adlen, const unsigned char *npub, const unsigned char *k)
Decrypts and authenticates a packet with Schwaemm128-128.
Definition: sparkle.c:620
void esch_256_hash_finalize(esch_256_hash_state_t *state, unsigned char *out)
Returns the final hash value from an Esch256 hashing operation.
Definition: sparkle.c:982
aead_hash_algorithm_t const esch_384_hash_algorithm
Meta-information block for the Esch384 hash algorithm.
Definition: sparkle.c:80