23 #ifndef LWCRYPTO_ASCON_H
24 #define LWCRYPTO_ASCON_H
54 #define ASCON128_KEY_SIZE 16
59 #define ASCON128_NONCE_SIZE 16
64 #define ASCON128_TAG_SIZE 16
69 #define ASCON80PQ_KEY_SIZE 20
74 #define ASCON80PQ_NONCE_SIZE 16
79 #define ASCON80PQ_TAG_SIZE 16
84 #define ASCON_HASH_SIZE 32
92 unsigned char state[40];
147 (
unsigned char *c,
unsigned long long *clen,
148 const unsigned char *m,
unsigned long long mlen,
149 const unsigned char *ad,
unsigned long long adlen,
150 const unsigned char *nsec,
151 const unsigned char *npub,
152 const unsigned char *k);
177 (
unsigned char *m,
unsigned long long *mlen,
179 const unsigned char *c,
unsigned long long clen,
180 const unsigned char *ad,
unsigned long long adlen,
181 const unsigned char *npub,
182 const unsigned char *k);
206 (
unsigned char *c,
unsigned long long *clen,
207 const unsigned char *m,
unsigned long long mlen,
208 const unsigned char *ad,
unsigned long long adlen,
209 const unsigned char *nsec,
210 const unsigned char *npub,
211 const unsigned char *k);
236 (
unsigned char *m,
unsigned long long *mlen,
238 const unsigned char *c,
unsigned long long clen,
239 const unsigned char *ad,
unsigned long long adlen,
240 const unsigned char *npub,
241 const unsigned char *k);
265 (
unsigned char *c,
unsigned long long *clen,
266 const unsigned char *m,
unsigned long long mlen,
267 const unsigned char *ad,
unsigned long long adlen,
268 const unsigned char *nsec,
269 const unsigned char *npub,
270 const unsigned char *k);
295 (
unsigned char *m,
unsigned long long *mlen,
297 const unsigned char *c,
unsigned long long clen,
298 const unsigned char *ad,
unsigned long long adlen,
299 const unsigned char *npub,
300 const unsigned char *k);
316 (
unsigned char *out,
const unsigned char *in,
unsigned long long inlen);
338 unsigned long long inlen);
368 (
unsigned char *out,
const unsigned char *in,
unsigned long long inlen);
390 unsigned long long inlen);
aead_cipher_t const ascon128_cipher
Meta-information block for the ASCON-128 cipher.
Definition: ascon128.c:42
unsigned long long align
Definition: ascon128.h:96
Meta-information about an AEAD cipher.
Definition: aead-common.h:185
aead_cipher_t const ascon80pq_cipher
Meta-information block for the ASCON-80pq cipher.
Definition: ascon128.c:62
Definitions that are common across AEAD schemes.
void ascon_hash_finalize(ascon_hash_state_t *state, unsigned char *out)
Returns the final hash value from an ASCON-HASH hashing operation.
Definition: ascon-hash.c:147
Meta-information about a hash algorithm that is related to an AEAD.
Definition: aead-common.h:204
int ascon80pq_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 ASCON-80pq.
Definition: ascon128.c:602
int ascon128_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 ASCON-128.
Definition: ascon128.c:334
int ascon_hash(unsigned char *out, const unsigned char *in, unsigned long long inlen)
Hashes a block of input data with ASCON-HASH.
Definition: ascon-hash.c:51
int ascon128a_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 ASCON-128a.
Definition: ascon128.c:493
void ascon_xof_init(ascon_hash_state_t *state)
Initializes the state for an ASCON-XOF hashing operation.
Definition: ascon-xof.c:60
State information for ASCON-HASH and ASCON-XOF incremental modes.
Definition: ascon128.h:89
int ascon128_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 ASCON-128.
Definition: ascon128.c:386
aead_hash_algorithm_t const ascon_hash_algorithm
Meta-information block for the ASCON-HASH algorithm.
Definition: ascon-hash.c:37
void ascon_hash_update(ascon_hash_state_t *state, const unsigned char *in, unsigned long long inlen)
Updates an ASCON-HASH state with more input data.
Definition: ascon-hash.c:94
aead_hash_algorithm_t const ascon_xof_algorithm
Meta-information block for the ASCON-XOF algorithm.
Definition: ascon-xof.c:37
void ascon_xof_absorb(ascon_hash_state_t *state, const unsigned char *in, unsigned long long inlen)
Aborbs more input data into an ASCON-XOF state.
Definition: ascon-xof.c:76
void ascon_hash_init(ascon_hash_state_t *state)
Initializes the state for an ASCON-HASH hashing operation.
Definition: ascon-hash.c:78
int ascon_xof(unsigned char *out, const unsigned char *in, unsigned long long inlen)
Hashes a block of input data with ASCON-XOF and generates a fixed-length 32 byte output.
Definition: ascon-xof.c:51
int ascon128a_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 ASCON-128a.
Definition: ascon128.c:441
void ascon_xof_squeeze(ascon_hash_state_t *state, unsigned char *out, unsigned long long outlen)
Squeezes output data from an ASCON-XOF state.
Definition: ascon-xof.c:95
int ascon80pq_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 ASCON-80pq.
Definition: ascon128.c:548
unsigned char count
Definition: ascon128.h:93
unsigned char mode
Definition: ascon128.h:94
aead_cipher_t const ascon128a_cipher
Meta-information block for the ASCON-128a cipher.
Definition: ascon128.c:52