1 /* LibTomCrypt, modular cryptographic library -- Tom St Denis */
2 /* SPDX-License-Identifier: Unlicense */
3 
4 #include "tomcrypt_private.h"
5 
6 #ifdef LTC_CHACHA20POLY1305_MODE
7 
8 /**
9    Initialize an ChaCha20Poly1305 context (only the key)
10    @param st        [out] The destination of the ChaCha20Poly1305 state
11    @param key       The secret key
12    @param keylen    The length of the secret key (octets)
13    @return CRYPT_OK if successful
14 */
chacha20poly1305_init(chacha20poly1305_state * st,const unsigned char * key,unsigned long keylen)15 int chacha20poly1305_init(chacha20poly1305_state *st, const unsigned char *key, unsigned long keylen)
16 {
17    return chacha_setup(&st->chacha, key, keylen, 20);
18 }
19 
20 #endif
21