23 #ifndef LWCRYPTO_AEAD_COMMON_H
24 #define LWCRYPTO_AEAD_COMMON_H
60 (
unsigned char *c,
unsigned long long *clen,
61 const unsigned char *m,
unsigned long long mlen,
62 const unsigned char *ad,
unsigned long long adlen,
63 const unsigned char *nsec,
64 const unsigned char *npub,
65 const unsigned char *k);
87 (
unsigned char *m,
unsigned long long *mlen,
89 const unsigned char *c,
unsigned long long clen,
90 const unsigned char *ad,
unsigned long long adlen,
91 const unsigned char *npub,
92 const unsigned char *k);
105 (
unsigned char *out,
const unsigned char *in,
unsigned long long inlen);
122 (
void *state,
const unsigned char *in,
unsigned long long inlen);
142 (
void *state,
const unsigned char *in,
unsigned long long inlen);
152 (
void *state,
unsigned char *out,
unsigned long long outlen);
157 #define AEAD_FLAG_NONE 0x0000
169 #define AEAD_FLAG_LITTLE_ENDIAN 0x0001
174 #define AEAD_FLAG_SC_PROTECT_KEY 0x0002
180 #define AEAD_FLAG_SC_PROTECT_ALL 0x0004
235 (
unsigned char *plaintext,
unsigned long long plaintext_len,
236 const unsigned char *tag1,
const unsigned char *tag2,
259 (
unsigned char *plaintext,
unsigned long long plaintext_len,
260 const unsigned char *tag1,
const unsigned char *tag2,
261 unsigned tag_len,
int precheck);
Meta-information about an AEAD cipher.
Definition: aead-common.h:185
Meta-information about a hash algorithm that is related to an AEAD.
Definition: aead-common.h:204
unsigned nonce_len
Definition: aead-common.h:189
void(* aead_hash_init_t)(void *state)
Initializes the state for a hashing operation.
Definition: aead-common.h:112
int(* aead_cipher_encrypt_t)(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 an AEAD scheme.
Definition: aead-common.h:60
unsigned flags
Definition: aead-common.h:191
unsigned hash_len
Definition: aead-common.h:208
int(* aead_hash_t)(unsigned char *out, const unsigned char *in, unsigned long long inlen)
Hashes a block of input data.
Definition: aead-common.h:105
size_t state_size
Definition: aead-common.h:207
aead_hash_init_t init
Definition: aead-common.h:211
const char * name
Definition: aead-common.h:206
aead_xof_squeeze_t squeeze
Definition: aead-common.h:215
aead_hash_finalize_t finalize
Definition: aead-common.h:213
void(* aead_hash_finalize_t)(void *state, unsigned char *out)
Returns the final hash value from a hashing operation.
Definition: aead-common.h:130
void(* aead_xof_squeeze_t)(void *state, unsigned char *out, unsigned long long outlen)
Squeezes output data from an XOF state.
Definition: aead-common.h:152
aead_hash_t hash
Definition: aead-common.h:210
aead_hash_update_t update
Definition: aead-common.h:212
int(* aead_cipher_decrypt_t)(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 an AEAD scheme.
Definition: aead-common.h:87
unsigned tag_len
Definition: aead-common.h:190
int aead_check_tag(unsigned char *plaintext, unsigned long long plaintext_len, const unsigned char *tag1, const unsigned char *tag2, unsigned tag_len)
Check an authentication tag in constant time.
Definition: aead-common.c:26
unsigned flags
Definition: aead-common.h:209
unsigned key_len
Definition: aead-common.h:188
const char * name
Definition: aead-common.h:187
aead_cipher_encrypt_t encrypt
Definition: aead-common.h:192
void(* aead_xof_absorb_t)(void *state, const unsigned char *in, unsigned long long inlen)
Aborbs more input data into an XOF state.
Definition: aead-common.h:142
aead_cipher_decrypt_t decrypt
Definition: aead-common.h:193
int aead_check_tag_precheck(unsigned char *plaintext, unsigned long long plaintext_len, const unsigned char *tag1, const unsigned char *tag2, unsigned tag_len, int precheck)
Check an authentication tag in constant time with a previous check.
Definition: aead-common.c:49
aead_xof_absorb_t absorb
Definition: aead-common.h:214
void(* aead_hash_update_t)(void *state, const unsigned char *in, unsigned long long inlen)
Updates a hash state with more input data.
Definition: aead-common.h:122