crypto_scalarmult.h 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. #ifndef crypto_scalarmult_H
  2. #define crypto_scalarmult_H
  3. #include <stddef.h>
  4. #include "crypto_scalarmult_curve25519.h"
  5. #include "export.h"
  6. #ifdef __cplusplus
  7. extern "C" {
  8. #endif
  9. #define crypto_scalarmult_BYTES crypto_scalarmult_curve25519_BYTES
  10. SODIUM_EXPORT
  11. size_t crypto_scalarmult_bytes(void);
  12. #define crypto_scalarmult_SCALARBYTES crypto_scalarmult_curve25519_SCALARBYTES
  13. SODIUM_EXPORT
  14. size_t crypto_scalarmult_scalarbytes(void);
  15. #define crypto_scalarmult_PRIMITIVE "curve25519"
  16. SODIUM_EXPORT
  17. const char *crypto_scalarmult_primitive(void);
  18. SODIUM_EXPORT
  19. int crypto_scalarmult_base(unsigned char *q, const unsigned char *n)
  20. __attribute__ ((nonnull));
  21. /*
  22. * NOTE: Do not use the result of this function directly for key exchange.
  23. *
  24. * Hash the result with the public keys in order to compute a shared
  25. * secret key: H(q || client_pk || server_pk)
  26. *
  27. * Or unless this is not an option, use the crypto_kx() API instead.
  28. */
  29. SODIUM_EXPORT
  30. int crypto_scalarmult(unsigned char *q, const unsigned char *n,
  31. const unsigned char *p)
  32. __attribute__ ((warn_unused_result)) __attribute__ ((nonnull));
  33. #ifdef __cplusplus
  34. }
  35. #endif
  36. #endif