]> git.meshlink.io Git - meshlink/blob - src/chacha-poly1305/chacha-poly1305.h
Add support for encrypted storage.
[meshlink] / src / chacha-poly1305 / chacha-poly1305.h
1 #ifndef CHACHA_POLY1305_H
2 #define CHACHA_POLY1305_H
3
4 #define CHACHA_POLY1305_KEYLEN 64
5
6 typedef struct chacha_poly1305_ctx chacha_poly1305_ctx_t;
7
8 extern chacha_poly1305_ctx_t *chacha_poly1305_init(void);
9 extern void chacha_poly1305_exit(chacha_poly1305_ctx_t *);
10 extern bool chacha_poly1305_set_key(chacha_poly1305_ctx_t *ctx, const void *key);
11
12 extern bool chacha_poly1305_encrypt(chacha_poly1305_ctx_t *ctx, uint64_t seqnr, const void *indata, size_t inlen, void *outdata, size_t *outlen);
13 extern bool chacha_poly1305_decrypt(chacha_poly1305_ctx_t *ctx, uint64_t seqnr, const void *indata, size_t inlen, void *outdata, size_t *outlen);
14
15 extern bool chacha_poly1305_encrypt_iv96(chacha_poly1305_ctx_t *ctx, const uint8_t *seqbuf, const void *indata, size_t inlen, void *outdata, size_t *outlen);
16 extern bool chacha_poly1305_decrypt_iv96(chacha_poly1305_ctx_t *ctx, const uint8_t *seqbuf, const void *indata, size_t inlen, void *outdata, size_t *outlen);
17
18 #endif //CHACHA_POLY1305_H