crypto_auth.c 775 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. #include "crypto_auth.h"
  2. #include "randombytes.h"
  3. size_t
  4. crypto_auth_bytes(void)
  5. {
  6. return crypto_auth_BYTES;
  7. }
  8. size_t
  9. crypto_auth_keybytes(void)
  10. {
  11. return crypto_auth_KEYBYTES;
  12. }
  13. const char *
  14. crypto_auth_primitive(void)
  15. {
  16. return crypto_auth_PRIMITIVE;
  17. }
  18. int
  19. crypto_auth(unsigned char *out, const unsigned char *in,
  20. unsigned long long inlen, const unsigned char *k)
  21. {
  22. return crypto_auth_hmacsha512256(out, in, inlen, k);
  23. }
  24. int
  25. crypto_auth_verify(const unsigned char *h, const unsigned char *in,
  26. unsigned long long inlen,const unsigned char *k)
  27. {
  28. return crypto_auth_hmacsha512256_verify(h, in, inlen, k);
  29. }
  30. void
  31. crypto_auth_keygen(unsigned char k[crypto_auth_KEYBYTES])
  32. {
  33. randombytes_buf(k, crypto_auth_KEYBYTES);
  34. }