pq_crypto 0.3.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 (328) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/ci.yml +56 -0
  3. data/CHANGELOG.md +62 -0
  4. data/GET_STARTED.md +366 -40
  5. data/README.md +76 -233
  6. data/SECURITY.md +107 -82
  7. data/ext/pqcrypto/extconf.rb +169 -87
  8. data/ext/pqcrypto/mldsa_api.h +1 -48
  9. data/ext/pqcrypto/mlkem_api.h +1 -18
  10. data/ext/pqcrypto/pq_externalmu.c +89 -204
  11. data/ext/pqcrypto/pqcrypto_native_api.h +129 -0
  12. data/ext/pqcrypto/pqcrypto_ruby_secure.c +484 -84
  13. data/ext/pqcrypto/pqcrypto_secure.c +203 -78
  14. data/ext/pqcrypto/pqcrypto_secure.h +53 -14
  15. data/ext/pqcrypto/pqcrypto_version.h +7 -0
  16. data/ext/pqcrypto/randombytes.h +9 -0
  17. data/ext/pqcrypto/vendor/.vendored +10 -5
  18. data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +105 -0
  19. data/ext/pqcrypto/vendor/mldsa-native/LICENSE +286 -0
  20. data/ext/pqcrypto/vendor/mldsa-native/META.yml +24 -0
  21. data/ext/pqcrypto/vendor/mldsa-native/README.md +221 -0
  22. data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +8 -0
  23. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +721 -0
  24. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +975 -0
  25. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +724 -0
  26. data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +723 -0
  27. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +166 -0
  28. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +321 -0
  29. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c +21 -0
  30. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +385 -0
  31. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +73 -0
  32. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +130 -0
  33. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +277 -0
  34. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +244 -0
  35. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +182 -0
  36. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +117 -0
  37. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +438 -0
  38. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +105 -0
  39. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +71 -0
  40. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +62 -0
  41. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +376 -0
  42. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +204 -0
  43. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +259 -0
  44. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1077 -0
  45. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +987 -0
  46. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +41 -0
  47. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +26 -0
  48. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +35 -0
  49. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +37 -0
  50. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +27 -0
  51. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +36 -0
  52. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +69 -0
  53. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
  54. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +32 -0
  55. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +20 -0
  56. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +638 -0
  57. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +136 -0
  58. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +52 -0
  59. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +29 -0
  60. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +488 -0
  61. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +16 -0
  62. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/xkcp.h +31 -0
  63. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +247 -0
  64. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +231 -0
  65. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +150 -0
  66. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +753 -0
  67. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +129 -0
  68. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +145 -0
  69. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +177 -0
  70. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +653 -0
  71. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +79 -0
  72. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +53 -0
  73. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +55 -0
  74. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +85 -0
  75. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +85 -0
  76. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +102 -0
  77. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +110 -0
  78. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +72 -0
  79. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +69 -0
  80. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +40 -0
  81. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +189 -0
  82. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +135 -0
  83. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +128 -0
  84. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +543 -0
  85. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +62 -0
  86. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +649 -0
  87. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +23 -0
  88. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +315 -0
  89. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +124 -0
  90. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
  91. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
  92. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +2311 -0
  93. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +2383 -0
  94. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +239 -0
  95. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +131 -0
  96. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +139 -0
  97. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +155 -0
  98. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +187 -0
  99. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +61 -0
  100. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +52 -0
  101. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +155 -0
  102. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +155 -0
  103. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +102 -0
  104. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +104 -0
  105. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +91 -0
  106. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +93 -0
  107. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +126 -0
  108. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +155 -0
  109. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +139 -0
  110. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +160 -0
  111. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +293 -0
  112. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +224 -0
  113. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +77 -0
  114. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +991 -0
  115. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +393 -0
  116. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +946 -0
  117. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +360 -0
  118. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +877 -0
  119. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +725 -0
  120. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
  121. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +139 -0
  122. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +249 -0
  123. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +1511 -0
  124. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +806 -0
  125. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
  126. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +268 -0
  127. data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
  128. data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +104 -0
  129. data/ext/pqcrypto/vendor/mlkem-native/LICENSE +294 -0
  130. data/ext/pqcrypto/vendor/mlkem-native/META.yml +30 -0
  131. data/ext/pqcrypto/vendor/mlkem-native/README.md +223 -0
  132. data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +86 -0
  133. data/ext/pqcrypto/vendor/mlkem-native/SECURITY.md +8 -0
  134. data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +23 -0
  135. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +660 -0
  136. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +538 -0
  137. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +681 -0
  138. data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +709 -0
  139. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +174 -0
  140. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +274 -0
  141. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +717 -0
  142. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +688 -0
  143. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +64 -0
  144. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +128 -0
  145. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +251 -0
  146. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +158 -0
  147. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +208 -0
  148. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +80 -0
  149. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +463 -0
  150. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +98 -0
  151. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +70 -0
  152. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
  153. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +375 -0
  154. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +203 -0
  155. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +258 -0
  156. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1076 -0
  157. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +986 -0
  158. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +46 -0
  159. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +25 -0
  160. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +34 -0
  161. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +35 -0
  162. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +26 -0
  163. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +35 -0
  164. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +117 -0
  165. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/README.md +10 -0
  166. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +79 -0
  167. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +35 -0
  168. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +667 -0
  169. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +40 -0
  170. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +51 -0
  171. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +290 -0
  172. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +314 -0
  173. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +28 -0
  174. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +33 -0
  175. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +41 -0
  176. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2.S +451 -0
  177. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +51 -0
  178. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +622 -0
  179. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +156 -0
  180. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +446 -0
  181. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +326 -0
  182. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/README.md +16 -0
  183. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +122 -0
  184. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +174 -0
  185. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +177 -0
  186. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/intt.S +628 -0
  187. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/ntt.S +562 -0
  188. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_mulcache_compute_asm.S +127 -0
  189. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_reduce_asm.S +150 -0
  190. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tobytes_asm.S +117 -0
  191. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tomont_asm.S +98 -0
  192. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +261 -0
  193. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +314 -0
  194. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +368 -0
  195. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_asm.S +226 -0
  196. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +542 -0
  197. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +637 -0
  198. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +25 -0
  199. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md +11 -0
  200. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +128 -0
  201. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +45 -0
  202. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +81 -0
  203. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +145 -0
  204. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_izetas.inc +27 -0
  205. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +805 -0
  206. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas.inc +27 -0
  207. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas_basemul.inc +39 -0
  208. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/README.md +4 -0
  209. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +304 -0
  210. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +309 -0
  211. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +94 -0
  212. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +45 -0
  213. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +102 -0
  214. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +25 -0
  215. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/intt.S +719 -0
  216. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mulcache_compute.S +90 -0
  217. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntt.S +639 -0
  218. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttfrombytes.S +193 -0
  219. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntttobytes.S +181 -0
  220. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttunpack.S +174 -0
  221. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d10.S +382 -0
  222. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d11.S +448 -0
  223. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d4.S +163 -0
  224. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d5.S +220 -0
  225. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d10.S +228 -0
  226. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d11.S +277 -0
  227. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d4.S +180 -0
  228. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d5.S +192 -0
  229. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +502 -0
  230. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +750 -0
  231. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +998 -0
  232. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/reduce.S +218 -0
  233. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_asm.S +103 -0
  234. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +544 -0
  235. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont.S +155 -0
  236. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h +76 -0
  237. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +572 -0
  238. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +317 -0
  239. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +502 -0
  240. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +668 -0
  241. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +60 -0
  242. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +362 -0
  243. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +118 -0
  244. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/symmetric.h +70 -0
  245. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +260 -0
  246. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.c +20 -0
  247. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +464 -0
  248. data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/zetas.inc +30 -0
  249. data/lib/pq_crypto/algorithm_registry.rb +200 -0
  250. data/lib/pq_crypto/hybrid_kem.rb +1 -12
  251. data/lib/pq_crypto/kem.rb +104 -13
  252. data/lib/pq_crypto/pkcs8.rb +387 -0
  253. data/lib/pq_crypto/serialization.rb +1 -14
  254. data/lib/pq_crypto/signature.rb +123 -17
  255. data/lib/pq_crypto/spki.rb +131 -0
  256. data/lib/pq_crypto/version.rb +1 -1
  257. data/lib/pq_crypto.rb +79 -20
  258. data/script/vendor_libs.rb +88 -155
  259. metadata +241 -73
  260. data/ext/pqcrypto/vendor/pqclean/common/aes.c +0 -639
  261. data/ext/pqcrypto/vendor/pqclean/common/aes.h +0 -64
  262. data/ext/pqcrypto/vendor/pqclean/common/compat.h +0 -73
  263. data/ext/pqcrypto/vendor/pqclean/common/crypto_declassify.h +0 -7
  264. data/ext/pqcrypto/vendor/pqclean/common/fips202.c +0 -928
  265. data/ext/pqcrypto/vendor/pqclean/common/fips202.h +0 -166
  266. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/feat.S +0 -168
  267. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.c +0 -684
  268. data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.h +0 -60
  269. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SIMD256.c +0 -1028
  270. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SnP.h +0 -50
  271. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-unrolling.macros +0 -198
  272. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile +0 -8
  273. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile.Microsoft_nmake +0 -8
  274. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/SIMD256-config.h +0 -3
  275. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/align.h +0 -34
  276. data/ext/pqcrypto/vendor/pqclean/common/keccak4x/brg_endian.h +0 -142
  277. data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.c +0 -101
  278. data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.h +0 -39
  279. data/ext/pqcrypto/vendor/pqclean/common/randombytes.c +0 -355
  280. data/ext/pqcrypto/vendor/pqclean/common/randombytes.h +0 -27
  281. data/ext/pqcrypto/vendor/pqclean/common/sha2.c +0 -769
  282. data/ext/pqcrypto/vendor/pqclean/common/sha2.h +0 -173
  283. data/ext/pqcrypto/vendor/pqclean/common/sp800-185.c +0 -156
  284. data/ext/pqcrypto/vendor/pqclean/common/sp800-185.h +0 -27
  285. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/LICENSE +0 -5
  286. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile +0 -19
  287. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile.Microsoft_nmake +0 -23
  288. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/api.h +0 -18
  289. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.c +0 -83
  290. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.h +0 -11
  291. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.c +0 -327
  292. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.h +0 -22
  293. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.c +0 -164
  294. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.h +0 -23
  295. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.c +0 -146
  296. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.h +0 -14
  297. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/params.h +0 -36
  298. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.c +0 -299
  299. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.h +0 -37
  300. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.c +0 -188
  301. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.h +0 -26
  302. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.c +0 -41
  303. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.h +0 -13
  304. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric-shake.c +0 -71
  305. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric.h +0 -30
  306. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.c +0 -67
  307. data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.h +0 -13
  308. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/LICENSE +0 -5
  309. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile +0 -19
  310. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile.Microsoft_nmake +0 -23
  311. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/api.h +0 -50
  312. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.c +0 -98
  313. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.h +0 -10
  314. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.c +0 -261
  315. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.h +0 -31
  316. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/params.h +0 -44
  317. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.c +0 -799
  318. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.h +0 -52
  319. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.c +0 -415
  320. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.h +0 -65
  321. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.c +0 -69
  322. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.h +0 -17
  323. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.c +0 -92
  324. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.h +0 -14
  325. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.c +0 -407
  326. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.h +0 -47
  327. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric-shake.c +0 -26
  328. data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric.h +0 -34
@@ -0,0 +1,326 @@
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
+ * - [REF]
15
+ * CRYSTALS-Kyber C reference implementation
16
+ * Bos, Ducas, Kiltz, Lepoint, Lyubashevsky, Schanck, Schwabe, Seiler, Stehlé
17
+ * https://github.com/pq-crystals/kyber/tree/main/ref
18
+ */
19
+
20
+ #ifndef MLK_KEM_H
21
+ #define MLK_KEM_H
22
+
23
+ #include "cbmc.h"
24
+ #include "common.h"
25
+ #include "sys.h"
26
+
27
+ #if defined(MLK_CHECK_APIS)
28
+ /* Include to ensure consistency between internal kem.h
29
+ * and external mlkem_native.h. */
30
+ #include "mlkem_native.h"
31
+
32
+ #if MLKEM_INDCCA_SECRETKEYBYTES != \
33
+ MLKEM_SECRETKEYBYTES(MLK_CONFIG_PARAMETER_SET)
34
+ #error Mismatch for SECRETKEYBYTES between kem.h and mlkem_native.h
35
+ #endif
36
+
37
+ #if MLKEM_INDCCA_PUBLICKEYBYTES != \
38
+ MLKEM_PUBLICKEYBYTES(MLK_CONFIG_PARAMETER_SET)
39
+ #error Mismatch for PUBLICKEYBYTES between kem.h and mlkem_native.h
40
+ #endif
41
+
42
+ #if MLKEM_INDCCA_CIPHERTEXTBYTES != \
43
+ MLKEM_CIPHERTEXTBYTES(MLK_CONFIG_PARAMETER_SET)
44
+ #error Mismatch for CIPHERTEXTBYTES between kem.h and mlkem_native.h
45
+ #endif
46
+
47
+ #endif /* MLK_CHECK_APIS */
48
+
49
+ #define mlk_kem_keypair_derand \
50
+ MLK_NAMESPACE_K(keypair_derand) MLK_CONTEXT_PARAMETERS_3
51
+ #define mlk_kem_keypair MLK_NAMESPACE_K(keypair) MLK_CONTEXT_PARAMETERS_2
52
+ #define mlk_kem_enc_derand MLK_NAMESPACE_K(enc_derand) MLK_CONTEXT_PARAMETERS_4
53
+ #define mlk_kem_enc MLK_NAMESPACE_K(enc) MLK_CONTEXT_PARAMETERS_3
54
+ #define mlk_kem_dec MLK_NAMESPACE_K(dec) MLK_CONTEXT_PARAMETERS_3
55
+ #define mlk_kem_check_pk MLK_NAMESPACE_K(check_pk) MLK_CONTEXT_PARAMETERS_1
56
+ #define mlk_kem_check_sk MLK_NAMESPACE_K(check_sk) MLK_CONTEXT_PARAMETERS_1
57
+
58
+ /*************************************************
59
+ * Name: mlk_kem_check_pk
60
+ *
61
+ * Description: Implements modulus check mandated by FIPS 203,
62
+ * i.e., ensures that coefficients are in [0,q-1].
63
+ *
64
+ * Arguments: - const uint8_t *pk: pointer to input public key
65
+ * (an already allocated array of MLKEM_INDCCA_PUBLICKEYBYTES
66
+ * bytes)
67
+ *
68
+ * Returns: - 0 on success
69
+ * - MLK_ERR_FAIL: If the modulus check failed.
70
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
71
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
72
+ *
73
+ * Specification: Implements @[FIPS203, Section 7.2, 'modulus check']
74
+ *
75
+ **************************************************/
76
+
77
+ /* Reference: Not implemented in the reference implementation @[REF]. */
78
+ MLK_EXTERNAL_API
79
+ MLK_MUST_CHECK_RETURN_VALUE
80
+ int mlk_kem_check_pk(const uint8_t pk[MLKEM_INDCCA_PUBLICKEYBYTES],
81
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
82
+ __contract__(
83
+ requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
84
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
85
+ return_value == MLK_ERR_OUT_OF_MEMORY)
86
+ );
87
+
88
+
89
+ /*************************************************
90
+ * Name: mlk_kem_check_sk
91
+ *
92
+ * Description: Implements public key hash check mandated by FIPS 203,
93
+ * i.e., ensures that
94
+ * sk[768𝑘+32 ∶ 768𝑘+64] = H(pk)= H(sk[384𝑘 : 768𝑘+32])
95
+ *
96
+ * Arguments: - const uint8_t *sk: pointer to input private key
97
+ * (an already allocated array of MLKEM_INDCCA_SECRETKEYBYTES
98
+ * bytes)
99
+ *
100
+ * Returns: - 0 on success
101
+ * - MLK_ERR_FAIL: If the public key hash check failed.
102
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
103
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
104
+ *
105
+ * Specification: Implements @[FIPS203, Section 7.3, 'hash check']
106
+ *
107
+ **************************************************/
108
+
109
+ /* Reference: Not implemented in the reference implementation @[REF]. */
110
+ MLK_EXTERNAL_API
111
+ MLK_MUST_CHECK_RETURN_VALUE
112
+ int mlk_kem_check_sk(const uint8_t sk[MLKEM_INDCCA_SECRETKEYBYTES],
113
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
114
+ __contract__(
115
+ requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
116
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
117
+ return_value == MLK_ERR_OUT_OF_MEMORY)
118
+ );
119
+
120
+ /*************************************************
121
+ * Name: mlk_kem_keypair_derand
122
+ *
123
+ * Description: Generates public and private key
124
+ * for CCA-secure ML-KEM key encapsulation mechanism
125
+ *
126
+ * Arguments: - uint8_t *pk: pointer to output public key
127
+ * (an already allocated array of MLKEM_INDCCA_PUBLICKEYBYTES
128
+ * bytes)
129
+ * - uint8_t *sk: pointer to output private key
130
+ * (an already allocated array of MLKEM_INDCCA_SECRETKEYBYTES
131
+ * bytes)
132
+ * - uint8_t *coins: pointer to input randomness
133
+ * (an already allocated array filled with 2*MLKEM_SYMBYTES
134
+ * random bytes)
135
+ *
136
+ * Returns: - 0: On success
137
+ * - MLK_ERR_FAIL: If MLK_CONFIG_KEYGEN_PCT is enabled and the
138
+ * PCT failed.
139
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
140
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
141
+ *
142
+ * Specification: Implements @[FIPS203, Algorithm 16, ML-KEM.KeyGen_Internal]
143
+ *
144
+ **************************************************/
145
+ MLK_EXTERNAL_API
146
+ MLK_MUST_CHECK_RETURN_VALUE
147
+ int mlk_kem_keypair_derand(uint8_t pk[MLKEM_INDCCA_PUBLICKEYBYTES],
148
+ uint8_t sk[MLKEM_INDCCA_SECRETKEYBYTES],
149
+ const uint8_t coins[2 * MLKEM_SYMBYTES],
150
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
151
+ __contract__(
152
+ requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
153
+ requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
154
+ requires(memory_no_alias(coins, 2 * MLKEM_SYMBYTES))
155
+ assigns(memory_slice(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
156
+ assigns(memory_slice(sk, MLKEM_INDCCA_SECRETKEYBYTES))
157
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
158
+ return_value == MLK_ERR_OUT_OF_MEMORY ||
159
+ return_value == MLK_ERR_RNG_FAIL)
160
+ );
161
+
162
+ /*************************************************
163
+ * Name: mlk_kem_keypair
164
+ *
165
+ * Description: Generates public and private key
166
+ * for CCA-secure ML-KEM key encapsulation mechanism
167
+ *
168
+ * Arguments: - uint8_t *pk: pointer to output public key
169
+ * (an already allocated array of MLKEM_INDCCA_PUBLICKEYBYTES
170
+ * bytes)
171
+ * - uint8_t *sk: pointer to output private key
172
+ * (an already allocated array of MLKEM_INDCCA_SECRETKEYBYTES
173
+ * bytes)
174
+ *
175
+ * Returns: - 0: On success
176
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
177
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
178
+ * - MLK_ERR_RNG_FAIL: Random number generation failed.
179
+ * - MLK_ERR_FAIL: If MLK_CONFIG_KEYGEN_PCT is enabled and the
180
+ * PCT failed.
181
+ *
182
+ * Specification: Implements @[FIPS203, Algorithm 19, ML-KEM.KeyGen]
183
+ *
184
+ **************************************************/
185
+ MLK_EXTERNAL_API
186
+ MLK_MUST_CHECK_RETURN_VALUE
187
+ int mlk_kem_keypair(uint8_t pk[MLKEM_INDCCA_PUBLICKEYBYTES],
188
+ uint8_t sk[MLKEM_INDCCA_SECRETKEYBYTES],
189
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
190
+ __contract__(
191
+ requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
192
+ requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
193
+ assigns(memory_slice(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
194
+ assigns(memory_slice(sk, MLKEM_INDCCA_SECRETKEYBYTES))
195
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
196
+ return_value == MLK_ERR_OUT_OF_MEMORY ||
197
+ return_value == MLK_ERR_RNG_FAIL)
198
+ );
199
+
200
+ /*************************************************
201
+ * Name: mlk_kem_enc_derand
202
+ *
203
+ * Description: Generates cipher text and shared
204
+ * secret for given public key
205
+ *
206
+ * Arguments: - uint8_t *ct: pointer to output cipher text
207
+ * (an already allocated array of MLKEM_INDCCA_CIPHERTEXTBYTES
208
+ * bytes)
209
+ * - uint8_t *ss: pointer to output shared secret
210
+ * (an already allocated array of MLKEM_SSBYTES bytes)
211
+ * - const uint8_t *pk: pointer to input public key
212
+ * (an already allocated array of MLKEM_INDCCA_PUBLICKEYBYTES
213
+ * bytes)
214
+ * - const uint8_t *coins: pointer to input randomness
215
+ * (an already allocated array filled with MLKEM_SYMBYTES random
216
+ * bytes)
217
+ *
218
+ * Returns: - 0 on success
219
+ * - MLK_ERR_FAIL: If the 'modulus check' @[FIPS203, Section 7.2]
220
+ * for the public key fails.
221
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
222
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
223
+ *
224
+ * Specification: Implements @[FIPS203, Algorithm 17, ML-KEM.Encaps_Internal]
225
+ *
226
+ **************************************************/
227
+ MLK_EXTERNAL_API
228
+ MLK_MUST_CHECK_RETURN_VALUE
229
+ int mlk_kem_enc_derand(uint8_t ct[MLKEM_INDCCA_CIPHERTEXTBYTES],
230
+ uint8_t ss[MLKEM_SSBYTES],
231
+ const uint8_t pk[MLKEM_INDCCA_PUBLICKEYBYTES],
232
+ const uint8_t coins[MLKEM_SYMBYTES],
233
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
234
+ __contract__(
235
+ requires(memory_no_alias(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
236
+ requires(memory_no_alias(ss, MLKEM_SSBYTES))
237
+ requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
238
+ requires(memory_no_alias(coins, MLKEM_SYMBYTES))
239
+ assigns(memory_slice(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
240
+ assigns(memory_slice(ss, MLKEM_SSBYTES))
241
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
242
+ return_value == MLK_ERR_OUT_OF_MEMORY)
243
+ );
244
+
245
+ /*************************************************
246
+ * Name: mlk_kem_enc
247
+ *
248
+ * Description: Generates cipher text and shared
249
+ * secret for given public key
250
+ *
251
+ * Arguments: - uint8_t *ct: pointer to output cipher text
252
+ * (an already allocated array of MLKEM_INDCCA_CIPHERTEXTBYTES
253
+ * bytes)
254
+ * - uint8_t *ss: pointer to output shared secret
255
+ * (an already allocated array of MLKEM_SSBYTES bytes)
256
+ * - const uint8_t *pk: pointer to input public key
257
+ * (an already allocated array of MLKEM_INDCCA_PUBLICKEYBYTES
258
+ * bytes)
259
+ *
260
+ * Returns: - 0 on success
261
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
262
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
263
+ * - MLK_ERR_RNG_FAIL: Random number generation failed.
264
+ * - MLK_ERR_FAIL: If the 'modulus check' @[FIPS203, Section 7.2]
265
+ * for the public key fails.
266
+ *
267
+ * Specification: Implements @[FIPS203, Algorithm 20, ML-KEM.Encaps]
268
+ *
269
+ **************************************************/
270
+ MLK_EXTERNAL_API
271
+ MLK_MUST_CHECK_RETURN_VALUE
272
+ int mlk_kem_enc(uint8_t ct[MLKEM_INDCCA_CIPHERTEXTBYTES],
273
+ uint8_t ss[MLKEM_SSBYTES],
274
+ const uint8_t pk[MLKEM_INDCCA_PUBLICKEYBYTES],
275
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
276
+ __contract__(
277
+ requires(memory_no_alias(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
278
+ requires(memory_no_alias(ss, MLKEM_SSBYTES))
279
+ requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
280
+ assigns(memory_slice(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
281
+ assigns(memory_slice(ss, MLKEM_SSBYTES))
282
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
283
+ return_value == MLK_ERR_OUT_OF_MEMORY ||
284
+ return_value == MLK_ERR_RNG_FAIL)
285
+ );
286
+
287
+ /*************************************************
288
+ * Name: mlk_kem_dec
289
+ *
290
+ * Description: Generates shared secret for given
291
+ * cipher text and private key
292
+ *
293
+ * Arguments: - uint8_t *ss: pointer to output shared secret
294
+ * (an already allocated array of MLKEM_SSBYTES bytes)
295
+ * - const uint8_t *ct: pointer to input cipher text
296
+ * (an already allocated array of MLKEM_INDCCA_CIPHERTEXTBYTES
297
+ * bytes)
298
+ * - const uint8_t *sk: pointer to input private key
299
+ * (an already allocated array of MLKEM_INDCCA_SECRETKEYBYTES
300
+ * bytes)
301
+ *
302
+ * Returns: - 0 on success
303
+ * - MLK_ERR_FAIL: If the 'hash check' @[FIPS203, Section 7.3]
304
+ * for the secret key fails.
305
+ * - MLK_ERR_OUT_OF_MEMORY: If MLK_CONFIG_CUSTOM_ALLOC_FREE is
306
+ * used and an allocation via MLK_CUSTOM_ALLOC returned NULL.
307
+ *
308
+ * Specification: Implements @[FIPS203, Algorithm 21, ML-KEM.Decaps]
309
+ *
310
+ **************************************************/
311
+ MLK_EXTERNAL_API
312
+ MLK_MUST_CHECK_RETURN_VALUE
313
+ int mlk_kem_dec(uint8_t ss[MLKEM_SSBYTES],
314
+ const uint8_t ct[MLKEM_INDCCA_CIPHERTEXTBYTES],
315
+ const uint8_t sk[MLKEM_INDCCA_SECRETKEYBYTES],
316
+ MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
317
+ __contract__(
318
+ requires(memory_no_alias(ss, MLKEM_SSBYTES))
319
+ requires(memory_no_alias(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
320
+ requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
321
+ assigns(memory_slice(ss, MLKEM_SSBYTES))
322
+ ensures(return_value == 0 || return_value == MLK_ERR_FAIL ||
323
+ return_value == MLK_ERR_OUT_OF_MEMORY)
324
+ );
325
+
326
+ #endif /* !MLK_KEM_H */
@@ -0,0 +1,16 @@
1
+ [//]: # (SPDX-License-Identifier: CC-BY-4.0)
2
+
3
+ # AArch64 backend (little endian)
4
+
5
+ This directory contains a native backend for little endian AArch64 systems. It is derived from [^NeonNTT] [^SLOTHY_Paper].
6
+
7
+ The code in this directory is auto-generated from the 'clean' assembly in [dev/aarch64_clean](../../../../dev/aarch64_clean)
8
+ in a two-step fashion: First, it is superoptimized using the [SLOTHY](https://github.com/slothy-optimizer/slothy) superoptimizer,
9
+ giving the assembly in [dev/aarch64_opt](../../../../dev/aarch64_opt). Then, it is stripped of remaining register aliases, macros
10
+ and most preprocessor directives by [`scripts/simpasm`](../../../../scripts/simpasm).
11
+
12
+ If you want to understand how the assembly works, and/or make changes to it, consult [dev/](../../../../dev).
13
+
14
+ <!--- bibliography --->
15
+ [^NeonNTT]: Becker, Hwang, Kannwischer, Yang, Yang: Neon NTT: Faster Dilithium, Kyber, and Saber on Cortex-A72 and Apple M1, [https://eprint.iacr.org/2021/986](https://eprint.iacr.org/2021/986)
16
+ [^SLOTHY_Paper]: Abdulrahman, Becker, Kannwischer, Klein: Fast and Clean: Auditable high-performance assembly via constraint solving, [https://eprint.iacr.org/2022/1303](https://eprint.iacr.org/2022/1303)
@@ -0,0 +1,122 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ #ifndef MLK_NATIVE_AARCH64_META_H
7
+ #define MLK_NATIVE_AARCH64_META_H
8
+
9
+ /* Set of primitives that this backend replaces */
10
+ #define MLK_USE_NATIVE_NTT
11
+ #define MLK_USE_NATIVE_INTT
12
+ #define MLK_USE_NATIVE_POLY_REDUCE
13
+ #define MLK_USE_NATIVE_POLY_TOMONT
14
+ #define MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE
15
+ #define MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED
16
+ #define MLK_USE_NATIVE_POLY_TOBYTES
17
+ #define MLK_USE_NATIVE_REJ_UNIFORM
18
+
19
+ /* Identifier for this backend so that source and assembly files
20
+ * in the build can be appropriately guarded. */
21
+ #define MLK_ARITH_BACKEND_AARCH64
22
+
23
+
24
+ #if !defined(__ASSEMBLER__)
25
+ #include "../api.h"
26
+ #include "src/arith_native_aarch64.h"
27
+
28
+ MLK_MUST_CHECK_RETURN_VALUE
29
+ static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N])
30
+ {
31
+ mlk_ntt_asm(data, mlk_aarch64_ntt_zetas_layer12345,
32
+ mlk_aarch64_ntt_zetas_layer67);
33
+ return MLK_NATIVE_FUNC_SUCCESS;
34
+ }
35
+
36
+ MLK_MUST_CHECK_RETURN_VALUE
37
+ static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N])
38
+ {
39
+ mlk_intt_asm(data, mlk_aarch64_invntt_zetas_layer12345,
40
+ mlk_aarch64_invntt_zetas_layer67);
41
+ return MLK_NATIVE_FUNC_SUCCESS;
42
+ }
43
+
44
+ MLK_MUST_CHECK_RETURN_VALUE
45
+ static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N])
46
+ {
47
+ mlk_poly_reduce_asm(data);
48
+ return MLK_NATIVE_FUNC_SUCCESS;
49
+ }
50
+
51
+ MLK_MUST_CHECK_RETURN_VALUE
52
+ static MLK_INLINE int mlk_poly_tomont_native(int16_t data[MLKEM_N])
53
+ {
54
+ mlk_poly_tomont_asm(data);
55
+ return MLK_NATIVE_FUNC_SUCCESS;
56
+ }
57
+
58
+ MLK_MUST_CHECK_RETURN_VALUE
59
+ static MLK_INLINE int mlk_poly_mulcache_compute_native(int16_t x[MLKEM_N / 2],
60
+ const int16_t y[MLKEM_N])
61
+ {
62
+ mlk_poly_mulcache_compute_asm(x, y, mlk_aarch64_zetas_mulcache_native,
63
+ mlk_aarch64_zetas_mulcache_twisted_native);
64
+ return MLK_NATIVE_FUNC_SUCCESS;
65
+ }
66
+
67
+ #if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2
68
+ MLK_MUST_CHECK_RETURN_VALUE
69
+ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
70
+ int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
71
+ const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
72
+ {
73
+ mlk_polyvec_basemul_acc_montgomery_cached_asm_k2(r, a, b, b_cache);
74
+ return MLK_NATIVE_FUNC_SUCCESS;
75
+ }
76
+ #endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 */
77
+
78
+ #if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3
79
+ MLK_MUST_CHECK_RETURN_VALUE
80
+ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
81
+ int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
82
+ const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
83
+ {
84
+ mlk_polyvec_basemul_acc_montgomery_cached_asm_k3(r, a, b, b_cache);
85
+ return MLK_NATIVE_FUNC_SUCCESS;
86
+ }
87
+ #endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3 */
88
+
89
+ #if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
90
+ MLK_MUST_CHECK_RETURN_VALUE
91
+ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
92
+ int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
93
+ const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
94
+ {
95
+ mlk_polyvec_basemul_acc_montgomery_cached_asm_k4(r, a, b, b_cache);
96
+ return MLK_NATIVE_FUNC_SUCCESS;
97
+ }
98
+ #endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
99
+
100
+ MLK_MUST_CHECK_RETURN_VALUE
101
+ static MLK_INLINE int mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
102
+ const int16_t a[MLKEM_N])
103
+ {
104
+ mlk_poly_tobytes_asm(r, a);
105
+ return MLK_NATIVE_FUNC_SUCCESS;
106
+ }
107
+
108
+ MLK_MUST_CHECK_RETURN_VALUE
109
+ static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len,
110
+ const uint8_t *buf,
111
+ unsigned buflen)
112
+ {
113
+ if (len != MLKEM_N ||
114
+ buflen % 24 != 0) /* NEON support is mandatory for AArch64 */
115
+ {
116
+ return MLK_NATIVE_FUNC_FALLBACK;
117
+ }
118
+ return (int)mlk_rej_uniform_asm(r, buf, buflen, mlk_rej_uniform_table);
119
+ }
120
+ #endif /* !__ASSEMBLER__ */
121
+
122
+ #endif /* !MLK_NATIVE_AARCH64_META_H */
@@ -0,0 +1,174 @@
1
+ /*
2
+ * Copyright (c) The mlkem-native project authors
3
+ * SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
4
+ */
5
+
6
+ /*
7
+ * WARNING: This file is auto-generated from scripts/autogen
8
+ * in the mlkem-native repository.
9
+ * Do not modify it directly.
10
+ */
11
+
12
+ #include "../../../common.h"
13
+
14
+ #if defined(MLK_ARITH_BACKEND_AARCH64) && \
15
+ !defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
16
+
17
+ #include "arith_native_aarch64.h"
18
+
19
+ /*
20
+ * Table of zeta values used in the AArch64 forward NTT
21
+ * See autogen for details.
22
+ */
23
+ MLK_ALIGN const int16_t mlk_aarch64_ntt_zetas_layer12345[] = {
24
+ -1600, -15749, -749, -7373, -40, -394, -687, -6762, 630, 6201,
25
+ -1432, -14095, 848, 8347, 0, 0, 1062, 10453, 296, 2914,
26
+ -882, -8682, 0, 0, -1410, -13879, 1339, 13180, 1476, 14529,
27
+ 0, 0, 193, 1900, -283, -2786, 56, 551, 0, 0,
28
+ 797, 7845, -1089, -10719, 1333, 13121, 0, 0, -543, -5345,
29
+ 1426, 14036, -1235, -12156, 0, 0, -69, -679, 535, 5266,
30
+ -447, -4400, 0, 0, 569, 5601, -936, -9213, -450, -4429,
31
+ 0, 0, -1583, -15582, -1355, -13338, 821, 8081, 0, 0,
32
+ };
33
+
34
+ MLK_ALIGN const int16_t mlk_aarch64_ntt_zetas_layer67[] = {
35
+ 289, 289, 331, 331, -76, -76, -1573, -1573, 2845,
36
+ 2845, 3258, 3258, -748, -748, -15483, -15483, 17, 17,
37
+ 583, 583, 1637, 1637, -1041, -1041, 167, 167, 5739,
38
+ 5739, 16113, 16113, -10247, -10247, -568, -568, -680, -680,
39
+ 723, 723, 1100, 1100, -5591, -5591, -6693, -6693, 7117,
40
+ 7117, 10828, 10828, 1197, 1197, -1025, -1025, -1052, -1052,
41
+ -1274, -1274, 11782, 11782, -10089, -10089, -10355, -10355, -12540,
42
+ -12540, 1409, 1409, -48, -48, 756, 756, -314, -314,
43
+ 13869, 13869, -472, -472, 7441, 7441, -3091, -3091, -667,
44
+ -667, 233, 233, -1173, -1173, -279, -279, -6565, -6565,
45
+ 2293, 2293, -11546, -11546, -2746, -2746, 650, 650, -1352,
46
+ -1352, -816, -816, 632, 632, 6398, 6398, -13308, -13308,
47
+ -8032, -8032, 6221, 6221, -1626, -1626, -540, -540, -1482,
48
+ -1482, 1461, 1461, -16005, -16005, -5315, -5315, -14588, -14588,
49
+ 14381, 14381, 1651, 1651, -1540, -1540, 952, 952, -642,
50
+ -642, 16251, 16251, -15159, -15159, 9371, 9371, -6319, -6319,
51
+ -464, -464, 33, 33, 1320, 1320, -1414, -1414, -4567,
52
+ -4567, 325, 325, 12993, 12993, -13918, -13918, 939, 939,
53
+ -892, -892, 733, 733, 268, 268, 9243, 9243, -8780,
54
+ -8780, 7215, 7215, 2638, 2638, -1021, -1021, -941, -941,
55
+ -992, -992, 641, 641, -10050, -10050, -9262, -9262, -9764,
56
+ -9764, 6309, 6309, -1010, -1010, 1435, 1435, 807, 807,
57
+ 452, 452, -9942, -9942, 14125, 14125, 7943, 7943, 4449,
58
+ 4449, 1584, 1584, -1292, -1292, 375, 375, -1239, -1239,
59
+ 15592, 15592, -12717, -12717, 3691, 3691, -12196, -12196, -1031,
60
+ -1031, -109, -109, -780, -780, 1645, 1645, -10148, -10148,
61
+ -1073, -1073, -7678, -7678, 16192, 16192, 1438, 1438, -461,
62
+ -461, 1534, 1534, -927, -927, 14155, 14155, -4538, -4538,
63
+ 15099, 15099, -9125, -9125, 1063, 1063, -556, -556, -1230,
64
+ -1230, -863, -863, 10463, 10463, -5473, -5473, -12107, -12107,
65
+ -8495, -8495, 319, 319, 757, 757, 561, 561, -735,
66
+ -735, 3140, 3140, 7451, 7451, 5522, 5522, -7235, -7235,
67
+ -682, -682, -712, -712, 1481, 1481, 648, 648, -6713,
68
+ -6713, -7008, -7008, 14578, 14578, 6378, 6378, -525, -525,
69
+ 403, 403, 1143, 1143, -554, -554, -5168, -5168, 3967,
70
+ 3967, 11251, 11251, -5453, -5453, 1092, 1092, 1026, 1026,
71
+ -1179, -1179, 886, 886, 10749, 10749, 10099, 10099, -11605,
72
+ -11605, 8721, 8721, -855, -855, -219, -219, 1227, 1227,
73
+ 910, 910, -8416, -8416, -2156, -2156, 12078, 12078, 8957,
74
+ 8957, -1607, -1607, -1455, -1455, -1219, -1219, 885, 885,
75
+ -15818, -15818, -14322, -14322, -11999, -11999, 8711, 8711, 1212,
76
+ 1212, 1029, 1029, -394, -394, -1175, -1175, 11930, 11930,
77
+ 10129, 10129, -3878, -3878, -11566, -11566,
78
+ };
79
+
80
+ MLK_ALIGN const int16_t mlk_aarch64_invntt_zetas_layer12345[] = {
81
+ 1583, 15582, -821, -8081, 1355, 13338, 0, 0, -569, -5601,
82
+ 450, 4429, 936, 9213, 0, 0, 69, 679, 447, 4400,
83
+ -535, -5266, 0, 0, 543, 5345, 1235, 12156, -1426, -14036,
84
+ 0, 0, -797, -7845, -1333, -13121, 1089, 10719, 0, 0,
85
+ -193, -1900, -56, -551, 283, 2786, 0, 0, 1410, 13879,
86
+ -1476, -14529, -1339, -13180, 0, 0, -1062, -10453, 882, 8682,
87
+ -296, -2914, 0, 0, 1600, 15749, 40, 394, 749, 7373,
88
+ -848, -8347, 1432, 14095, -630, -6201, 687, 6762, 0, 0,
89
+ };
90
+
91
+ MLK_ALIGN const int16_t mlk_aarch64_invntt_zetas_layer67[] = {
92
+ -910, -910, -1227, -1227, 219, 219, 855, 855, -8957,
93
+ -8957, -12078, -12078, 2156, 2156, 8416, 8416, 1175, 1175,
94
+ 394, 394, -1029, -1029, -1212, -1212, 11566, 11566, 3878,
95
+ 3878, -10129, -10129, -11930, -11930, -885, -885, 1219, 1219,
96
+ 1455, 1455, 1607, 1607, -8711, -8711, 11999, 11999, 14322,
97
+ 14322, 15818, 15818, -648, -648, -1481, -1481, 712, 712,
98
+ 682, 682, -6378, -6378, -14578, -14578, 7008, 7008, 6713,
99
+ 6713, -886, -886, 1179, 1179, -1026, -1026, -1092, -1092,
100
+ -8721, -8721, 11605, 11605, -10099, -10099, -10749, -10749, 554,
101
+ 554, -1143, -1143, -403, -403, 525, 525, 5453, 5453,
102
+ -11251, -11251, -3967, -3967, 5168, 5168, 927, 927, -1534,
103
+ -1534, 461, 461, -1438, -1438, 9125, 9125, -15099, -15099,
104
+ 4538, 4538, -14155, -14155, 735, 735, -561, -561, -757,
105
+ -757, -319, -319, 7235, 7235, -5522, -5522, -7451, -7451,
106
+ -3140, -3140, 863, 863, 1230, 1230, 556, 556, -1063,
107
+ -1063, 8495, 8495, 12107, 12107, 5473, 5473, -10463, -10463,
108
+ -452, -452, -807, -807, -1435, -1435, 1010, 1010, -4449,
109
+ -4449, -7943, -7943, -14125, -14125, 9942, 9942, -1645, -1645,
110
+ 780, 780, 109, 109, 1031, 1031, -16192, -16192, 7678,
111
+ 7678, 1073, 1073, 10148, 10148, 1239, 1239, -375, -375,
112
+ 1292, 1292, -1584, -1584, 12196, 12196, -3691, -3691, 12717,
113
+ 12717, -15592, -15592, 1414, 1414, -1320, -1320, -33, -33,
114
+ 464, 464, 13918, 13918, -12993, -12993, -325, -325, 4567,
115
+ 4567, -641, -641, 992, 992, 941, 941, 1021, 1021,
116
+ -6309, -6309, 9764, 9764, 9262, 9262, 10050, 10050, -268,
117
+ -268, -733, -733, 892, 892, -939, -939, -2638, -2638,
118
+ -7215, -7215, 8780, 8780, -9243, -9243, -632, -632, 816,
119
+ 816, 1352, 1352, -650, -650, -6221, -6221, 8032, 8032,
120
+ 13308, 13308, -6398, -6398, 642, 642, -952, -952, 1540,
121
+ 1540, -1651, -1651, 6319, 6319, -9371, -9371, 15159, 15159,
122
+ -16251, -16251, -1461, -1461, 1482, 1482, 540, 540, 1626,
123
+ 1626, -14381, -14381, 14588, 14588, 5315, 5315, 16005, 16005,
124
+ 1274, 1274, 1052, 1052, 1025, 1025, -1197, -1197, 12540,
125
+ 12540, 10355, 10355, 10089, 10089, -11782, -11782, 279, 279,
126
+ 1173, 1173, -233, -233, 667, 667, 2746, 2746, 11546,
127
+ 11546, -2293, -2293, 6565, 6565, 314, 314, -756, -756,
128
+ 48, 48, -1409, -1409, 3091, 3091, -7441, -7441, 472,
129
+ 472, -13869, -13869, 1573, 1573, 76, 76, -331, -331,
130
+ -289, -289, 15483, 15483, 748, 748, -3258, -3258, -2845,
131
+ -2845, -1100, -1100, -723, -723, 680, 680, 568, 568,
132
+ -10828, -10828, -7117, -7117, 6693, 6693, 5591, 5591, 1041,
133
+ 1041, -1637, -1637, -583, -583, -17, -17, 10247, 10247,
134
+ -16113, -16113, -5739, -5739, -167, -167,
135
+ };
136
+
137
+ MLK_ALIGN const int16_t mlk_aarch64_zetas_mulcache_native[] = {
138
+ 17, -17, -568, 568, 583, -583, -680, 680, 1637, -1637, 723,
139
+ -723, -1041, 1041, 1100, -1100, 1409, -1409, -667, 667, -48, 48,
140
+ 233, -233, 756, -756, -1173, 1173, -314, 314, -279, 279, -1626,
141
+ 1626, 1651, -1651, -540, 540, -1540, 1540, -1482, 1482, 952, -952,
142
+ 1461, -1461, -642, 642, 939, -939, -1021, 1021, -892, 892, -941,
143
+ 941, 733, -733, -992, 992, 268, -268, 641, -641, 1584, -1584,
144
+ -1031, 1031, -1292, 1292, -109, 109, 375, -375, -780, 780, -1239,
145
+ 1239, 1645, -1645, 1063, -1063, 319, -319, -556, 556, 757, -757,
146
+ -1230, 1230, 561, -561, -863, 863, -735, 735, -525, 525, 1092,
147
+ -1092, 403, -403, 1026, -1026, 1143, -1143, -1179, 1179, -554, 554,
148
+ 886, -886, -1607, 1607, 1212, -1212, -1455, 1455, 1029, -1029, -1219,
149
+ 1219, -394, 394, 885, -885, -1175, 1175,
150
+ };
151
+
152
+ MLK_ALIGN const int16_t mlk_aarch64_zetas_mulcache_twisted_native[] = {
153
+ 167, -167, -5591, 5591, 5739, -5739, -6693, 6693, 16113,
154
+ -16113, 7117, -7117, -10247, 10247, 10828, -10828, 13869, -13869,
155
+ -6565, 6565, -472, 472, 2293, -2293, 7441, -7441, -11546,
156
+ 11546, -3091, 3091, -2746, 2746, -16005, 16005, 16251, -16251,
157
+ -5315, 5315, -15159, 15159, -14588, 14588, 9371, -9371, 14381,
158
+ -14381, -6319, 6319, 9243, -9243, -10050, 10050, -8780, 8780,
159
+ -9262, 9262, 7215, -7215, -9764, 9764, 2638, -2638, 6309,
160
+ -6309, 15592, -15592, -10148, 10148, -12717, 12717, -1073, 1073,
161
+ 3691, -3691, -7678, 7678, -12196, 12196, 16192, -16192, 10463,
162
+ -10463, 3140, -3140, -5473, 5473, 7451, -7451, -12107, 12107,
163
+ 5522, -5522, -8495, 8495, -7235, 7235, -5168, 5168, 10749,
164
+ -10749, 3967, -3967, 10099, -10099, 11251, -11251, -11605, 11605,
165
+ -5453, 5453, 8721, -8721, -15818, 15818, 11930, -11930, -14322,
166
+ 14322, 10129, -10129, -11999, 11999, -3878, 3878, 8711, -8711,
167
+ -11566, 11566,
168
+ };
169
+
170
+ #else /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED */
171
+
172
+ MLK_EMPTY_CU(aarch64_zetas)
173
+
174
+ #endif /* !(MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED) */