ed_25519.h 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #ifndef ED25519_H
  2. #define ED25519_H
  3. // Nightcracker's Ed25519 - https://github.com/orlp/ed25519
  4. #include <stddef.h>
  5. #if defined(_WIN32)
  6. #if defined(ED25519_BUILD_DLL)
  7. #define ED25519_DECLSPEC __declspec(dllexport)
  8. #elif defined(ED25519_DLL)
  9. #define ED25519_DECLSPEC __declspec(dllimport)
  10. #else
  11. #define ED25519_DECLSPEC
  12. #endif
  13. #else
  14. #define ED25519_DECLSPEC
  15. #endif
  16. #ifdef __cplusplus
  17. extern "C" {
  18. #endif
  19. #ifndef ED25519_NO_SEED
  20. int ED25519_DECLSPEC ed25519_create_seed(unsigned char *seed);
  21. #endif
  22. void ED25519_DECLSPEC ed25519_create_keypair(unsigned char *public_key, unsigned char *private_key, const unsigned char *seed);
  23. void ED25519_DECLSPEC ed25519_sign(unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key, const unsigned char *private_key);
  24. int ED25519_DECLSPEC ed25519_verify(const unsigned char *signature, const unsigned char *message, size_t message_len, const unsigned char *public_key);
  25. void ED25519_DECLSPEC ed25519_add_scalar(unsigned char *public_key, unsigned char *private_key, const unsigned char *scalar);
  26. void ED25519_DECLSPEC ed25519_key_exchange(unsigned char *shared_secret, const unsigned char *public_key, const unsigned char *private_key);
  27. #ifdef __cplusplus
  28. }
  29. #endif
  30. #endif