You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

54 lines
1.8 KiB

  1. /*
  2. xmss.h version 20160722
  3. Andreas Hülsing
  4. Joost Rijneveld
  5. Public domain.
  6. */
  7. #include "wots.h"
  8. #ifndef XMSS_H
  9. #define XMSS_H
  10. /**
  11. * Generates a XMSS key pair for a given parameter set.
  12. * Format sk: [(32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  13. * Format pk: [root || PUB_SEED] omitting algo oid.
  14. */
  15. int xmss_keypair(unsigned char *pk, unsigned char *sk);
  16. /**
  17. * Signs a message.
  18. * Returns
  19. * 1. an array containing the signature followed by the message AND
  20. * 2. an updated secret key!
  21. *
  22. */
  23. int xmss_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  24. /**
  25. * Verifies a given message signature pair under a given public key.
  26. *
  27. * Note: msg and msglen are pure outputs which carry the message in case verification succeeds. The (input) message is assumed to be within sig_msg which has the form (sig||msg).
  28. */
  29. int xmss_sign_open(unsigned char *msg, unsigned long long *msglen, const unsigned char *sig_msg, unsigned long long sig_msg_len, const unsigned char *pk);
  30. /*
  31. * Generates a XMSSMT key pair for a given parameter set.
  32. * Format sk: [(ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  33. * Format pk: [root || PUB_SEED] omitting algo oid.
  34. */
  35. int xmssmt_keypair(unsigned char *pk, unsigned char *sk);
  36. /**
  37. * Signs a message.
  38. * Returns
  39. * 1. an array containing the signature followed by the message AND
  40. * 2. an updated secret key!
  41. *
  42. */
  43. int xmssmt_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  44. /**
  45. * Verifies a given message signature pair under a given public key.
  46. */
  47. int xmssmt_sign_open(unsigned char *msg, unsigned long long *msglen, const unsigned char *sig_msg, unsigned long long sig_msg_len, const unsigned char *pk);
  48. #endif