Você não pode selecionar mais de 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.

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