pq_crypto 0.6.7 → 0.6.9

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 (214) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +20 -0
  3. data/README.md +1 -3
  4. data/ext/pqcrypto/pqcrypto_ruby_secure.c +41 -11
  5. data/ext/pqcrypto/pqcrypto_secure.c +501 -296
  6. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  7. data/ext/pqcrypto/vendor/.vendored +7 -7
  8. data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +71 -0
  9. data/ext/pqcrypto/vendor/mldsa-native/README.md +26 -11
  10. data/ext/pqcrypto/vendor/mldsa-native/RELEASE.md +77 -150
  11. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +93 -40
  12. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +74 -59
  13. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +106 -40
  14. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +94 -92
  15. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/capability.h +31 -0
  16. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +55 -4
  17. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +30 -0
  18. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h +1 -0
  19. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +1 -0
  20. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +1 -0
  21. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -2
  22. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +4 -4
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +4 -4
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +8 -3
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +8 -4
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +12 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +4 -2
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +37 -19
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +37 -19
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +3 -8
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/auto.h +53 -0
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h +38 -0
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h +38 -0
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +24 -0
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S +574 -0
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +46 -18
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S +679 -0
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +13 -4
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +6 -4
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +5 -6
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_intt_aarch64_asm.S +4 -2
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_ntt_aarch64_asm.S +4 -2
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_pointwise_montgomery_aarch64_asm.S +6 -4
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_caddq_aarch64_asm.S +4 -2
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_chknorm_aarch64_asm.S +6 -4
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_32_aarch64_asm.S +4 -3
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_88_aarch64_asm.S +4 -3
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_32_aarch64_asm.S +4 -3
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_88_aarch64_asm.S +4 -3
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +4 -2
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +4 -2
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +4 -2
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_17_aarch64_asm.S +5 -3
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_19_aarch64_asm.S +5 -3
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_aarch64_asm.S +110 -120
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta2_aarch64_asm.S +109 -101
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta4_aarch64_asm.S +97 -93
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +1 -9
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +4 -0
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/fastmul.h +74 -0
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/slowmul.h +77 -0
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/arith_native_rv32im.h +124 -0
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_asm.S +331 -0
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_slowmul_asm.S +381 -0
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_ntt_rv32im_asm.S +304 -0
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_ntt_rv32im_slowmul_asm.S +351 -0
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_poly_pointwise_montgomery_rv32im_asm.S +139 -0
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/rv32im_zetas.c +118 -0
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +6 -5
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +2 -3
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_intt_avx2_asm.S +5 -3
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_ntt_avx2_asm.S +5 -3
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_nttunpack_avx2_asm.S +5 -3
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l4_avx2_asm.S +6 -3
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l5_avx2_asm.S +6 -3
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l7_avx2_asm.S +6 -3
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_avx2_asm.S +5 -3
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_caddq_avx2_asm.S +5 -3
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +7 -5
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +69 -67
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +69 -67
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +12 -16
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +14 -18
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +6 -3
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +6 -3
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +5 -3
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +5 -3
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +5 -3
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +23 -27
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +21 -42
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +28 -1
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +87 -28
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +61 -3
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +23 -19
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +30 -0
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +55 -107
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +67 -107
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +16 -24
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +27 -21
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +8 -8
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +191 -119
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +6 -3
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +16 -42
  104. data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +72 -0
  105. data/ext/pqcrypto/vendor/mlkem-native/README.md +9 -5
  106. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +64 -312
  107. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -34
  108. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +41 -13
  109. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +89 -33
  110. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +50 -46
  111. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/capability.h +30 -0
  112. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +30 -0
  113. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +1 -0
  114. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +4 -5
  115. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +1 -0
  116. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +15 -0
  117. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +23 -8
  118. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +11 -3
  119. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +7 -1
  120. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +8 -0
  121. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +8 -0
  122. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -2
  123. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +4 -4
  124. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +4 -4
  125. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +8 -3
  126. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +8 -4
  127. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +4 -2
  128. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +37 -19
  129. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +37 -19
  130. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -2
  131. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/auto.h +47 -0
  132. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h +37 -0
  133. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h +37 -0
  134. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +24 -0
  135. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S +573 -0
  136. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +46 -18
  137. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S +678 -0
  138. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +13 -4
  139. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +1 -2
  140. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +7 -5
  141. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +29 -5
  142. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +156 -0
  143. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +137 -3
  144. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/compress_d5_table.c +43 -0
  145. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d10_table.c +50 -0
  146. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d11_table.c +53 -0
  147. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d4_table.c +44 -0
  148. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d5_table.c +53 -0
  149. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_intt_aarch64_asm.S +5 -3
  150. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_ntt_aarch64_asm.S +4 -2
  151. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d10_aarch64_asm.S +439 -0
  152. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d11_aarch64_asm.S +452 -0
  153. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d4_aarch64_asm.S +106 -0
  154. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d5_aarch64_asm.S +124 -0
  155. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d10_aarch64_asm.S +108 -0
  156. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d11_aarch64_asm.S +116 -0
  157. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d4_aarch64_asm.S +93 -0
  158. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d5_aarch64_asm.S +104 -0
  159. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_frombytes_aarch64_asm.S +84 -0
  160. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_mulcache_compute_aarch64_asm.S +4 -2
  161. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_reduce_aarch64_asm.S +4 -2
  162. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tobytes_aarch64_asm.S +5 -3
  163. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tomont_aarch64_asm.S +4 -3
  164. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S +4 -2
  165. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S +4 -2
  166. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S +4 -2
  167. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_rej_uniform_aarch64_asm.S +112 -104
  168. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +0 -1
  169. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +2 -2
  170. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +2 -2
  171. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +16 -21
  172. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +1 -0
  173. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +2 -2
  174. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_intt_ppc_asm.S +6 -5
  175. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_ntt_ppc_asm.S +6 -5
  176. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_poly_tomont_ppc_asm.S +6 -5
  177. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_reduce_ppc_asm.S +6 -5
  178. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +5 -4
  179. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +2 -2
  180. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +1 -1
  181. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +5 -5
  182. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_intt_avx2_asm.S +36 -33
  183. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntt_avx2_asm.S +67 -65
  184. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttfrombytes_avx2_asm.S +8 -5
  185. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntttobytes_avx2_asm.S +6 -3
  186. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttunpack_avx2_asm.S +5 -3
  187. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d10_avx2_asm.S +7 -5
  188. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d11_avx2_asm.S +7 -4
  189. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d4_avx2_asm.S +7 -5
  190. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d5_avx2_asm.S +7 -4
  191. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d10_avx2_asm.S +7 -4
  192. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d11_avx2_asm.S +6 -4
  193. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d4_avx2_asm.S +7 -4
  194. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d5_avx2_asm.S +6 -4
  195. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_mulcache_compute_avx2_asm.S +5 -3
  196. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S +118 -115
  197. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S +174 -171
  198. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S +230 -227
  199. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_reduce_avx2_asm.S +17 -15
  200. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_rej_uniform_avx2_asm.S +7 -6
  201. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_tomont_avx2_asm.S +5 -3
  202. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +4 -9
  203. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +1 -1
  204. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +31 -44
  205. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +1 -1
  206. data/lib/pq_crypto/internal.rb +10 -0
  207. data/lib/pq_crypto/kem.rb +5 -10
  208. data/lib/pq_crypto/pkcs8/der.rb +26 -11
  209. data/lib/pq_crypto/pkcs8/private_key_choice.rb +21 -25
  210. data/lib/pq_crypto/signature.rb +28 -40
  211. data/lib/pq_crypto/spki.rb +36 -23
  212. data/lib/pq_crypto/version.rb +1 -1
  213. data/script/vendor_libs.rb +6 -6
  214. metadata +36 -1
@@ -138,7 +138,7 @@ MLD_INTERNAL_API
138
138
  void mld_poly_shiftl(mld_poly *a)
139
139
  __contract__(
140
140
  requires(memory_no_alias(a, sizeof(mld_poly)))
141
- requires(array_bound(a->coeffs, 0, MLDSA_N, 0, 1 << 10))
141
+ requires(array_bound(a->coeffs, 0, MLDSA_N, 0, 1 << MLDSA_POLYT1_PACKEDBITS))
142
142
  assigns(memory_slice(a, sizeof(mld_poly)))
143
143
  ensures(array_bound(a->coeffs, 0, MLDSA_N, 0, MLDSA_Q))
144
144
  );
@@ -318,7 +318,7 @@ void mld_polyt1_pack(uint8_t r[MLDSA_POLYT1_PACKEDBYTES], const mld_poly *a)
318
318
  __contract__(
319
319
  requires(memory_no_alias(r, MLDSA_POLYT1_PACKEDBYTES))
320
320
  requires(memory_no_alias(a, sizeof(mld_poly)))
321
- requires(array_bound(a->coeffs, 0, MLDSA_N, 0, 1 << 10))
321
+ requires(array_bound(a->coeffs, 0, MLDSA_N, 0, 1 << MLDSA_POLYT1_PACKEDBITS))
322
322
  assigns(memory_slice(r, MLDSA_POLYT1_PACKEDBYTES))
323
323
  );
324
324
  #endif /* !MLD_CONFIG_NO_KEYPAIR_API */
@@ -340,7 +340,7 @@ __contract__(
340
340
  requires(memory_no_alias(r, sizeof(mld_poly)))
341
341
  requires(memory_no_alias(a, MLDSA_POLYT1_PACKEDBYTES))
342
342
  assigns(memory_slice(r, sizeof(mld_poly)))
343
- ensures(array_bound(r->coeffs, 0, MLDSA_N, 0, 1 << 10))
343
+ ensures(array_bound(r->coeffs, 0, MLDSA_N, 0, 1 << MLDSA_POLYT1_PACKEDBITS))
344
344
  );
345
345
  #endif /* !MLD_CONFIG_NO_VERIFY_API */
346
346
 
@@ -385,6 +385,10 @@ __contract__(
385
385
  );
386
386
  #endif /* !MLD_CONFIG_NO_SIGN_API || MLD_UNIT_TEST */
387
387
 
388
+ #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API) || \
389
+ (!defined(MLD_CONFIG_NO_KEYPAIR_API) && \
390
+ !defined(MLD_CONFIG_CORE_API_ONLY)) || \
391
+ defined(MLD_UNIT_TEST)
388
392
  #define mld_poly_chknorm MLD_NAMESPACE(poly_chknorm)
389
393
  /**
390
394
  * Check infinity norm of polynomial against given bound. Assumes input
@@ -413,6 +417,9 @@ __contract__(
413
417
  ensures(return_value == 0 || return_value == 0xFFFFFFFF)
414
418
  ensures((return_value == 0) == array_abs_bound(a->coeffs, 0, MLDSA_N, B))
415
419
  );
420
+ #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API || \
421
+ (!MLD_CONFIG_NO_KEYPAIR_API && !MLD_CONFIG_CORE_API_ONLY) || \
422
+ MLD_UNIT_TEST */
416
423
 
417
424
  #if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
418
425
  #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
@@ -461,4 +468,55 @@ __contract__(
461
468
  || MLD_CONFIG_PARAMETER_SET == 87 */
462
469
  #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
463
470
 
471
+ #if !defined(MLD_CONFIG_NO_SIGN_API)
472
+ #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
473
+ #define mld_polyw1_unpack_88 MLD_NAMESPACE(polyw1_unpack_88)
474
+ /**
475
+ * Unpack polynomial w1 packed with 6 bits per coefficient.
476
+ * This is the variant for parameter sets with MLDSA_GAMMA2 = (MLDSA_Q-1)/88
477
+ * (ML-DSA-44). Inverse of mld_polyw1_pack_88.
478
+ *
479
+ * @spec{Implements @[FIPS204, Algorithm 18, SimpleBitUnpack] for b = 43.}
480
+ *
481
+ * @param[out] r Pointer to output polynomial.
482
+ * @param[in] a Byte array with bit-packed polynomial.
483
+ */
484
+ MLD_INTERNAL_API
485
+ void mld_polyw1_unpack_88(mld_poly *r,
486
+ const uint8_t a[MLDSA_POLYW1_PACKEDBYTES_88])
487
+ __contract__(
488
+ requires(memory_no_alias(r, sizeof(mld_poly)))
489
+ requires(memory_no_alias(a, MLDSA_POLYW1_PACKEDBYTES_88))
490
+ assigns(memory_slice(r, sizeof(mld_poly)))
491
+ ensures(array_bound(r->coeffs, 0, MLDSA_N, 0, 1 << MLDSA_POLYW1_PACKEDBITS_88))
492
+ );
493
+ #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
494
+ */
495
+
496
+ #if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
497
+ (MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
498
+ #define mld_polyw1_unpack_32 MLD_NAMESPACE(polyw1_unpack_32)
499
+ /**
500
+ * Unpack polynomial w1 packed with 4 bits per coefficient.
501
+ * This is the variant for parameter sets with MLDSA_GAMMA2 = (MLDSA_Q-1)/32
502
+ * (ML-DSA-65 and ML-DSA-87). Inverse of mld_polyw1_pack_32.
503
+ *
504
+ * @spec{Implements @[FIPS204, Algorithm 18, SimpleBitUnpack] for b = 15.}
505
+ *
506
+ * @param[out] r Pointer to output polynomial.
507
+ * @param[in] a Byte array with bit-packed polynomial.
508
+ */
509
+ MLD_INTERNAL_API
510
+ void mld_polyw1_unpack_32(mld_poly *r,
511
+ const uint8_t a[MLDSA_POLYW1_PACKEDBYTES_32])
512
+ __contract__(
513
+ requires(memory_no_alias(r, sizeof(mld_poly)))
514
+ requires(memory_no_alias(a, MLDSA_POLYW1_PACKEDBYTES_32))
515
+ assigns(memory_slice(r, sizeof(mld_poly)))
516
+ ensures(array_bound(r->coeffs, 0, MLDSA_N, 0, 1 << MLDSA_POLYW1_PACKEDBITS_32))
517
+ );
518
+ #endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
519
+ || MLD_CONFIG_PARAMETER_SET == 87 */
520
+ #endif /* !MLD_CONFIG_NO_SIGN_API */
521
+
464
522
  #endif /* !MLD_POLY_H */
@@ -19,7 +19,6 @@
19
19
  */
20
20
 
21
21
  #include "poly_kl.h"
22
-
23
22
  #include "ct.h"
24
23
  #include "debug.h"
25
24
  #include "rounding.h"
@@ -52,7 +51,7 @@ __contract__(
52
51
  {
53
52
  unsigned int i;
54
53
  mld_assert_bound(a0->coeffs, MLDSA_N, 0, MLDSA_Q);
55
- for (i = 0; i < MLDSA_N; ++i)
54
+ for (i = 0; i < MLDSA_N; i++)
56
55
  __loop__(
57
56
  assigns(i, memory_slice(a0, sizeof(mld_poly)), memory_slice(a1, sizeof(mld_poly)))
58
57
  invariant(i <= MLDSA_N)
@@ -118,7 +117,7 @@ __contract__(
118
117
  mld_assert_bound(a->coeffs, MLDSA_N, 0, MLDSA_Q);
119
118
  mld_assert_bound(h->coeffs, MLDSA_N, 0, 2);
120
119
 
121
- for (i = 0; i < MLDSA_N; ++i)
120
+ for (i = 0; i < MLDSA_N; i++)
122
121
  __loop__(
123
122
  invariant(i <= MLDSA_N)
124
123
  invariant(array_bound(a->coeffs, 0, i, 0, (MLDSA_Q-1)/(2*MLDSA_GAMMA2)))
@@ -283,10 +282,10 @@ __contract__(
283
282
  requires(buflen <= (MLD_POLY_UNIFORM_ETA_NBLOCKS * MLD_STREAM256_BLOCKBYTES))
284
283
  requires(memory_no_alias(a, sizeof(int32_t) * target))
285
284
  requires(memory_no_alias(buf, buflen))
286
- requires(array_abs_bound(a, 0, offset, MLDSA_ETA + 1))
285
+ requires(array_abs_bound(a, 0, offset, MLDSA_N, MLDSA_ETA + 1))
287
286
  assigns(memory_slice(a, sizeof(int32_t) * target))
288
287
  ensures(offset <= return_value && return_value <= target)
289
- ensures(array_abs_bound(a, 0, return_value, MLDSA_ETA + 1))
288
+ ensures(array_abs_bound(a, 0, return_value, MLDSA_N, MLDSA_ETA + 1))
290
289
  )
291
290
  {
292
291
  #if MLDSA_ETA == 2 && defined(MLD_USE_NATIVE_REJ_UNIFORM_ETA2)
@@ -382,10 +381,10 @@ void mld_poly_uniform_eta_4x(mld_poly *r0, mld_poly *r1, mld_poly *r2,
382
381
  object_whole(buf[3]))
383
382
  invariant(ctr[0] <= MLDSA_N && ctr[1] <= MLDSA_N)
384
383
  invariant(ctr[2] <= MLDSA_N && ctr[3] <= MLDSA_N)
385
- invariant(array_abs_bound(r0->coeffs, 0, ctr[0], MLDSA_ETA + 1))
386
- invariant(array_abs_bound(r1->coeffs, 0, ctr[1], MLDSA_ETA + 1))
387
- invariant(array_abs_bound(r2->coeffs, 0, ctr[2], MLDSA_ETA + 1))
388
- invariant(array_abs_bound(r3->coeffs, 0, ctr[3], MLDSA_ETA + 1)))
384
+ invariant(array_abs_bound(r0->coeffs, 0, ctr[0], MLDSA_N, MLDSA_ETA + 1))
385
+ invariant(array_abs_bound(r1->coeffs, 0, ctr[1], MLDSA_N, MLDSA_ETA + 1))
386
+ invariant(array_abs_bound(r2->coeffs, 0, ctr[2], MLDSA_N, MLDSA_ETA + 1))
387
+ invariant(array_abs_bound(r3->coeffs, 0, ctr[3], MLDSA_N, MLDSA_ETA + 1)))
389
388
  {
390
389
  mld_xof256_x4_squeezeblocks(buf, 1, &state);
391
390
  ctr[0] = mld_rej_eta(r0->coeffs, MLDSA_N, ctr[0], buf[0], buflen);
@@ -576,7 +575,7 @@ void mld_poly_challenge(mld_poly *c, const uint8_t seed[MLDSA_CTILDEBYTES])
576
575
  /* Convert the first 8 bytes of buf[] into an unsigned 64-bit value. */
577
576
  /* Each bit of that dictates the sign of the resulting challenge value */
578
577
  signs = 0;
579
- for (i = 0; i < 8; ++i)
578
+ for (i = 0; i < 8; i++)
580
579
  __loop__(
581
580
  assigns(i, signs)
582
581
  invariant(i <= 8)
@@ -589,7 +588,7 @@ void mld_poly_challenge(mld_poly *c, const uint8_t seed[MLDSA_CTILDEBYTES])
589
588
 
590
589
  mld_memset(c, 0, sizeof(mld_poly));
591
590
 
592
- for (i = MLDSA_N - MLDSA_TAU; i < MLDSA_N; ++i)
591
+ for (i = MLDSA_N - MLDSA_TAU; i < MLDSA_N; i++)
593
592
  __loop__(
594
593
  assigns(i, j, object_whole(buf), state, pos, memory_slice(c, sizeof(mld_poly)), signs)
595
594
  invariant(i >= MLDSA_N - MLDSA_TAU)
@@ -654,7 +653,7 @@ void mld_polyeta_pack(uint8_t r[MLDSA_POLYETA_PACKEDBYTES], const mld_poly *a)
654
653
  mld_assert_abs_bound(a->coeffs, MLDSA_N, MLDSA_ETA + 1);
655
654
 
656
655
  #if MLDSA_ETA == 2
657
- for (i = 0; i < MLDSA_N / 8; ++i)
656
+ for (i = 0; i < MLDSA_N / 8; i++)
658
657
  __loop__(
659
658
  invariant(i <= MLDSA_N/8)
660
659
  decreases(MLDSA_N / 8 - i))
@@ -677,7 +676,7 @@ void mld_polyeta_pack(uint8_t r[MLDSA_POLYETA_PACKEDBYTES], const mld_poly *a)
677
676
  r[3 * i + 2] = (uint8_t)(((t[5] >> 1) | (t[6] << 2) | (t[7] << 5)) & 0xFF);
678
677
  }
679
678
  #elif MLDSA_ETA == 4
680
- for (i = 0; i < MLDSA_N / 2; ++i)
679
+ for (i = 0; i < MLDSA_N / 2; i++)
681
680
  __loop__(
682
681
  invariant(i <= MLDSA_N/2)
683
682
  decreases(MLDSA_N / 2 - i))
@@ -691,6 +690,9 @@ void mld_polyeta_pack(uint8_t r[MLDSA_POLYETA_PACKEDBYTES], const mld_poly *a)
691
690
  #else /* MLDSA_ETA == 4 */
692
691
  #error "Invalid value of MLDSA_ETA"
693
692
  #endif /* MLDSA_ETA != 2 && MLDSA_ETA != 4 */
693
+
694
+ /* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
695
+ mld_zeroize(t, sizeof(t));
694
696
  }
695
697
  #endif /* !MLD_CONFIG_NO_KEYPAIR_API */
696
698
 
@@ -701,7 +703,7 @@ void mld_polyeta_unpack(mld_poly *r, const uint8_t a[MLDSA_POLYETA_PACKEDBYTES])
701
703
  unsigned int i;
702
704
 
703
705
  #if MLDSA_ETA == 2
704
- for (i = 0; i < MLDSA_N / 8; ++i)
706
+ for (i = 0; i < MLDSA_N / 8; i++)
705
707
  __loop__(
706
708
  invariant(i <= MLDSA_N/8)
707
709
  invariant(array_bound(r->coeffs, 0, i*8, -5, MLDSA_ETA + 1))
@@ -726,7 +728,7 @@ void mld_polyeta_unpack(mld_poly *r, const uint8_t a[MLDSA_POLYETA_PACKEDBYTES])
726
728
  r->coeffs[8 * i + 7] = MLDSA_ETA - r->coeffs[8 * i + 7];
727
729
  }
728
730
  #elif MLDSA_ETA == 4
729
- for (i = 0; i < MLDSA_N / 2; ++i)
731
+ for (i = 0; i < MLDSA_N / 2; i++)
730
732
  __loop__(
731
733
  invariant(i <= MLDSA_N/2)
732
734
  invariant(array_bound(r->coeffs, 0, i*2, -11, MLDSA_ETA + 1))
@@ -756,7 +758,7 @@ void mld_polyz_pack(uint8_t r[MLDSA_POLYZ_PACKEDBYTES], const mld_poly *a)
756
758
  mld_assert_bound(a->coeffs, MLDSA_N, -(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1 + 1);
757
759
 
758
760
  #if MLD_CONFIG_PARAMETER_SET == 44
759
- for (i = 0; i < MLDSA_N / 4; ++i)
761
+ for (i = 0; i < MLDSA_N / 4; i++)
760
762
  __loop__(
761
763
  invariant(i <= MLDSA_N/4)
762
764
  decreases(MLDSA_N / 4 - i))
@@ -781,7 +783,7 @@ void mld_polyz_pack(uint8_t r[MLDSA_POLYZ_PACKEDBYTES], const mld_poly *a)
781
783
  r[9 * i + 8] = (uint8_t)((t[3] >> 10) & 0xFF);
782
784
  }
783
785
  #else /* MLD_CONFIG_PARAMETER_SET == 44 */
784
- for (i = 0; i < MLDSA_N / 2; ++i)
786
+ for (i = 0; i < MLDSA_N / 2; i++)
785
787
  __loop__(
786
788
  invariant(i <= MLDSA_N/2)
787
789
  decreases(MLDSA_N / 2 - i))
@@ -798,6 +800,8 @@ void mld_polyz_pack(uint8_t r[MLDSA_POLYZ_PACKEDBYTES], const mld_poly *a)
798
800
  r[5 * i + 4] = (uint8_t)((t[1] >> 12) & 0xFF);
799
801
  }
800
802
  #endif /* MLD_CONFIG_PARAMETER_SET != 44 */
803
+ /* @[FIPS204, Section 3.6.3] Destruction of intermediate values. */
804
+ mld_zeroize(t, sizeof(t));
801
805
  }
802
806
  #endif /* !MLD_CONFIG_NO_SIGN_API */
803
807
 
@@ -813,7 +817,7 @@ __contract__(
813
817
  {
814
818
  unsigned int i;
815
819
  #if MLD_CONFIG_PARAMETER_SET == 44
816
- for (i = 0; i < MLDSA_N / 4; ++i)
820
+ for (i = 0; i < MLDSA_N / 4; i++)
817
821
  __loop__(
818
822
  invariant(i <= MLDSA_N/4)
819
823
  invariant(array_bound(r->coeffs, 0, i*4, -(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1 + 1))
@@ -845,7 +849,7 @@ __contract__(
845
849
  r->coeffs[4 * i + 3] = MLDSA_GAMMA1 - r->coeffs[4 * i + 3];
846
850
  }
847
851
  #else /* MLD_CONFIG_PARAMETER_SET == 44 */
848
- for (i = 0; i < MLDSA_N / 2; ++i)
852
+ for (i = 0; i < MLDSA_N / 2; i++)
849
853
  __loop__(
850
854
  invariant(i <= MLDSA_N/2)
851
855
  invariant(array_bound(r->coeffs, 0, i*2, -(MLDSA_GAMMA1 - 1), MLDSA_GAMMA1 + 1))
@@ -364,4 +364,34 @@ __contract__(
364
364
  }
365
365
  #endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
366
366
 
367
+ #if !defined(MLD_CONFIG_NO_SIGN_API)
368
+ #define mld_polyw1_unpack MLD_NAMESPACE_KL(polyw1_unpack)
369
+ /**
370
+ * Unpack polynomial w1. Inverse of mld_polyw1_pack; dispatches to the
371
+ * value-specialized variant for the selected parameter set.
372
+ *
373
+ * @spec{Implements @[FIPS204, Algorithm 18, SimpleBitUnpack] for the two
374
+ * values of b arising for w1: b = 43 (ML-DSA-44) and b = 15 (ML-DSA-65 and
375
+ * ML-DSA-87).}
376
+ *
377
+ * @param[out] r Pointer to output polynomial.
378
+ * @param[in] a Byte array with bit-packed polynomial.
379
+ */
380
+ static MLD_INLINE void mld_polyw1_unpack(
381
+ mld_poly *r, const uint8_t a[MLDSA_POLYW1_PACKEDBYTES])
382
+ __contract__(
383
+ requires(memory_no_alias(r, sizeof(mld_poly)))
384
+ requires(memory_no_alias(a, MLDSA_POLYW1_PACKEDBYTES))
385
+ assigns(memory_slice(r, sizeof(mld_poly)))
386
+ ensures(array_bound(r->coeffs, 0, MLDSA_N, 0, 1 << MLDSA_POLYW1_PACKEDBITS))
387
+ )
388
+ {
389
+ #if MLD_CONFIG_PARAMETER_SET == 44
390
+ mld_polyw1_unpack_88(r, a);
391
+ #else
392
+ mld_polyw1_unpack_32(r, a);
393
+ #endif
394
+ }
395
+ #endif /* !MLD_CONFIG_NO_SIGN_API */
396
+
367
397
  #endif /* !MLD_POLY_KL_H */
@@ -13,7 +13,6 @@
13
13
  */
14
14
 
15
15
  #include "polyvec.h"
16
-
17
16
  #include "debug.h"
18
17
  #include "polyvec_lazy.h"
19
18
 
@@ -81,12 +80,12 @@ void mld_polyvecl_ntt(mld_polyvecl *v)
81
80
  unsigned int i;
82
81
  mld_assert_abs_bound_2d(v->vec, MLDSA_L, MLDSA_N, MLDSA_Q);
83
82
 
84
- for (i = 0; i < MLDSA_L; ++i)
83
+ for (i = 0; i < MLDSA_L; i++)
85
84
  __loop__(
86
85
  assigns(i, memory_slice(v, sizeof(mld_polyvecl)))
87
86
  invariant(i <= MLDSA_L)
88
87
  invariant(forall(k0, i, MLDSA_L, forall(k1, 0, MLDSA_N, v->vec[k0].coeffs[k1] == loop_entry(*v).vec[k0].coeffs[k1])))
89
- invariant(forall(k1, 0, i, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
88
+ invariant(forall(k1, 0, i, MLDSA_L, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
90
89
  decreases(MLDSA_L - i))
91
90
  {
92
91
  mld_poly_ntt(&v->vec[i]);
@@ -120,7 +119,7 @@ __contract__(
120
119
  __loop__(
121
120
  assigns(i, j, memory_slice(w, sizeof(mld_poly)))
122
121
  invariant(i <= MLDSA_N)
123
- invariant(array_abs_bound(w->coeffs, 0, i, MLDSA_Q))
122
+ invariant(array_abs_bound(w->coeffs, 0, i, MLDSA_N, MLDSA_Q))
124
123
  decreases(MLDSA_N - i)
125
124
  )
126
125
  {
@@ -206,8 +205,9 @@ void mld_polyvecl_pointwise_acc_montgomery(mld_poly *w, const mld_polyvecl *u,
206
205
  }
207
206
  #endif /* !MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST */
208
207
 
209
- #if !defined(MLD_CONFIG_NO_KEYPAIR_API) || !defined(MLD_CONFIG_NO_VERIFY_API) || \
210
- defined(MLD_UNIT_TEST)
208
+ #if (!defined(MLD_CONFIG_NO_KEYPAIR_API) && \
209
+ !defined(MLD_CONFIG_CORE_API_ONLY)) || \
210
+ !defined(MLD_CONFIG_NO_VERIFY_API) || defined(MLD_UNIT_TEST)
211
211
  MLD_INTERNAL_API
212
212
  uint32_t mld_polyvecl_chknorm(const mld_polyvecl *v, int32_t bound)
213
213
  {
@@ -216,11 +216,11 @@ uint32_t mld_polyvecl_chknorm(const mld_polyvecl *v, int32_t bound)
216
216
  mld_assert_bound_2d(v->vec, MLDSA_L, MLDSA_N, -MLD_REDUCE32_RANGE_MAX,
217
217
  MLD_REDUCE32_RANGE_MAX);
218
218
 
219
- for (i = 0; i < MLDSA_L; ++i)
219
+ for (i = 0; i < MLDSA_L; i++)
220
220
  __loop__(
221
221
  invariant(i <= MLDSA_L)
222
222
  invariant(t == 0 || t == 0xFFFFFFFF)
223
- invariant((t == 0) == forall(k1, 0, i, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, bound)))
223
+ invariant((t == 0) == forall(k1, 0, i, MLDSA_L, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, bound)))
224
224
  decreases(MLDSA_L - i)
225
225
  )
226
226
  {
@@ -232,8 +232,8 @@ uint32_t mld_polyvecl_chknorm(const mld_polyvecl *v, int32_t bound)
232
232
  }
233
233
  return t;
234
234
  }
235
- #endif /* !MLD_CONFIG_NO_KEYPAIR_API || !MLD_CONFIG_NO_VERIFY_API || \
236
- MLD_UNIT_TEST */
235
+ #endif /* (!MLD_CONFIG_NO_KEYPAIR_API && !MLD_CONFIG_CORE_API_ONLY) || \
236
+ !MLD_CONFIG_NO_VERIFY_API || MLD_UNIT_TEST */
237
237
 
238
238
  /**************************************************************/
239
239
  /************ Vectors of polynomials of length MLDSA_K **************/
@@ -248,12 +248,12 @@ void mld_polyveck_reduce(mld_polyveck *v)
248
248
  mld_assert_bound_2d(v->vec, MLDSA_K, MLDSA_N, INT32_MIN,
249
249
  MLD_REDUCE32_DOMAIN_MAX);
250
250
 
251
- for (i = 0; i < MLDSA_K; ++i)
251
+ for (i = 0; i < MLDSA_K; i++)
252
252
  __loop__(
253
253
  assigns(i, memory_slice(v, sizeof(mld_polyveck)))
254
254
  invariant(i <= MLDSA_K)
255
255
  invariant(forall(k0, i, MLDSA_K, forall(k1, 0, MLDSA_N, v->vec[k0].coeffs[k1] == loop_entry(*v).vec[k0].coeffs[k1])))
256
- invariant(forall(k2, 0, i,
256
+ invariant(forall(k2, 0, i, MLDSA_K,
257
257
  array_bound(v->vec[k2].coeffs, 0, MLDSA_N, -MLD_REDUCE32_RANGE_MAX, MLD_REDUCE32_RANGE_MAX)))
258
258
  decreases(MLDSA_K - i)
259
259
  )
@@ -274,12 +274,12 @@ void mld_polyveck_caddq(mld_polyveck *v)
274
274
  unsigned int i;
275
275
  mld_assert_abs_bound_2d(v->vec, MLDSA_K, MLDSA_N, MLDSA_Q);
276
276
 
277
- for (i = 0; i < MLDSA_K; ++i)
277
+ for (i = 0; i < MLDSA_K; i++)
278
278
  __loop__(
279
279
  assigns(i, memory_slice(v, sizeof(mld_polyveck)))
280
280
  invariant(i <= MLDSA_K)
281
281
  invariant(forall(k0, i, MLDSA_K, forall(k1, 0, MLDSA_N, v->vec[k0].coeffs[k1] == loop_entry(*v).vec[k0].coeffs[k1])))
282
- invariant(forall(k1, 0, i, array_bound(v->vec[k1].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
282
+ invariant(forall(k1, 0, i, MLDSA_K, array_bound(v->vec[k1].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
283
283
  decreases(MLDSA_K - i))
284
284
  {
285
285
  mld_poly_caddq(&v->vec[i]);
@@ -297,12 +297,12 @@ void mld_polyveck_ntt(mld_polyveck *v)
297
297
  unsigned int i;
298
298
  mld_assert_abs_bound_2d(v->vec, MLDSA_K, MLDSA_N, MLDSA_Q);
299
299
 
300
- for (i = 0; i < MLDSA_K; ++i)
300
+ for (i = 0; i < MLDSA_K; i++)
301
301
  __loop__(
302
302
  assigns(i, memory_slice(v, sizeof(mld_polyveck)))
303
303
  invariant(i <= MLDSA_K)
304
304
  invariant(forall(k0, i, MLDSA_K, forall(k1, 0, MLDSA_N, v->vec[k0].coeffs[k1] == loop_entry(*v).vec[k0].coeffs[k1])))
305
- invariant(forall(k1, 0, i, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
305
+ invariant(forall(k1, 0, i, MLDSA_K, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_NTT_BOUND)))
306
306
  decreases(MLDSA_K - i))
307
307
  {
308
308
  mld_poly_ntt(&v->vec[i]);
@@ -319,12 +319,12 @@ void mld_polyveck_invntt_tomont(mld_polyveck *v)
319
319
  unsigned int i;
320
320
  mld_assert_abs_bound_2d(v->vec, MLDSA_K, MLDSA_N, MLDSA_Q);
321
321
 
322
- for (i = 0; i < MLDSA_K; ++i)
322
+ for (i = 0; i < MLDSA_K; i++)
323
323
  __loop__(
324
324
  assigns(i, memory_slice(v, sizeof(mld_polyveck)))
325
325
  invariant(i <= MLDSA_K)
326
326
  invariant(forall(k0, i, MLDSA_K, forall(k1, 0, MLDSA_N, v->vec[k0].coeffs[k1] == loop_entry(*v).vec[k0].coeffs[k1])))
327
- invariant(forall(k1, 0, i, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_INTT_BOUND)))
327
+ invariant(forall(k1, 0, i, MLDSA_K, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, MLD_INTT_BOUND)))
328
328
  decreases(MLDSA_K - i))
329
329
  {
330
330
  mld_poly_invntt_tomont(&v->vec[i]);
@@ -334,131 +334,77 @@ void mld_polyveck_invntt_tomont(mld_polyveck *v)
334
334
  }
335
335
  #endif /* !MLD_CONFIG_NO_SIGN_API || MLD_UNIT_TEST */
336
336
 
337
- #if !defined(MLD_CONFIG_NO_KEYPAIR_API)
337
+ #if !defined(MLD_CONFIG_NO_KEYPAIR_API) && !defined(MLD_CONFIG_CORE_API_ONLY)
338
338
  MLD_INTERNAL_API
339
- uint32_t mld_polyveck_chknorm(const mld_polyveck *v, int32_t bound)
339
+ uint32_t mld_polyveck_unpack_eta_chknorm(
340
+ const uint8_t r[MLDSA_K * MLDSA_POLYETA_PACKEDBYTES], int32_t bound,
341
+ mld_poly *scratch)
340
342
  {
341
343
  unsigned int i;
342
344
  uint32_t t = 0;
343
- mld_assert_bound_2d(v->vec, MLDSA_K, MLDSA_N, -MLD_REDUCE32_RANGE_MAX,
344
- MLD_REDUCE32_RANGE_MAX);
345
345
 
346
- for (i = 0; i < MLDSA_K; ++i)
346
+ for (i = 0; i < MLDSA_K; i++)
347
347
  __loop__(
348
+ assigns(i, t, memory_slice(scratch, sizeof(mld_poly)))
348
349
  invariant(i <= MLDSA_K)
349
350
  invariant(t == 0 || t == 0xFFFFFFFF)
350
- invariant((t == 0) == forall(k1, 0, i, array_abs_bound(v->vec[k1].coeffs, 0, MLDSA_N, bound)))
351
351
  decreases(MLDSA_K - i)
352
352
  )
353
353
  {
354
+ mld_polyeta_unpack(scratch, r + i * MLDSA_POLYETA_PACKEDBYTES);
354
355
  /* Reference: Leaks which polynomial violates the bound via a conditional.
355
356
  * We are more conservative to reduce the number of declassifications in
356
357
  * constant-time testing.
357
358
  */
358
- t |= mld_poly_chknorm(&v->vec[i], bound);
359
+ t |= mld_poly_chknorm(scratch, bound);
359
360
  }
360
361
 
361
362
  return t;
362
363
  }
363
364
 
364
- #endif /* !MLD_CONFIG_NO_KEYPAIR_API */
365
+ #endif /* !MLD_CONFIG_NO_KEYPAIR_API && !MLD_CONFIG_CORE_API_ONLY */
365
366
 
366
367
  #if !defined(MLD_CONFIG_NO_SIGN_API)
367
368
  MLD_INTERNAL_API
368
- void mld_polyveck_decompose(mld_polyveck *v1, mld_polyveck *v0)
369
+ void mld_polyveck_decompose_pack_w1(
370
+ uint8_t r[MLDSA_K * MLDSA_POLYW1_PACKEDBYTES], mld_polyveck *v0,
371
+ mld_poly *scratch)
369
372
  {
370
373
  unsigned int i;
371
374
  mld_assert_bound_2d(v0->vec, MLDSA_K, MLDSA_N, 0, MLDSA_Q);
372
375
 
373
- for (i = 0; i < MLDSA_K; ++i)
376
+ for (i = 0; i < MLDSA_K; i++)
374
377
  __loop__(
375
- assigns(i, memory_slice(v0, sizeof(mld_polyveck)), memory_slice(v1, sizeof(mld_polyveck)))
378
+ assigns(i, memory_slice(v0, sizeof(mld_polyveck)),
379
+ memory_slice(scratch, sizeof(mld_poly)),
380
+ memory_slice(r, MLDSA_K * MLDSA_POLYW1_PACKEDBYTES))
376
381
  invariant(i <= MLDSA_K)
377
- invariant(forall(k1, 0, i,
378
- array_bound(v1->vec[k1].coeffs, 0, MLDSA_N, 0, (MLDSA_Q-1)/(2*MLDSA_GAMMA2))))
379
- invariant(forall(k2, 0, i,
380
- array_abs_bound(v0->vec[k2].coeffs, 0, MLDSA_N, MLDSA_GAMMA2+1)))
381
- invariant(forall(k3, i, MLDSA_K,
382
- array_bound(v0->vec[k3].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
382
+ invariant(forall(k1, 0, i, MLDSA_K,
383
+ array_abs_bound(v0->vec[k1].coeffs, 0, MLDSA_N, MLDSA_GAMMA2+1)))
384
+ invariant(forall(k2, i, MLDSA_K,
385
+ array_bound(v0->vec[k2].coeffs, 0, MLDSA_N, 0, MLDSA_Q)))
383
386
  decreases(MLDSA_K - i)
384
387
  )
385
388
  {
386
- mld_poly_decompose(&v1->vec[i], &v0->vec[i]);
389
+ mld_poly_decompose(scratch, &v0->vec[i]);
390
+ mld_polyw1_pack(&r[i * MLDSA_POLYW1_PACKEDBYTES], scratch);
387
391
  }
388
392
 
389
- mld_assert_bound_2d(v1->vec, MLDSA_K, MLDSA_N, 0,
390
- (MLDSA_Q - 1) / (2 * MLDSA_GAMMA2));
391
393
  mld_assert_abs_bound_2d(v0->vec, MLDSA_K, MLDSA_N, MLDSA_GAMMA2 + 1);
392
394
  }
393
395
  #endif /* !MLD_CONFIG_NO_SIGN_API */
394
396
 
395
- #if !defined(MLD_CONFIG_NO_SIGN_API)
396
- MLD_INTERNAL_API
397
- void mld_polyveck_pack_w1(uint8_t r[MLDSA_K * MLDSA_POLYW1_PACKEDBYTES],
398
- const mld_polyveck *w1)
399
- {
400
- unsigned int i;
401
- mld_assert_bound_2d(w1->vec, MLDSA_K, MLDSA_N, 0,
402
- (MLDSA_Q - 1) / (2 * MLDSA_GAMMA2));
403
-
404
- for (i = 0; i < MLDSA_K; ++i)
405
- __loop__(
406
- assigns(i, memory_slice(r, MLDSA_K * MLDSA_POLYW1_PACKEDBYTES))
407
- invariant(i <= MLDSA_K)
408
- decreases(MLDSA_K - i)
409
- )
410
- {
411
- mld_polyw1_pack(&r[i * MLDSA_POLYW1_PACKEDBYTES], &w1->vec[i]);
412
- }
413
- }
414
- #endif /* !MLD_CONFIG_NO_SIGN_API */
415
-
416
- #if !defined(MLD_CONFIG_NO_KEYPAIR_API)
417
- MLD_INTERNAL_API
418
- void mld_polyveck_pack_eta(uint8_t r[MLDSA_K * MLDSA_POLYETA_PACKEDBYTES],
419
- const mld_polyveck *p)
420
- {
421
- unsigned int i;
422
- mld_assert_abs_bound_2d(p->vec, MLDSA_K, MLDSA_N, MLDSA_ETA + 1);
423
- for (i = 0; i < MLDSA_K; ++i)
424
- __loop__(
425
- assigns(i, memory_slice(r, MLDSA_K * MLDSA_POLYETA_PACKEDBYTES))
426
- invariant(i <= MLDSA_K)
427
- decreases(MLDSA_K - i)
428
- )
429
- {
430
- mld_polyeta_pack(&r[i * MLDSA_POLYETA_PACKEDBYTES], &p->vec[i]);
431
- }
432
- }
433
-
434
- MLD_INTERNAL_API
435
- void mld_polyvecl_pack_eta(uint8_t r[MLDSA_L * MLDSA_POLYETA_PACKEDBYTES],
436
- const mld_polyvecl *p)
437
- {
438
- unsigned int i;
439
- mld_assert_abs_bound_2d(p->vec, MLDSA_L, MLDSA_N, MLDSA_ETA + 1);
440
- for (i = 0; i < MLDSA_L; ++i)
441
- __loop__(
442
- assigns(i, memory_slice(r, MLDSA_L * MLDSA_POLYETA_PACKEDBYTES))
443
- invariant(i <= MLDSA_L)
444
- decreases(MLDSA_L - i)
445
- )
446
- {
447
- mld_polyeta_pack(&r[i * MLDSA_POLYETA_PACKEDBYTES], &p->vec[i]);
448
- }
449
- }
450
-
451
- #endif /* !MLD_CONFIG_NO_KEYPAIR_API */
452
-
453
- #if !defined(MLD_CONFIG_NO_KEYPAIR_API) || \
454
- (!defined(MLD_CONFIG_NO_SIGN_API) && \
397
+ #if (!defined(MLD_CONFIG_NO_KEYPAIR_API) && \
398
+ !defined(MLD_CONFIG_CORE_API_ONLY)) || \
399
+ ((!defined(MLD_CONFIG_NO_KEYPAIR_API) || \
400
+ !defined(MLD_CONFIG_NO_SIGN_API)) && \
455
401
  (!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)))
456
402
  MLD_INTERNAL_API
457
403
  void mld_polyvecl_unpack_eta(
458
404
  mld_polyvecl *p, const uint8_t r[MLDSA_L * MLDSA_POLYETA_PACKEDBYTES])
459
405
  {
460
406
  unsigned int i;
461
- for (i = 0; i < MLDSA_L; ++i)
407
+ for (i = 0; i < MLDSA_L; i++)
462
408
  {
463
409
  mld_polyeta_unpack(&p->vec[i], r + i * MLDSA_POLYETA_PACKEDBYTES);
464
410
  }
@@ -466,7 +412,8 @@ void mld_polyvecl_unpack_eta(
466
412
  mld_assert_bound_2d(p->vec, MLDSA_L, MLDSA_N, MLD_POLYETA_UNPACK_LOWER_BOUND,
467
413
  MLDSA_ETA + 1);
468
414
  }
469
- #endif /* !MLD_CONFIG_NO_KEYPAIR_API || (!MLD_CONFIG_NO_SIGN_API && \
415
+ #endif /* (!MLD_CONFIG_NO_KEYPAIR_API && !MLD_CONFIG_CORE_API_ONLY) || \
416
+ ((!MLD_CONFIG_NO_KEYPAIR_API || !MLD_CONFIG_NO_SIGN_API) && \
470
417
  (!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST)) */
471
418
 
472
419
  #if !defined(MLD_CONFIG_NO_VERIFY_API)
@@ -475,7 +422,7 @@ void mld_polyvecl_unpack_z(mld_polyvecl *z,
475
422
  const uint8_t r[MLDSA_L * MLDSA_POLYZ_PACKEDBYTES])
476
423
  {
477
424
  unsigned int i;
478
- for (i = 0; i < MLDSA_L; ++i)
425
+ for (i = 0; i < MLDSA_L; i++)
479
426
  {
480
427
  mld_polyz_unpack(&z->vec[i], r + i * MLDSA_POLYZ_PACKEDBYTES);
481
428
  }
@@ -485,15 +432,15 @@ void mld_polyvecl_unpack_z(mld_polyvecl *z,
485
432
  }
486
433
  #endif /* !MLD_CONFIG_NO_VERIFY_API */
487
434
 
488
- #if !defined(MLD_CONFIG_NO_KEYPAIR_API) || \
489
- (!defined(MLD_CONFIG_NO_SIGN_API) && \
490
- (!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)))
435
+ #if (!defined(MLD_CONFIG_NO_KEYPAIR_API) || !defined(MLD_CONFIG_NO_SIGN_API)) && \
436
+ (!defined(MLD_CONFIG_NO_SIGN_API) || defined(MLD_UNIT_TEST)) && \
437
+ (!defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST))
491
438
  MLD_INTERNAL_API
492
439
  void mld_polyveck_unpack_eta(
493
440
  mld_polyveck *p, const uint8_t r[MLDSA_K * MLDSA_POLYETA_PACKEDBYTES])
494
441
  {
495
442
  unsigned int i;
496
- for (i = 0; i < MLDSA_K; ++i)
443
+ for (i = 0; i < MLDSA_K; i++)
497
444
  {
498
445
  mld_polyeta_unpack(&p->vec[i], r + i * MLDSA_POLYETA_PACKEDBYTES);
499
446
  }
@@ -501,8 +448,9 @@ void mld_polyveck_unpack_eta(
501
448
  mld_assert_bound_2d(p->vec, MLDSA_K, MLDSA_N, MLD_POLYETA_UNPACK_LOWER_BOUND,
502
449
  MLDSA_ETA + 1);
503
450
  }
504
- #endif /* !MLD_CONFIG_NO_KEYPAIR_API || (!MLD_CONFIG_NO_SIGN_API && \
505
- (!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST)) */
451
+ #endif /* (!MLD_CONFIG_NO_KEYPAIR_API || !MLD_CONFIG_NO_SIGN_API) && \
452
+ (!MLD_CONFIG_NO_SIGN_API || MLD_UNIT_TEST) && \
453
+ (!MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST) */
506
454
 
507
455
  /* To facilitate single-compilation-unit (SCU) builds, undefine all macros.
508
456
  * Don't modify by hand -- this is auto-generated by scripts/autogen. */