pq_crypto 0.4.2 → 0.5.0

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 (408) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +25 -0
  3. data/GET_STARTED.md +21 -16
  4. data/README.md +26 -0
  5. data/SECURITY.md +22 -16
  6. data/ext/pqcrypto/extconf.rb +148 -99
  7. data/ext/pqcrypto/mldsa_api.h +1 -118
  8. data/ext/pqcrypto/mlkem_api.h +1 -42
  9. data/ext/pqcrypto/pq_externalmu.c +88 -216
  10. data/ext/pqcrypto/pqcrypto_native_api.h +129 -0
  11. data/ext/pqcrypto/pqcrypto_ruby_secure.c +0 -3
  12. data/ext/pqcrypto/pqcrypto_secure.c +135 -117
  13. data/ext/pqcrypto/pqcrypto_secure.h +1 -42
  14. data/ext/pqcrypto/pqcrypto_version.h +1 -1
  15. data/ext/pqcrypto/randombytes.h +9 -0
  16. data/ext/pqcrypto/vendor/.vendored +10 -5
  17. data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +105 -0
  18. data/ext/pqcrypto/vendor/mldsa-native/LICENSE +286 -0
  19. data/ext/pqcrypto/vendor/mldsa-native/META.yml +24 -0
  20. data/ext/pqcrypto/vendor/mldsa-native/README.md +221 -0
  21. data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +8 -0
  22. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +721 -0
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +975 -0
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +724 -0
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +723 -0
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +166 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +321 -0
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c +21 -0
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +385 -0
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +73 -0
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +130 -0
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +277 -0
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +244 -0
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +182 -0
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +117 -0
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +438 -0
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +105 -0
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +71 -0
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +62 -0
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +376 -0
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +204 -0
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +259 -0
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1077 -0
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +987 -0
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +41 -0
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +26 -0
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +35 -0
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +37 -0
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +27 -0
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +36 -0
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +69 -0
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +32 -0
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +20 -0
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +638 -0
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +136 -0
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +52 -0
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +29 -0
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +488 -0
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +16 -0
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/xkcp.h +31 -0
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +247 -0
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +231 -0
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +150 -0
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +753 -0
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +129 -0
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +145 -0
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +177 -0
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +653 -0
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +79 -0
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +53 -0
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +55 -0
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +85 -0
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +85 -0
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +102 -0
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +110 -0
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +72 -0
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +69 -0
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +40 -0
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +189 -0
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +135 -0
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +128 -0
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +543 -0
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +62 -0
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +649 -0
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +23 -0
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +315 -0
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +124 -0
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +2311 -0
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +2383 -0
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +239 -0
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +131 -0
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +139 -0
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +155 -0
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +187 -0
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +61 -0
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +52 -0
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +155 -0
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +155 -0
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +102 -0
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +104 -0
  104. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +91 -0
  105. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +93 -0
  106. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +126 -0
  107. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +155 -0
  108. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +139 -0
  109. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +160 -0
  110. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +293 -0
  111. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +224 -0
  112. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +77 -0
  113. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +991 -0
  114. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +393 -0
  115. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +946 -0
  116. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +360 -0
  117. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +877 -0
  118. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +725 -0
  119. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
  120. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +139 -0
  121. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +249 -0
  122. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +1511 -0
  123. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +806 -0
  124. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
  125. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +268 -0
  126. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
  127. data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +104 -0
  128. data/ext/pqcrypto/vendor/mlkem-native/LICENSE +294 -0
  129. data/ext/pqcrypto/vendor/mlkem-native/META.yml +30 -0
  130. data/ext/pqcrypto/vendor/mlkem-native/README.md +223 -0
  131. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +86 -0
  132. data/ext/pqcrypto/vendor/mlkem-native/SECURITY.md +8 -0
  133. data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +23 -0
  134. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +660 -0
  135. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +538 -0
  136. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +681 -0
  137. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +709 -0
  138. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +174 -0
  139. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +274 -0
  140. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +717 -0
  141. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +688 -0
  142. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +64 -0
  143. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +128 -0
  144. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +251 -0
  145. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +158 -0
  146. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +208 -0
  147. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +80 -0
  148. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +463 -0
  149. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +98 -0
  150. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +70 -0
  151. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
  152. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +375 -0
  153. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +203 -0
  154. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +258 -0
  155. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1076 -0
  156. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +986 -0
  157. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +46 -0
  158. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +25 -0
  159. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +34 -0
  160. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +35 -0
  161. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +26 -0
  162. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +35 -0
  163. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +117 -0
  164. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/README.md +10 -0
  165. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +79 -0
  166. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +35 -0
  167. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +667 -0
  168. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +40 -0
  169. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +51 -0
  170. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +290 -0
  171. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +314 -0
  172. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +28 -0
  173. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +33 -0
  174. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +41 -0
  175. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2.S +451 -0
  176. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +51 -0
  177. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +622 -0
  178. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +156 -0
  179. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +446 -0
  180. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +326 -0
  181. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/README.md +16 -0
  182. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +122 -0
  183. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +174 -0
  184. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +177 -0
  185. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/intt.S +628 -0
  186. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/ntt.S +562 -0
  187. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_mulcache_compute_asm.S +127 -0
  188. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_reduce_asm.S +150 -0
  189. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tobytes_asm.S +117 -0
  190. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tomont_asm.S +98 -0
  191. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +261 -0
  192. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +314 -0
  193. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +368 -0
  194. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_asm.S +226 -0
  195. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +542 -0
  196. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +637 -0
  197. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +25 -0
  198. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md +11 -0
  199. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +128 -0
  200. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +45 -0
  201. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +81 -0
  202. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +145 -0
  203. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_izetas.inc +27 -0
  204. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +805 -0
  205. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas.inc +27 -0
  206. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas_basemul.inc +39 -0
  207. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/README.md +4 -0
  208. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +304 -0
  209. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +309 -0
  210. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +94 -0
  211. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +45 -0
  212. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +102 -0
  213. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +25 -0
  214. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/intt.S +719 -0
  215. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mulcache_compute.S +90 -0
  216. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntt.S +639 -0
  217. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttfrombytes.S +193 -0
  218. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntttobytes.S +181 -0
  219. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttunpack.S +174 -0
  220. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d10.S +382 -0
  221. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d11.S +448 -0
  222. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d4.S +163 -0
  223. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d5.S +220 -0
  224. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d10.S +228 -0
  225. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d11.S +277 -0
  226. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d4.S +180 -0
  227. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d5.S +192 -0
  228. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +502 -0
  229. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +750 -0
  230. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +998 -0
  231. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/reduce.S +218 -0
  232. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_asm.S +103 -0
  233. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +544 -0
  234. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont.S +155 -0
  235. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h +76 -0
  236. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +572 -0
  237. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +317 -0
  238. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +502 -0
  239. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +668 -0
  240. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +60 -0
  241. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +362 -0
  242. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +118 -0
  243. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/symmetric.h +70 -0
  244. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +260 -0
  245. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.c +20 -0
  246. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +464 -0
  247. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/zetas.inc +30 -0
  248. data/lib/pq_crypto/version.rb +1 -1
  249. data/lib/pq_crypto.rb +1 -1
  250. data/script/vendor_libs.rb +88 -159
  251. metadata +236 -160
  252. data/ext/pqcrypto/vendor/pqclean/common/aes.c +0 -639
  253. data/ext/pqcrypto/vendor/pqclean/common/aes.h +0 -64
  254. data/ext/pqcrypto/vendor/pqclean/common/compat.h +0 -73
  255. data/ext/pqcrypto/vendor/pqclean/common/crypto_declassify.h +0 -7
  256. data/ext/pqcrypto/vendor/pqclean/common/fips202.c +0 -928
  257. data/ext/pqcrypto/vendor/pqclean/common/fips202.h +0 -166
  258. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/feat.S +0 -168
  259. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.c +0 -684
  260. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.h +0 -60
  261. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SIMD256.c +0 -1028
  262. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SnP.h +0 -50
  263. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-unrolling.macros +0 -198
  264. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile +0 -8
  265. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile.Microsoft_nmake +0 -8
  266. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/SIMD256-config.h +0 -3
  267. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/align.h +0 -34
  268. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/brg_endian.h +0 -142
  269. data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.c +0 -101
  270. data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.h +0 -39
  271. data/ext/pqcrypto/vendor/pqclean/common/randombytes.c +0 -355
  272. data/ext/pqcrypto/vendor/pqclean/common/randombytes.h +0 -27
  273. data/ext/pqcrypto/vendor/pqclean/common/sha2.c +0 -769
  274. data/ext/pqcrypto/vendor/pqclean/common/sha2.h +0 -173
  275. data/ext/pqcrypto/vendor/pqclean/common/sp800-185.c +0 -156
  276. data/ext/pqcrypto/vendor/pqclean/common/sp800-185.h +0 -27
  277. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/LICENSE +0 -5
  278. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile +0 -19
  279. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile.Microsoft_nmake +0 -23
  280. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/api.h +0 -18
  281. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.c +0 -83
  282. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.h +0 -11
  283. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.c +0 -327
  284. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.h +0 -22
  285. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.c +0 -164
  286. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.h +0 -23
  287. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.c +0 -146
  288. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.h +0 -14
  289. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/params.h +0 -36
  290. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.c +0 -311
  291. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.h +0 -37
  292. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.c +0 -198
  293. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.h +0 -26
  294. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.c +0 -41
  295. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.h +0 -13
  296. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric-shake.c +0 -71
  297. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric.h +0 -30
  298. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.c +0 -67
  299. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.h +0 -13
  300. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/LICENSE +0 -5
  301. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile +0 -19
  302. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile.Microsoft_nmake +0 -23
  303. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/api.h +0 -18
  304. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.c +0 -108
  305. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.h +0 -11
  306. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.c +0 -327
  307. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.h +0 -22
  308. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.c +0 -164
  309. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.h +0 -23
  310. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.c +0 -146
  311. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.h +0 -14
  312. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/params.h +0 -36
  313. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.c +0 -299
  314. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.h +0 -37
  315. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.c +0 -188
  316. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.h +0 -26
  317. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.c +0 -41
  318. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.h +0 -13
  319. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric-shake.c +0 -71
  320. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric.h +0 -30
  321. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.c +0 -67
  322. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.h +0 -13
  323. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/LICENSE +0 -5
  324. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile +0 -19
  325. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile.Microsoft_nmake +0 -23
  326. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/api.h +0 -18
  327. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.c +0 -83
  328. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.h +0 -11
  329. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.c +0 -327
  330. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.h +0 -22
  331. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.c +0 -164
  332. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.h +0 -23
  333. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.c +0 -146
  334. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.h +0 -14
  335. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/params.h +0 -36
  336. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.c +0 -299
  337. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.h +0 -37
  338. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.c +0 -188
  339. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.h +0 -26
  340. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.c +0 -41
  341. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.h +0 -13
  342. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric-shake.c +0 -71
  343. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric.h +0 -30
  344. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.c +0 -67
  345. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.h +0 -13
  346. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/LICENSE +0 -5
  347. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile +0 -19
  348. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile.Microsoft_nmake +0 -23
  349. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/api.h +0 -50
  350. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.c +0 -98
  351. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.h +0 -10
  352. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.c +0 -261
  353. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.h +0 -31
  354. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/params.h +0 -44
  355. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.c +0 -848
  356. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.h +0 -52
  357. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.c +0 -415
  358. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.h +0 -65
  359. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.c +0 -69
  360. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.h +0 -17
  361. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.c +0 -98
  362. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.h +0 -14
  363. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.c +0 -407
  364. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.h +0 -47
  365. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric-shake.c +0 -26
  366. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric.h +0 -34
  367. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/LICENSE +0 -5
  368. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile +0 -19
  369. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile.Microsoft_nmake +0 -23
  370. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/api.h +0 -50
  371. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.c +0 -98
  372. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.h +0 -10
  373. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.c +0 -261
  374. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.h +0 -31
  375. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/params.h +0 -44
  376. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.c +0 -799
  377. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.h +0 -52
  378. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.c +0 -415
  379. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.h +0 -65
  380. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.c +0 -69
  381. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.h +0 -17
  382. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.c +0 -92
  383. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.h +0 -14
  384. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.c +0 -407
  385. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.h +0 -47
  386. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric-shake.c +0 -26
  387. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric.h +0 -34
  388. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/LICENSE +0 -5
  389. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile +0 -19
  390. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile.Microsoft_nmake +0 -23
  391. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/api.h +0 -50
  392. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.c +0 -98
  393. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.h +0 -10
  394. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.c +0 -261
  395. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.h +0 -31
  396. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/params.h +0 -44
  397. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.c +0 -823
  398. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.h +0 -52
  399. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.c +0 -415
  400. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.h +0 -65
  401. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.c +0 -69
  402. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.h +0 -17
  403. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.c +0 -92
  404. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.h +0 -14
  405. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.c +0 -407
  406. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.h +0 -47
  407. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric-shake.c +0 -26
  408. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric.h +0 -34
@@ -1255,9 +1255,6 @@ static VALUE pqcrypto__native_mldsa_mu_builder_finalize(VALUE self, VALUE builde
1255
1255
 
1256
1256
  rb_nogvl(pq_mu_finalize_nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
1257
1257
 
1258
- if (call.result != PQ_SUCCESS) {
1259
- pq_mu_builder_release(wrapper->builder);
1260
- }
1261
1258
  wrapper->builder = NULL;
1262
1259
 
1263
1260
  if (call.result != PQ_SUCCESS) {
@@ -22,12 +22,7 @@
22
22
  #error "OpenSSL 3.0 or later is required for pq_crypto"
23
23
  #endif
24
24
 
25
- #ifndef HAVE_PQCLEAN
26
- #error "PQClean-backed algorithms are required. Run: bundle exec rake vendor"
27
- #endif
28
-
29
- #include "mlkem_api.h"
30
- #include "mldsa_api.h"
25
+ #include "pqcrypto_native_api.h"
31
26
 
32
27
  void pq_secure_wipe(void *ptr, size_t len) {
33
28
  if (ptr == NULL) {
@@ -223,8 +218,7 @@ static int xwing_expand_secret_key(hybrid_expanded_secret_key_t *expanded_key,
223
218
  if (EVP_DigestFinalXOF(ctx, expanded, sizeof(expanded)) != 1)
224
219
  goto cleanup;
225
220
 
226
- ret = PQCLEAN_MLKEM768_CLEAN_crypto_kem_keypair_derand(expanded_key->mlkem_pk,
227
- expanded_key->mlkem_sk, expanded);
221
+ ret = pqcr_mlkem768_keypair_derand(expanded_key->mlkem_pk, expanded_key->mlkem_sk, expanded);
228
222
  if (ret != 0) {
229
223
  ret = PQ_ERROR_KEYPAIR;
230
224
  goto cleanup;
@@ -248,31 +242,36 @@ cleanup:
248
242
  return ret;
249
243
  }
250
244
 
251
- #define PQ_MLKEM_VARIANTS(X) \
252
- X(mlkem, MLKEM768_CLEAN) \
253
- X(mlkem512, MLKEM512_CLEAN) \
254
- X(mlkem1024, MLKEM1024_CLEAN)
255
-
256
- #define PQ_DEFINE_MLKEM_SHIMS(prefix, pqclean) \
257
- int pq_##prefix##_keypair(uint8_t *pk, uint8_t *sk) { \
258
- return PQCLEAN_##pqclean##_crypto_kem_keypair(pk, sk) == 0 ? PQ_SUCCESS \
259
- : PQ_ERROR_KEYPAIR; \
260
- } \
261
- int pq_##prefix##_keypair_from_seed(uint8_t *pk, uint8_t *sk, const uint8_t *seed64) { \
262
- if (!pk || !sk || !seed64) { \
263
- return PQ_ERROR_BUFFER; \
264
- } \
265
- return PQCLEAN_##pqclean##_crypto_kem_keypair_derand(pk, sk, seed64) == 0 \
266
- ? PQ_SUCCESS \
267
- : PQ_ERROR_KEYPAIR; \
268
- } \
269
- int pq_##prefix##_encapsulate(uint8_t *ct, uint8_t *ss, const uint8_t *pk) { \
270
- return PQCLEAN_##pqclean##_crypto_kem_enc(ct, ss, pk) == 0 ? PQ_SUCCESS \
271
- : PQ_ERROR_ENCAPSULATE; \
272
- } \
273
- int pq_##prefix##_decapsulate(uint8_t *ss, const uint8_t *ct, const uint8_t *sk) { \
274
- return PQCLEAN_##pqclean##_crypto_kem_dec(ss, ct, sk) == 0 ? PQ_SUCCESS \
275
- : PQ_ERROR_DECAPSULATE; \
245
+ #define PQ_MLKEM_VARIANTS(X) \
246
+ X(mlkem, pqcr_mlkem768) \
247
+ X(mlkem512, pqcr_mlkem512) \
248
+ X(mlkem1024, pqcr_mlkem1024)
249
+
250
+ #define PQ_DEFINE_MLKEM_SHIMS(prefix, native) \
251
+ int pq_##prefix##_keypair(uint8_t *pk, uint8_t *sk) { \
252
+ if (!pk || !sk) { \
253
+ return PQ_ERROR_BUFFER; \
254
+ } \
255
+ return native##_keypair(pk, sk) == 0 ? PQ_SUCCESS : PQ_ERROR_KEYPAIR; \
256
+ } \
257
+ int pq_##prefix##_keypair_from_seed(uint8_t *pk, uint8_t *sk, const uint8_t *seed64) {\
258
+ if (!pk || !sk || !seed64) { \
259
+ return PQ_ERROR_BUFFER; \
260
+ } \
261
+ return native##_keypair_derand(pk, sk, seed64) == 0 ? PQ_SUCCESS \
262
+ : PQ_ERROR_KEYPAIR; \
263
+ } \
264
+ int pq_##prefix##_encapsulate(uint8_t *ct, uint8_t *ss, const uint8_t *pk) { \
265
+ if (!ct || !ss || !pk) { \
266
+ return PQ_ERROR_BUFFER; \
267
+ } \
268
+ return native##_enc(ct, ss, pk) == 0 ? PQ_SUCCESS : PQ_ERROR_ENCAPSULATE; \
269
+ } \
270
+ int pq_##prefix##_decapsulate(uint8_t *ss, const uint8_t *ct, const uint8_t *sk) { \
271
+ if (!ss || !ct || !sk) { \
272
+ return PQ_ERROR_BUFFER; \
273
+ } \
274
+ return native##_dec(ss, ct, sk) == 0 ? PQ_SUCCESS : PQ_ERROR_DECAPSULATE; \
276
275
  }
277
276
 
278
277
  PQ_MLKEM_VARIANTS(PQ_DEFINE_MLKEM_SHIMS)
@@ -299,136 +298,152 @@ static int pq_testing_mlkem_encapsulate_from_seed_with(
299
298
  : PQ_ERROR_ENCAPSULATE;
300
299
  }
301
300
 
302
- #define PQ_DEFINE_MLKEM_TESTING_SHIMS(prefix, pqclean) \
303
- int pq_testing_##prefix##_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, \
304
- const uint8_t *seed, size_t seed_len) { \
305
- return pq_testing_mlkem_keypair_from_seed_with( \
306
- public_key, secret_key, seed, seed_len, \
307
- PQCLEAN_##pqclean##_crypto_kem_keypair_derand); \
308
- } \
309
- int pq_testing_##prefix##_encapsulate_from_seed(uint8_t *ciphertext, uint8_t *shared_secret, \
310
- const uint8_t *public_key, \
311
- const uint8_t *seed, size_t seed_len) { \
312
- return pq_testing_mlkem_encapsulate_from_seed_with( \
313
- ciphertext, shared_secret, public_key, seed, seed_len, \
314
- PQCLEAN_##pqclean##_crypto_kem_enc_derand); \
301
+ #define PQ_DEFINE_MLKEM_TESTING_SHIMS(prefix, native) \
302
+ int pq_testing_##prefix##_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, \
303
+ const uint8_t *seed, size_t seed_len) { \
304
+ return pq_testing_mlkem_keypair_from_seed_with(public_key, secret_key, seed, seed_len, \
305
+ native##_keypair_derand); \
306
+ } \
307
+ int pq_testing_##prefix##_encapsulate_from_seed(uint8_t *ciphertext, uint8_t *shared_secret,\
308
+ const uint8_t *public_key, \
309
+ const uint8_t *seed, size_t seed_len) { \
310
+ return pq_testing_mlkem_encapsulate_from_seed_with(ciphertext, shared_secret, public_key,\
311
+ seed, seed_len, native##_enc_derand);\
315
312
  }
316
313
 
317
314
  PQ_MLKEM_VARIANTS(PQ_DEFINE_MLKEM_TESTING_SHIMS)
318
315
 
319
316
  #undef PQ_DEFINE_MLKEM_TESTING_SHIMS
320
317
 
321
- #define PQ_DEFINE_MLDSA_SIGN_KEYPAIR(prefix, pqclean) \
322
- int pq_##prefix##_keypair(uint8_t *public_key, uint8_t *secret_key) { \
323
- return PQCLEAN_##pqclean##_crypto_sign_keypair(public_key, secret_key) == 0 \
324
- ? PQ_SUCCESS \
325
- : PQ_ERROR_KEYPAIR; \
318
+ #define PQ_DEFINE_MLDSA_SIGN_KEYPAIR(prefix, native) \
319
+ int pq_##prefix##_keypair(uint8_t *public_key, uint8_t *secret_key) { \
320
+ if (!public_key || !secret_key) { \
321
+ return PQ_ERROR_BUFFER; \
322
+ } \
323
+ return native##_keypair(public_key, secret_key) == 0 ? PQ_SUCCESS \
324
+ : PQ_ERROR_KEYPAIR; \
326
325
  }
327
326
 
328
- PQ_DEFINE_MLDSA_SIGN_KEYPAIR(sign, MLDSA65_CLEAN)
329
- PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa44_sign, MLDSA44_CLEAN)
330
- PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa87_sign, MLDSA87_CLEAN)
327
+ PQ_DEFINE_MLDSA_SIGN_KEYPAIR(sign, pqcr_mldsa65)
328
+ PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa44_sign, pqcr_mldsa44)
329
+ PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa87_sign, pqcr_mldsa87)
331
330
 
332
331
  #undef PQ_DEFINE_MLDSA_SIGN_KEYPAIR
333
332
 
334
- #define PQ_DEFINE_MLDSA_SIGN(name, pqclean) \
335
- int pq_##name(uint8_t *signature, size_t *signature_len, const uint8_t *message, \
336
- size_t message_len, const uint8_t *secret_key) { \
337
- return PQCLEAN_##pqclean##_crypto_sign_signature(signature, signature_len, message, \
338
- message_len, secret_key) == 0 \
339
- ? PQ_SUCCESS \
340
- : PQ_ERROR_SIGN; \
333
+ #define PQ_DEFINE_MLDSA_SIGN(name, native) \
334
+ int pq_##name(uint8_t *signature, size_t *signature_len, const uint8_t *message, \
335
+ size_t message_len, const uint8_t *secret_key) { \
336
+ if (!signature || !signature_len || !secret_key || (message_len > 0 && !message)) {\
337
+ return PQ_ERROR_BUFFER; \
338
+ } \
339
+ return native##_signature(signature, signature_len, message, message_len, NULL, 0,\
340
+ secret_key) == 0 \
341
+ ? PQ_SUCCESS \
342
+ : PQ_ERROR_SIGN; \
341
343
  }
342
344
 
343
- PQ_DEFINE_MLDSA_SIGN(sign, MLDSA65_CLEAN)
344
- PQ_DEFINE_MLDSA_SIGN(mldsa44_sign, MLDSA44_CLEAN)
345
- PQ_DEFINE_MLDSA_SIGN(mldsa87_sign, MLDSA87_CLEAN)
345
+ PQ_DEFINE_MLDSA_SIGN(sign, pqcr_mldsa65)
346
+ PQ_DEFINE_MLDSA_SIGN(mldsa44_sign, pqcr_mldsa44)
347
+ PQ_DEFINE_MLDSA_SIGN(mldsa87_sign, pqcr_mldsa87)
346
348
 
347
349
  #undef PQ_DEFINE_MLDSA_SIGN
348
350
 
349
- #define PQ_DEFINE_MLDSA_VERIFY(name, pqclean) \
351
+ #define PQ_DEFINE_MLDSA_VERIFY(name, native) \
350
352
  int pq_##name(const uint8_t *signature, size_t signature_len, const uint8_t *message, \
351
- size_t message_len, const uint8_t *public_key) { \
352
- return PQCLEAN_##pqclean##_crypto_sign_verify(signature, signature_len, message, \
353
- message_len, public_key) == 0 \
353
+ size_t message_len, const uint8_t *public_key) { \
354
+ if (!signature || !public_key || (message_len > 0 && !message)) { \
355
+ return PQ_ERROR_BUFFER; \
356
+ } \
357
+ return native##_verify(signature, signature_len, message, message_len, NULL, 0, \
358
+ public_key) == 0 \
354
359
  ? PQ_SUCCESS \
355
360
  : PQ_ERROR_VERIFY; \
356
361
  }
357
362
 
358
- PQ_DEFINE_MLDSA_VERIFY(verify, MLDSA65_CLEAN)
359
- PQ_DEFINE_MLDSA_VERIFY(mldsa44_verify, MLDSA44_CLEAN)
360
- PQ_DEFINE_MLDSA_VERIFY(mldsa87_verify, MLDSA87_CLEAN)
363
+ PQ_DEFINE_MLDSA_VERIFY(verify, pqcr_mldsa65)
364
+ PQ_DEFINE_MLDSA_VERIFY(mldsa44_verify, pqcr_mldsa44)
365
+ PQ_DEFINE_MLDSA_VERIFY(mldsa87_verify, pqcr_mldsa87)
361
366
 
362
367
  #undef PQ_DEFINE_MLDSA_VERIFY
363
368
 
364
- static int pq_testing_mldsa_keypair_from_seed_with(uint8_t *public_key, uint8_t *secret_key,
365
- const uint8_t *seed, size_t seed_len,
366
- int (*keypair)(uint8_t *, uint8_t *)) {
367
- int rc;
368
- if (!public_key || !secret_key || !seed || seed_len != 32 || !keypair) {
369
- return PQ_ERROR_BUFFER;
370
- }
371
-
372
- pq_testing_set_seed(seed, seed_len);
373
- rc = keypair(public_key, secret_key);
374
- pq_testing_clear_seed();
375
- return rc == 0 ? PQ_SUCCESS : PQ_ERROR_KEYPAIR;
376
- }
377
-
378
369
  static int pq_testing_mldsa_sign_from_seed_with(
379
370
  uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len,
380
371
  const uint8_t *secret_key, const uint8_t *seed, size_t seed_len,
381
- int (*sign)(uint8_t *, size_t *, const uint8_t *, size_t, const uint8_t *)) {
382
- int rc;
383
- if (!signature || !signature_len || !secret_key || !seed || seed_len != 32 || !sign) {
372
+ int (*signature_internal)(uint8_t *, size_t *, const uint8_t *, size_t, const uint8_t *, size_t,
373
+ const uint8_t *, const uint8_t *, int),
374
+ size_t (*prepare_prefix)(uint8_t *, const uint8_t *, size_t, const uint8_t *, size_t, int)) {
375
+ uint8_t pre[MLDSA_DOMAIN_SEPARATION_MAX_BYTES];
376
+ size_t pre_len;
377
+
378
+ if (!signature || !signature_len || !secret_key || !seed || seed_len != MLDSA_RNDBYTES ||
379
+ !signature_internal || !prepare_prefix || (message_len > 0 && !message)) {
384
380
  return PQ_ERROR_BUFFER;
385
381
  }
386
382
 
387
- pq_testing_set_seed(seed, seed_len);
388
- rc = sign(signature, signature_len, message, message_len, secret_key);
389
- pq_testing_clear_seed();
390
- return rc == 0 ? PQ_SUCCESS : PQ_ERROR_SIGN;
383
+ /*
384
+ * mldsa-native's signature_internal is lower-level than the public pure
385
+ * ML-DSA signing API. It expects the FIPS 204 domain-separation prefix explicitly. Passing
386
+ * NULL/0 signs CRH(tr, message) instead of CRH(tr, 0x00 || ctxlen || ctx || message),
387
+ * which produces signatures that do not verify through the public pure-ML-DSA API
388
+ * and do not match ACVP/KAT sigGen vectors.
389
+ */
390
+ pre_len = prepare_prefix(pre, NULL, 0, NULL, 0, MLDSA_PREHASH_NONE);
391
+ if (pre_len == 0) {
392
+ return PQ_ERROR_SIGN;
393
+ }
394
+
395
+ return signature_internal(signature, signature_len, message, message_len, pre, pre_len, seed,
396
+ secret_key, 0) == 0
397
+ ? PQ_SUCCESS
398
+ : PQ_ERROR_SIGN;
391
399
  }
392
400
 
393
- /*
394
- * Production ML-DSA seed expansion for RFC 9881 seed-format PKCS#8 imports.
395
- *
396
- * PQClean does not expose a public crypto_sign_keypair_derand entrypoint for
397
- * ML-DSA. This deliberately reuses pq_crypto's thread-local seed-replay
398
- * randombytes() path, the same path covered by Patch 8 KATs, and is surfaced
399
- * only through the Ruby PKCS#8 opt-in gate.
400
- */
401
401
  int pq_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
402
- return pq_testing_mldsa_keypair_from_seed_with(public_key, secret_key, seed32, 32,
403
- PQCLEAN_MLDSA44_CLEAN_crypto_sign_keypair);
402
+ if (!public_key || !secret_key || !seed32) {
403
+ return PQ_ERROR_BUFFER;
404
+ }
405
+ return pqcr_mldsa44_keypair_internal(public_key, secret_key, seed32) == 0 ? PQ_SUCCESS
406
+ : PQ_ERROR_KEYPAIR;
404
407
  }
405
408
 
406
409
  int pq_mldsa_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
407
- return pq_testing_mldsa_keypair_from_seed_with(public_key, secret_key, seed32, 32,
408
- PQCLEAN_MLDSA65_CLEAN_crypto_sign_keypair);
410
+ if (!public_key || !secret_key || !seed32) {
411
+ return PQ_ERROR_BUFFER;
412
+ }
413
+ return pqcr_mldsa65_keypair_internal(public_key, secret_key, seed32) == 0 ? PQ_SUCCESS
414
+ : PQ_ERROR_KEYPAIR;
409
415
  }
410
416
 
411
417
  int pq_mldsa87_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
412
- return pq_testing_mldsa_keypair_from_seed_with(public_key, secret_key, seed32, 32,
413
- PQCLEAN_MLDSA87_CLEAN_crypto_sign_keypair);
418
+ if (!public_key || !secret_key || !seed32) {
419
+ return PQ_ERROR_BUFFER;
420
+ }
421
+ return pqcr_mldsa87_keypair_internal(public_key, secret_key, seed32) == 0 ? PQ_SUCCESS
422
+ : PQ_ERROR_KEYPAIR;
414
423
  }
415
424
 
416
425
  int pq_testing_mldsa_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
417
426
  const uint8_t *seed, size_t seed_len) {
418
- return pq_testing_mldsa_keypair_from_seed_with(public_key, secret_key, seed, seed_len,
419
- PQCLEAN_MLDSA65_CLEAN_crypto_sign_keypair);
427
+ if (seed_len != MLDSA_SEEDBYTES) {
428
+ return PQ_ERROR_BUFFER;
429
+ }
430
+ return pq_mldsa_keypair_from_seed(public_key, secret_key, seed);
420
431
  }
421
432
 
422
433
  int pq_testing_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
423
434
  const uint8_t *seed, size_t seed_len) {
424
- return pq_testing_mldsa_keypair_from_seed_with(public_key, secret_key, seed, seed_len,
425
- PQCLEAN_MLDSA44_CLEAN_crypto_sign_keypair);
435
+ if (seed_len != MLDSA_SEEDBYTES) {
436
+ return PQ_ERROR_BUFFER;
437
+ }
438
+ return pq_mldsa44_keypair_from_seed(public_key, secret_key, seed);
426
439
  }
427
440
 
428
441
  int pq_testing_mldsa87_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
429
442
  const uint8_t *seed, size_t seed_len) {
430
- return pq_testing_mldsa_keypair_from_seed_with(public_key, secret_key, seed, seed_len,
431
- PQCLEAN_MLDSA87_CLEAN_crypto_sign_keypair);
443
+ if (seed_len != MLDSA_SEEDBYTES) {
444
+ return PQ_ERROR_BUFFER;
445
+ }
446
+ return pq_mldsa87_keypair_from_seed(public_key, secret_key, seed);
432
447
  }
433
448
 
434
449
  int pq_testing_mldsa_sign_from_seed(uint8_t *signature, size_t *signature_len,
@@ -437,7 +452,8 @@ int pq_testing_mldsa_sign_from_seed(uint8_t *signature, size_t *signature_len,
437
452
  size_t seed_len) {
438
453
  return pq_testing_mldsa_sign_from_seed_with(signature, signature_len, message, message_len,
439
454
  secret_key, seed, seed_len,
440
- PQCLEAN_MLDSA65_CLEAN_crypto_sign_signature);
455
+ pqcr_mldsa65_signature_internal,
456
+ pqcr_mldsa65_prepare_domain_separation_prefix);
441
457
  }
442
458
 
443
459
  int pq_testing_mldsa44_sign_from_seed(uint8_t *signature, size_t *signature_len,
@@ -446,7 +462,8 @@ int pq_testing_mldsa44_sign_from_seed(uint8_t *signature, size_t *signature_len,
446
462
  size_t seed_len) {
447
463
  return pq_testing_mldsa_sign_from_seed_with(signature, signature_len, message, message_len,
448
464
  secret_key, seed, seed_len,
449
- PQCLEAN_MLDSA44_CLEAN_crypto_sign_signature);
465
+ pqcr_mldsa44_signature_internal,
466
+ pqcr_mldsa44_prepare_domain_separation_prefix);
450
467
  }
451
468
 
452
469
  int pq_testing_mldsa87_sign_from_seed(uint8_t *signature, size_t *signature_len,
@@ -455,7 +472,8 @@ int pq_testing_mldsa87_sign_from_seed(uint8_t *signature, size_t *signature_len,
455
472
  size_t seed_len) {
456
473
  return pq_testing_mldsa_sign_from_seed_with(signature, signature_len, message, message_len,
457
474
  secret_key, seed, seed_len,
458
- PQCLEAN_MLDSA87_CLEAN_crypto_sign_signature);
475
+ pqcr_mldsa87_signature_internal,
476
+ pqcr_mldsa87_prepare_domain_separation_prefix);
459
477
  }
460
478
 
461
479
  int pq_hybrid_kem_keypair(uint8_t *public_key, uint8_t *secret_key) {
@@ -512,7 +530,7 @@ int pq_hybrid_kem_encapsulate(uint8_t *ciphertext, uint8_t *shared_secret,
512
530
  memset(x25519_ss, 0, sizeof(x25519_ss));
513
531
  memset(x25519_ephemeral_sk, 0, sizeof(x25519_ephemeral_sk));
514
532
 
515
- if (PQCLEAN_MLKEM768_CLEAN_crypto_kem_enc(ct.mlkem_ct, mlkem_ss, pk.mlkem_pk) != 0) {
533
+ if (pqcr_mlkem768_enc(ct.mlkem_ct, mlkem_ss, pk.mlkem_pk) != 0) {
516
534
  ret = PQ_ERROR_ENCAPSULATE;
517
535
  goto cleanup;
518
536
  }
@@ -566,7 +584,7 @@ int pq_hybrid_kem_decapsulate(uint8_t *shared_secret, const uint8_t *ciphertext,
566
584
  goto cleanup;
567
585
  }
568
586
 
569
- if (PQCLEAN_MLKEM768_CLEAN_crypto_kem_dec(mlkem_ss, ct.mlkem_ct, expanded.mlkem_sk) != 0) {
587
+ if (pqcr_mlkem768_dec(mlkem_ss, ct.mlkem_ct, expanded.mlkem_sk) != 0) {
570
588
  ret = PQ_ERROR_DECAPSULATE;
571
589
  goto cleanup;
572
590
  }
@@ -5,48 +5,7 @@
5
5
  #include <stdlib.h>
6
6
  #include <string.h>
7
7
 
8
- #ifndef HAVE_PQCLEAN
9
- #error "PQClean sources are required to build pq_crypto. Run: bundle exec rake vendor"
10
- #endif
11
-
12
- #include "mlkem_api.h"
13
- #include "mldsa_api.h"
14
-
15
- #define MLKEM512_PUBLICKEYBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_PUBLICKEYBYTES
16
- #define MLKEM512_SECRETKEYBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_SECRETKEYBYTES
17
- #define MLKEM512_CIPHERTEXTBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_CIPHERTEXTBYTES
18
- #define MLKEM512_SHAREDSECRETBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_BYTES
19
-
20
- #define MLKEM768_PUBLICKEYBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_PUBLICKEYBYTES
21
- #define MLKEM768_SECRETKEYBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_SECRETKEYBYTES
22
- #define MLKEM768_CIPHERTEXTBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_CIPHERTEXTBYTES
23
- #define MLKEM768_SHAREDSECRETBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_BYTES
24
-
25
- #define MLKEM1024_PUBLICKEYBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_PUBLICKEYBYTES
26
- #define MLKEM1024_SECRETKEYBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_SECRETKEYBYTES
27
- #define MLKEM1024_CIPHERTEXTBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_CIPHERTEXTBYTES
28
- #define MLKEM1024_SHAREDSECRETBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_BYTES
29
-
30
- #define MLKEM_PUBLICKEYBYTES MLKEM768_PUBLICKEYBYTES
31
- #define MLKEM_SECRETKEYBYTES MLKEM768_SECRETKEYBYTES
32
- #define MLKEM_CIPHERTEXTBYTES MLKEM768_CIPHERTEXTBYTES
33
- #define MLKEM_SHAREDSECRETBYTES MLKEM768_SHAREDSECRETBYTES
34
-
35
- #define MLDSA44_PUBLICKEYBYTES PQCLEAN_MLDSA44_CLEAN_CRYPTO_PUBLICKEYBYTES
36
- #define MLDSA44_SECRETKEYBYTES PQCLEAN_MLDSA44_CLEAN_CRYPTO_SECRETKEYBYTES
37
- #define MLDSA44_BYTES PQCLEAN_MLDSA44_CLEAN_CRYPTO_BYTES
38
-
39
- #define MLDSA65_PUBLICKEYBYTES PQCLEAN_MLDSA65_CLEAN_CRYPTO_PUBLICKEYBYTES
40
- #define MLDSA65_SECRETKEYBYTES PQCLEAN_MLDSA65_CLEAN_CRYPTO_SECRETKEYBYTES
41
- #define MLDSA65_BYTES PQCLEAN_MLDSA65_CLEAN_CRYPTO_BYTES
42
-
43
- #define MLDSA87_PUBLICKEYBYTES PQCLEAN_MLDSA87_CLEAN_CRYPTO_PUBLICKEYBYTES
44
- #define MLDSA87_SECRETKEYBYTES PQCLEAN_MLDSA87_CLEAN_CRYPTO_SECRETKEYBYTES
45
- #define MLDSA87_BYTES PQCLEAN_MLDSA87_CLEAN_CRYPTO_BYTES
46
-
47
- #define MLDSA_PUBLICKEYBYTES MLDSA65_PUBLICKEYBYTES
48
- #define MLDSA_SECRETKEYBYTES MLDSA65_SECRETKEYBYTES
49
- #define MLDSA_BYTES MLDSA65_BYTES
8
+ #include "pqcrypto_native_api.h"
50
9
 
51
10
  #define X25519_PUBLICKEYBYTES 32
52
11
  #define X25519_SECRETKEYBYTES 32
@@ -2,6 +2,6 @@
2
2
  #ifndef PQCRYPTO_VERSION_H
3
3
  #define PQCRYPTO_VERSION_H
4
4
 
5
- #define PQCRYPTO_VERSION "0.4.2"
5
+ #define PQCRYPTO_VERSION "0.5.0"
6
6
 
7
7
  #endif
@@ -0,0 +1,9 @@
1
+ #ifndef PQCRYPTO_RANDOMBYTES_H
2
+ #define PQCRYPTO_RANDOMBYTES_H
3
+
4
+ #include <stddef.h>
5
+ #include <stdint.h>
6
+
7
+ int randombytes(uint8_t *output, size_t n);
8
+
9
+ #endif
@@ -1,5 +1,10 @@
1
- pqclean_version=2cc64716044832eea747234ddbffc06746ab815d
2
- pqclean_url=https://github.com/PQClean/PQClean/archive/2cc64716044832eea747234ddbffc06746ab815d.tar.gz
3
- pqclean_archive_sha256=0e92076a79082a8d220e27227f37b280fb2ce050af412babd2bc755ab37b871a
4
- pqclean_strip=PQClean-2cc64716044832eea747234ddbffc06746ab815d
5
- pqclean_tree_sha256=14a141198236603be48b637021edfd1fca9970cae41bcfd76a9e9aa18823eaad
1
+ backend=PQ Code Package native only
2
+ pqclean=removed
3
+ mlkem_native_repo=https://github.com/pq-code-package/mlkem-native.git
4
+ mlkem_native_ref=v1.1.0
5
+ mlkem_native_commit=d2cae2be522a67bfae26100fdb520576f1b2ef90
6
+ mlkem_native_tree_sha256=368ad66b3a8092dd919d5646eb8507b8336e8f9f09c43b779dbf864700b5b8fb
7
+ mldsa_native_repo=https://github.com/pq-code-package/mldsa-native.git
8
+ mldsa_native_ref=v1.0.0-beta
9
+ mldsa_native_commit=db65535319d9750d75d34c6d170677415f9d2c46
10
+ mldsa_native_tree_sha256=9c73cd6c185bb6885a7cf0ecb56a5282a5657aa5e6c32f68f442d941baa92b3d
@@ -0,0 +1,105 @@
1
+ [//]: # (SPDX-License-Identifier: CC-BY-4.0)
2
+
3
+ # Building mldsa-native
4
+
5
+ ### Prerequisites
6
+
7
+ To build **mldsa-native**, you need `make` and a C90 compiler. To use the test scripts, you need Python3 (>= 3.7).
8
+
9
+ ### By hand
10
+
11
+ See [mldsa](mldsa).
12
+
13
+ ### Using `make`
14
+
15
+ You can build and test **mldsa-native** as follows:
16
+
17
+ ```bash
18
+ make test # With native code backend (if available)
19
+ make OPT=0 test # With C backend
20
+ ```
21
+
22
+ To merely build test components, use the following `make` targets:
23
+
24
+ ```bash
25
+ make func
26
+ make kat
27
+ make acvp
28
+ ```
29
+
30
+ To run them, add `run_`:
31
+
32
+ ```bash
33
+ make run_func
34
+ make run_kat
35
+ make run_acvp
36
+ ```
37
+
38
+ The resulting binaries can be found in `test/build` (their full path is printed by `make`).
39
+
40
+ For benchmarking, specify the cycle counting method. Currently, **mldsa-native** is supporting NO, PERF, PMU, and MAC:
41
+ * `NO` means that no cycle counting will be used; this can be used to confirm that benchmarks compile fine.
42
+ * `PERF` uses the `perf` kernel module for cycle counting. Does not work on Apple platforms.
43
+ * `PMU` uses direct PMU access if available. On AArch64, this may require you to load a kernel module first, see [here](https://github.com/mupq/pqax?tab=readme-ov-file#enable-access-to-performance-counters). Does not work on Apple platforms.
44
+ * `MAC` is `perf`-based and works on some Apple platforms, at least Apple M1.
45
+
46
+ ```
47
+ # CYCLES has to be one of PERF, PMU, MAC, NO
48
+ sudo make run_bench CYCLES=PERF
49
+ sudo make run_bench_components CYCLES=PERF
50
+ ```
51
+
52
+ ### Using `tests` script
53
+
54
+ For convenience, you can also use the [`./scripts/tests`](scripts/tests) script as a wrapper around `make`. For
55
+ example,
56
+
57
+ ```bash
58
+ ./scripts/tests func
59
+ ```
60
+
61
+ will compile and run functionality tests. Similarly,
62
+
63
+ ```bash
64
+ ./scripts/tests bench -c PERF -r
65
+ ```
66
+
67
+ will compile and run benchmarks, using PERF for cycle counting (`-c PERF`) and running as root (`-r`).
68
+
69
+ For detailed information on how to use the script, please refer to
70
+ `./scripts/tests --help`.
71
+
72
+ ### Windows
73
+
74
+ You can also build **mldsa-native** on Windows using `nmake` and an MSVC compiler.
75
+
76
+ To build and run the tests (only support functional testing for non-opt implementation for now), use the following `nmake` targets:
77
+ ```powershell
78
+ nmke /f .\Makefile.Microsoft_nmake quickcheck
79
+ ```
80
+
81
+ # Checking the proofs
82
+
83
+ ## CBMC
84
+
85
+ ### Prerequisites
86
+
87
+ To run the CBMC proofs, you need specific versions of CBMC and the underlying solvers, e.g. as specified in our `nix` environment; see [nix/cbmc](nix/cbmc/).
88
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to setup and use `nix`.
89
+
90
+ ### Running the CBMC proofs
91
+
92
+ Once you are in the `nix` shell or have all tools setup by hand, use `./scripts/tests cbmc` (or just `tests cbmc` in the `nix` shell) to re-check the CBMC proofs.
93
+ See `tests cbmc --help` for details on the command line options, and [proofs/cbmc](proofs/cbmc) for more details on the CBMC proofs in general.
94
+
95
+ ## HOL-Light
96
+
97
+ ### Prerequisites
98
+
99
+ To run the HOL-Light proofs, you need recent versions of HOL-Light and s2n-bignum, e.g. as specified in our `nix` environment; see [nix/s2n_bignum](nix/s2n_bignum) and [nix/hol_light](nix/hol_light).
100
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to setup and use `nix`.
101
+
102
+ ### Running the HOL-Light proofs
103
+
104
+ Once you are in the `nix` shell or have all tools setup by hand, use `./scripts/tests hol_light` (or just `tests hol_light` in the `nix` shell) to re-check the HOL-Light proofs. Note that depending on the function, they will take a long time. See `tests hol_light --help` for details on the command line options, and [proofs/hol_light](proofs/hol_light) for more details on the HOL-Light proofs in general.
105
+