Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.

47 linhas
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. */
  17. 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);
  18. /**
  19. * Verifies a given message signature pair under a given public key.
  20. *
  21. * 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).
  22. */
  23. 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);
  24. /*
  25. * Generates a XMSSMT key pair for a given parameter set.
  26. * Format sk: [(ceil(h/8) bit) idx || SK_SEED || SK_PRF || PUB_SEED || root]
  27. * Format pk: [root || PUB_SEED] omitting algo oid.
  28. */
  29. int xmssmt_core_keypair(const xmss_params *params, unsigned char *pk, unsigned char *sk);
  30. /**
  31. * Signs a message.
  32. * Returns
  33. * 1. an array containing the signature followed by the message AND
  34. * 2. an updated secret key!
  35. *
  36. */
  37. 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);
  38. /**
  39. * Verifies a given message signature pair under a given public key.
  40. */
  41. 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);
  42. #endif