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.

45 lines
1.8 KiB

  1. #ifndef XMSS_H
  2. #define XMSS_H
  3. #include <stdint.h>
  4. /**
  5. * Generates a XMSS key pair for a given parameter set.
  6. * Format sk: [oid || (32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  7. * Format pk: [oid || root || PUB_SEED]
  8. */
  9. int xmss_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid);
  10. /**
  11. * Signs a message.
  12. * Returns
  13. * 1. an array containing the signature followed by the message AND
  14. * 2. an updated secret key!
  15. */
  16. int xmss_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  17. /**
  18. * Verifies a given message signature pair under a given public key.
  19. *
  20. * 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).
  21. */
  22. 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);
  23. /*
  24. * Generates a XMSSMT key pair for a given parameter set.
  25. * Format sk: [oid || (ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  26. * Format pk: [oid || root || PUB_SEED]
  27. */
  28. int xmssmt_keypair(unsigned char *pk, unsigned char *sk, const uint32_t oid);
  29. /**
  30. * Signs a message.
  31. * Returns
  32. * 1. an array containing the signature followed by the message AND
  33. * 2. an updated secret key!
  34. */
  35. int xmssmt_sign(unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  36. /**
  37. * Verifies a given message signature pair under a given public key.
  38. */
  39. 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);
  40. #endif