chacha20poly1305.h 727 B

12345678910111213141516171819
  1. #ifndef CHACHA20POLY1305_H
  2. #define CHACHA20POLY1305_H
  3. #include <stdint.h>
  4. #include "ecrypt-sync.h"
  5. #include "poly1305-donna.h"
  6. typedef struct {
  7. ECRYPT_ctx chacha20;
  8. poly1305_context poly1305;
  9. } chacha20poly1305_ctx;
  10. void xchacha20poly1305_init(chacha20poly1305_ctx *ctx, const uint8_t key[32], const uint8_t nonce[24]);
  11. void chacha20poly1305_encrypt(chacha20poly1305_ctx *ctx, const uint8_t *in, uint8_t *out, size_t n);
  12. void chacha20poly1305_decrypt(chacha20poly1305_ctx *ctx, const uint8_t *in, uint8_t *out, size_t n);
  13. void chacha20poly1305_auth(chacha20poly1305_ctx *ctx, const uint8_t *in, size_t n);
  14. void chacha20poly1305_finish(chacha20poly1305_ctx *ctx, uint8_t mac[16]);
  15. #endif // CHACHA20POLY1305_H