pq_crypto 0.6.4 → 0.6.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (213) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +180 -0
  3. data/README.md +7 -0
  4. data/ext/pqcrypto/extconf.rb +4 -1
  5. data/ext/pqcrypto/pq_externalmu.c +35 -0
  6. data/ext/pqcrypto/pqcrypto_native_api.h +85 -75
  7. data/ext/pqcrypto/pqcrypto_ruby_secure.c +16 -9
  8. data/ext/pqcrypto/pqcrypto_secure.c +43 -33
  9. data/ext/pqcrypto/pqcrypto_secure.h +52 -47
  10. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  11. data/ext/pqcrypto/vendor/.vendored +7 -7
  12. data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +5 -2
  13. data/ext/pqcrypto/vendor/mldsa-native/LICENSE +21 -2
  14. data/ext/pqcrypto/vendor/mldsa-native/README.md +20 -7
  15. data/ext/pqcrypto/vendor/mldsa-native/RELEASE.md +160 -0
  16. data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +1 -1
  17. data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +2 -2
  18. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +85 -59
  19. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +292 -348
  20. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +122 -76
  21. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +184 -86
  22. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +49 -4
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +49 -81
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h +152 -0
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +25 -12
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +2 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +2 -0
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +2 -2
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +9 -11
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +19 -11
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +6 -4
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +7 -4
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +7 -4
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +12 -9
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +12 -9
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +1 -1
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +3 -2
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +3 -2
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +6 -1
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +3 -2
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +11 -11
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +9 -22
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +8 -5
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +1 -0
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/{state_extract_bytes_x4_mve.S → keccak_f1600_x4_state_extract_bytes_mve.S} +14 -14
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/{state_xor_bytes_x4_mve.S → keccak_f1600_x4_state_xor_bytes_mve.S} +12 -12
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +5 -4
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +1 -0
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +36 -2
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +62 -4
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +87 -54
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{intt_aarch64_asm.S → mldsa_intt_aarch64_asm.S} +39 -6
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{ntt_aarch64_asm.S → mldsa_ntt_aarch64_asm.S} +39 -6
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{pointwise_montgomery_aarch64_asm.S → mldsa_pointwise_montgomery_aarch64_asm.S} +25 -3
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_caddq_aarch64_asm.S → mldsa_poly_caddq_aarch64_asm.S} +19 -3
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_chknorm_aarch64_asm.S → mldsa_poly_chknorm_aarch64_asm.S} +24 -3
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_decompose_32_aarch64_asm.S → mldsa_poly_decompose_32_aarch64_asm.S} +25 -3
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_decompose_88_aarch64_asm.S → mldsa_poly_decompose_88_aarch64_asm.S} +25 -3
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_use_hint_32_aarch64_asm.S → mldsa_poly_use_hint_32_aarch64_asm.S} +25 -3
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_use_hint_88_aarch64_asm.S → mldsa_poly_use_hint_88_aarch64_asm.S} +25 -3
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S} +31 -3
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S} +31 -3
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S} +31 -3
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{polyz_unpack_17_aarch64_asm.S → mldsa_polyz_unpack_17_aarch64_asm.S} +31 -3
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{polyz_unpack_19_aarch64_asm.S → mldsa_polyz_unpack_19_aarch64_asm.S} +31 -3
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_aarch64_asm.S → mldsa_rej_uniform_aarch64_asm.S} +48 -15
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_eta2_aarch64_asm.S → mldsa_rej_uniform_eta2_aarch64_asm.S} +42 -9
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_eta4_aarch64_asm.S → mldsa_rej_uniform_eta4_aarch64_asm.S} +42 -9
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +11 -3
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +3 -2
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +28 -28
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +171 -49
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{intt_avx2_asm.S → mldsa_intt_avx2_asm.S} +23 -1
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{ntt_avx2_asm.S → mldsa_ntt_avx2_asm.S} +23 -1
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{nttunpack_avx2_asm.S → mldsa_nttunpack_avx2_asm.S} +17 -1
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l4_avx2_asm.S → mldsa_pointwise_acc_l4_avx2_asm.S} +37 -3
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l5_avx2_asm.S → mldsa_pointwise_acc_l5_avx2_asm.S} +37 -3
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l7_avx2_asm.S → mldsa_pointwise_acc_l7_avx2_asm.S} +37 -3
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_avx2_asm.S → mldsa_pointwise_avx2_asm.S} +31 -3
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{poly_caddq_avx2_asm.S → mldsa_poly_caddq_avx2_asm.S} +18 -9
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +176 -0
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +490 -0
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +489 -0
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +123 -0
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +125 -0
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +355 -0
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +355 -0
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +132 -0
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +205 -0
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +176 -0
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +27 -36
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +42 -8
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +93 -17
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +74 -15
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +97 -11
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +7 -38
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +49 -7
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +16 -17
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +26 -9
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +3 -0
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +18 -19
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +15 -3
  104. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +28 -6
  105. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +311 -246
  106. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +245 -240
  107. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +64 -5
  108. data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +5 -2
  109. data/ext/pqcrypto/vendor/mlkem-native/LICENSE +21 -3
  110. data/ext/pqcrypto/vendor/mlkem-native/README.md +4 -6
  111. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +211 -0
  112. data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +2 -2
  113. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +25 -34
  114. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +79 -142
  115. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +62 -71
  116. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +77 -39
  117. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +25 -0
  118. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +48 -34
  119. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +25 -5
  120. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +14 -0
  121. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/context.h +51 -0
  122. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +2 -2
  123. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +8 -8
  124. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +20 -12
  125. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -3
  126. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +5 -2
  127. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +5 -2
  128. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +10 -7
  129. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +10 -7
  130. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +1 -1
  131. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +3 -2
  132. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +3 -2
  133. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +6 -1
  134. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +3 -2
  135. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +11 -11
  136. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +8 -22
  137. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +8 -5
  138. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/{state_extract_bytes_x4_mve.S → keccak_f1600_x4_state_extract_bytes_mve.S} +14 -14
  139. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/{state_xor_bytes_x4_mve.S → keccak_f1600_x4_state_xor_bytes_mve.S} +12 -12
  140. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
  141. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +36 -2
  142. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +22 -0
  143. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +20 -11
  144. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +39 -11
  145. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +64 -15
  146. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +44 -2
  147. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +2 -0
  148. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +11 -10
  149. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt_aarch64_asm.S → mlkem_intt_aarch64_asm.S} +16 -9
  150. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt_aarch64_asm.S → mlkem_ntt_aarch64_asm.S} +10 -7
  151. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_aarch64_asm.S → mlkem_poly_mulcache_compute_aarch64_asm.S} +6 -3
  152. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_aarch64_asm.S → mlkem_poly_reduce_aarch64_asm.S} +6 -3
  153. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_aarch64_asm.S → mlkem_poly_tobytes_aarch64_asm.S} +12 -5
  154. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_aarch64_asm.S → mlkem_poly_tomont_aarch64_asm.S} +11 -5
  155. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S} +6 -3
  156. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S} +6 -3
  157. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S} +6 -3
  158. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_aarch64_asm.S → mlkem_rej_uniform_aarch64_asm.S} +17 -17
  159. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +21 -8
  160. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +1 -1
  161. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +4 -0
  162. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{intt_ppc_asm.S → mlkem_intt_ppc_asm.S} +29 -5
  163. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{ntt_ppc_asm.S → mlkem_ntt_ppc_asm.S} +22 -1
  164. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{poly_tomont_ppc_asm.S → mlkem_poly_tomont_ppc_asm.S} +25 -3
  165. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{reduce_ppc_asm.S → mlkem_reduce_ppc_asm.S} +22 -1
  166. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +4 -0
  167. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +4 -0
  168. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +6 -2
  169. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +45 -25
  170. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +20 -20
  171. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +14 -3
  172. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -0
  173. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt_avx2_asm.S → mlkem_intt_avx2_asm.S} +27 -3
  174. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt_avx2_asm.S → mlkem_ntt_avx2_asm.S} +23 -1
  175. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes_avx2_asm.S → mlkem_nttfrombytes_avx2_asm.S} +27 -3
  176. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes_avx2_asm.S → mlkem_ntttobytes_avx2_asm.S} +27 -3
  177. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack_avx2_asm.S → mlkem_nttunpack_avx2_asm.S} +17 -1
  178. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10_avx2_asm.S → mlkem_poly_compress_d10_avx2_asm.S} +34 -3
  179. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11_avx2_asm.S → mlkem_poly_compress_d11_avx2_asm.S} +33 -2
  180. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4_avx2_asm.S → mlkem_poly_compress_d4_avx2_asm.S} +34 -3
  181. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5_avx2_asm.S → mlkem_poly_compress_d5_avx2_asm.S} +33 -2
  182. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10_avx2_asm.S → mlkem_poly_decompress_d10_avx2_asm.S} +32 -3
  183. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11_avx2_asm.S → mlkem_poly_decompress_d11_avx2_asm.S} +32 -2
  184. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4_avx2_asm.S → mlkem_poly_decompress_d4_avx2_asm.S} +32 -3
  185. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5_avx2_asm.S → mlkem_poly_decompress_d5_avx2_asm.S} +32 -2
  186. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_mulcache_compute_avx2_asm.S → mlkem_poly_mulcache_compute_avx2_asm.S} +29 -1
  187. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S} +35 -1
  188. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S} +35 -1
  189. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S} +35 -1
  190. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce_avx2_asm.S → mlkem_reduce_avx2_asm.S} +17 -1
  191. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_avx2_asm.S → mlkem_rej_uniform_avx2_asm.S} +40 -7
  192. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont_avx2_asm.S → mlkem_tomont_avx2_asm.S} +20 -3
  193. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +7 -2
  194. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +6 -0
  195. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +25 -4
  196. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +33 -4
  197. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +4 -0
  198. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +4 -0
  199. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +21 -3
  200. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +11 -10
  201. data/lib/pq_crypto/version.rb +1 -1
  202. data/script/vendor_libs.rb +6 -6
  203. metadata +79 -79
  204. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +0 -52
  205. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +0 -157
  206. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +0 -157
  207. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +0 -103
  208. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +0 -105
  209. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +0 -94
  210. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +0 -96
  211. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +0 -126
  212. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +0 -157
  213. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +0 -141
@@ -322,27 +322,29 @@ PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa87_sign, pqcr_mldsa87)
322
322
 
323
323
  #undef PQ_DEFINE_MLDSA_SIGN_KEYPAIR
324
324
 
325
- #define PQ_DEFINE_MLDSA_SIGN(name, native) \
326
- int pq_##name(uint8_t *signature, size_t *signature_len, const uint8_t *message, \
327
- size_t message_len, const uint8_t *ctx, size_t ctx_len, \
328
- const uint8_t *secret_key) { \
329
- if (!signature || !signature_len || !secret_key || (message_len > 0 && !message) || \
330
- (ctx_len > 0 && !ctx) || ctx_len > 255) { \
331
- return PQ_ERROR_BUFFER; \
332
- } \
333
- return native##_signature(signature, signature_len, message, message_len, ctx, ctx_len, \
334
- secret_key) == 0 \
335
- ? PQ_SUCCESS \
336
- : PQ_ERROR_SIGN; \
337
- }
338
-
339
- PQ_DEFINE_MLDSA_SIGN(sign, pqcr_mldsa65)
340
- PQ_DEFINE_MLDSA_SIGN(mldsa44_sign, pqcr_mldsa44)
341
- PQ_DEFINE_MLDSA_SIGN(mldsa87_sign, pqcr_mldsa87)
325
+ #define PQ_DEFINE_MLDSA_SIGN(name, native, sig_bytes) \
326
+ int pq_##name(uint8_t *signature, size_t *signature_len, const uint8_t *message, \
327
+ size_t message_len, const uint8_t *ctx, size_t ctx_len, \
328
+ const uint8_t *secret_key) { \
329
+ if (!signature || !signature_len || !secret_key || (message_len > 0 && !message) || \
330
+ (ctx_len > 0 && !ctx) || ctx_len > 255) { \
331
+ return PQ_ERROR_BUFFER; \
332
+ } \
333
+ if (native##_signature(signature, message, message_len, ctx, ctx_len, secret_key) != 0) { \
334
+ *signature_len = 0; \
335
+ return PQ_ERROR_SIGN; \
336
+ } \
337
+ *signature_len = (size_t)(sig_bytes); \
338
+ return PQ_SUCCESS; \
339
+ }
340
+
341
+ PQ_DEFINE_MLDSA_SIGN(sign, pqcr_mldsa65, MLDSA65_BYTES)
342
+ PQ_DEFINE_MLDSA_SIGN(mldsa44_sign, pqcr_mldsa44, MLDSA44_BYTES)
343
+ PQ_DEFINE_MLDSA_SIGN(mldsa87_sign, pqcr_mldsa87, MLDSA87_BYTES)
342
344
 
343
345
  #undef PQ_DEFINE_MLDSA_SIGN
344
346
 
345
- #define PQ_DEFINE_MLDSA_VERIFY(name, native) \
347
+ #define PQ_DEFINE_MLDSA_VERIFY(name, native, sig_bytes) \
346
348
  int pq_##name(const uint8_t *signature, size_t signature_len, const uint8_t *message, \
347
349
  size_t message_len, const uint8_t *ctx, size_t ctx_len, \
348
350
  const uint8_t *public_key) { \
@@ -350,29 +352,32 @@ PQ_DEFINE_MLDSA_SIGN(mldsa87_sign, pqcr_mldsa87)
350
352
  ctx_len > 255) { \
351
353
  return PQ_ERROR_BUFFER; \
352
354
  } \
353
- return native##_verify(signature, signature_len, message, message_len, ctx, ctx_len, \
354
- public_key) == 0 \
355
+ if (signature_len != (size_t)(sig_bytes)) { \
356
+ return PQ_ERROR_VERIFY; \
357
+ } \
358
+ return native##_verify(signature, message, message_len, ctx, ctx_len, public_key) == 0 \
355
359
  ? PQ_SUCCESS \
356
360
  : PQ_ERROR_VERIFY; \
357
361
  }
358
362
 
359
- PQ_DEFINE_MLDSA_VERIFY(verify, pqcr_mldsa65)
360
- PQ_DEFINE_MLDSA_VERIFY(mldsa44_verify, pqcr_mldsa44)
361
- PQ_DEFINE_MLDSA_VERIFY(mldsa87_verify, pqcr_mldsa87)
363
+ PQ_DEFINE_MLDSA_VERIFY(verify, pqcr_mldsa65, MLDSA65_BYTES)
364
+ PQ_DEFINE_MLDSA_VERIFY(mldsa44_verify, pqcr_mldsa44, MLDSA44_BYTES)
365
+ PQ_DEFINE_MLDSA_VERIFY(mldsa87_verify, pqcr_mldsa87, MLDSA87_BYTES)
362
366
 
363
367
  #undef PQ_DEFINE_MLDSA_VERIFY
364
368
 
365
369
  static int pq_testing_mldsa_sign_from_seed_with(
366
370
  uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len,
367
- const uint8_t *secret_key, const uint8_t *seed, size_t seed_len,
368
- int (*signature_internal)(uint8_t *, size_t *, const uint8_t *, size_t, const uint8_t *, size_t,
371
+ const uint8_t *secret_key, const uint8_t *seed, size_t seed_len, size_t expected_signature_len,
372
+ int (*signature_internal)(uint8_t *, const uint8_t *, size_t, const uint8_t *, size_t,
369
373
  const uint8_t *, const uint8_t *, int),
370
374
  size_t (*prepare_prefix)(uint8_t *, const uint8_t *, size_t, const uint8_t *, size_t, int)) {
371
375
  uint8_t pre[MLDSA_DOMAIN_SEPARATION_MAX_BYTES];
372
376
  size_t pre_len;
373
377
 
374
378
  if (!signature || !signature_len || !secret_key || !seed || seed_len != MLDSA_RNDBYTES ||
375
- !signature_internal || !prepare_prefix || (message_len > 0 && !message)) {
379
+ !signature_internal || !prepare_prefix || expected_signature_len == 0 ||
380
+ (message_len > 0 && !message)) {
376
381
  return PQ_ERROR_BUFFER;
377
382
  }
378
383
 
@@ -385,13 +390,18 @@ static int pq_testing_mldsa_sign_from_seed_with(
385
390
  */
386
391
  pre_len = prepare_prefix(pre, NULL, 0, NULL, 0, MLDSA_PREHASH_NONE);
387
392
  if (pre_len == 0) {
393
+ *signature_len = 0;
388
394
  return PQ_ERROR_SIGN;
389
395
  }
390
396
 
391
- return signature_internal(signature, signature_len, message, message_len, pre, pre_len, seed,
392
- secret_key, 0) == 0
393
- ? PQ_SUCCESS
394
- : PQ_ERROR_SIGN;
397
+ if (signature_internal(signature, message, message_len, pre, pre_len, seed, secret_key, 0) !=
398
+ 0) {
399
+ *signature_len = 0;
400
+ return PQ_ERROR_SIGN;
401
+ }
402
+
403
+ *signature_len = expected_signature_len;
404
+ return PQ_SUCCESS;
395
405
  }
396
406
 
397
407
  int pq_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
@@ -447,7 +457,7 @@ int pq_testing_mldsa_sign_from_seed(uint8_t *signature, size_t *signature_len,
447
457
  const uint8_t *secret_key, const uint8_t *seed,
448
458
  size_t seed_len) {
449
459
  return pq_testing_mldsa_sign_from_seed_with(
450
- signature, signature_len, message, message_len, secret_key, seed, seed_len,
460
+ signature, signature_len, message, message_len, secret_key, seed, seed_len, MLDSA65_BYTES,
451
461
  pqcr_mldsa65_signature_internal, pqcr_mldsa65_prepare_domain_separation_prefix);
452
462
  }
453
463
 
@@ -456,7 +466,7 @@ int pq_testing_mldsa44_sign_from_seed(uint8_t *signature, size_t *signature_len,
456
466
  const uint8_t *secret_key, const uint8_t *seed,
457
467
  size_t seed_len) {
458
468
  return pq_testing_mldsa_sign_from_seed_with(
459
- signature, signature_len, message, message_len, secret_key, seed, seed_len,
469
+ signature, signature_len, message, message_len, secret_key, seed, seed_len, MLDSA44_BYTES,
460
470
  pqcr_mldsa44_signature_internal, pqcr_mldsa44_prepare_domain_separation_prefix);
461
471
  }
462
472
 
@@ -465,7 +475,7 @@ int pq_testing_mldsa87_sign_from_seed(uint8_t *signature, size_t *signature_len,
465
475
  const uint8_t *secret_key, const uint8_t *seed,
466
476
  size_t seed_len) {
467
477
  return pq_testing_mldsa_sign_from_seed_with(
468
- signature, signature_len, message, message_len, secret_key, seed, seed_len,
478
+ signature, signature_len, message, message_len, secret_key, seed, seed_len, MLDSA87_BYTES,
469
479
  pqcr_mldsa87_signature_internal, pqcr_mldsa87_prepare_domain_separation_prefix);
470
480
  }
471
481
 
@@ -69,15 +69,13 @@ void pq_secure_wipe(void *ptr, size_t len);
69
69
  int pq_mlkem_keypair(uint8_t *public_key, uint8_t *secret_key);
70
70
  int pq_mlkem512_keypair(uint8_t *public_key, uint8_t *secret_key);
71
71
  int pq_mlkem1024_keypair(uint8_t *public_key, uint8_t *secret_key);
72
- int pq_mlkem_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
73
- const uint8_t *seed64);
74
- int pq_mlkem512_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
75
- const uint8_t *seed64);
76
- int pq_mlkem1024_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
77
- const uint8_t *seed64);
72
+ int pq_mlkem_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed64);
73
+ int pq_mlkem512_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed64);
74
+ int pq_mlkem1024_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed64);
78
75
  int pq_mlkem_encapsulate(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key);
79
76
  int pq_mlkem512_encapsulate(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key);
80
- int pq_mlkem1024_encapsulate(uint8_t *ciphertext, uint8_t *shared_secret, const uint8_t *public_key);
77
+ int pq_mlkem1024_encapsulate(uint8_t *ciphertext, uint8_t *shared_secret,
78
+ const uint8_t *public_key);
81
79
  int pq_mlkem_decapsulate(uint8_t *shared_secret, const uint8_t *ciphertext,
82
80
  const uint8_t *secret_key);
83
81
  int pq_mlkem512_decapsulate(uint8_t *shared_secret, const uint8_t *ciphertext,
@@ -88,53 +86,49 @@ int pq_mlkem1024_decapsulate(uint8_t *shared_secret, const uint8_t *ciphertext,
88
86
  int pq_sign_keypair(uint8_t *public_key, uint8_t *secret_key);
89
87
  int pq_mldsa44_sign_keypair(uint8_t *public_key, uint8_t *secret_key);
90
88
  int pq_mldsa87_sign_keypair(uint8_t *public_key, uint8_t *secret_key);
91
- int pq_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
92
- const uint8_t *seed32);
93
- int pq_mldsa_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
94
- const uint8_t *seed32);
95
- int pq_mldsa87_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
96
- const uint8_t *seed32);
89
+ int pq_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32);
90
+ int pq_mldsa_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32);
91
+ int pq_mldsa87_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32);
97
92
  int pq_sign(uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len,
98
93
  const uint8_t *ctx, size_t ctx_len, const uint8_t *secret_key);
99
- int pq_mldsa44_sign(uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len,
100
- const uint8_t *ctx, size_t ctx_len, const uint8_t *secret_key);
101
- int pq_mldsa87_sign(uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len,
102
- const uint8_t *ctx, size_t ctx_len, const uint8_t *secret_key);
94
+ int pq_mldsa44_sign(uint8_t *signature, size_t *signature_len, const uint8_t *message,
95
+ size_t message_len, const uint8_t *ctx, size_t ctx_len,
96
+ const uint8_t *secret_key);
97
+ int pq_mldsa87_sign(uint8_t *signature, size_t *signature_len, const uint8_t *message,
98
+ size_t message_len, const uint8_t *ctx, size_t ctx_len,
99
+ const uint8_t *secret_key);
103
100
  int pq_verify(const uint8_t *signature, size_t signature_len, const uint8_t *message,
104
101
  size_t message_len, const uint8_t *ctx, size_t ctx_len, const uint8_t *public_key);
105
102
  int pq_mldsa44_verify(const uint8_t *signature, size_t signature_len, const uint8_t *message,
106
- size_t message_len, const uint8_t *ctx, size_t ctx_len, const uint8_t *public_key);
103
+ size_t message_len, const uint8_t *ctx, size_t ctx_len,
104
+ const uint8_t *public_key);
107
105
  int pq_mldsa87_verify(const uint8_t *signature, size_t signature_len, const uint8_t *message,
108
- size_t message_len, const uint8_t *ctx, size_t ctx_len, const uint8_t *public_key);
106
+ size_t message_len, const uint8_t *ctx, size_t ctx_len,
107
+ const uint8_t *public_key);
109
108
 
110
109
  int pq_public_key_to_pqc_container_der(uint8_t **output, size_t *output_len,
111
- const uint8_t *public_key,
112
- size_t public_key_len, const char *algorithm);
113
- int pq_public_key_to_pqc_container_pem(char **output, size_t *output_len,
114
- const uint8_t *public_key,
110
+ const uint8_t *public_key, size_t public_key_len,
111
+ const char *algorithm);
112
+ int pq_public_key_to_pqc_container_pem(char **output, size_t *output_len, const uint8_t *public_key,
115
113
  size_t public_key_len, const char *algorithm);
116
114
  int pq_secret_key_to_pqc_container_der(uint8_t **output, size_t *output_len,
117
- const uint8_t *secret_key,
118
- size_t secret_key_len, const char *algorithm);
119
- int pq_secret_key_to_pqc_container_pem(char **output, size_t *output_len,
120
- const uint8_t *secret_key,
121
- size_t secret_key_len, const char *algorithm);
115
+ const uint8_t *secret_key, size_t secret_key_len,
116
+ const char *algorithm);
117
+ int pq_secret_key_to_pqc_container_pem(char **output, size_t *output_len, const uint8_t *secret_key,
118
+ size_t secret_key_len, const char *algorithm);
122
119
  int pq_public_key_from_pqc_container_der(char **algorithm_out, uint8_t **key_out,
123
120
  size_t *key_len_out, const uint8_t *input,
124
121
  size_t input_len);
125
122
  int pq_public_key_from_pqc_container_pem(char **algorithm_out, uint8_t **key_out,
126
- size_t *key_len_out, const char *input,
127
- size_t input_len);
123
+ size_t *key_len_out, const char *input, size_t input_len);
128
124
  int pq_secret_key_from_pqc_container_der(char **algorithm_out, uint8_t **key_out,
129
- size_t *key_len_out, const uint8_t *input,
130
- size_t input_len);
125
+ size_t *key_len_out, const uint8_t *input,
126
+ size_t input_len);
131
127
  int pq_secret_key_from_pqc_container_pem(char **algorithm_out, uint8_t **key_out,
132
- size_t *key_len_out, const char *input,
133
- size_t input_len);
128
+ size_t *key_len_out, const char *input, size_t input_len);
134
129
 
135
- int pq_pkcs8_private_key_info_to_der(uint8_t **output, size_t *output_len,
136
- const char *oid_text, const uint8_t *private_key,
137
- size_t private_key_len);
130
+ int pq_pkcs8_private_key_info_to_der(uint8_t **output, size_t *output_len, const char *oid_text,
131
+ const uint8_t *private_key, size_t private_key_len);
138
132
  int pq_pkcs8_private_key_info_from_der(char **oid_text_out, uint8_t **private_key_out,
139
133
  size_t *private_key_len_out, const uint8_t *input,
140
134
  size_t input_len);
@@ -143,9 +137,8 @@ int pq_pkcs8_encrypt_private_key_info_der(uint8_t **output, size_t *output_len,
143
137
  const char *passphrase, size_t passphrase_len,
144
138
  int iterations);
145
139
  int pq_pkcs8_decrypt_private_key_info_der(uint8_t **output, size_t *output_len,
146
- const uint8_t *encrypted_der,
147
- size_t encrypted_der_len, const char *passphrase,
148
- size_t passphrase_len);
140
+ const uint8_t *encrypted_der, size_t encrypted_der_len,
141
+ const char *passphrase, size_t passphrase_len);
149
142
  int pq_pkcs8_der_is_encrypted_private_key_info(const uint8_t *input, size_t input_len);
150
143
  int pq_pkcs8_der_to_pem(char **output, size_t *output_len, const uint8_t *der, size_t der_len,
151
144
  int encrypted);
@@ -197,7 +190,7 @@ const char *pq_version(void);
197
190
  #define PQ_MLKEM_CIPHERTEXTBYTES MLKEM_CIPHERTEXTBYTES
198
191
  #define PQ_MLKEM_SHAREDSECRETBYTES MLKEM_SHAREDSECRETBYTES
199
192
 
200
- #define PQ_HYBRID_PUBLICKEYBYTES HYBRID_PUBLICKEYBYTES
193
+ #define PQ_HYBRID_PUBLICKEYBYTES HYBRID_PUBLICKEYBYTES
201
194
  #define PQ_HYBRID_SECRETKEYBYTES HYBRID_SECRETKEYBYTES
202
195
  #define PQ_HYBRID_EXPANDED_SECRETKEYBYTES HYBRID_EXPANDED_SECRETKEYBYTES
203
196
  #define PQ_HYBRID_CIPHERTEXTBYTES HYBRID_CIPHERTEXTBYTES
@@ -215,15 +208,27 @@ int pq_mldsa_extract_tr_from_secret_key(uint8_t *tr_out, const uint8_t *secret_k
215
208
  int pq_mldsa_compute_tr_from_public_key(uint8_t *tr_out, const uint8_t *public_key,
216
209
  size_t public_key_len);
217
210
 
218
- int pq_sign_mu(uint8_t *signature, size_t *signature_len,
219
- const uint8_t *mu, const uint8_t *secret_key,
211
+ int pq_mldsa44_signature_extmu_compat(uint8_t *sig, size_t *siglen, const uint8_t *mu,
212
+ const uint8_t *sk);
213
+ int pq_mldsa65_signature_extmu_compat(uint8_t *sig, size_t *siglen, const uint8_t *mu,
214
+ const uint8_t *sk);
215
+ int pq_mldsa87_signature_extmu_compat(uint8_t *sig, size_t *siglen, const uint8_t *mu,
216
+ const uint8_t *sk);
217
+ int pq_mldsa44_verify_extmu_compat(const uint8_t *sig, size_t siglen, const uint8_t *mu,
218
+ const uint8_t *pk);
219
+ int pq_mldsa65_verify_extmu_compat(const uint8_t *sig, size_t siglen, const uint8_t *mu,
220
+ const uint8_t *pk);
221
+ int pq_mldsa87_verify_extmu_compat(const uint8_t *sig, size_t siglen, const uint8_t *mu,
222
+ const uint8_t *pk);
223
+
224
+ int pq_sign_mu(uint8_t *signature, size_t *signature_len, const uint8_t *mu,
225
+ const uint8_t *secret_key,
220
226
  int (*signature_extmu)(uint8_t *, size_t *, const uint8_t *, const uint8_t *));
221
- int pq_verify_mu(const uint8_t *signature, size_t signature_len,
222
- const uint8_t *mu, const uint8_t *public_key, size_t expected_signature_len,
227
+ int pq_verify_mu(const uint8_t *signature, size_t signature_len, const uint8_t *mu,
228
+ const uint8_t *public_key, size_t expected_signature_len,
223
229
  int (*verify_extmu)(const uint8_t *, size_t, const uint8_t *, const uint8_t *));
224
230
  void *pq_mu_builder_new(void);
225
- int pq_mu_builder_init(void *state, const uint8_t *tr,
226
- const uint8_t *ctx, size_t ctxlen);
231
+ int pq_mu_builder_init(void *state, const uint8_t *tr, const uint8_t *ctx, size_t ctxlen);
227
232
  int pq_mu_builder_absorb(void *state, const uint8_t *chunk, size_t chunk_len);
228
233
  int pq_mu_builder_finalize(void *state, uint8_t *mu_out);
229
234
  void pq_mu_builder_release(void *state);
@@ -2,6 +2,6 @@
2
2
  #ifndef PQCRYPTO_VERSION_H
3
3
  #define PQCRYPTO_VERSION_H
4
4
 
5
- #define PQCRYPTO_VERSION "0.6.4"
5
+ #define PQCRYPTO_VERSION "0.6.6"
6
6
 
7
7
  #endif
@@ -2,11 +2,11 @@
2
2
  backend=PQ Code Package native only
3
3
  pqclean=removed
4
4
  mlkem_native_repo=https://github.com/pq-code-package/mlkem-native.git
5
- mlkem_native_ref=v1.2.0
6
- mlkem_native_commit=0ba906cb14b1c241476134d7403a811b382ca498
7
- mlkem_native_tree_sha256=cc78ed199b8c65abe68635b23a13b294d5a8deb20c8bc7b4d76590c00976bb2d
5
+ mlkem_native_ref=v2.0.0
6
+ mlkem_native_commit=d1b2fe782888bdb761a50336012923180be7f502
7
+ mlkem_native_tree_sha256=18bfa9ea4e2232bdf56f8ec374b62d10e50b99a30cb08aafc18d0b97e00cd06f
8
8
  mldsa_native_repo=https://github.com/pq-code-package/mldsa-native.git
9
- mldsa_native_ref=v1.0.0-beta2
10
- mldsa_native_commit=9b0ee84f4cf399043eca59eca4e5f8531ca1d61b
11
- mldsa_native_tree_sha256=2887f59926c18a877e8c5a5e30727e84497c357032093d00d7135aedf53f011e
12
- manifest_sha256=011e9d7d1160c7d612869695d950e17f9e330dac6bf782883639593f96fee951
9
+ mldsa_native_ref=v2.0.0
10
+ mldsa_native_commit=834a90d5e846ffa1e1611bd24e160bb2e9b86d35
11
+ mldsa_native_tree_sha256=25b3c3949d2ed37d1ad5d4722c8476d13deb2a0bb945f12444f463378d69375d
12
+ manifest_sha256=4bcf7cc4d0ac0d0e66ebb9612042960dc1197838f26bbedb16e3b6a3978e264c
@@ -73,11 +73,14 @@ For detailed information on how to use the script, please refer to
73
73
 
74
74
  You can also build **mldsa-native** on Windows using `nmake` and an MSVC compiler.
75
75
 
76
- To build and run the tests (only support functional testing for non-opt implementation for now), use the following `nmake` targets:
76
+ To build and run the tests, use the following `nmake` target:
77
77
  ```powershell
78
- nmke /f .\Makefile.Microsoft_nmake quickcheck
78
+ nmake /f .\Makefile.Microsoft_nmake quickcheck
79
79
  ```
80
80
 
81
+ This runs the functional, RNG-failure, allocation, ACVP, KAT and Wycheproof tests. The assembly backends are not yet
82
+ supported on Windows, so the tests are built for the C backend only.
83
+
81
84
  # Checking the proofs
82
85
 
83
86
  ## CBMC
@@ -6,14 +6,33 @@ implementation are made available under the Apache-2.0 license OR
6
6
  the ISC license OR the MIT license. These licenses are
7
7
  reproduced at the bottom of this file.
8
8
 
9
- The code in test/notrandombytes/* is derived from
9
+ Files outside the library itself may carry different terms. Every file
10
+ states its own SPDX-License-Identifier, which determines the terms that
11
+ apply to it. In particular:
12
+
13
+ The code in test/notrandombytes/*, and its copies in
14
+ examples/*/test_only_rng/* and scripts/notrandombytes, is derived from
10
15
  https://cr.yp.to/papers.html#surf and licensed under
11
16
  LicenseRef-PD-hp OR CC0-1.0 OR 0BSD OR MIT-0 OR MIT.
12
17
  It is only used for testing purposes.
13
18
 
14
- The benchmarking code in test/hal/hal.c carries the
19
+ The benchmarking code in test/hal/* carries the
15
20
  MIT license. It is only used for testing purposes.
16
21
 
22
+ The tiny_sha3 code in
23
+ examples/bring_your_own_fips202/custom_fips202/tiny_sha3/* and
24
+ examples/custom_backend/mldsa_native/src/fips202/native/custom/src/*
25
+ carries the MIT license. It is only used to demonstrate custom
26
+ FIPS-202 implementations.
27
+
28
+ The proofs in proofs/* are in part derived from Amazon Web Services
29
+ verification infrastructure and licensed under
30
+ Apache-2.0 OR ISC OR MIT-0, MIT-0, or MIT-0 AND Apache-2.0. The IACR
31
+ document class proofs/isabelle/neon_ntt/document/iacrtrans.cls is
32
+ licensed under CC0-1.0. None of this is part of the library.
33
+
34
+ Documentation is licensed under CC-BY-4.0.
35
+
17
36
  ```
18
37
  Copyright (c) The mldsa-native project authors
19
38
  Copyright (c) The mlkem-native project authors
@@ -3,7 +3,6 @@
3
3
  # mldsa-native
4
4
 
5
5
  ![CI](https://github.com/pq-code-package/mldsa-native/actions/workflows/all.yml/badge.svg)
6
- ![Proof: HOL-Light](https://github.com/pq-code-package/mldsa-native/actions/workflows/hol_light.yml/badge.svg)
7
6
  ![Benchmarks](https://github.com/pq-code-package/mldsa-native/actions/workflows/bench.yml/badge.svg)
8
7
  ![C90](https://img.shields.io/badge/language-C90-blue.svg)
9
8
 
@@ -52,18 +51,25 @@ make test
52
51
  mldsa-native is used in
53
52
  - AWS' Cryptography library [AWS-LC](https://github.com/aws/aws-lc/)
54
53
  - [libOQS](https://github.com/open-quantum-safe/liboqs/) of the Open Quantum Safe project
55
- - The [zeroRISC's fork of OpenTitan](https://github.com/zerorisc/expo) - an open source silicon Root of Trust (RoT)
54
+ - [Pavona](https://github.com/pavona/pavona) - a library of modular, tapeout-proven, and secure-by-default open silicon blocks
56
55
  - [CHERIoT-PQC](https://github.com/CHERIoT-Platform/cheriot-pqc) — post-quantum cryptography support for the CHERIoT platform
57
56
 
58
57
  ## Formal Verification
59
58
 
60
59
  We use the [C Bounded Model Checker (CBMC)](https://github.com/diffblue/cbmc) to prove absence of various classes of undefined behaviour in C, including out of bounds memory accesses and integer overflows. The proofs cover all C code in [mldsa/src/*](mldsa) and [mldsa/src/fips202/*](mldsa/src/fips202) involved in running mldsa-native with its C backend. See [proofs/cbmc](proofs/cbmc) for details.
61
60
 
62
- HOL-Light functional correctness proofs can be found in [proofs/hol_light](proofs/hol_light). See the [HOL-Light README](proofs/hol_light/README.md) for the list of functions that have been proven correct. These proofs utilize the verification infrastructure in [s2n-bignum](https://github.com/awslabs/s2n-bignum).
61
+ All AArch64 and x86_64 assembly is proved functionally correct and memory-safe at the object-code level, using
62
+ [HOL-Light](https://hol-light.github.io/) and the [s2n-bignum](https://github.com/awslabs/s2n-bignum) verification
63
+ infrastructure. All routines are additionally proved to have secret-independent timing, with two exceptions. The
64
+ matrix sampler `rej_uniform` operates on public data only, and is deliberately variable-time. The secret-vector
65
+ samplers `rej_uniform_eta{2,4}` _do_ have secret-independent timing, but this property is not yet backed by proof.
66
+ See [proofs/hol_light](proofs/hol_light) for details.
63
67
 
64
68
  Finally, [proofs/isabelle](proofs/isabelle/compress) contains proofs in [Isabelle/HOL](https://isabelle.in.tum.de/) of the correctness of
65
69
  different approaches for computing the scalar decomposition routines used in ML-DSA. Those are still experimental and do not yet operate
66
- on the source level.
70
+ on the source level. [proofs/isabelle/neon_ntt](proofs/isabelle/neon_ntt) additionally provides a machine-checked formalisation of the
71
+ modular-arithmetic core of the Neon NTT paper[^NeonNTT], covering the Barrett and Montgomery primitives underlying the AArch64 NTT and
72
+ pointwise-multiplication assembly; see its [README](proofs/isabelle/neon_ntt/README.md).
67
73
 
68
74
  **NOTE:** Formal Verification is never absolute. See [SOUNDNESS.md](SOUNDNESS.md) for an analysis of the scope, assumptions and risks of the formal verification efforts around mldsa-native.
69
75
 
@@ -157,6 +163,8 @@ For CI benchmark results and historical performance data, see the [benchmarking
157
163
 
158
164
  If you want to use mldsa-native, import [mldsa](mldsa) into your project's source tree and build using your favourite build system. See [examples/basic](examples/basic) for a simple example. The build system provided in this repository is for development purposes only.
159
165
 
166
+ See [API-CONVENTIONS.md](API-CONVENTIONS.md) for conventions that apply to all public functions, such as return values, pointer validity, and the state of output buffers on error.
167
+
160
168
  ### Can I bring my own FIPS-202?
161
169
 
162
170
  mldsa-native relies on and comes with an implementation of FIPS-202[^FIPS202]. If your library has its own FIPS-202 implementation, you
@@ -185,11 +193,15 @@ Yes. mldsa-native provides a compile-time option `MLD_CONFIG_REDUCE_RAM` that re
185
193
 
186
194
  To enable this mode, define `MLD_CONFIG_REDUCE_RAM` in [mldsa_native_config.h](mldsa/mldsa_native_config.h) or pass `-DMLD_CONFIG_REDUCE_RAM` as a compiler flag.
187
195
 
196
+ ### Can I bound or restart the signing loop for real-time systems?
197
+
198
+ Yes. Signing hooks allow you to pause and restart ML-DSA signature operations, thereby bounding their runtime. See [examples/restartable_sign](examples/restartable_sign) for an example.
199
+
188
200
  ### Does mldsa-native use hedged or deterministic signing?
189
201
 
190
202
  By default, mldsa-native uses the randomized "hedged" signing variant as specified in FIPS 204 Section 3.4. The hedged variant uses both fresh randomness at signing time and precomputed randomness from the private key. This helps mitigate fault injection attacks and side-channel attacks while protecting against potential flaws in the random number generator.
191
203
 
192
- If you need the deterministic variant of ML-DSA, you can call `crypto_sign_signature_internal`
204
+ If you need the deterministic variant of ML-DSA, you can call `signature_internal`
193
205
  directly with an all-zero `rnd` argument.
194
206
  However, note that FIPS 204 warns that this should not be used on platforms where fault injection attacks and side-channel attacks are a concern, as the lack of fresh randomness makes fault attacks more difficult to mitigate.
195
207
 
@@ -204,8 +216,8 @@ External mu mode enables applications to compute the message digest (mu) externa
204
216
  Yes. mldsa-native supports HashML-DSA, the pre-hashing variant of ML-DSA defined in FIPS 204 Algorithms 4 and 5.
205
217
 
206
218
  mldsa-native provides two levels of API:
207
- - `crypto_sign_signature_pre_hash_internal` and `crypto_sign_verify_pre_hash_internal` - Low-level functions that accept a pre-hashed message digest. This function supports all 12 allowed hash functions.
208
- - `crypto_sign_signature_pre_hash_shake256` and `crypto_sign_verify_pre_hash_shake256` - High-level functions that perform SHAKE256 pre-hashing internally for convenience. Currently, only SHAKE256 is supported. If you require another hash function, use the `*_pre_hash_internal` functions or open an issue.
219
+ - `signature_pre_hash_internal` and `verify_pre_hash_internal` - Low-level functions that accept a pre-hashed message digest. This function supports all 12 allowed hash functions.
220
+ - `signature_pre_hash_shake256` and `verify_pre_hash_shake256` - High-level functions that perform SHAKE256 pre-hashing internally for convenience. Currently, only SHAKE256 is supported. If you require another hash function, use the `*_pre_hash_internal` functions or open an issue.
209
221
 
210
222
  ## Have a Question?
211
223
 
@@ -229,6 +241,7 @@ through the [PQCA Discord](https://discord.com/invite/xyVnwzfg5R). See also [CON
229
241
  [^FIPS204]: National Institute of Standards and Technology: FIPS 204 Module-Lattice-Based Digital Signature Standard, [https://csrc.nist.gov/pubs/fips/204/final](https://csrc.nist.gov/pubs/fips/204/final)
230
242
  [^NIST_FAQ]: National Institute of Standards and Technology: Post-Quantum Cryptography FAQs, [https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs#Rdc7](https://csrc.nist.gov/Projects/post-quantum-cryptography/faqs#Rdc7)
231
243
  [^NIST_FIPS204_SEC6]: National Institute of Standards and Technology: FIPS 204 Section 6 Guidance, [https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/fips204-sec6-03192025.pdf](https://csrc.nist.gov/csrc/media/Projects/post-quantum-cryptography/documents/faq/fips204-sec6-03192025.pdf)
244
+ [^NeonNTT]: Becker, Hwang, Kannwischer, Yang, Yang: Neon NTT: Faster Dilithium, Kyber, and Saber on Cortex-A72 and Apple M1, [https://eprint.iacr.org/2021/986](https://eprint.iacr.org/2021/986)
232
245
  [^REF]: Bai, Ducas, Kiltz, Lepoint, Lyubashevsky, Schwabe, Seiler, Stehlé: CRYSTALS-Dilithium reference implementation, [https://github.com/pq-crystals/dilithium/tree/master/ref](https://github.com/pq-crystals/dilithium/tree/master/ref)
233
246
  [^tiny_sha3]: Markku-Juhani O. Saarinen: tiny_sha3, [https://github.com/mjosaarinen/tiny_sha3](https://github.com/mjosaarinen/tiny_sha3)
234
247
  [^wycheproof]: Community Cryptography Specification Project: Project Wycheproof, [https://github.com/C2SP/wycheproof](https://github.com/C2SP/wycheproof)
@@ -0,0 +1,160 @@
1
+ [//]: # (SPDX-License-Identifier: CC-BY-4.0)
2
+
3
+ mldsa-native v2.0.0
4
+ ===================
5
+
6
+ Release notes
7
+ -------------
8
+
9
+ v2.0.0 is the first stable release of mldsa-native, a secure, fast and portable C90 implementation of
10
+ [ML-DSA](https://csrc.nist.gov/pubs/fips/204/final) derived from the
11
+ [ML-DSA reference implementation](https://github.com/pq-crystals/dilithium).
12
+ It carries the version number v2.0.0 rather than v1.0.0 because its public API and configuration are aligned with
13
+ those of the upcoming v2 release of the sister project
14
+ [mlkem-native](https://github.com/pq-code-package/mlkem-native).
15
+
16
+ mldsa-native v2.0.0 offers:
17
+ * High maintainability and extensibility through modular frontend/backend design.
18
+ * High performance through AArch64 (Neon) and x86_64 (AVX2) assembly backends and the use of the
19
+ [SLOTHY super-optimizer](https://github.com/slothy-optimizer/slothy).
20
+ * High assurance through memory- and type-safety proofs for the C frontend and backend (CBMC),
21
+ functional-correctness and memory-safety proofs for both the AArch64 and x86_64 assembly
22
+ backends (HOL Light and s2n-bignum), and extensive constant-time testing.
23
+
24
+ mldsa-native v2.0.0 is uniformly licensed Apache-2.0 OR MIT OR ISC, giving consumers the choice to use any of these
25
+ licenses.
26
+
27
+ Assurance
28
+ ---------
29
+
30
+ v2.0.0 marks the completion of the two formal-verification efforts underpinning mldsa-native: the HOL Light proofs for
31
+ the AArch64 (Neon) and x86_64 (AVX2) assembly backends and the CBMC proofs for the C code are now both complete.
32
+
33
+ - **AArch64 and x86_64 assembly proved in HOL Light.** Every routine in both the AArch64 (Neon) and x86_64 (AVX2)
34
+ backends is proved functionally correct and memory-safe at the object-code level, using
35
+ [HOL Light](https://hol-light.github.io/) and the [s2n-bignum](https://github.com/awslabs/s2n-bignum) verification
36
+ infrastructure. All routines except the secret-vector rejection samplers (`rej_uniform_eta{2,4}`) are additionally
37
+ proved to have secret-independent timing (those samplers _do_ have secret-independent timing, but this property is
38
+ not yet backed by proof).
39
+ - **CBMC proofs for the C code**, establishing memory safety, type safety and absence of various classes of undefined
40
+ behaviour for all C code involved in running mldsa-native with its C backend.
41
+
42
+ See [SOUNDNESS.md](SOUNDNESS.md) for more detail on the scope, assumptions and residual risks of the verification
43
+ work; it shares its methodology, formal models and trusted computing base with the sister project
44
+ [mlkem-native](https://github.com/pq-code-package/mlkem-native).
45
+
46
+ Breaking changes since v1.0.0-beta2
47
+ -----------------------------------
48
+
49
+ Between the last beta release
50
+ ([v1.0.0-beta2](https://github.com/pq-code-package/mldsa-native/releases/tag/v1.0.0-beta2)) and this release, a number
51
+ of breaking changes to the public API and configuration have been introduced. Consumers upgrading from
52
+ `v1.0.0-beta2` should be aware of the following:
53
+
54
+ - **`siglen` removed from the signing and verification APIs.** Signing functions no longer take a `size_t *siglen`
55
+ out-parameter and verification functions no longer take a `size_t siglen` in-parameter; signatures are always
56
+ `MLDSA_BYTES(MLD_CONFIG_PARAMETER_SET)` bytes and verification now takes a fixed-size signature array. Drop the
57
+ `siglen` argument at every call site. ([#1240](https://github.com/pq-code-package/mldsa-native/pull/1240))
58
+ - **SUPERCOP-style aliases and constants removed.** The `crypto_sign_keypair` / `crypto_sign_signature` /
59
+ `crypto_sign_verify` aliases, the `CRYPTO_SECRETKEYBYTES` / `CRYPTO_PUBLICKEYBYTES` / `CRYPTO_BYTES` size macros, and
60
+ the `MLD_CONFIG_NO_SUPERCOP` option were removed. Use the namespaced API directly and derive sizes from
61
+ `MLDSA_SECRETKEYBYTES` / `MLDSA_PUBLICKEYBYTES` / `MLDSA_BYTES`.
62
+ ([#1248](https://github.com/pq-code-package/mldsa-native/pull/1248))
63
+ - **SUPERCOP signed-message API removed.** The combined signed-message functions (`crypto_sign` / `crypto_sign_open`
64
+ and their namespaced equivalents, which produced/consumed signature-prepended messages) were removed. Applications
65
+ needing that format should build it on top of the detached `signature` / `verify` API.
66
+ ([#1236](https://github.com/pq-code-package/mldsa-native/pull/1236))
67
+ - **`MLD_ERR_FAIL` split into specific error codes.** Failure conditions that previously all surfaced as
68
+ `MLD_ERR_FAIL` now have dedicated codes: `MLD_ERR_INVALID_SIGNATURE` (verification rejected the signature),
69
+ `MLD_ERR_INVALID_KEY` (`pk_from_sk` found the secret key malformed or internally inconsistent), `MLD_ERR_PCT_FAIL`
70
+ (the key-generation pairwise consistency test failed) and `MLD_ERR_INVALID_ARG` (unsupported pre-hash algorithm or
71
+ context string longer than 255 bytes). The previously existing codes keep their values, but callers matching on
72
+ `MLD_ERR_FAIL` must be updated; it is no longer externally observable.
73
+ ([#1309](https://github.com/pq-code-package/mldsa-native/pull/1309))
74
+ - **Legacy header-time configuration removed.** The deprecated `MLD_CONFIG_API_*` macros
75
+ (`MLD_CONFIG_API_PARAMETER_SET`, `MLD_CONFIG_API_NAMESPACE_PREFIX`, `MLD_CONFIG_API_NO_SUPERCOP`,
76
+ `MLD_CONFIG_API_CONSTANTS_ONLY`, `MLD_CONFIG_API_QUALIFIER`) were removed in favour of configuring through the
77
+ [config file](mldsa/mldsa_native_config.h) (`MLD_CONFIG_PARAMETER_SET`, `MLD_CONFIG_NAMESPACE_PREFIX`,
78
+ `MLD_CONFIG_CONSTANTS_ONLY`, `MLD_CONFIG_EXTERNAL_API_QUALIFIER`). For multi-level builds, set
79
+ `MLD_CONFIG_MULTILEVEL_BUILD` and do not bake the 44/65/87 suffix into the namespace prefix; the security level is
80
+ now appended automatically. ([#1206](https://github.com/pq-code-package/mldsa-native/pull/1206),
81
+ [#1270](https://github.com/pq-code-package/mldsa-native/pull/1270))
82
+ - **FIPS-202 backend flags renamed to the `MLD_USE_NATIVE_*` convention.** Custom FIPS-202 backends must rename the
83
+ flags they define: `MLD_USE_FIPS202_X1_NATIVE` -> `MLD_USE_NATIVE_FIPS202_X1`, `MLD_USE_FIPS202_X4_NATIVE` ->
84
+ `MLD_USE_NATIVE_FIPS202_X4`, `MLD_USE_FIPS202_X4_XOR_BYTES_NATIVE` -> `MLD_USE_NATIVE_FIPS202_X4_XOR_BYTES`, and
85
+ `MLD_USE_FIPS202_X4_EXTRACT_BYTES_NATIVE` -> `MLD_USE_NATIVE_FIPS202_X4_EXTRACT_BYTES`. Default builds are
86
+ unaffected. ([#1207](https://github.com/pq-code-package/mldsa-native/pull/1207))
87
+ - **Capability enum values prefixed with the architecture.** `mld_sys_cap` values were renamed
88
+ (`MLD_SYS_CAP_AVX2` -> `MLD_SYS_CAP_X86_64_AVX2`, `MLD_SYS_CAP_SHA3` -> `MLD_SYS_CAP_AARCH64_SHA3`,
89
+ `MLD_SYS_CAP_MVE` -> `MLD_SYS_CAP_ARMV81M_MVE`). This affects integrators with custom native backends or a custom
90
+ capability-check function. ([#1208](https://github.com/pq-code-package/mldsa-native/pull/1208))
91
+ - **Minimum FIPS 204 signing-attempt bound raised from 814 to 821.** Builds that set
92
+ `MLD_CONFIG_MAX_SIGNING_ATTEMPTS` explicitly must now use a value of at least 821; 814 through 820 no longer compile.
93
+ The [FIPS 204 errata](https://csrc.nist.gov/files/pubs/fips/204/final/docs/fips-204-potential-updates.xlsx) revises
94
+ the Repetitions row of Table 1 to 4.36 / 5.14 / 3.91 and, with it, the minimum loop-iteration limit for
95
+ `ML-DSA.Sign_internal` in Table 3 from 814 to 821.
96
+ ([#1349](https://github.com/pq-code-package/mldsa-native/pull/1349))
97
+
98
+ We hope these simplifications make integrations easier for the majority of consumers. Moving forward, APIs and
99
+ configuration options not marked as experimental are guaranteed to be stable until a new major version (`v3`) is
100
+ released; additional APIs and configuration options may be introduced at any time.
101
+
102
+ If the breaking changes above cause any issues for your application, please
103
+ [open a GitHub issue](https://github.com/pq-code-package/mldsa-native/issues). If your application could benefit from
104
+ additional APIs or configuration options, please open an issue as well.
105
+
106
+ What's New
107
+ ----------
108
+
109
+ ### Restartable and bounded signing for real-time systems
110
+
111
+ ML-DSA signing is a rejection-sampling loop: it draws a candidate signature and retries until one passes the
112
+ bounds checks. The number of attempts is not known in advance, so a single signing call has an *unbounded* worst-case
113
+ runtime.
114
+ For environments with strict timing requirements that is a problem: a signing call cannot be allowed to run for an
115
+ arbitrary number of iterations before returning control to the caller.
116
+
117
+ mldsa-native addresses this with three optional, independent **signing hooks** around the rejection-sampling loop,
118
+ enabled with `MLD_CONFIG_SIGN_HOOK_ATTEMPT`, `MLD_CONFIG_SIGN_HOOK_RESUME` and `MLD_CONFIG_SIGN_HOOK_FINISH`. The
119
+ attempt hook runs before each attempt and may **pause** the operation; signing then returns the new
120
+ `MLD_ERR_SIGNING_PAUSED` code instead of iterating further. At the start of the next call the resume hook is queried
121
+ for the attempt to restart from (the one the attempt hook recorded when it paused), so signing continues exactly where
122
+ it left off; the finish hook fires with the succeeding attempt once a signature is found. The split, resumed run
123
+ produces exactly the same signature as a single uninterrupted call.
124
+
125
+ To bound per-call runtime, the attempt hook pauses once a per-call budget is spent, and the caller re-invokes signing
126
+ in a loop until it completes.
127
+
128
+ For concurrent or interleaved signers, hold the resume state per caller by enabling `MLD_CONFIG_CONTEXT_PARAMETER`
129
+ instead of a global; each API function then forwards a context argument to the hooks. A complete example is in
130
+ [examples/restartable_sign](examples/restartable_sign).
131
+ ([#1237](https://github.com/pq-code-package/mldsa-native/pull/1237))
132
+
133
+ This feature is experimental: its scope, configuration and hook signatures may change, including after v2.
134
+ We would love to hear your feedback on this feature.
135
+
136
+ ### API and configuration
137
+
138
+ - **`MLD_SYS_AARCH64_FAST_SHA3`** opts non-Apple AArch64 cores with fast SHA3 instructions into the SHA3-instruction
139
+ path. ([#1254](https://github.com/pq-code-package/mldsa-native/pull/1254))
140
+
141
+ ### Platforms and testing
142
+
143
+ - **Windows MSVC** test support (KAT, Wycheproof, allocation-failure and RNG-failure tests).
144
+ ([#1247](https://github.com/pq-code-package/mldsa-native/pull/1247))
145
+ - **AVR baremetal / 16-bit** platform support. ([#1158](https://github.com/pq-code-package/mldsa-native/pull/1158))
146
+ - **Zephyr** hardware and QEMU test platforms, including NUCLEO-N657X0-Q.
147
+ ([#1259](https://github.com/pq-code-package/mldsa-native/pull/1259),
148
+ [#1269](https://github.com/pq-code-package/mldsa-native/pull/1269))
149
+ - **ABI checker** for AArch64, x86_64 (SysV) and Armv8.1-M+MVE.
150
+ ([#1195](https://github.com/pq-code-package/mldsa-native/pull/1195))
151
+
152
+ ### Documentation
153
+
154
+ - **FIPS 204 references** annotated throughout the code and expanded in the documentation, mapping the implementation
155
+ to [the standard](https://csrc.nist.gov/pubs/fips/204/final).
156
+ - **[API-CONVENTIONS.md](API-CONVENTIONS.md)** documents the conventions shared by all public functions: return
157
+ values, pointer validity (all pointers are assumed valid and non-NULL, except a pointer paired with a length, which
158
+ may be NULL when that length is `0`), and the state of output buffers on error (left either unchanged or fully
159
+ zeroized, never holding partially computed data).
160
+