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.
 
 

46 line
1.4 KiB

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