ed25519.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. #ifndef ED25519_H
  2. #define ED25519_H
  3. #include "../options.h"
  4. #if defined(__cplusplus)
  5. extern "C" {
  6. #endif
  7. typedef unsigned char ed25519_signature[64];
  8. typedef unsigned char ed25519_public_key[32];
  9. typedef unsigned char ed25519_secret_key[32];
  10. typedef unsigned char curve25519_key[32];
  11. typedef unsigned char ed25519_cosi_signature[32];
  12. void ed25519_publickey(const ed25519_secret_key sk, ed25519_public_key pk);
  13. void ed25519_publickey_ext(const ed25519_secret_key extsk, ed25519_public_key pk);
  14. int ed25519_sign_open(const unsigned char *m, size_t mlen, const ed25519_public_key pk, const ed25519_signature RS);
  15. void ed25519_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, ed25519_signature RS);
  16. void ed25519_sign_ext(const unsigned char *m, size_t mlen, const ed25519_secret_key sk, const ed25519_secret_key skext, ed25519_signature RS);
  17. int ed25519_scalarmult(ed25519_public_key res, const ed25519_secret_key sk, const ed25519_public_key pk);
  18. void curve25519_scalarmult(curve25519_key mypublic, const curve25519_key secret, const curve25519_key basepoint);
  19. void curve25519_scalarmult_basepoint(curve25519_key mypublic, const curve25519_key secret);
  20. #if !defined(__GNUC__) || __GNUC__ > 4
  21. #define CONST const
  22. #else
  23. #define CONST
  24. #endif
  25. int ed25519_cosi_combine_publickeys(ed25519_public_key res, CONST ed25519_public_key *pks, size_t n);
  26. void ed25519_cosi_combine_signatures(ed25519_signature res, const ed25519_public_key R, CONST ed25519_cosi_signature *sigs, size_t n);
  27. void ed25519_cosi_commit(ed25519_secret_key nonce, ed25519_public_key commitment);
  28. int ed25519_cosi_sign(const unsigned char *m, size_t mlen, const ed25519_secret_key key, const ed25519_secret_key nonce, const ed25519_public_key R, const ed25519_public_key pk, ed25519_cosi_signature sig);
  29. #if defined(__cplusplus)
  30. }
  31. #endif
  32. #endif // ED25519_H