Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

72 Zeilen
2.2 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 padding_len;
  14. unsigned int wots_w;
  15. unsigned int wots_log_w;
  16. unsigned int wots_len1;
  17. unsigned int wots_len2;
  18. unsigned int wots_len;
  19. unsigned int wots_sig_bytes;
  20. unsigned int full_height;
  21. unsigned int tree_height;
  22. unsigned int d;
  23. unsigned int index_bytes;
  24. unsigned int sig_bytes;
  25. unsigned int pk_bytes;
  26. unsigned long long sk_bytes;
  27. unsigned int bds_k;
  28. } xmss_params;
  29. /**
  30. * Accepts strings such as "XMSS-SHA2_10_256"
  31. * and outputs OIDs such as 0x01000001.
  32. * Returns -1 when the parameter set is not found, 0 otherwise
  33. */
  34. int xmss_str_to_oid(uint32_t *oid, const char *s);
  35. /**
  36. * Accepts takes strings such as "XMSSMT-SHA2_20/2_256"
  37. * and outputs OIDs such as 0x01000001.
  38. * Returns -1 when the parameter set is not found, 0 otherwise
  39. */
  40. int xmssmt_str_to_oid(uint32_t *oid, const char *s);
  41. /**
  42. * Accepts OIDs such as 0x01000001, and configures params accordingly.
  43. * Returns -1 when the OID is not found, 0 otherwise.
  44. */
  45. int xmss_parse_oid(xmss_params *params, const uint32_t oid);
  46. /**
  47. * Accepts OIDs such as 0x01000001, and configures params accordingly.
  48. * Returns -1 when the OID is not found, 0 otherwise.
  49. */
  50. int xmssmt_parse_oid(xmss_params *params, const uint32_t oid);
  51. /* Given a params struct where the following properties have been initialized;
  52. - full_height; the height of the complete (hyper)tree
  53. - n; the number of bytes of hash function output
  54. - d; the number of layers (d > 1 implies XMSSMT)
  55. - func; one of {XMSS_SHA2, XMSS_SHAKE}
  56. - wots_w; the Winternitz parameter
  57. - optionally, bds_k; the BDS traversal trade-off parameter,
  58. this function initializes the remainder of the params structure. */
  59. int xmss_xmssmt_initialize_params(xmss_params *params);
  60. #endif