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ů.

xmss_core.h 2.5 KiB

před 9 roky
před 7 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
před 9 roky
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. #ifndef XMSS_CORE_H
  2. #define XMSS_CORE_H
  3. #include "params.h"
  4. /**
  5. * Given a set of parameters, this function returns the size of the secret key.
  6. * This is implementation specific, as varying choices in tree traversal will
  7. * result in varying requirements for state storage.
  8. *
  9. * This function handles both XMSS and XMSSMT parameter sets.
  10. */
  11. unsigned long long xmss_xmssmt_core_sk_bytes(const xmss_params *params);
  12. /*
  13. * Generates a XMSS key pair for a given parameter set.
  14. * Format sk: [(32bit) index || SK_SEED || SK_PRF || PUB_SEED || root]
  15. * Format pk: [root || PUB_SEED], omitting algorithm OID.
  16. */
  17. int xmss_core_keypair(const xmss_params *params,
  18. unsigned char *pk, unsigned char *sk);
  19. /**
  20. * Signs a message. Returns an array containing the signature followed by the
  21. * message and an updated secret key.
  22. */
  23. int xmss_core_sign(const xmss_params *params,
  24. unsigned char *sk,
  25. unsigned char *sm, unsigned long long *smlen,
  26. const unsigned char *m, unsigned long long mlen);
  27. /**
  28. * Verifies a given message signature pair under a given public key.
  29. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  30. */
  31. int xmss_core_sign_open(const xmss_params *params,
  32. unsigned char *m, unsigned long long *mlen,
  33. const unsigned char *sm, unsigned long long smlen,
  34. const unsigned char *pk);
  35. /*
  36. * Generates a XMSSMT key pair for a given parameter set.
  37. * Format sk: [(ceil(h/8) bit) index || SK_SEED || SK_PRF || PUB_SEED || root]
  38. * Format pk: [root || PUB_SEED] omitting algorithm OID.
  39. */
  40. int xmssmt_core_keypair(const xmss_params *params,
  41. unsigned char *pk, unsigned char *sk);
  42. /**
  43. * Signs a message. Returns an array containing the signature followed by the
  44. * message and an updated secret key.
  45. */
  46. int xmssmt_core_sign(const xmss_params *params,
  47. unsigned char *sk,
  48. unsigned char *sm, unsigned long long *smlen,
  49. const unsigned char *m, unsigned long long mlen);
  50. /**
  51. * Verifies a given message signature pair under a given public key.
  52. * Note that this assumes a pk without an OID, i.e. [root || PUB_SEED]
  53. */
  54. int xmssmt_core_sign_open(const xmss_params *params,
  55. unsigned char *m, unsigned long long *mlen,
  56. const unsigned char *sm, unsigned long long smlen,
  57. const unsigned char *pk);
  58. #endif