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,108 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [FIPS203]
10
+ * FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
11
+ * National Institute of Standards and Technology
12
+ * https://csrc.nist.gov/pubs/fips/203/final
13
+ */
14
+
15
+ /*yaml
16
+ Name: poly_decompress_d10_aarch64_asm
17
+ Description: Decompression of a polynomial from 10 bits per coefficient
18
+ Signature: void mlk_poly_decompress_d10_aarch64_asm(int16_t r[256], const uint8_t a[320], const uint8_t table[80])
19
+ ABI:
20
+ Architecture: aarch64
21
+ CallingConvention: AAPCS64
22
+ Features: [NEON]
23
+ x0:
24
+ type: buffer
25
+ size_bytes: 512
26
+ permissions: write-only
27
+ c_parameter: int16_t r[256]
28
+ description: Output polynomial
29
+ x1:
30
+ type: buffer
31
+ size_bytes: 320
32
+ permissions: read-only
33
+ c_parameter: const uint8_t a[320]
34
+ description: Input compressed polynomial
35
+ x2:
36
+ type: buffer
37
+ size_bytes: 80
38
+ permissions: read-only
39
+ c_parameter: const uint8_t table[80]
40
+ description: Constants (index, shift, mask and multiplier vectors)
41
+ Stack:
42
+ bytes: 0
43
+ */
44
+
45
+ #include "../../../common.h"
46
+ #if defined(MLK_SYS_AARCH64_NEON) && \
47
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
48
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
49
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
50
+ (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || MLKEM_K == 3)
51
+
52
+ /*
53
+ * WARNING: This file is auto-derived from the mlkem-native source file
54
+ * dev/aarch64_opt/src/mlkem_poly_decompress_d10_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
55
+ */
56
+
57
+ .text
58
+ .balign 4
59
+ .global MLK_ASM_NAMESPACE(poly_decompress_d10_aarch64_asm)
60
+ MLK_ASM_FN_SYMBOL(poly_decompress_d10_aarch64_asm)
61
+
62
+ .cfi_startproc
63
+ ld1 { v16.16b, v17.16b, v18.16b, v19.16b }, [x2], #64
64
+ ld1 { v20.16b }, [x2]
65
+ mov x3, #0x8 // =8
66
+
67
+ Lmlk_poly_decompress_d10_loop_start:
68
+ add x4, x1, #0xa
69
+ add x5, x1, #0x14
70
+ add x6, x1, #0x18
71
+ ld1 { v0.16b }, [x1]
72
+ ld1 { v1.16b }, [x4]
73
+ ld1 { v2.16b }, [x5]
74
+ ld1 { v3.16b }, [x6]
75
+ add x1, x1, #0x28
76
+ tbl v4.16b, { v0.16b }, v16.16b
77
+ ushl v4.8h, v4.8h, v18.8h
78
+ and v4.16b, v4.16b, v19.16b
79
+ tbl v5.16b, { v1.16b }, v16.16b
80
+ ushl v5.8h, v5.8h, v18.8h
81
+ and v5.16b, v5.16b, v19.16b
82
+ tbl v6.16b, { v2.16b }, v16.16b
83
+ ushl v6.8h, v6.8h, v18.8h
84
+ and v6.16b, v6.16b, v19.16b
85
+ tbl v7.16b, { v3.16b }, v17.16b
86
+ ushl v7.8h, v7.8h, v18.8h
87
+ and v7.16b, v7.16b, v19.16b
88
+ sqrdmulh v4.8h, v4.8h, v20.8h
89
+ sqrdmulh v5.8h, v5.8h, v20.8h
90
+ sqrdmulh v6.8h, v6.8h, v20.8h
91
+ sqrdmulh v7.8h, v7.8h, v20.8h
92
+ stp q4, q5, [x0], #0x40
93
+ stp q6, q7, [x0, #-0x20]
94
+ subs x3, x3, #0x1
95
+ cbnz x3, Lmlk_poly_decompress_d10_loop_start
96
+ ret
97
+ .cfi_endproc
98
+
99
+ MLK_ASM_FN_SIZE(poly_decompress_d10_aarch64_asm)
100
+
101
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
102
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && !MLK_CONFIG_NO_DECAPS_API && \
103
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == 3) \
104
+ */
105
+
106
+ #if defined(__ELF__)
107
+ .section .note.GNU-stack,"",%progbits
108
+ #endif
@@ -0,0 +1,116 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [FIPS203]
10
+ * FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
11
+ * National Institute of Standards and Technology
12
+ * https://csrc.nist.gov/pubs/fips/203/final
13
+ */
14
+
15
+ /*yaml
16
+ Name: poly_decompress_d11_aarch64_asm
17
+ Description: Decompression of a polynomial from 11 bits per coefficient
18
+ Signature: void mlk_poly_decompress_d11_aarch64_asm(int16_t r[256], const uint8_t a[352], const uint8_t table[112])
19
+ ABI:
20
+ Architecture: aarch64
21
+ CallingConvention: AAPCS64
22
+ Features: [NEON]
23
+ x0:
24
+ type: buffer
25
+ size_bytes: 512
26
+ permissions: write-only
27
+ c_parameter: int16_t r[256]
28
+ description: Output polynomial
29
+ x1:
30
+ type: buffer
31
+ size_bytes: 352
32
+ permissions: read-only
33
+ c_parameter: const uint8_t a[352]
34
+ description: Input compressed polynomial
35
+ x2:
36
+ type: buffer
37
+ size_bytes: 112
38
+ permissions: read-only
39
+ c_parameter: const uint8_t table[112]
40
+ description: Constants (index, shift, mask and multiplier vectors)
41
+ Stack:
42
+ bytes: 0
43
+ */
44
+
45
+ #include "../../../common.h"
46
+ #if defined(MLK_SYS_AARCH64_NEON) && \
47
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
48
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
49
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
50
+ (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
51
+
52
+ /*
53
+ * WARNING: This file is auto-derived from the mlkem-native source file
54
+ * dev/aarch64_opt/src/mlkem_poly_decompress_d11_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
55
+ */
56
+
57
+ .text
58
+ .balign 4
59
+ .global MLK_ASM_NAMESPACE(poly_decompress_d11_aarch64_asm)
60
+ MLK_ASM_FN_SYMBOL(poly_decompress_d11_aarch64_asm)
61
+
62
+ .cfi_startproc
63
+ ld1 { v24.16b, v25.16b, v26.16b, v27.16b }, [x2], #64
64
+ ld1 { v28.16b, v29.16b }, [x2], #32
65
+ ld1 { v30.16b }, [x2]
66
+ mov x3, #0x8 // =8
67
+
68
+ Lmlk_poly_decompress_d11_loop_start:
69
+ add x4, x1, #0xb
70
+ add x5, x1, #0x16
71
+ add x6, x1, #0x1c
72
+ ld1 { v0.16b }, [x1]
73
+ ld1 { v1.16b }, [x4]
74
+ ld1 { v2.16b }, [x5]
75
+ ld1 { v3.16b }, [x6]
76
+ add x1, x1, #0x2c
77
+ tbl v4.16b, { v0.16b }, v24.16b
78
+ tbl v16.16b, { v0.16b }, v25.16b
79
+ ushl v4.8h, v4.8h, v28.8h
80
+ sli v4.8h, v16.8h, #0xc
81
+ and v4.16b, v4.16b, v29.16b
82
+ tbl v5.16b, { v1.16b }, v24.16b
83
+ tbl v17.16b, { v1.16b }, v25.16b
84
+ ushl v5.8h, v5.8h, v28.8h
85
+ sli v5.8h, v17.8h, #0xc
86
+ and v5.16b, v5.16b, v29.16b
87
+ tbl v6.16b, { v2.16b }, v24.16b
88
+ tbl v18.16b, { v2.16b }, v25.16b
89
+ ushl v6.8h, v6.8h, v28.8h
90
+ sli v6.8h, v18.8h, #0xc
91
+ and v6.16b, v6.16b, v29.16b
92
+ tbl v7.16b, { v3.16b }, v26.16b
93
+ tbl v19.16b, { v3.16b }, v27.16b
94
+ ushl v7.8h, v7.8h, v28.8h
95
+ sli v7.8h, v19.8h, #0xc
96
+ and v7.16b, v7.16b, v29.16b
97
+ sqrdmulh v4.8h, v4.8h, v30.8h
98
+ sqrdmulh v5.8h, v5.8h, v30.8h
99
+ sqrdmulh v6.8h, v6.8h, v30.8h
100
+ sqrdmulh v7.8h, v7.8h, v30.8h
101
+ stp q4, q5, [x0], #0x40
102
+ stp q6, q7, [x0, #-0x20]
103
+ subs x3, x3, #0x1
104
+ cbnz x3, Lmlk_poly_decompress_d11_loop_start
105
+ ret
106
+ .cfi_endproc
107
+
108
+ MLK_ASM_FN_SIZE(poly_decompress_d11_aarch64_asm)
109
+
110
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
111
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && !MLK_CONFIG_NO_DECAPS_API && \
112
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
113
+
114
+ #if defined(__ELF__)
115
+ .section .note.GNU-stack,"",%progbits
116
+ #endif
@@ -0,0 +1,93 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [FIPS203]
10
+ * FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
11
+ * National Institute of Standards and Technology
12
+ * https://csrc.nist.gov/pubs/fips/203/final
13
+ */
14
+
15
+ /*yaml
16
+ Name: poly_decompress_d4_aarch64_asm
17
+ Description: Decompression of a polynomial from 4 bits per coefficient
18
+ Signature: void mlk_poly_decompress_d4_aarch64_asm(int16_t r[256], const uint8_t a[128], const uint8_t table[32])
19
+ ABI:
20
+ Architecture: aarch64
21
+ CallingConvention: AAPCS64
22
+ Features: [NEON]
23
+ x0:
24
+ type: buffer
25
+ size_bytes: 512
26
+ permissions: write-only
27
+ c_parameter: int16_t r[256]
28
+ description: Output polynomial
29
+ x1:
30
+ type: buffer
31
+ size_bytes: 128
32
+ permissions: read-only
33
+ c_parameter: const uint8_t a[128]
34
+ description: Input compressed polynomial
35
+ x2:
36
+ type: buffer
37
+ size_bytes: 32
38
+ permissions: read-only
39
+ c_parameter: const uint8_t table[32]
40
+ description: Lookup table for Decompress_4
41
+ Stack:
42
+ bytes: 0
43
+ */
44
+
45
+ #include "../../../common.h"
46
+ #if defined(MLK_SYS_AARCH64_NEON) && \
47
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
48
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
49
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
50
+ (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2 || MLKEM_K == 3)
51
+
52
+ /*
53
+ * WARNING: This file is auto-derived from the mlkem-native source file
54
+ * dev/aarch64_opt/src/mlkem_poly_decompress_d4_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
55
+ */
56
+
57
+ .text
58
+ .balign 4
59
+ .global MLK_ASM_NAMESPACE(poly_decompress_d4_aarch64_asm)
60
+ MLK_ASM_FN_SYMBOL(poly_decompress_d4_aarch64_asm)
61
+
62
+ .cfi_startproc
63
+ ld1 { v17.16b, v18.16b }, [x2]
64
+ movi v19.16b, #0xf
65
+ mov x3, #0x8 // =8
66
+
67
+ Lmlk_poly_decompress_d4_loop_start:
68
+ ld1 { v0.16b }, [x1], #16
69
+ and v1.16b, v0.16b, v19.16b
70
+ ushr v2.16b, v0.16b, #0x4
71
+ zip1 v3.16b, v1.16b, v2.16b
72
+ zip2 v16.16b, v1.16b, v2.16b
73
+ tbl v4.16b, { v17.16b }, v3.16b
74
+ tbl v5.16b, { v18.16b }, v3.16b
75
+ tbl v6.16b, { v17.16b }, v16.16b
76
+ tbl v7.16b, { v18.16b }, v16.16b
77
+ st2 { v4.16b, v5.16b }, [x0], #32
78
+ st2 { v6.16b, v7.16b }, [x0], #32
79
+ subs x3, x3, #0x1
80
+ cbnz x3, Lmlk_poly_decompress_d4_loop_start
81
+ ret
82
+ .cfi_endproc
83
+
84
+ MLK_ASM_FN_SIZE(poly_decompress_d4_aarch64_asm)
85
+
86
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
87
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && !MLK_CONFIG_NO_DECAPS_API && \
88
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == 3) \
89
+ */
90
+
91
+ #if defined(__ELF__)
92
+ .section .note.GNU-stack,"",%progbits
93
+ #endif
@@ -0,0 +1,104 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [FIPS203]
10
+ * FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
11
+ * National Institute of Standards and Technology
12
+ * https://csrc.nist.gov/pubs/fips/203/final
13
+ */
14
+
15
+ /*yaml
16
+ Name: poly_decompress_d5_aarch64_asm
17
+ Description: Decompression of a polynomial from 5 bits per coefficient
18
+ Signature: void mlk_poly_decompress_d5_aarch64_asm(int16_t r[256], const uint8_t a[160], const uint8_t table[112])
19
+ ABI:
20
+ Architecture: aarch64
21
+ CallingConvention: AAPCS64
22
+ Features: [NEON]
23
+ x0:
24
+ type: buffer
25
+ size_bytes: 512
26
+ permissions: write-only
27
+ c_parameter: int16_t r[256]
28
+ description: Output polynomial
29
+ x1:
30
+ type: buffer
31
+ size_bytes: 160
32
+ permissions: read-only
33
+ c_parameter: const uint8_t a[160]
34
+ description: Input compressed polynomial
35
+ x2:
36
+ type: buffer
37
+ size_bytes: 112
38
+ permissions: read-only
39
+ c_parameter: const uint8_t table[112]
40
+ description: Constants (index, shift, mask and multiplier vectors)
41
+ Stack:
42
+ bytes: 0
43
+ */
44
+
45
+ #include "../../../common.h"
46
+ #if defined(MLK_SYS_AARCH64_NEON) && \
47
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
48
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
49
+ !defined(MLK_CONFIG_NO_DECAPS_API) && \
50
+ (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
51
+
52
+ /*
53
+ * WARNING: This file is auto-derived from the mlkem-native source file
54
+ * dev/aarch64_opt/src/mlkem_poly_decompress_d5_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
55
+ */
56
+
57
+ .text
58
+ .balign 4
59
+ .global MLK_ASM_NAMESPACE(poly_decompress_d5_aarch64_asm)
60
+ MLK_ASM_FN_SYMBOL(poly_decompress_d5_aarch64_asm)
61
+
62
+ .cfi_startproc
63
+ ld1 { v16.16b, v17.16b, v18.16b, v19.16b }, [x2], #64
64
+ ld1 { v20.16b, v21.16b }, [x2], #32
65
+ ld1 { v22.16b }, [x2]
66
+ mov x3, #0x8 // =8
67
+
68
+ Lmlk_poly_decompress_d5_loop_start:
69
+ add x4, x1, #0x4
70
+ ld1 { v0.16b }, [x1]
71
+ ld1 { v1.16b }, [x4]
72
+ add x1, x1, #0x14
73
+ tbl v2.16b, { v0.16b }, v16.16b
74
+ ushl v2.8h, v2.8h, v20.8h
75
+ and v2.16b, v2.16b, v21.16b
76
+ tbl v3.16b, { v0.16b }, v17.16b
77
+ ushl v3.8h, v3.8h, v20.8h
78
+ and v3.16b, v3.16b, v21.16b
79
+ tbl v4.16b, { v0.16b }, v18.16b
80
+ ushl v4.8h, v4.8h, v20.8h
81
+ and v4.16b, v4.16b, v21.16b
82
+ tbl v5.16b, { v1.16b }, v19.16b
83
+ ushl v5.8h, v5.8h, v20.8h
84
+ and v5.16b, v5.16b, v21.16b
85
+ sqrdmulh v2.8h, v2.8h, v22.8h
86
+ sqrdmulh v3.8h, v3.8h, v22.8h
87
+ sqrdmulh v4.8h, v4.8h, v22.8h
88
+ sqrdmulh v5.8h, v5.8h, v22.8h
89
+ stp q2, q3, [x0], #0x40
90
+ stp q4, q5, [x0, #-0x20]
91
+ subs x3, x3, #0x1
92
+ cbnz x3, Lmlk_poly_decompress_d5_loop_start
93
+ ret
94
+ .cfi_endproc
95
+
96
+ MLK_ASM_FN_SIZE(poly_decompress_d5_aarch64_asm)
97
+
98
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
99
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && !MLK_CONFIG_NO_DECAPS_API && \
100
+ (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
101
+
102
+ #if defined(__ELF__)
103
+ .section .note.GNU-stack,"",%progbits
104
+ #endif
@@ -0,0 +1,84 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /* References
7
+ * ==========
8
+ *
9
+ * - [FIPS203]
10
+ * FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
11
+ * National Institute of Standards and Technology
12
+ * https://csrc.nist.gov/pubs/fips/203/final
13
+ */
14
+
15
+ /*yaml
16
+ Name: poly_frombytes_aarch64_asm
17
+ Description: Convert byte representation to polynomial
18
+ Signature: void mlk_poly_frombytes_aarch64_asm(int16_t r[256], const uint8_t a[384])
19
+ ABI:
20
+ Architecture: aarch64
21
+ CallingConvention: AAPCS64
22
+ Features: [NEON]
23
+ x0:
24
+ type: buffer
25
+ size_bytes: 512
26
+ permissions: write-only
27
+ c_parameter: int16_t r[256]
28
+ description: Output polynomial
29
+ x1:
30
+ type: buffer
31
+ size_bytes: 384
32
+ permissions: read-only
33
+ c_parameter: const uint8_t a[384]
34
+ description: Input byte array
35
+ Stack:
36
+ bytes: 0
37
+ */
38
+
39
+ #include "../../../common.h"
40
+ #if defined(MLK_SYS_AARCH64_NEON) && \
41
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
42
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
43
+ (!defined(MLK_CONFIG_NO_ENCAPS_API) || \
44
+ !defined(MLK_CONFIG_NO_DECAPS_API))
45
+
46
+ /*
47
+ * WARNING: This file is auto-derived from the mlkem-native source file
48
+ * dev/aarch64_opt/src/mlkem_poly_frombytes_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
49
+ */
50
+
51
+ .text
52
+ .balign 4
53
+ .global MLK_ASM_NAMESPACE(poly_frombytes_aarch64_asm)
54
+ MLK_ASM_FN_SYMBOL(poly_frombytes_aarch64_asm)
55
+
56
+ .cfi_startproc
57
+ movi v16.16b, #0xf
58
+ mov x2, #0x8 // =8
59
+
60
+ Lmlk_poly_frombytes_loop_start:
61
+ ld3 { v0.16b, v1.16b, v2.16b }, [x1], #48
62
+ and v3.16b, v1.16b, v16.16b
63
+ zip1 v4.16b, v0.16b, v3.16b
64
+ zip2 v6.16b, v0.16b, v3.16b
65
+ zip1 v5.16b, v1.16b, v2.16b
66
+ zip2 v7.16b, v1.16b, v2.16b
67
+ ushr v5.8h, v5.8h, #0x4
68
+ ushr v7.8h, v7.8h, #0x4
69
+ st2 { v4.8h, v5.8h }, [x0], #32
70
+ st2 { v6.8h, v7.8h }, [x0], #32
71
+ subs x2, x2, #0x1
72
+ cbnz x2, Lmlk_poly_frombytes_loop_start
73
+ ret
74
+ .cfi_endproc
75
+
76
+ MLK_ASM_FN_SIZE(poly_frombytes_aarch64_asm)
77
+
78
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
79
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && (!MLK_CONFIG_NO_ENCAPS_API || \
80
+ !MLK_CONFIG_NO_DECAPS_API) */
81
+
82
+ #if defined(__ELF__)
83
+ .section .note.GNU-stack,"",%progbits
84
+ #endif
@@ -40,7 +40,8 @@
40
40
  */
41
41
 
42
42
  #include "../../../common.h"
43
- #if defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
43
+ #if defined(MLK_SYS_AARCH64_NEON) && \
44
+ defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
44
45
 
45
46
  /*
46
47
  * WARNING: This file is auto-derived from the mlkem-native source file
@@ -123,7 +124,8 @@ Lmlk_poly_mulcache_compute_loop_start:
123
124
 
124
125
  MLK_ASM_FN_SIZE(poly_mulcache_compute_aarch64_asm)
125
126
 
126
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED */
127
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
128
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED */
127
129
 
128
130
  #if defined(__ELF__)
129
131
  .section .note.GNU-stack,"",%progbits
@@ -22,7 +22,8 @@
22
22
  */
23
23
 
24
24
  #include "../../../common.h"
25
- #if defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
25
+ #if defined(MLK_SYS_AARCH64_NEON) && \
26
+ defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
26
27
 
27
28
  /*
28
29
  * WARNING: This file is auto-derived from the mlkem-native source file
@@ -146,7 +147,8 @@ Lmlk_poly_reduce_loop_start:
146
147
 
147
148
  MLK_ASM_FN_SIZE(poly_reduce_aarch64_asm)
148
149
 
149
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED */
150
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
151
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED */
150
152
 
151
153
  #if defined(__ELF__)
152
154
  .section .note.GNU-stack,"",%progbits
@@ -28,7 +28,8 @@
28
28
  */
29
29
 
30
30
  #include "../../../common.h"
31
- #if defined(MLK_ARITH_BACKEND_AARCH64) && \
31
+ #if defined(MLK_SYS_AARCH64_NEON) && \
32
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
32
33
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
33
34
  (!defined(MLK_CONFIG_NO_KEYPAIR_API) || \
34
35
  !defined(MLK_CONFIG_NO_ENCAPS_API))
@@ -116,8 +117,9 @@ Lmlk_poly_tobytes_loop_start:
116
117
 
117
118
  MLK_ASM_FN_SIZE(poly_tobytes_aarch64_asm)
118
119
 
119
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
120
- (!MLK_CONFIG_NO_KEYPAIR_API || !MLK_CONFIG_NO_ENCAPS_API) */
120
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
121
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && (!MLK_CONFIG_NO_KEYPAIR_API || \
122
+ !MLK_CONFIG_NO_ENCAPS_API) */
121
123
 
122
124
  #if defined(__ELF__)
123
125
  .section .note.GNU-stack,"",%progbits
@@ -22,7 +22,8 @@
22
22
  */
23
23
 
24
24
  #include "../../../common.h"
25
- #if defined(MLK_ARITH_BACKEND_AARCH64) && \
25
+ #if defined(MLK_SYS_AARCH64_NEON) && \
26
+ defined(MLK_ARITH_BACKEND_AARCH64) && \
26
27
  !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
27
28
  !defined(MLK_CONFIG_NO_KEYPAIR_API)
28
29
 
@@ -94,8 +95,8 @@ Lmlk_poly_tomont_loop:
94
95
 
95
96
  MLK_ASM_FN_SIZE(poly_tomont_aarch64_asm)
96
97
 
97
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
98
- !MLK_CONFIG_NO_KEYPAIR_API */
98
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
99
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && !MLK_CONFIG_NO_KEYPAIR_API */
99
100
 
100
101
  #if defined(__ELF__)
101
102
  .section .note.GNU-stack,"",%progbits
@@ -52,7 +52,8 @@
52
52
  /* Re-implementation of asymmetric base multiplication following @[NeonNTT] */
53
53
 
54
54
  #include "../../../common.h"
55
- #if defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2)
55
+ #if defined(MLK_SYS_AARCH64_NEON) && \
56
+ defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2)
56
57
 
57
58
  /*
58
59
  * WARNING: This file is auto-derived from the mlkem-native source file
@@ -256,7 +257,8 @@ Lmlk_polyvec_basemul_acc_montgomery_cached_k2_loop_start:
256
257
  MLK_ASM_FN_SIZE(polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm)
257
258
 
258
259
 
259
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
260
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
261
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
260
262
  (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2) */
261
263
 
262
264
  #if defined(__ELF__)
@@ -52,7 +52,8 @@
52
52
  /* Re-implementation of asymmetric base multiplication following @[NeonNTT] */
53
53
 
54
54
  #include "../../../common.h"
55
- #if defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3)
55
+ #if defined(MLK_SYS_AARCH64_NEON) && \
56
+ defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3)
56
57
 
57
58
  /*
58
59
  * WARNING: This file is auto-derived from the mlkem-native source file
@@ -309,7 +310,8 @@ Lmlk_polyvec_basemul_acc_montgomery_cached_k3_loop_start:
309
310
 
310
311
  MLK_ASM_FN_SIZE(polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm)
311
312
 
312
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
313
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
314
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
313
315
  (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3) */
314
316
 
315
317
  #if defined(__ELF__)
@@ -52,7 +52,8 @@
52
52
  /* Re-implementation of asymmetric base multiplication following @[NeonNTT] */
53
53
 
54
54
  #include "../../../common.h"
55
- #if defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
55
+ #if defined(MLK_SYS_AARCH64_NEON) && \
56
+ defined(MLK_ARITH_BACKEND_AARCH64) && !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && (defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4)
56
57
 
57
58
  /*
58
59
  * WARNING: This file is auto-derived from the mlkem-native source file
@@ -363,7 +364,8 @@ Lmlk_polyvec_basemul_acc_montgomery_cached_k4_loop_start:
363
364
 
364
365
  MLK_ASM_FN_SIZE(polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm)
365
366
 
366
- #endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
367
+ #endif /* MLK_SYS_AARCH64_NEON && MLK_ARITH_BACKEND_AARCH64 && \
368
+ !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
367
369
  (MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4) */
368
370
 
369
371
  #if defined(__ELF__)