Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

60 рядки
1.6 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. #endif