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.

115 lignes
4.3 KiB

  1. #include <stdio.h>
  2. #include "../params.h"
  3. #define CHECK_OID_XMSS(PARAMSET) \
  4. if (xmss_str_to_oid(&oid, PARAMSET)) {\
  5. printf("Did not recognize " PARAMSET "!\n");\
  6. return -1;\
  7. }\
  8. if (xmss_parse_oid(&params, oid)) {\
  9. printf("Could not parse OID for " PARAMSET "!\n");\
  10. return -1;\
  11. }
  12. #define CHECK_OID_XMSSMT(PARAMSET) \
  13. if (xmssmt_str_to_oid(&oid, PARAMSET)) {\
  14. printf("Did not recognize " PARAMSET "!\n");\
  15. return -1;\
  16. }\
  17. if (xmssmt_parse_oid(&params, oid)) {\
  18. printf("Could not parse OID for " PARAMSET "!\n");\
  19. return -1;\
  20. }
  21. int main()
  22. {
  23. uint32_t oid;
  24. xmss_params params;
  25. printf("Testing if all expected XMSS parameter sets are recognized.. ");
  26. CHECK_OID_XMSS("XMSS-SHA2_10_256");
  27. CHECK_OID_XMSS("XMSS-SHA2_16_256");
  28. CHECK_OID_XMSS("XMSS-SHA2_20_256");
  29. CHECK_OID_XMSS("XMSS-SHA2_10_512");
  30. CHECK_OID_XMSS("XMSS-SHA2_16_512");
  31. CHECK_OID_XMSS("XMSS-SHA2_20_512");
  32. CHECK_OID_XMSS("XMSS-SHAKE_10_256");
  33. CHECK_OID_XMSS("XMSS-SHAKE_16_256");
  34. CHECK_OID_XMSS("XMSS-SHAKE_20_256");
  35. CHECK_OID_XMSS("XMSS-SHAKE_10_512");
  36. CHECK_OID_XMSS("XMSS-SHAKE_16_512");
  37. CHECK_OID_XMSS("XMSS-SHAKE_20_512");
  38. CHECK_OID_XMSS("XMSS-SHA2_10_192");
  39. CHECK_OID_XMSS("XMSS-SHA2_16_192");
  40. CHECK_OID_XMSS("XMSS-SHA2_20_192");
  41. CHECK_OID_XMSS("XMSS-SHAKE256_10_256");
  42. CHECK_OID_XMSS("XMSS-SHAKE256_16_256");
  43. CHECK_OID_XMSS("XMSS-SHAKE256_20_256");
  44. CHECK_OID_XMSS("XMSS-SHAKE256_10_192");
  45. CHECK_OID_XMSS("XMSS-SHAKE256_16_192");
  46. CHECK_OID_XMSS("XMSS-SHAKE256_20_192");
  47. printf("successful.\n");
  48. printf("Testing if all expected XMSSMT parameter sets are recognized.. ");
  49. CHECK_OID_XMSSMT("XMSSMT-SHA2_20/2_256");
  50. CHECK_OID_XMSSMT("XMSSMT-SHA2_20/4_256");
  51. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/2_256");
  52. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/4_256");
  53. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/8_256");
  54. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/3_256");
  55. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/6_256");
  56. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/12_256");
  57. CHECK_OID_XMSSMT("XMSSMT-SHA2_20/2_512");
  58. CHECK_OID_XMSSMT("XMSSMT-SHA2_20/4_512");
  59. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/2_512");
  60. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/4_512");
  61. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/8_512");
  62. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/3_512");
  63. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/6_512");
  64. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/12_512");
  65. CHECK_OID_XMSSMT("XMSSMT-SHAKE_20/2_256");
  66. CHECK_OID_XMSSMT("XMSSMT-SHAKE_20/4_256");
  67. CHECK_OID_XMSSMT("XMSSMT-SHAKE_40/2_256");
  68. CHECK_OID_XMSSMT("XMSSMT-SHAKE_40/4_256");
  69. CHECK_OID_XMSSMT("XMSSMT-SHAKE_40/8_256");
  70. CHECK_OID_XMSSMT("XMSSMT-SHAKE_60/3_256");
  71. CHECK_OID_XMSSMT("XMSSMT-SHAKE_60/6_256");
  72. CHECK_OID_XMSSMT("XMSSMT-SHAKE_60/12_256");
  73. CHECK_OID_XMSSMT("XMSSMT-SHAKE_20/2_512");
  74. CHECK_OID_XMSSMT("XMSSMT-SHAKE_20/4_512");
  75. CHECK_OID_XMSSMT("XMSSMT-SHAKE_40/2_512");
  76. CHECK_OID_XMSSMT("XMSSMT-SHAKE_40/4_512");
  77. CHECK_OID_XMSSMT("XMSSMT-SHAKE_40/8_512");
  78. CHECK_OID_XMSSMT("XMSSMT-SHAKE_60/3_512");
  79. CHECK_OID_XMSSMT("XMSSMT-SHAKE_60/6_512");
  80. CHECK_OID_XMSSMT("XMSSMT-SHAKE_60/12_512");
  81. CHECK_OID_XMSSMT("XMSSMT-SHA2_20/2_192");
  82. CHECK_OID_XMSSMT("XMSSMT-SHA2_20/4_192");
  83. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/2_192");
  84. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/4_192");
  85. CHECK_OID_XMSSMT("XMSSMT-SHA2_40/8_192");
  86. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/3_192");
  87. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/6_192");
  88. CHECK_OID_XMSSMT("XMSSMT-SHA2_60/12_192");
  89. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_20/2_256");
  90. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_20/4_256");
  91. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_40/2_256");
  92. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_40/4_256");
  93. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_40/8_256");
  94. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_60/3_256");
  95. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_60/6_256");
  96. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_60/12_256");
  97. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_20/2_192");
  98. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_20/4_192");
  99. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_40/2_192");
  100. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_40/4_192");
  101. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_40/8_192");
  102. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_60/3_192");
  103. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_60/6_192");
  104. CHECK_OID_XMSSMT("XMSSMT-SHAKE256_60/12_192");
  105. printf("successful.\n");
  106. return 0;
  107. }