box.c 680 B

123456789101112131415161718192021222324252627
  1. #include "crypto_box.h"
  2. int crypto_box_curve25519xsalsa20poly1305_ref(
  3. unsigned char *c,
  4. const unsigned char *m,unsigned long long mlen,
  5. const unsigned char *n,
  6. const unsigned char *pk,
  7. const unsigned char *sk
  8. )
  9. {
  10. unsigned char k[crypto_box_BEFORENMBYTES];
  11. crypto_box_beforenm(k,pk,sk);
  12. return crypto_box_afternm(c,m,mlen,n,k);
  13. }
  14. int crypto_box_curve25519xsalsa20poly1305_ref_open(
  15. unsigned char *m,
  16. const unsigned char *c,unsigned long long clen,
  17. const unsigned char *n,
  18. const unsigned char *pk,
  19. const unsigned char *sk
  20. )
  21. {
  22. unsigned char k[crypto_box_BEFORENMBYTES];
  23. crypto_box_beforenm(k,pk,sk);
  24. return crypto_box_open_afternm(m,c,clen,n,k);
  25. }