crypto_onetimeauth_poly1305.h 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. #ifndef crypto_onetimeauth_poly1305_H
  2. #define crypto_onetimeauth_poly1305_H
  3. #ifdef __cplusplus
  4. # ifdef __GNUC__
  5. # pragma GCC diagnostic ignored "-Wlong-long"
  6. # endif
  7. extern "C" {
  8. #endif
  9. #include <stdint.h>
  10. #include <stdio.h>
  11. #include <stdlib.h>
  12. #include <sys/types.h>
  13. #include "export.h"
  14. typedef struct CRYPTO_ALIGN(16) crypto_onetimeauth_poly1305_state {
  15. unsigned char opaque[256];
  16. } crypto_onetimeauth_poly1305_state;
  17. SODIUM_EXPORT
  18. size_t crypto_onetimeauth_poly1305_statebytes(void);
  19. #define crypto_onetimeauth_poly1305_BYTES 16U
  20. SODIUM_EXPORT
  21. size_t crypto_onetimeauth_poly1305_bytes(void);
  22. #define crypto_onetimeauth_poly1305_KEYBYTES 32U
  23. SODIUM_EXPORT
  24. size_t crypto_onetimeauth_poly1305_keybytes(void);
  25. SODIUM_EXPORT
  26. int crypto_onetimeauth_poly1305(unsigned char *out,
  27. const unsigned char *in,
  28. unsigned long long inlen,
  29. const unsigned char *k)
  30. __attribute__ ((nonnull(1, 4)));
  31. SODIUM_EXPORT
  32. int crypto_onetimeauth_poly1305_verify(const unsigned char *h,
  33. const unsigned char *in,
  34. unsigned long long inlen,
  35. const unsigned char *k)
  36. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull(1, 4)));
  37. SODIUM_EXPORT
  38. int crypto_onetimeauth_poly1305_init(crypto_onetimeauth_poly1305_state *state,
  39. const unsigned char *key)
  40. __attribute__ ((nonnull));
  41. SODIUM_EXPORT
  42. int crypto_onetimeauth_poly1305_update(crypto_onetimeauth_poly1305_state *state,
  43. const unsigned char *in,
  44. unsigned long long inlen)
  45. __attribute__ ((nonnull(1)));
  46. SODIUM_EXPORT
  47. int crypto_onetimeauth_poly1305_final(crypto_onetimeauth_poly1305_state *state,
  48. unsigned char *out)
  49. __attribute__ ((nonnull));
  50. SODIUM_EXPORT
  51. void crypto_onetimeauth_poly1305_keygen(unsigned char k[crypto_onetimeauth_poly1305_KEYBYTES])
  52. __attribute__ ((nonnull));
  53. #ifdef __cplusplus
  54. }
  55. #endif
  56. #endif