before.c 444 B

1234567891011121314151617
  1. #include "crypto_core_hsalsa20.h"
  2. #include "crypto_scalarmult_curve25519.h"
  3. #include "crypto_box.h"
  4. static const unsigned char sigma[16] = "expand 32-byte k";
  5. static const unsigned char n[16] = {0};
  6. int crypto_box_curve25519xsalsa20poly1305_ref_beforenm(
  7. unsigned char *k,
  8. const unsigned char *pk,
  9. const unsigned char *sk
  10. )
  11. {
  12. unsigned char s[32];
  13. crypto_scalarmult_curve25519(s,sk,pk);
  14. return crypto_core_hsalsa20(k,n,s,sigma);
  15. }