1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis
3 * LibTomCrypt is a library that provides various cryptographic
4 * algorithms in a highly modular and flexible manner.
6 * The library is free for all purposes without any express
12 #ifdef LTC_CHACHA20POLY1305_MODE
15 Add AAD to the ChaCha20Poly1305 state
16 @param st The ChaCha20Poly1305 state
17 @param in The additional authentication data to add to the ChaCha20Poly1305 state
18 @param inlen The length of the ChaCha20Poly1305 data.
19 @return CRYPT_OK on success
21 int chacha20poly1305_add_aad(chacha20poly1305_state *st, const unsigned char *in, unsigned long inlen)
25 if (inlen == 0) return CRYPT_OK; /* nothing to do */
26 LTC_ARGCHK(st != NULL);
28 if (st->aadflg == 0) return CRYPT_ERROR;
29 if ((err = poly1305_process(&st->poly, in, inlen)) != CRYPT_OK) return err;
30 st->aadlen += (ulong64)inlen;
36 /* ref: $Format:%D$ */
37 /* git commit: $Format:%H$ */
38 /* commit time: $Format:%ai$ */