Vous ne pouvez pas sélectionner plus de 25 sujets Les noms de sujets doivent commencer par une lettre ou un nombre, peuvent contenir des tirets ('-') et peuvent comporter jusqu'à 35 caractères.

71 lignes
2.1 KiB

  1. #ifndef XMSS_PARAMS_H
  2. #define XMSS_PARAMS_H
  3. #include <stdint.h>
  4. /* These are merely internal identifiers for the supported hash functions. */
  5. #define XMSS_SHA2 0
  6. #define XMSS_SHAKE 1
  7. /* This is a result of the OID definitions in the draft; needed for parsing. */
  8. #define XMSS_OID_LEN 4
  9. /* This structure will be populated when calling xmss[mt]_parse_oid. */
  10. typedef struct {
  11. unsigned int func;
  12. unsigned int n;
  13. unsigned int wots_w;
  14. unsigned int wots_log_w;
  15. unsigned int wots_len1;
  16. unsigned int wots_len2;
  17. unsigned int wots_len;
  18. unsigned int wots_sig_bytes;
  19. unsigned int full_height;
  20. unsigned int tree_height;
  21. unsigned int d;
  22. unsigned int index_bytes;
  23. unsigned int sig_bytes;
  24. unsigned int pk_bytes;
  25. unsigned long long sk_bytes;
  26. unsigned int bds_k;
  27. } xmss_params;
  28. /**
  29. * Accepts strings such as "XMSS-SHA2_10_256"
  30. * and outputs OIDs such as 0x01000001.
  31. * Returns -1 when the parameter set is not found, 0 otherwise
  32. */
  33. int xmss_str_to_oid(uint32_t *oid, const char *s);
  34. /**
  35. * Accepts takes strings such as "XMSSMT-SHA2_20/2_256"
  36. * and outputs OIDs such as 0x01000001.
  37. * Returns -1 when the parameter set is not found, 0 otherwise
  38. */
  39. int xmssmt_str_to_oid(uint32_t *oid, const char *s);
  40. /**
  41. * Accepts OIDs such as 0x01000001, and configures params accordingly.
  42. * Returns -1 when the OID is not found, 0 otherwise.
  43. */
  44. int xmss_parse_oid(xmss_params *params, const uint32_t oid);
  45. /**
  46. * Accepts OIDs such as 0x01000001, and configures params accordingly.
  47. * Returns -1 when the OID is not found, 0 otherwise.
  48. */
  49. int xmssmt_parse_oid(xmss_params *params, const uint32_t oid);
  50. /* Given a params struct where the following properties have been initialized;
  51. - full_height; the height of the complete (hyper)tree
  52. - n; the number of bytes of hash function output
  53. - d; the number of layers (d > 1 implies XMSSMT)
  54. - func; one of {XMSS_SHA2, XMSS_SHAKE}
  55. - wots_w; the Winternitz parameter
  56. - optionally, bds_k; the BDS traversal trade-off parameter,
  57. this function initializes the remainder of the params structure. */
  58. int xmss_xmssmt_initialize_params(xmss_params *params);
  59. #endif