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.

52 lines
1.4 KiB

  1. /*
  2. xmss.h version 20150811
  3. Andreas Hülsing
  4. Public domain.
  5. */
  6. #include "wots.h"
  7. #ifndef XMSS_H
  8. #define XMSS_H
  9. typedef struct{
  10. int level;
  11. unsigned long long subtree;
  12. int subleaf;
  13. } leafaddr;
  14. typedef struct{
  15. wots_params *wots_par;
  16. int n;
  17. int m;
  18. int h;
  19. } xmss_params;
  20. /**
  21. * Initializes parameter set.
  22. * Needed, for any of the other methods.
  23. */
  24. void xmss_set_params(xmss_params *params, int m, int n, int h, int w);
  25. /**
  26. * Generates a XMSS key pair for a given parameter set.
  27. * Format sk: [(32bit) idx || SK_SEED || SK_PRF || PUB_SEED]
  28. * Format pk: [root || PUB_SEED] omitting algo oid.
  29. */
  30. int xmss_keypair(unsigned char *pk, unsigned char *sk, xmss_params *params);
  31. /**
  32. * Signs a message.
  33. * Returns
  34. * 1. an array containing the signature followed by the message AND
  35. * 2. an updated secret key!
  36. *
  37. */
  38. int xmss_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg,unsigned long long msglen, const xmss_params *params, unsigned char* pk);
  39. /**
  40. * Verifies a given message signature pair under a given public key.
  41. *
  42. * 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).
  43. */
  44. 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, const xmss_params *params);
  45. #endif