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
@@ -0,0 +1,304 @@
1
+ /*
2
+ * Copyright (c) The mldsa-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [NeonNTT_Autoformalised]
10
+ * Neon NTT - (Auto)formalised
11
+ * Hanno Becker
12
+ * https://eprint.iacr.org/2026/1223
13
+ */
14
+
15
+ /*
16
+ * RV32-IM ML-DSA forward NTT, fast-multiplier variant.
17
+ *
18
+ * Thin wrapper: the kernel body is shared via mldsa_ntt_rv32im_asm.i, which
19
+ * computes the Barrett low(t*q) reduction with a single multiply by q here.
20
+ * `native/rv32im/fastmul.h` selects this wrapper; the slow-multiplier variant
21
+ * lives in mldsa_ntt_rv32im_slowmul_asm.S.
22
+ * The coarse Barrett output bound used by the shared kernel is proved in
23
+ * @[NeonNTT_Autoformalised, Section 13.2].
24
+ */
25
+
26
+ /*yaml
27
+ Name: ntt_rv32im_fastmul_asm
28
+ Description: RV32IM ML-DSA forward NTT optimized for fast multipliers
29
+ Signature: void mld_ntt_rv32im_fastmul_asm(int32_t r[256], const int32_t zetas[510])
30
+ ABI:
31
+ Architecture: riscv32
32
+ CallingConvention: ILP32
33
+ Features: [RV32M]
34
+ a0:
35
+ type: buffer
36
+ size_bytes: 1024
37
+ permissions: read/write
38
+ c_parameter: int32_t r[256]
39
+ description: Input/output polynomial (256 x int32_t)
40
+ a1:
41
+ type: buffer
42
+ size_bytes: 2040
43
+ permissions: read-only
44
+ c_parameter: const int32_t zetas[510]
45
+ description: Twiddle table (255 Barrett pairs)
46
+ */
47
+
48
+ #include "../../../common.h"
49
+ #if defined(MLD_SYS_RISCV32_M) && \
50
+ defined(MLD_ARITH_BACKEND_RV32IM) && \
51
+ !defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
52
+ defined(MLD_RV32IM_NEED_FASTMUL)
53
+ /* Without linker relaxation, GNU as resolves the branches to .L
54
+ * labels and leaves no relocations in the kernel. It uses the
55
+ * setting in force at the end of the file, so keep this outside
56
+ * the push/pop below. */
57
+ .option norelax
58
+ /* Keep RV32IMC builds byte-identical to the verified RV32IM code. */
59
+ .option push
60
+ .option norvc
61
+
62
+ /*
63
+ * WARNING: This file is auto-derived from the mldsa-native source file
64
+ * dev/riscv32/src/mldsa_ntt_rv32im_asm.S using scripts/simpasm. Do not modify it directly.
65
+ */
66
+
67
+ .text
68
+ .balign 4
69
+ .global MLD_ASM_NAMESPACE(ntt_rv32im_fastmul_asm)
70
+ MLD_ASM_FN_SYMBOL(ntt_rv32im_fastmul_asm)
71
+
72
+ .cfi_startproc
73
+ addi sp, sp, -0x20
74
+ .cfi_adjust_cfa_offset 0x20
75
+ sw s0, 0x0(sp)
76
+ .cfi_rel_offset s0, 0x0
77
+ sw s1, 0x4(sp)
78
+ .cfi_rel_offset s1, 0x4
79
+ sw s2, 0x8(sp)
80
+ .cfi_rel_offset s2, 0x8
81
+ sw s3, 0xc(sp)
82
+ .cfi_rel_offset s3, 0xc
83
+ sw s4, 0x10(sp)
84
+ .cfi_rel_offset s4, 0x10
85
+ sw s5, 0x14(sp)
86
+ .cfi_rel_offset s5, 0x14
87
+ lui t0, 0x7fe
88
+ addi t0, t0, 0x1
89
+ lw s0, 0x0(a1)
90
+ lw s1, 0x4(a1)
91
+ lw s2, 0x8(a1)
92
+ lw s3, 0xc(a1)
93
+ lw s4, 0x10(a1)
94
+ lw s5, 0x14(a1)
95
+ addi a1, a1, 0x18
96
+ mv t2, a0
97
+ addi t4, a0, 0x100
98
+
99
+ .Lmld_ntt_rv32im_p1_loop:
100
+ lw a2, 0x0(t2)
101
+ lw a3, 0x100(t2)
102
+ lw a4, 0x200(t2)
103
+ lw a5, 0x300(t2)
104
+ mulh a7, a4, s1
105
+ mul a6, a4, s0
106
+ mul a7, a7, t0
107
+ sub a6, a6, a7
108
+ sub a4, a2, a6
109
+ add a2, a2, a6
110
+ mulh a7, a5, s1
111
+ mul a6, a5, s0
112
+ mul a7, a7, t0
113
+ sub a6, a6, a7
114
+ sub a5, a3, a6
115
+ add a3, a3, a6
116
+ mulh a7, a3, s3
117
+ mul a6, a3, s2
118
+ mul a7, a7, t0
119
+ sub a6, a6, a7
120
+ sub a3, a2, a6
121
+ add a2, a2, a6
122
+ mulh a7, a5, s5
123
+ mul a6, a5, s4
124
+ mul a7, a7, t0
125
+ sub a6, a6, a7
126
+ sub a5, a4, a6
127
+ add a4, a4, a6
128
+ sw a2, 0x0(t2)
129
+ sw a3, 0x100(t2)
130
+ sw a4, 0x200(t2)
131
+ sw a5, 0x300(t2)
132
+ addi t2, t2, 0x4
133
+ bne t2, t4, .Lmld_ntt_rv32im_p1_loop
134
+ mv t2, a0
135
+ addi t3, a0, 0x400
136
+
137
+ .Lmld_ntt_rv32im_p2_outer:
138
+ lw s0, 0x0(a1)
139
+ lw s1, 0x4(a1)
140
+ lw s2, 0x8(a1)
141
+ lw s3, 0xc(a1)
142
+ lw s4, 0x10(a1)
143
+ lw s5, 0x14(a1)
144
+ addi a1, a1, 0x18
145
+ addi t4, t2, 0x40
146
+
147
+ .Lmld_ntt_rv32im_p2_inner:
148
+ lw a2, 0x0(t2)
149
+ lw a3, 0x40(t2)
150
+ lw a4, 0x80(t2)
151
+ lw a5, 0xc0(t2)
152
+ mulh a7, a4, s1
153
+ mul a6, a4, s0
154
+ mul a7, a7, t0
155
+ sub a6, a6, a7
156
+ sub a4, a2, a6
157
+ add a2, a2, a6
158
+ mulh a7, a5, s1
159
+ mul a6, a5, s0
160
+ mul a7, a7, t0
161
+ sub a6, a6, a7
162
+ sub a5, a3, a6
163
+ add a3, a3, a6
164
+ mulh a7, a3, s3
165
+ mul a6, a3, s2
166
+ mul a7, a7, t0
167
+ sub a6, a6, a7
168
+ sub a3, a2, a6
169
+ add a2, a2, a6
170
+ mulh a7, a5, s5
171
+ mul a6, a5, s4
172
+ mul a7, a7, t0
173
+ sub a6, a6, a7
174
+ sub a5, a4, a6
175
+ add a4, a4, a6
176
+ sw a2, 0x0(t2)
177
+ sw a3, 0x40(t2)
178
+ sw a4, 0x80(t2)
179
+ sw a5, 0xc0(t2)
180
+ addi t2, t2, 0x4
181
+ bne t2, t4, .Lmld_ntt_rv32im_p2_inner
182
+ addi t2, t2, 0xc0
183
+ bne t2, t3, .Lmld_ntt_rv32im_p2_outer
184
+ mv t2, a0
185
+ addi t3, a0, 0x400
186
+
187
+ .Lmld_ntt_rv32im_p3_outer:
188
+ lw s0, 0x0(a1)
189
+ lw s1, 0x4(a1)
190
+ lw s2, 0x8(a1)
191
+ lw s3, 0xc(a1)
192
+ lw s4, 0x10(a1)
193
+ lw s5, 0x14(a1)
194
+ addi a1, a1, 0x18
195
+ addi t4, t2, 0x10
196
+
197
+ .Lmld_ntt_rv32im_p3_inner:
198
+ lw a2, 0x0(t2)
199
+ lw a3, 0x10(t2)
200
+ lw a4, 0x20(t2)
201
+ lw a5, 0x30(t2)
202
+ mulh a7, a4, s1
203
+ mul a6, a4, s0
204
+ mul a7, a7, t0
205
+ sub a6, a6, a7
206
+ sub a4, a2, a6
207
+ add a2, a2, a6
208
+ mulh a7, a5, s1
209
+ mul a6, a5, s0
210
+ mul a7, a7, t0
211
+ sub a6, a6, a7
212
+ sub a5, a3, a6
213
+ add a3, a3, a6
214
+ mulh a7, a3, s3
215
+ mul a6, a3, s2
216
+ mul a7, a7, t0
217
+ sub a6, a6, a7
218
+ sub a3, a2, a6
219
+ add a2, a2, a6
220
+ mulh a7, a5, s5
221
+ mul a6, a5, s4
222
+ mul a7, a7, t0
223
+ sub a6, a6, a7
224
+ sub a5, a4, a6
225
+ add a4, a4, a6
226
+ sw a2, 0x0(t2)
227
+ sw a3, 0x10(t2)
228
+ sw a4, 0x20(t2)
229
+ sw a5, 0x30(t2)
230
+ addi t2, t2, 0x4
231
+ bne t2, t4, .Lmld_ntt_rv32im_p3_inner
232
+ addi t2, t2, 0x30
233
+ bne t2, t3, .Lmld_ntt_rv32im_p3_outer
234
+ mv t2, a0
235
+ addi t3, a0, 0x400
236
+
237
+ .Lmld_ntt_rv32im_p4_outer:
238
+ lw s0, 0x0(a1)
239
+ lw s1, 0x4(a1)
240
+ lw s2, 0x8(a1)
241
+ lw s3, 0xc(a1)
242
+ lw s4, 0x10(a1)
243
+ lw s5, 0x14(a1)
244
+ addi a1, a1, 0x18
245
+ lw a2, 0x0(t2)
246
+ lw a3, 0x4(t2)
247
+ lw a4, 0x8(t2)
248
+ lw a5, 0xc(t2)
249
+ mulh a7, a4, s1
250
+ mul a6, a4, s0
251
+ mul a7, a7, t0
252
+ sub a6, a6, a7
253
+ sub a4, a2, a6
254
+ add a2, a2, a6
255
+ mulh a7, a5, s1
256
+ mul a6, a5, s0
257
+ mul a7, a7, t0
258
+ sub a6, a6, a7
259
+ sub a5, a3, a6
260
+ add a3, a3, a6
261
+ mulh a7, a3, s3
262
+ mul a6, a3, s2
263
+ mul a7, a7, t0
264
+ sub a6, a6, a7
265
+ sub a3, a2, a6
266
+ add a2, a2, a6
267
+ mulh a7, a5, s5
268
+ mul a6, a5, s4
269
+ mul a7, a7, t0
270
+ sub a6, a6, a7
271
+ sub a5, a4, a6
272
+ add a4, a4, a6
273
+ sw a2, 0x0(t2)
274
+ sw a3, 0x4(t2)
275
+ sw a4, 0x8(t2)
276
+ sw a5, 0xc(t2)
277
+ addi t2, t2, 0x10
278
+ bne t2, t3, .Lmld_ntt_rv32im_p4_outer
279
+ lw s0, 0x0(sp)
280
+ .cfi_restore s0
281
+ lw s1, 0x4(sp)
282
+ .cfi_restore s1
283
+ lw s2, 0x8(sp)
284
+ .cfi_restore s2
285
+ lw s3, 0xc(sp)
286
+ .cfi_restore s3
287
+ lw s4, 0x10(sp)
288
+ .cfi_restore s4
289
+ lw s5, 0x14(sp)
290
+ .cfi_restore s5
291
+ addi sp, sp, 0x20
292
+ .cfi_adjust_cfa_offset -0x20
293
+ ret
294
+ .cfi_endproc
295
+
296
+ MLD_ASM_FN_SIZE(ntt_rv32im_fastmul_asm)
297
+
298
+ .option pop
299
+ #endif /* MLD_SYS_RISCV32_M && MLD_ARITH_BACKEND_RV32IM && \
300
+ !MLD_CONFIG_MULTILEVEL_NO_SHARED && MLD_RV32IM_NEED_FASTMUL */
301
+
302
+ #if defined(__ELF__)
303
+ .section .note.GNU-stack,"",%progbits
304
+ #endif
@@ -0,0 +1,351 @@
1
+ /*
2
+ * Copyright (c) The mldsa-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [NeonNTT_Autoformalised]
10
+ * Neon NTT - (Auto)formalised
11
+ * Hanno Becker
12
+ * https://eprint.iacr.org/2026/1223
13
+ */
14
+
15
+ /*
16
+ * RV32-IM ML-DSA forward NTT, slow-multiplier variant.
17
+ *
18
+ * Thin wrapper: the kernel body is shared via mldsa_ntt_rv32im_asm.i. Here it
19
+ * computes the Barrett low(t*q) reduction with a shift/add chain (exploiting
20
+ * q = 2^23 - 2^13 + 1), trading the multiply for cheap ALU ops -- preferred
21
+ * when the multiplier is slow. `native/rv32im/slowmul.h` selects this
22
+ * wrapper; the fast-multiplier variant lives in mldsa_ntt_rv32im_asm.S.
23
+ * The coarse Barrett output bound used by the shared kernel is proved in
24
+ * @[NeonNTT_Autoformalised, Section 13.2].
25
+ */
26
+
27
+ /*yaml
28
+ Name: ntt_rv32im_slowmul_asm
29
+ Description: RV32IM ML-DSA forward NTT optimized for slow multipliers
30
+ Signature: void mld_ntt_rv32im_slowmul_asm(int32_t r[256], const int32_t zetas[510])
31
+ ABI:
32
+ Architecture: riscv32
33
+ CallingConvention: ILP32
34
+ Features: [RV32M]
35
+ a0:
36
+ type: buffer
37
+ size_bytes: 1024
38
+ permissions: read/write
39
+ c_parameter: int32_t r[256]
40
+ description: Input/output polynomial (256 x int32_t)
41
+ a1:
42
+ type: buffer
43
+ size_bytes: 2040
44
+ permissions: read-only
45
+ c_parameter: const int32_t zetas[510]
46
+ description: Twiddle table (255 Barrett pairs)
47
+ */
48
+
49
+ #include "../../../common.h"
50
+ #if defined(MLD_SYS_RISCV32_M) && \
51
+ defined(MLD_ARITH_BACKEND_RV32IM) && \
52
+ !defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
53
+ defined(MLD_RV32IM_NEED_SLOWMUL)
54
+ /* Without linker relaxation, GNU as resolves the branches to .L
55
+ * labels and leaves no relocations in the kernel. It uses the
56
+ * setting in force at the end of the file, so keep this outside
57
+ * the push/pop below. */
58
+ .option norelax
59
+ /* Keep RV32IMC builds byte-identical to the verified RV32IM code. */
60
+ .option push
61
+ .option norvc
62
+
63
+ /*
64
+ * WARNING: This file is auto-derived from the mldsa-native source file
65
+ * dev/riscv32/src/mldsa_ntt_rv32im_slowmul_asm.S using scripts/simpasm. Do not modify it directly.
66
+ */
67
+
68
+ .text
69
+ .balign 4
70
+ .global MLD_ASM_NAMESPACE(ntt_rv32im_slowmul_asm)
71
+ MLD_ASM_FN_SYMBOL(ntt_rv32im_slowmul_asm)
72
+
73
+ .cfi_startproc
74
+ addi sp, sp, -0x20
75
+ .cfi_adjust_cfa_offset 0x20
76
+ sw s0, 0x0(sp)
77
+ .cfi_rel_offset s0, 0x0
78
+ sw s1, 0x4(sp)
79
+ .cfi_rel_offset s1, 0x4
80
+ sw s2, 0x8(sp)
81
+ .cfi_rel_offset s2, 0x8
82
+ sw s3, 0xc(sp)
83
+ .cfi_rel_offset s3, 0xc
84
+ sw s4, 0x10(sp)
85
+ .cfi_rel_offset s4, 0x10
86
+ sw s5, 0x14(sp)
87
+ .cfi_rel_offset s5, 0x14
88
+ lw s0, 0x0(a1)
89
+ lw s1, 0x4(a1)
90
+ lw s2, 0x8(a1)
91
+ lw s3, 0xc(a1)
92
+ lw s4, 0x10(a1)
93
+ lw s5, 0x14(a1)
94
+ addi a1, a1, 0x18
95
+ mv t2, a0
96
+ addi t4, a0, 0x100
97
+
98
+ .Lmld_ntt_rv32im_p1_loop:
99
+ lw a2, 0x0(t2)
100
+ lw a3, 0x100(t2)
101
+ lw a4, 0x200(t2)
102
+ lw a5, 0x300(t2)
103
+ mulh a7, a4, s1
104
+ mul a6, a4, s0
105
+ sub a6, a6, a7
106
+ slli a7, a7, 0xd
107
+ add a6, a6, a7
108
+ slli a7, a7, 0xa
109
+ sub a6, a6, a7
110
+ sub a4, a2, a6
111
+ add a2, a2, a6
112
+ mulh a7, a5, s1
113
+ mul a6, a5, s0
114
+ sub a6, a6, a7
115
+ slli a7, a7, 0xd
116
+ add a6, a6, a7
117
+ slli a7, a7, 0xa
118
+ sub a6, a6, a7
119
+ sub a5, a3, a6
120
+ add a3, a3, a6
121
+ mulh a7, a3, s3
122
+ mul a6, a3, s2
123
+ sub a6, a6, a7
124
+ slli a7, a7, 0xd
125
+ add a6, a6, a7
126
+ slli a7, a7, 0xa
127
+ sub a6, a6, a7
128
+ sub a3, a2, a6
129
+ add a2, a2, a6
130
+ mulh a7, a5, s5
131
+ mul a6, a5, s4
132
+ sub a6, a6, a7
133
+ slli a7, a7, 0xd
134
+ add a6, a6, a7
135
+ slli a7, a7, 0xa
136
+ sub a6, a6, a7
137
+ sub a5, a4, a6
138
+ add a4, a4, a6
139
+ sw a2, 0x0(t2)
140
+ sw a3, 0x100(t2)
141
+ sw a4, 0x200(t2)
142
+ sw a5, 0x300(t2)
143
+ addi t2, t2, 0x4
144
+ bne t2, t4, .Lmld_ntt_rv32im_p1_loop
145
+ mv t2, a0
146
+ addi t3, a0, 0x400
147
+
148
+ .Lmld_ntt_rv32im_p2_outer:
149
+ lw s0, 0x0(a1)
150
+ lw s1, 0x4(a1)
151
+ lw s2, 0x8(a1)
152
+ lw s3, 0xc(a1)
153
+ lw s4, 0x10(a1)
154
+ lw s5, 0x14(a1)
155
+ addi a1, a1, 0x18
156
+ addi t4, t2, 0x40
157
+
158
+ .Lmld_ntt_rv32im_p2_inner:
159
+ lw a2, 0x0(t2)
160
+ lw a3, 0x40(t2)
161
+ lw a4, 0x80(t2)
162
+ lw a5, 0xc0(t2)
163
+ mulh a7, a4, s1
164
+ mul a6, a4, s0
165
+ sub a6, a6, a7
166
+ slli a7, a7, 0xd
167
+ add a6, a6, a7
168
+ slli a7, a7, 0xa
169
+ sub a6, a6, a7
170
+ sub a4, a2, a6
171
+ add a2, a2, a6
172
+ mulh a7, a5, s1
173
+ mul a6, a5, s0
174
+ sub a6, a6, a7
175
+ slli a7, a7, 0xd
176
+ add a6, a6, a7
177
+ slli a7, a7, 0xa
178
+ sub a6, a6, a7
179
+ sub a5, a3, a6
180
+ add a3, a3, a6
181
+ mulh a7, a3, s3
182
+ mul a6, a3, s2
183
+ sub a6, a6, a7
184
+ slli a7, a7, 0xd
185
+ add a6, a6, a7
186
+ slli a7, a7, 0xa
187
+ sub a6, a6, a7
188
+ sub a3, a2, a6
189
+ add a2, a2, a6
190
+ mulh a7, a5, s5
191
+ mul a6, a5, s4
192
+ sub a6, a6, a7
193
+ slli a7, a7, 0xd
194
+ add a6, a6, a7
195
+ slli a7, a7, 0xa
196
+ sub a6, a6, a7
197
+ sub a5, a4, a6
198
+ add a4, a4, a6
199
+ sw a2, 0x0(t2)
200
+ sw a3, 0x40(t2)
201
+ sw a4, 0x80(t2)
202
+ sw a5, 0xc0(t2)
203
+ addi t2, t2, 0x4
204
+ bne t2, t4, .Lmld_ntt_rv32im_p2_inner
205
+ addi t2, t2, 0xc0
206
+ bne t2, t3, .Lmld_ntt_rv32im_p2_outer
207
+ mv t2, a0
208
+ addi t3, a0, 0x400
209
+
210
+ .Lmld_ntt_rv32im_p3_outer:
211
+ lw s0, 0x0(a1)
212
+ lw s1, 0x4(a1)
213
+ lw s2, 0x8(a1)
214
+ lw s3, 0xc(a1)
215
+ lw s4, 0x10(a1)
216
+ lw s5, 0x14(a1)
217
+ addi a1, a1, 0x18
218
+ addi t4, t2, 0x10
219
+
220
+ .Lmld_ntt_rv32im_p3_inner:
221
+ lw a2, 0x0(t2)
222
+ lw a3, 0x10(t2)
223
+ lw a4, 0x20(t2)
224
+ lw a5, 0x30(t2)
225
+ mulh a7, a4, s1
226
+ mul a6, a4, s0
227
+ sub a6, a6, a7
228
+ slli a7, a7, 0xd
229
+ add a6, a6, a7
230
+ slli a7, a7, 0xa
231
+ sub a6, a6, a7
232
+ sub a4, a2, a6
233
+ add a2, a2, a6
234
+ mulh a7, a5, s1
235
+ mul a6, a5, s0
236
+ sub a6, a6, a7
237
+ slli a7, a7, 0xd
238
+ add a6, a6, a7
239
+ slli a7, a7, 0xa
240
+ sub a6, a6, a7
241
+ sub a5, a3, a6
242
+ add a3, a3, a6
243
+ mulh a7, a3, s3
244
+ mul a6, a3, s2
245
+ sub a6, a6, a7
246
+ slli a7, a7, 0xd
247
+ add a6, a6, a7
248
+ slli a7, a7, 0xa
249
+ sub a6, a6, a7
250
+ sub a3, a2, a6
251
+ add a2, a2, a6
252
+ mulh a7, a5, s5
253
+ mul a6, a5, s4
254
+ sub a6, a6, a7
255
+ slli a7, a7, 0xd
256
+ add a6, a6, a7
257
+ slli a7, a7, 0xa
258
+ sub a6, a6, a7
259
+ sub a5, a4, a6
260
+ add a4, a4, a6
261
+ sw a2, 0x0(t2)
262
+ sw a3, 0x10(t2)
263
+ sw a4, 0x20(t2)
264
+ sw a5, 0x30(t2)
265
+ addi t2, t2, 0x4
266
+ bne t2, t4, .Lmld_ntt_rv32im_p3_inner
267
+ addi t2, t2, 0x30
268
+ bne t2, t3, .Lmld_ntt_rv32im_p3_outer
269
+ mv t2, a0
270
+ addi t3, a0, 0x400
271
+
272
+ .Lmld_ntt_rv32im_p4_outer:
273
+ lw s0, 0x0(a1)
274
+ lw s1, 0x4(a1)
275
+ lw s2, 0x8(a1)
276
+ lw s3, 0xc(a1)
277
+ lw s4, 0x10(a1)
278
+ lw s5, 0x14(a1)
279
+ addi a1, a1, 0x18
280
+ lw a2, 0x0(t2)
281
+ lw a3, 0x4(t2)
282
+ lw a4, 0x8(t2)
283
+ lw a5, 0xc(t2)
284
+ mulh a7, a4, s1
285
+ mul a6, a4, s0
286
+ sub a6, a6, a7
287
+ slli a7, a7, 0xd
288
+ add a6, a6, a7
289
+ slli a7, a7, 0xa
290
+ sub a6, a6, a7
291
+ sub a4, a2, a6
292
+ add a2, a2, a6
293
+ mulh a7, a5, s1
294
+ mul a6, a5, s0
295
+ sub a6, a6, a7
296
+ slli a7, a7, 0xd
297
+ add a6, a6, a7
298
+ slli a7, a7, 0xa
299
+ sub a6, a6, a7
300
+ sub a5, a3, a6
301
+ add a3, a3, a6
302
+ mulh a7, a3, s3
303
+ mul a6, a3, s2
304
+ sub a6, a6, a7
305
+ slli a7, a7, 0xd
306
+ add a6, a6, a7
307
+ slli a7, a7, 0xa
308
+ sub a6, a6, a7
309
+ sub a3, a2, a6
310
+ add a2, a2, a6
311
+ mulh a7, a5, s5
312
+ mul a6, a5, s4
313
+ sub a6, a6, a7
314
+ slli a7, a7, 0xd
315
+ add a6, a6, a7
316
+ slli a7, a7, 0xa
317
+ sub a6, a6, a7
318
+ sub a5, a4, a6
319
+ add a4, a4, a6
320
+ sw a2, 0x0(t2)
321
+ sw a3, 0x4(t2)
322
+ sw a4, 0x8(t2)
323
+ sw a5, 0xc(t2)
324
+ addi t2, t2, 0x10
325
+ bne t2, t3, .Lmld_ntt_rv32im_p4_outer
326
+ lw s0, 0x0(sp)
327
+ .cfi_restore s0
328
+ lw s1, 0x4(sp)
329
+ .cfi_restore s1
330
+ lw s2, 0x8(sp)
331
+ .cfi_restore s2
332
+ lw s3, 0xc(sp)
333
+ .cfi_restore s3
334
+ lw s4, 0x10(sp)
335
+ .cfi_restore s4
336
+ lw s5, 0x14(sp)
337
+ .cfi_restore s5
338
+ addi sp, sp, 0x20
339
+ .cfi_adjust_cfa_offset -0x20
340
+ ret
341
+ .cfi_endproc
342
+
343
+ MLD_ASM_FN_SIZE(ntt_rv32im_slowmul_asm)
344
+
345
+ .option pop
346
+ #endif /* MLD_SYS_RISCV32_M && MLD_ARITH_BACKEND_RV32IM && \
347
+ !MLD_CONFIG_MULTILEVEL_NO_SHARED && MLD_RV32IM_NEED_SLOWMUL */
348
+
349
+ #if defined(__ELF__)
350
+ .section .note.GNU-stack,"",%progbits
351
+ #endif