Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.

59 řádky
1.9 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. typedef struct{
  11. unsigned int level;
  12. unsigned long long subtree;
  13. unsigned int subleaf;
  14. } leafaddr;
  15. /**
  16. * Generates a XMSS key pair for a given parameter set.
  17. * Format sk: [(32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  18. * Format pk: [root || PUB_SEED] omitting algo oid.
  19. */
  20. int xmss_keypair(unsigned char *pk, unsigned char *sk);
  21. /**
  22. * Signs a message.
  23. * Returns
  24. * 1. an array containing the signature followed by the message AND
  25. * 2. an updated secret key!
  26. *
  27. */
  28. int xmss_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  29. /**
  30. * Verifies a given message signature pair under a given public key.
  31. *
  32. * 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).
  33. */
  34. 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);
  35. /*
  36. * Generates a XMSSMT key pair for a given parameter set.
  37. * Format sk: [(ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  38. * Format pk: [root || PUB_SEED] omitting algo oid.
  39. */
  40. int xmssmt_keypair(unsigned char *pk, unsigned char *sk);
  41. /**
  42. * Signs a message.
  43. * Returns
  44. * 1. an array containing the signature followed by the message AND
  45. * 2. an updated secret key!
  46. *
  47. */
  48. int xmssmt_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  49. /**
  50. * Verifies a given message signature pair under a given public key.
  51. */
  52. 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);
  53. #endif