chacha20poly1305.h 734 B

12345678910111213141516171819202122
  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(
  11. chacha20poly1305_ctx* ctx,
  12. const uint8_t key[32],
  13. const uint8_t nonce[24]);
  14. void chacha20poly1305_encrypt(chacha20poly1305_ctx* ctx, const uint8_t* in, uint8_t* out, size_t n);
  15. void chacha20poly1305_decrypt(chacha20poly1305_ctx* ctx, const uint8_t* in, uint8_t* out, size_t n);
  16. void chacha20poly1305_auth(chacha20poly1305_ctx* ctx, const uint8_t* in, size_t n);
  17. void chacha20poly1305_finish(chacha20poly1305_ctx* ctx, uint8_t mac[16]);
  18. #endif // CHACHA20POLY1305_H