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.

48 line
1.9 KiB

  1. #ifndef XMSS_CORE_H
  2. #define XMSS_CORE_H
  3. #include "params.h"
  4. /**
  5. * Generates a XMSS key pair for a given parameter set.
  6. * Format sk: [(32bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  7. * Format pk: [root || PUB_SEED] omitting algo oid.
  8. */
  9. int xmss_core_keypair(const xmss_params *params, unsigned char *pk, unsigned char *sk);
  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_core_sign(const xmss_params *params, 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
  21. * verification succeeds. The (input) message is assumed to be within sig_msg
  22. * which has the form (sig||msg).
  23. */
  24. int xmss_core_sign_open(const xmss_params *params, unsigned char *msg, unsigned long long *msglen, const unsigned char *sig_msg, unsigned long long sig_msg_len, const unsigned char *pk);
  25. /*
  26. * Generates a XMSSMT key pair for a given parameter set.
  27. * Format sk: [(ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  28. * Format pk: [root || PUB_SEED] omitting algo oid.
  29. */
  30. int xmssmt_core_keypair(const xmss_params *params, unsigned char *pk, unsigned char *sk);
  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 xmssmt_core_sign(const xmss_params *params, unsigned char *sk, unsigned char *sig_msg, unsigned long long *sig_msg_len, const unsigned char *msg, unsigned long long msglen);
  39. /**
  40. * Verifies a given message signature pair under a given public key.
  41. */
  42. int xmssmt_core_sign_open(const xmss_params *params, unsigned char *msg, unsigned long long *msglen, const unsigned char *sig_msg, unsigned long long sig_msg_len, const unsigned char *pk);
  43. #endif