pq_crypto 0.4.2 → 0.5.1
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.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +27 -2
- data/CHANGELOG.md +59 -0
- data/GET_STARTED.md +21 -16
- data/README.md +26 -0
- data/SECURITY.md +22 -16
- data/ext/pqcrypto/extconf.rb +183 -99
- data/ext/pqcrypto/mldsa_api.h +1 -118
- data/ext/pqcrypto/mlkem_api.h +1 -42
- data/ext/pqcrypto/pq_externalmu.c +88 -216
- data/ext/pqcrypto/pqcrypto_native_api.h +132 -0
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +234 -12
- data/ext/pqcrypto/pqcrypto_secure.c +429 -334
- data/ext/pqcrypto/pqcrypto_secure.h +13 -45
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/randombytes.h +9 -0
- data/ext/pqcrypto/vendor/.vendored +12 -5
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +105 -0
- data/ext/pqcrypto/vendor/mldsa-native/LICENSE +286 -0
- data/ext/pqcrypto/vendor/mldsa-native/META.yml +24 -0
- data/ext/pqcrypto/vendor/mldsa-native/README.md +221 -0
- data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +8 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +721 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +975 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +724 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +723 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +166 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +321 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c +21 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +385 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +73 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +277 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +244 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +182 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +117 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +438 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +105 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +71 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +62 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +376 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +204 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +259 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1077 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +987 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +41 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +26 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +35 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +37 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +27 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +36 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +69 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +32 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +20 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +638 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +136 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +29 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +488 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +16 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/xkcp.h +31 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +247 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +231 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +150 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +753 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +129 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +145 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +177 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +79 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +55 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +85 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +85 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +102 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +110 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +72 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +69 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +40 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +189 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +135 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +128 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +543 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +62 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +649 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +23 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +315 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +124 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +2311 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +2383 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +239 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +131 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +187 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +61 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +102 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +104 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +91 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +93 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +126 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +160 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +293 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +224 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +77 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +991 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +393 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +946 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +360 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +877 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +725 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +249 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +1511 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +806 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +268 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +104 -0
- data/ext/pqcrypto/vendor/mlkem-native/LICENSE +294 -0
- data/ext/pqcrypto/vendor/mlkem-native/META.yml +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/README.md +223 -0
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +86 -0
- data/ext/pqcrypto/vendor/mlkem-native/SECURITY.md +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +23 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +660 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +538 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +681 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +709 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +274 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +717 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +688 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +64 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +128 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +251 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +158 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +208 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +80 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +463 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +98 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +70 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +375 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +203 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +258 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1076 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +986 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +46 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +34 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +26 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +117 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/README.md +10 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +79 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +667 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +40 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +290 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +314 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +28 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +33 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +41 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2.S +451 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +622 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +156 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +446 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +326 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/README.md +16 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +122 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +177 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/intt.S +628 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/ntt.S +562 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_mulcache_compute_asm.S +127 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_reduce_asm.S +150 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tobytes_asm.S +117 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tomont_asm.S +98 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +261 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +314 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +368 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_asm.S +226 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +542 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +637 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md +11 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +128 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +45 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +81 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +145 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_izetas.inc +27 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +805 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas.inc +27 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas_basemul.inc +39 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/README.md +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +304 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +309 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +94 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +45 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +102 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/intt.S +719 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mulcache_compute.S +90 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntt.S +639 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttfrombytes.S +193 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntttobytes.S +181 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttunpack.S +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d10.S +382 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d11.S +448 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d4.S +163 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d5.S +220 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d10.S +228 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d11.S +277 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d4.S +180 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d5.S +192 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +502 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +750 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +998 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/reduce.S +218 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_asm.S +103 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +544 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont.S +155 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h +76 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +572 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +317 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +502 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +668 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +60 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +362 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +118 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/symmetric.h +70 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +260 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.c +20 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +464 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/zetas.inc +30 -0
- data/lib/pq_crypto/hybrid_kem.rb +10 -1
- data/lib/pq_crypto/version.rb +1 -1
- data/lib/pq_crypto.rb +5 -1
- data/script/vendor_libs.rb +228 -154
- metadata +236 -160
- data/ext/pqcrypto/vendor/pqclean/common/aes.c +0 -639
- data/ext/pqcrypto/vendor/pqclean/common/aes.h +0 -64
- data/ext/pqcrypto/vendor/pqclean/common/compat.h +0 -73
- data/ext/pqcrypto/vendor/pqclean/common/crypto_declassify.h +0 -7
- data/ext/pqcrypto/vendor/pqclean/common/fips202.c +0 -928
- data/ext/pqcrypto/vendor/pqclean/common/fips202.h +0 -166
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/feat.S +0 -168
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.c +0 -684
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.h +0 -60
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SIMD256.c +0 -1028
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SnP.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-unrolling.macros +0 -198
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile +0 -8
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile.Microsoft_nmake +0 -8
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/SIMD256-config.h +0 -3
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/align.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/brg_endian.h +0 -142
- data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.c +0 -101
- data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.h +0 -39
- data/ext/pqcrypto/vendor/pqclean/common/randombytes.c +0 -355
- data/ext/pqcrypto/vendor/pqclean/common/randombytes.h +0 -27
- data/ext/pqcrypto/vendor/pqclean/common/sha2.c +0 -769
- data/ext/pqcrypto/vendor/pqclean/common/sha2.h +0 -173
- data/ext/pqcrypto/vendor/pqclean/common/sp800-185.c +0 -156
- data/ext/pqcrypto/vendor/pqclean/common/sp800-185.h +0 -27
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.c +0 -83
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.c +0 -311
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.c +0 -198
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.c +0 -108
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.c +0 -299
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.c +0 -188
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.c +0 -83
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.c +0 -299
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.c +0 -188
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.c +0 -848
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.c +0 -799
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.c +0 -92
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.c +0 -823
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.c +0 -92
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric.h +0 -34
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#include "../../../../common.h"
|
|
7
|
+
|
|
8
|
+
#if defined(MLK_FIPS202_ARMV81M_NEED_X4) && \
|
|
9
|
+
!defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
|
|
10
|
+
|
|
11
|
+
#include "fips202_native_armv81m.h"
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Keccak round constants in bit-interleaved form.
|
|
15
|
+
* Each 64-bit constant is split into two 32-bit words:
|
|
16
|
+
* - low word contains even-indexed bits
|
|
17
|
+
* - high word contains odd-indexed bits
|
|
18
|
+
*/
|
|
19
|
+
MLK_ALIGN const uint32_t mlk_keccakf1600_round_constants[48] = {
|
|
20
|
+
0x00000001, 0x00000000, /* RC0 */
|
|
21
|
+
0x00000000, 0x00000089, /* RC1 */
|
|
22
|
+
0x00000000, 0x8000008b, /* RC2 */
|
|
23
|
+
0x00000000, 0x80008080, /* RC3 */
|
|
24
|
+
0x00000001, 0x0000008b, /* RC4 */
|
|
25
|
+
0x00000001, 0x00008000, /* RC5 */
|
|
26
|
+
0x00000001, 0x80008088, /* RC6 */
|
|
27
|
+
0x00000001, 0x80000082, /* RC7 */
|
|
28
|
+
0x00000000, 0x0000000b, /* RC8 */
|
|
29
|
+
0x00000000, 0x0000000a, /* RC9 */
|
|
30
|
+
0x00000001, 0x00008082, /* RC10 */
|
|
31
|
+
0x00000000, 0x00008003, /* RC11 */
|
|
32
|
+
0x00000001, 0x0000808b, /* RC12 */
|
|
33
|
+
0x00000001, 0x8000000b, /* RC13 */
|
|
34
|
+
0x00000001, 0x8000008a, /* RC14 */
|
|
35
|
+
0x00000001, 0x80000081, /* RC15 */
|
|
36
|
+
0x00000000, 0x80000081, /* RC16 */
|
|
37
|
+
0x00000000, 0x80000008, /* RC17 */
|
|
38
|
+
0x00000000, 0x00000083, /* RC18 */
|
|
39
|
+
0x00000000, 0x80008003, /* RC19 */
|
|
40
|
+
0x00000001, 0x80008088, /* RC20 */
|
|
41
|
+
0x00000000, 0x80000088, /* RC21 */
|
|
42
|
+
0x00000001, 0x00008000, /* RC22 */
|
|
43
|
+
0x00000000, 0x80008082, /* RC23 */
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
#else /* MLK_FIPS202_ARMV81M_NEED_X4 && !MLK_CONFIG_MULTILEVEL_NO_SHARED */
|
|
47
|
+
|
|
48
|
+
MLK_EMPTY_CU(fips202_armv81m_round_constants)
|
|
49
|
+
|
|
50
|
+
#endif /* !(MLK_FIPS202_ARMV81M_NEED_X4 && !MLK_CONFIG_MULTILEVEL_NO_SHARED) \
|
|
51
|
+
*/
|
|
@@ -0,0 +1,290 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* Copyright (c) The mldsa-native project authors
|
|
4
|
+
* Copyright (c) 2026 Arm Limited
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Overview
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// MVE/Helium implementation of KeccakF1600x4_StateExtractBytes
|
|
12
|
+
// (inverse of state_xor_bytes_x4_mve.S).
|
|
13
|
+
//
|
|
14
|
+
// void KeccakF1600x4_StateExtractBytes(state, d0, d1, d2, d3, offset, length)
|
|
15
|
+
//
|
|
16
|
+
// Reads 'length' bytes from the bit-interleaved Keccak state starting at
|
|
17
|
+
// byte 'offset', recombines the even and odd halves of each lane back
|
|
18
|
+
// into plain bytes, and writes them to four output buffers (d0..d3).
|
|
19
|
+
//
|
|
20
|
+
// ---------------------------------------------------------------------------
|
|
21
|
+
// Bit-interleaving background
|
|
22
|
+
// ---------------------------------------------------------------------------
|
|
23
|
+
// Each 64-bit Keccak lane is stored as two 32-bit words:
|
|
24
|
+
// even half -- bits 0, 2, 4, ..., 62 of the lane
|
|
25
|
+
// odd half -- bits 1, 3, 5, ..., 63 of the lane
|
|
26
|
+
// This representation allows 64-bit lane rotations (used in the Keccak
|
|
27
|
+
// round function) to be implemented as pairs of 32-bit rotations.
|
|
28
|
+
//
|
|
29
|
+
// Batched (x4) processing:
|
|
30
|
+
// Four Keccak instances are processed as a batch. Their states are
|
|
31
|
+
// stored interleaved in a single 800-byte buffer: first the even
|
|
32
|
+
// halves of all 25 lanes (400 bytes), then the odd halves (400 bytes).
|
|
33
|
+
// Within each 16-byte row, the four u32 words correspond to
|
|
34
|
+
// instances 0..3 of the same lane, enabling SIMD-parallel operations
|
|
35
|
+
// across all four instances.
|
|
36
|
+
//
|
|
37
|
+
// State memory layout (25 lanes x 4 instances x 2 halves):
|
|
38
|
+
// S[i][l]_even/odd = even/odd half of lane l, instance i (u32)
|
|
39
|
+
// Each row is 16 bytes (one Q-register).
|
|
40
|
+
// Offset Contents
|
|
41
|
+
// 0 S[0][ 0]_even, S[1][ 0]_even, S[2][ 0]_even, S[3][ 0]_even
|
|
42
|
+
// 16 S[0][ 1]_even, S[1][ 1]_even, S[2][ 1]_even, S[3][ 1]_even
|
|
43
|
+
// ...
|
|
44
|
+
// 384 S[0][24]_even, S[1][24]_even, S[2][24]_even, S[3][24]_even
|
|
45
|
+
// 400 S[0][ 0]_odd, S[1][ 0]_odd, S[2][ 0]_odd, S[3][ 0]_odd
|
|
46
|
+
// 416 S[0][ 1]_odd, S[1][ 1]_odd, S[2][ 1]_odd, S[3][ 1]_odd
|
|
47
|
+
// ...
|
|
48
|
+
// 784 S[0][24]_odd, S[1][24]_odd, S[2][24]_odd, S[3][24]_odd
|
|
49
|
+
//
|
|
50
|
+
// ---------------------------------------------------------------------------
|
|
51
|
+
// Three-phase structure
|
|
52
|
+
// ---------------------------------------------------------------------------
|
|
53
|
+
// Prologue -- if offset is not 8-byte aligned, extract
|
|
54
|
+
// min(length, 8-(offset%8)) bytes via predicated byte stores.
|
|
55
|
+
// Main -- process full 8-byte groups: load even/odd lane pair,
|
|
56
|
+
// de-interleave, scatter-store to output buffers.
|
|
57
|
+
// Tail -- extract remaining <8 bytes via predicated byte stores.
|
|
58
|
+
|
|
59
|
+
#include "../../../../common.h"
|
|
60
|
+
#if defined(MLK_FIPS202_ARMV81M_NEED_X4) && \
|
|
61
|
+
!defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* WARNING: This file is auto-derived from the mlkem-native source file
|
|
65
|
+
* dev/fips202/armv81m/src/state_extract_bytes_x4_mve.S using scripts/simpasm. Do not modify it directly.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
.thumb
|
|
69
|
+
.syntax unified
|
|
70
|
+
|
|
71
|
+
.text
|
|
72
|
+
.balign 4
|
|
73
|
+
.global MLK_ASM_NAMESPACE(keccak_f1600_x4_state_extract_bytes_asm)
|
|
74
|
+
MLK_ASM_FN_SYMBOL(keccak_f1600_x4_state_extract_bytes_asm)
|
|
75
|
+
|
|
76
|
+
push.w {r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
|
|
77
|
+
vpush {d8, d9, d10, d11, d12, d13, d14, d15}
|
|
78
|
+
ldr r4, [sp, #0x68]
|
|
79
|
+
ldr.w r10, [sp, #0x6c]
|
|
80
|
+
ldr r6, [sp, #0x70]
|
|
81
|
+
cmp r6, #0x0
|
|
82
|
+
beq.w keccak_f1600_x4_state_extract_bytes_asm_exit @ imm = #0x2ea
|
|
83
|
+
and r5, r10, #0x7
|
|
84
|
+
bic r9, r10, #0x7
|
|
85
|
+
add.w r8, r0, r9, lsl #1
|
|
86
|
+
add.w r7, r8, #0x190
|
|
87
|
+
cmp r5, #0x0
|
|
88
|
+
beq.w keccak_f1600_x4_state_extract_bytes_asm_pre_main @ imm = #0x112
|
|
89
|
+
vldrw.u32 q0, [r8], #16
|
|
90
|
+
vldrw.u32 q1, [r7], #16
|
|
91
|
+
vrev32.16 q2, q0
|
|
92
|
+
vrev32.16 q3, q1
|
|
93
|
+
vsli.32 q0, q0, #0x8
|
|
94
|
+
vsli.16 q0, q0, #0x4
|
|
95
|
+
vsli.8 q0, q0, #0x1
|
|
96
|
+
vshr.u8 q4, q0, #0x3
|
|
97
|
+
vsli.8 q0, q4, #0x4
|
|
98
|
+
vshr.u8 q4, q0, #0x5
|
|
99
|
+
vsli.8 q0, q4, #0x6
|
|
100
|
+
vsli.32 q1, q1, #0x8
|
|
101
|
+
vsli.16 q1, q1, #0x4
|
|
102
|
+
vsli.8 q1, q1, #0x1
|
|
103
|
+
vshr.u8 q4, q1, #0x3
|
|
104
|
+
vsli.8 q1, q4, #0x4
|
|
105
|
+
vshr.u8 q4, q1, #0x5
|
|
106
|
+
vsli.8 q1, q4, #0x6
|
|
107
|
+
mov.w r0, #0x55
|
|
108
|
+
vdup.8 q4, r0
|
|
109
|
+
vand q0, q0, q4
|
|
110
|
+
vand q1, q1, q4
|
|
111
|
+
vshl.i32 q1, q1, #0x1
|
|
112
|
+
vorr q0, q0, q1
|
|
113
|
+
vsli.32 q2, q2, #0x8
|
|
114
|
+
vsli.16 q2, q2, #0x4
|
|
115
|
+
vsli.8 q2, q2, #0x1
|
|
116
|
+
vshr.u8 q1, q2, #0x3
|
|
117
|
+
vsli.8 q2, q1, #0x4
|
|
118
|
+
vshr.u8 q1, q2, #0x5
|
|
119
|
+
vsli.8 q2, q1, #0x6
|
|
120
|
+
vsli.32 q3, q3, #0x8
|
|
121
|
+
vsli.16 q3, q3, #0x4
|
|
122
|
+
vsli.8 q3, q3, #0x1
|
|
123
|
+
vshr.u8 q1, q3, #0x3
|
|
124
|
+
vsli.8 q3, q1, #0x4
|
|
125
|
+
vshr.u8 q1, q3, #0x5
|
|
126
|
+
vsli.8 q3, q1, #0x6
|
|
127
|
+
vand q1, q2, q4
|
|
128
|
+
vand q3, q3, q4
|
|
129
|
+
vshl.i32 q3, q3, #0x1
|
|
130
|
+
vorr q1, q1, q3
|
|
131
|
+
vrev64.32 q2, q0
|
|
132
|
+
vrev64.32 q3, q1
|
|
133
|
+
movw r0, #0xf0f
|
|
134
|
+
vmsr p0, r0
|
|
135
|
+
vpsel q0, q0, q3
|
|
136
|
+
vpsel q1, q2, q1
|
|
137
|
+
vmov.f64 d4, d1
|
|
138
|
+
vmov.f64 d6, d3
|
|
139
|
+
rsb.w lr, r5, #0x8
|
|
140
|
+
cmp r6, lr
|
|
141
|
+
it ls
|
|
142
|
+
movls lr, r6
|
|
143
|
+
vctp.8 lr
|
|
144
|
+
vmrs r11, p0
|
|
145
|
+
lsl.w r11, r11, r5
|
|
146
|
+
vmsr p0, r11
|
|
147
|
+
subs r1, r1, r5
|
|
148
|
+
subs r2, r2, r5
|
|
149
|
+
subs r3, r3, r5
|
|
150
|
+
subs r4, r4, r5
|
|
151
|
+
vpstttt
|
|
152
|
+
vstrbt.8 q0, [r1], #4
|
|
153
|
+
vstrbt.8 q1, [r2], #4
|
|
154
|
+
vstrbt.8 q2, [r3], #4
|
|
155
|
+
vstrbt.8 q3, [r4], #4
|
|
156
|
+
subs.w r6, r6, lr
|
|
157
|
+
cmp r6, #0x0
|
|
158
|
+
beq.w keccak_f1600_x4_state_extract_bytes_asm_exit @ imm = #0x1cc
|
|
159
|
+
vmov q7[2], q7[0], r1, r3
|
|
160
|
+
vmov q7[3], q7[1], r2, r4
|
|
161
|
+
b keccak_f1600_x4_state_extract_bytes_asm_main_body @ imm = #0xe
|
|
162
|
+
|
|
163
|
+
keccak_f1600_x4_state_extract_bytes_asm_pre_main:
|
|
164
|
+
vmov q7[2], q7[0], r1, r3
|
|
165
|
+
vmov q7[3], q7[1], r2, r4
|
|
166
|
+
mov.w r12, #0x4
|
|
167
|
+
vsub.i32 q7, q7, r12
|
|
168
|
+
|
|
169
|
+
keccak_f1600_x4_state_extract_bytes_asm_main_body:
|
|
170
|
+
lsr.w lr, r6, #0x3
|
|
171
|
+
wls lr, lr, keccak_f1600_x4_state_extract_bytes_asm_main_loop_end @ imm = #0xb4
|
|
172
|
+
|
|
173
|
+
keccak_f1600_x4_state_extract_bytes_asm_main_loop_start:
|
|
174
|
+
vldrw.u32 q0, [r8], #16
|
|
175
|
+
vldrw.u32 q1, [r7], #16
|
|
176
|
+
vrev32.16 q2, q0
|
|
177
|
+
vrev32.16 q3, q1
|
|
178
|
+
vsli.32 q0, q0, #0x8
|
|
179
|
+
vsli.16 q0, q0, #0x4
|
|
180
|
+
vsli.8 q0, q0, #0x1
|
|
181
|
+
vshr.u8 q4, q0, #0x3
|
|
182
|
+
vsli.8 q0, q4, #0x4
|
|
183
|
+
vshr.u8 q4, q0, #0x5
|
|
184
|
+
vsli.8 q0, q4, #0x6
|
|
185
|
+
vsli.32 q1, q1, #0x8
|
|
186
|
+
vsli.16 q1, q1, #0x4
|
|
187
|
+
vsli.8 q1, q1, #0x1
|
|
188
|
+
vshr.u8 q4, q1, #0x3
|
|
189
|
+
vsli.8 q1, q4, #0x4
|
|
190
|
+
vshr.u8 q4, q1, #0x5
|
|
191
|
+
vsli.8 q1, q4, #0x6
|
|
192
|
+
mov.w r0, #0x55
|
|
193
|
+
vdup.8 q4, r0
|
|
194
|
+
vand q0, q0, q4
|
|
195
|
+
vand q1, q1, q4
|
|
196
|
+
vshl.i32 q1, q1, #0x1
|
|
197
|
+
vorr q0, q0, q1
|
|
198
|
+
vsli.32 q2, q2, #0x8
|
|
199
|
+
vsli.16 q2, q2, #0x4
|
|
200
|
+
vsli.8 q2, q2, #0x1
|
|
201
|
+
vshr.u8 q1, q2, #0x3
|
|
202
|
+
vsli.8 q2, q1, #0x4
|
|
203
|
+
vshr.u8 q1, q2, #0x5
|
|
204
|
+
vsli.8 q2, q1, #0x6
|
|
205
|
+
vsli.32 q3, q3, #0x8
|
|
206
|
+
vsli.16 q3, q3, #0x4
|
|
207
|
+
vsli.8 q3, q3, #0x1
|
|
208
|
+
vshr.u8 q1, q3, #0x3
|
|
209
|
+
vsli.8 q3, q1, #0x4
|
|
210
|
+
vshr.u8 q1, q3, #0x5
|
|
211
|
+
vsli.8 q3, q1, #0x6
|
|
212
|
+
vand q1, q2, q4
|
|
213
|
+
vand q3, q3, q4
|
|
214
|
+
vshl.i32 q3, q3, #0x1
|
|
215
|
+
vorr q1, q1, q3
|
|
216
|
+
vstrw.32 q0, [q7, #4]!
|
|
217
|
+
vstrw.32 q1, [q7, #4]!
|
|
218
|
+
le lr, keccak_f1600_x4_state_extract_bytes_asm_main_loop_start @ imm = #-0xb4
|
|
219
|
+
|
|
220
|
+
keccak_f1600_x4_state_extract_bytes_asm_main_loop_end:
|
|
221
|
+
ands r6, r6, #0x7
|
|
222
|
+
beq keccak_f1600_x4_state_extract_bytes_asm_exit @ imm = #0xee
|
|
223
|
+
mov.w r12, #0x4
|
|
224
|
+
vadd.i32 q7, q7, r12
|
|
225
|
+
vmov r1, r3, q7[2], q7[0]
|
|
226
|
+
vmov r2, r4, q7[3], q7[1]
|
|
227
|
+
vldrw.u32 q0, [r8], #16
|
|
228
|
+
vldrw.u32 q1, [r7], #16
|
|
229
|
+
vrev32.16 q2, q0
|
|
230
|
+
vrev32.16 q3, q1
|
|
231
|
+
vsli.32 q0, q0, #0x8
|
|
232
|
+
vsli.16 q0, q0, #0x4
|
|
233
|
+
vsli.8 q0, q0, #0x1
|
|
234
|
+
vshr.u8 q4, q0, #0x3
|
|
235
|
+
vsli.8 q0, q4, #0x4
|
|
236
|
+
vshr.u8 q4, q0, #0x5
|
|
237
|
+
vsli.8 q0, q4, #0x6
|
|
238
|
+
vsli.32 q1, q1, #0x8
|
|
239
|
+
vsli.16 q1, q1, #0x4
|
|
240
|
+
vsli.8 q1, q1, #0x1
|
|
241
|
+
vshr.u8 q4, q1, #0x3
|
|
242
|
+
vsli.8 q1, q4, #0x4
|
|
243
|
+
vshr.u8 q4, q1, #0x5
|
|
244
|
+
vsli.8 q1, q4, #0x6
|
|
245
|
+
mov.w r0, #0x55
|
|
246
|
+
vdup.8 q4, r0
|
|
247
|
+
vand q0, q0, q4
|
|
248
|
+
vand q1, q1, q4
|
|
249
|
+
vshl.i32 q1, q1, #0x1
|
|
250
|
+
vorr q0, q0, q1
|
|
251
|
+
vsli.32 q2, q2, #0x8
|
|
252
|
+
vsli.16 q2, q2, #0x4
|
|
253
|
+
vsli.8 q2, q2, #0x1
|
|
254
|
+
vshr.u8 q1, q2, #0x3
|
|
255
|
+
vsli.8 q2, q1, #0x4
|
|
256
|
+
vshr.u8 q1, q2, #0x5
|
|
257
|
+
vsli.8 q2, q1, #0x6
|
|
258
|
+
vsli.32 q3, q3, #0x8
|
|
259
|
+
vsli.16 q3, q3, #0x4
|
|
260
|
+
vsli.8 q3, q3, #0x1
|
|
261
|
+
vshr.u8 q1, q3, #0x3
|
|
262
|
+
vsli.8 q3, q1, #0x4
|
|
263
|
+
vshr.u8 q1, q3, #0x5
|
|
264
|
+
vsli.8 q3, q1, #0x6
|
|
265
|
+
vand q1, q2, q4
|
|
266
|
+
vand q3, q3, q4
|
|
267
|
+
vshl.i32 q3, q3, #0x1
|
|
268
|
+
vorr q1, q1, q3
|
|
269
|
+
vrev64.32 q2, q0
|
|
270
|
+
vrev64.32 q3, q1
|
|
271
|
+
movw r0, #0xf0f
|
|
272
|
+
vmsr p0, r0
|
|
273
|
+
vpsel q0, q0, q3
|
|
274
|
+
vpsel q1, q2, q1
|
|
275
|
+
vmov.f64 d4, d1
|
|
276
|
+
vmov.f64 d6, d3
|
|
277
|
+
vctp.8 r6
|
|
278
|
+
vpstttt
|
|
279
|
+
vstrbt.8 q0, [r1], #4
|
|
280
|
+
vstrbt.8 q1, [r2], #4
|
|
281
|
+
vstrbt.8 q2, [r3], #4
|
|
282
|
+
vstrbt.8 q3, [r4], #4
|
|
283
|
+
|
|
284
|
+
keccak_f1600_x4_state_extract_bytes_asm_exit:
|
|
285
|
+
vpop {d8, d9, d10, d11, d12, d13, d14, d15}
|
|
286
|
+
pop.w {r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}
|
|
287
|
+
|
|
288
|
+
MLK_ASM_FN_SIZE(keccak_f1600_x4_state_extract_bytes_asm)
|
|
289
|
+
|
|
290
|
+
#endif /* MLK_FIPS202_ARMV81M_NEED_X4 && !MLK_CONFIG_MULTILEVEL_NO_SHARED */
|
data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* Copyright (c) The mldsa-native project authors
|
|
4
|
+
* Copyright (c) 2026 Arm Limited
|
|
5
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// ---------------------------------------------------------------------------
|
|
9
|
+
// Overview
|
|
10
|
+
// ---------------------------------------------------------------------------
|
|
11
|
+
// MVE/Helium implementation of KeccakF1600x4_StateXORBytes.
|
|
12
|
+
//
|
|
13
|
+
// void KeccakF1600x4_StateXORBytes(state, d0, d1, d2, d3, offset, length)
|
|
14
|
+
//
|
|
15
|
+
// Reads 'length' plain bytes from each of four input buffers (d0..d3),
|
|
16
|
+
// splits every byte into its even and odd bits (bit-interleaving), and
|
|
17
|
+
// XORs the result into the Keccak state starting at byte 'offset'.
|
|
18
|
+
//
|
|
19
|
+
// ---------------------------------------------------------------------------
|
|
20
|
+
// Bit-interleaving background
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Each 64-bit Keccak lane is stored as two 32-bit words:
|
|
23
|
+
// even half -- bits 0, 2, 4, ..., 62 of the lane
|
|
24
|
+
// odd half -- bits 1, 3, 5, ..., 63 of the lane
|
|
25
|
+
// This representation allows 64-bit lane rotations (used in the Keccak
|
|
26
|
+
// round function) to be implemented as pairs of 32-bit rotations.
|
|
27
|
+
//
|
|
28
|
+
// Batched (x4) processing:
|
|
29
|
+
// Four Keccak instances are processed as a batch. Their states are
|
|
30
|
+
// stored interleaved in a single 800-byte buffer: first the even
|
|
31
|
+
// halves of all 25 lanes (400 bytes), then the odd halves (400 bytes).
|
|
32
|
+
// Within each 16-byte row, the four u32 words correspond to
|
|
33
|
+
// instances 0..3 of the same lane, enabling SIMD-parallel operations
|
|
34
|
+
// across all four instances.
|
|
35
|
+
//
|
|
36
|
+
// State memory layout (25 lanes x 4 instances x 2 halves):
|
|
37
|
+
// S[i][l]_even/odd = even/odd half of lane l, instance i (u32)
|
|
38
|
+
// Each row is 16 bytes (one Q-register).
|
|
39
|
+
// Offset Contents
|
|
40
|
+
// 0 S[0][ 0]_even, S[1][ 0]_even, S[2][ 0]_even, S[3][ 0]_even
|
|
41
|
+
// 16 S[0][ 1]_even, S[1][ 1]_even, S[2][ 1]_even, S[3][ 1]_even
|
|
42
|
+
// ...
|
|
43
|
+
// 384 S[0][24]_even, S[1][24]_even, S[2][24]_even, S[3][24]_even
|
|
44
|
+
// 400 S[0][ 0]_odd, S[1][ 0]_odd, S[2][ 0]_odd, S[3][ 0]_odd
|
|
45
|
+
// 416 S[0][ 1]_odd, S[1][ 1]_odd, S[2][ 1]_odd, S[3][ 1]_odd
|
|
46
|
+
// ...
|
|
47
|
+
// 784 S[0][24]_odd, S[1][24]_odd, S[2][24]_odd, S[3][24]_odd
|
|
48
|
+
//
|
|
49
|
+
// ---------------------------------------------------------------------------
|
|
50
|
+
// Three-phase structure
|
|
51
|
+
// ---------------------------------------------------------------------------
|
|
52
|
+
// Prologue -- if offset is not 8-byte aligned, absorb
|
|
53
|
+
// min(length, 8-(offset%8)) bytes via predicated byte loads.
|
|
54
|
+
// Main -- process full 8-byte groups via word-level gather loads,
|
|
55
|
+
// bit-interleave, then VEOR into even/odd state halves.
|
|
56
|
+
// Tail -- absorb remaining <8 bytes via predicated byte loads.
|
|
57
|
+
|
|
58
|
+
#include "../../../../common.h"
|
|
59
|
+
#if defined(MLK_FIPS202_ARMV81M_NEED_X4) && \
|
|
60
|
+
!defined(MLK_CONFIG_MULTILEVEL_NO_SHARED)
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* WARNING: This file is auto-derived from the mlkem-native source file
|
|
64
|
+
* dev/fips202/armv81m/src/state_xor_bytes_x4_mve.S using scripts/simpasm. Do not modify it directly.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
.thumb
|
|
68
|
+
.syntax unified
|
|
69
|
+
|
|
70
|
+
.text
|
|
71
|
+
.balign 4
|
|
72
|
+
.global MLK_ASM_NAMESPACE(keccak_f1600_x4_state_xor_bytes_asm)
|
|
73
|
+
MLK_ASM_FN_SYMBOL(keccak_f1600_x4_state_xor_bytes_asm)
|
|
74
|
+
|
|
75
|
+
push.w {r4, r5, r6, r7, r8, r9, r10, r11, r12, lr}
|
|
76
|
+
vpush {d8, d9, d10, d11, d12, d13, d14, d15}
|
|
77
|
+
ldr r4, [sp, #0x68]
|
|
78
|
+
ldr.w r10, [sp, #0x6c]
|
|
79
|
+
ldr r6, [sp, #0x70]
|
|
80
|
+
cmp r6, #0x0
|
|
81
|
+
beq.w keccak_f1600_x4_state_xor_bytes_asm_exit @ imm = #0x34c
|
|
82
|
+
and r5, r10, #0x7
|
|
83
|
+
bic r9, r10, #0x7
|
|
84
|
+
add.w r8, r0, r9, lsl #1
|
|
85
|
+
add.w r7, r8, #0x190
|
|
86
|
+
cmp r5, #0x0
|
|
87
|
+
beq.w keccak_f1600_x4_state_xor_bytes_asm_pre_main @ imm = #0x132
|
|
88
|
+
subs r1, r1, r5
|
|
89
|
+
subs r2, r2, r5
|
|
90
|
+
subs r3, r3, r5
|
|
91
|
+
subs r4, r4, r5
|
|
92
|
+
rsb.w lr, r5, #0x8
|
|
93
|
+
cmp r6, lr
|
|
94
|
+
it ls
|
|
95
|
+
movls lr, r6
|
|
96
|
+
subs.w r6, r6, lr
|
|
97
|
+
vctp.8 lr
|
|
98
|
+
vmrs r11, p0
|
|
99
|
+
lsl.w r11, r11, r5
|
|
100
|
+
vmsr p0, r11
|
|
101
|
+
vpstttt
|
|
102
|
+
vldrbt.u8 q0, [r1], #4
|
|
103
|
+
vldrbt.u8 q1, [r2], #4
|
|
104
|
+
vldrbt.u8 q2, [r3], #4
|
|
105
|
+
vldrbt.u8 q3, [r4], #4
|
|
106
|
+
vmov.f64 d1, d4
|
|
107
|
+
vmov.f64 d3, d6
|
|
108
|
+
vrev64.32 q2, q0
|
|
109
|
+
vrev64.32 q3, q1
|
|
110
|
+
movw r0, #0xf0f
|
|
111
|
+
vmsr p0, r0
|
|
112
|
+
vpsel q0, q0, q3
|
|
113
|
+
vpsel q1, q2, q1
|
|
114
|
+
vmov q2, q0
|
|
115
|
+
vmov q3, q1
|
|
116
|
+
vshr.u8 q4, q0, #0x2
|
|
117
|
+
vsli.8 q0, q4, #0x1
|
|
118
|
+
vshr.u8 q4, q0, #0x3
|
|
119
|
+
vsli.8 q0, q4, #0x2
|
|
120
|
+
vshr.u8 q4, q0, #0x4
|
|
121
|
+
vsli.8 q0, q4, #0x3
|
|
122
|
+
vshr.u16 q4, q0, #0x8
|
|
123
|
+
vsli.8 q0, q4, #0x4
|
|
124
|
+
vshr.u32 q4, q0, #0x10
|
|
125
|
+
vsli.16 q0, q4, #0x8
|
|
126
|
+
vshr.u8 q4, q3, #0x2
|
|
127
|
+
vsli.8 q3, q4, #0x1
|
|
128
|
+
vshr.u8 q4, q3, #0x3
|
|
129
|
+
vsli.8 q3, q4, #0x2
|
|
130
|
+
vshr.u8 q4, q3, #0x4
|
|
131
|
+
vsli.8 q3, q4, #0x3
|
|
132
|
+
vshr.u16 q4, q3, #0x8
|
|
133
|
+
vsli.8 q3, q4, #0x4
|
|
134
|
+
vshr.u32 q4, q3, #0x10
|
|
135
|
+
vsli.16 q3, q4, #0x8
|
|
136
|
+
vsli.32 q0, q3, #0x10
|
|
137
|
+
vshl.i8 q4, q2, #0x2
|
|
138
|
+
vsri.8 q2, q4, #0x1
|
|
139
|
+
vshl.i8 q4, q2, #0x3
|
|
140
|
+
vsri.8 q2, q4, #0x2
|
|
141
|
+
vshl.i8 q4, q2, #0x4
|
|
142
|
+
vsri.8 q2, q4, #0x3
|
|
143
|
+
vshl.i16 q4, q2, #0x8
|
|
144
|
+
vsri.8 q2, q4, #0x4
|
|
145
|
+
vshl.i32 q4, q2, #0x10
|
|
146
|
+
vsri.16 q2, q4, #0x8
|
|
147
|
+
vshl.i8 q4, q1, #0x2
|
|
148
|
+
vsri.8 q1, q4, #0x1
|
|
149
|
+
vshl.i8 q4, q1, #0x3
|
|
150
|
+
vsri.8 q1, q4, #0x2
|
|
151
|
+
vshl.i8 q4, q1, #0x4
|
|
152
|
+
vsri.8 q1, q4, #0x3
|
|
153
|
+
vshl.i16 q4, q1, #0x8
|
|
154
|
+
vsri.8 q1, q4, #0x4
|
|
155
|
+
vshl.i32 q4, q1, #0x10
|
|
156
|
+
vsri.16 q1, q4, #0x8
|
|
157
|
+
vsri.32 q1, q2, #0x10
|
|
158
|
+
vldrw.u32 q4, [r8]
|
|
159
|
+
vldrw.u32 q5, [r7]
|
|
160
|
+
veor q4, q4, q0
|
|
161
|
+
veor q5, q5, q1
|
|
162
|
+
vstrw.32 q4, [r8], #16
|
|
163
|
+
vstrw.32 q5, [r7], #16
|
|
164
|
+
vmov q7[2], q7[0], r1, r3
|
|
165
|
+
vmov q7[3], q7[1], r2, r4
|
|
166
|
+
cmp r6, #0x0
|
|
167
|
+
beq.w keccak_f1600_x4_state_xor_bytes_asm_exit @ imm = #0x206
|
|
168
|
+
b keccak_f1600_x4_state_xor_bytes_asm_main_body @ imm = #0xe
|
|
169
|
+
|
|
170
|
+
keccak_f1600_x4_state_xor_bytes_asm_pre_main:
|
|
171
|
+
vmov q7[2], q7[0], r1, r3
|
|
172
|
+
vmov q7[3], q7[1], r2, r4
|
|
173
|
+
mov.w r0, #0x4
|
|
174
|
+
vsub.i32 q7, q7, r0
|
|
175
|
+
|
|
176
|
+
keccak_f1600_x4_state_xor_bytes_asm_main_body:
|
|
177
|
+
lsr.w lr, r6, #0x3
|
|
178
|
+
wls lr, lr, keccak_f1600_x4_state_xor_bytes_asm_main_loop_end @ imm = #0xd4
|
|
179
|
+
|
|
180
|
+
keccak_f1600_x4_state_xor_bytes_asm_main_loop_start:
|
|
181
|
+
vldrw.u32 q0, [q7, #4]!
|
|
182
|
+
vldrw.u32 q1, [q7, #4]!
|
|
183
|
+
vmov q2, q0
|
|
184
|
+
vmov q3, q1
|
|
185
|
+
vshr.u8 q4, q0, #0x2
|
|
186
|
+
vsli.8 q0, q4, #0x1
|
|
187
|
+
vshr.u8 q4, q0, #0x3
|
|
188
|
+
vsli.8 q0, q4, #0x2
|
|
189
|
+
vshr.u8 q4, q0, #0x4
|
|
190
|
+
vsli.8 q0, q4, #0x3
|
|
191
|
+
vshr.u16 q4, q0, #0x8
|
|
192
|
+
vsli.8 q0, q4, #0x4
|
|
193
|
+
vshr.u32 q4, q0, #0x10
|
|
194
|
+
vsli.16 q0, q4, #0x8
|
|
195
|
+
vshr.u8 q4, q3, #0x2
|
|
196
|
+
vsli.8 q3, q4, #0x1
|
|
197
|
+
vshr.u8 q4, q3, #0x3
|
|
198
|
+
vsli.8 q3, q4, #0x2
|
|
199
|
+
vshr.u8 q4, q3, #0x4
|
|
200
|
+
vsli.8 q3, q4, #0x3
|
|
201
|
+
vshr.u16 q4, q3, #0x8
|
|
202
|
+
vsli.8 q3, q4, #0x4
|
|
203
|
+
vshr.u32 q4, q3, #0x10
|
|
204
|
+
vsli.16 q3, q4, #0x8
|
|
205
|
+
vsli.32 q0, q3, #0x10
|
|
206
|
+
vshl.i8 q4, q2, #0x2
|
|
207
|
+
vsri.8 q2, q4, #0x1
|
|
208
|
+
vshl.i8 q4, q2, #0x3
|
|
209
|
+
vsri.8 q2, q4, #0x2
|
|
210
|
+
vshl.i8 q4, q2, #0x4
|
|
211
|
+
vsri.8 q2, q4, #0x3
|
|
212
|
+
vshl.i16 q4, q2, #0x8
|
|
213
|
+
vsri.8 q2, q4, #0x4
|
|
214
|
+
vshl.i32 q4, q2, #0x10
|
|
215
|
+
vsri.16 q2, q4, #0x8
|
|
216
|
+
vshl.i8 q4, q1, #0x2
|
|
217
|
+
vsri.8 q1, q4, #0x1
|
|
218
|
+
vshl.i8 q4, q1, #0x3
|
|
219
|
+
vsri.8 q1, q4, #0x2
|
|
220
|
+
vshl.i8 q4, q1, #0x4
|
|
221
|
+
vsri.8 q1, q4, #0x3
|
|
222
|
+
vshl.i16 q4, q1, #0x8
|
|
223
|
+
vsri.8 q1, q4, #0x4
|
|
224
|
+
vshl.i32 q4, q1, #0x10
|
|
225
|
+
vsri.16 q1, q4, #0x8
|
|
226
|
+
vsri.32 q1, q2, #0x10
|
|
227
|
+
vldrw.u32 q4, [r8]
|
|
228
|
+
vldrw.u32 q5, [r7]
|
|
229
|
+
veor q4, q4, q0
|
|
230
|
+
veor q5, q5, q1
|
|
231
|
+
vstrw.32 q4, [r8], #16
|
|
232
|
+
vstrw.32 q5, [r7], #16
|
|
233
|
+
le lr, keccak_f1600_x4_state_xor_bytes_asm_main_loop_start @ imm = #-0xd4
|
|
234
|
+
|
|
235
|
+
keccak_f1600_x4_state_xor_bytes_asm_main_loop_end:
|
|
236
|
+
ands r6, r6, #0x7
|
|
237
|
+
beq.w keccak_f1600_x4_state_xor_bytes_asm_exit @ imm = #0x110
|
|
238
|
+
mov.w r0, #0x4
|
|
239
|
+
vadd.i32 q7, q7, r0
|
|
240
|
+
vmov r1, r3, q7[2], q7[0]
|
|
241
|
+
vmov r2, r4, q7[3], q7[1]
|
|
242
|
+
vctp.8 r6
|
|
243
|
+
vpstttt
|
|
244
|
+
vldrbt.u8 q0, [r1]
|
|
245
|
+
vldrbt.u8 q1, [r2]
|
|
246
|
+
vldrbt.u8 q2, [r3]
|
|
247
|
+
vldrbt.u8 q3, [r4]
|
|
248
|
+
vmov.f64 d1, d4
|
|
249
|
+
vmov.f64 d3, d6
|
|
250
|
+
vrev64.32 q2, q0
|
|
251
|
+
vrev64.32 q3, q1
|
|
252
|
+
movw r0, #0xf0f
|
|
253
|
+
vmsr p0, r0
|
|
254
|
+
vpsel q0, q0, q3
|
|
255
|
+
vpsel q1, q2, q1
|
|
256
|
+
vmov q2, q0
|
|
257
|
+
vmov q3, q1
|
|
258
|
+
vshr.u8 q4, q0, #0x2
|
|
259
|
+
vsli.8 q0, q4, #0x1
|
|
260
|
+
vshr.u8 q4, q0, #0x3
|
|
261
|
+
vsli.8 q0, q4, #0x2
|
|
262
|
+
vshr.u8 q4, q0, #0x4
|
|
263
|
+
vsli.8 q0, q4, #0x3
|
|
264
|
+
vshr.u16 q4, q0, #0x8
|
|
265
|
+
vsli.8 q0, q4, #0x4
|
|
266
|
+
vshr.u32 q4, q0, #0x10
|
|
267
|
+
vsli.16 q0, q4, #0x8
|
|
268
|
+
vshr.u8 q4, q3, #0x2
|
|
269
|
+
vsli.8 q3, q4, #0x1
|
|
270
|
+
vshr.u8 q4, q3, #0x3
|
|
271
|
+
vsli.8 q3, q4, #0x2
|
|
272
|
+
vshr.u8 q4, q3, #0x4
|
|
273
|
+
vsli.8 q3, q4, #0x3
|
|
274
|
+
vshr.u16 q4, q3, #0x8
|
|
275
|
+
vsli.8 q3, q4, #0x4
|
|
276
|
+
vshr.u32 q4, q3, #0x10
|
|
277
|
+
vsli.16 q3, q4, #0x8
|
|
278
|
+
vsli.32 q0, q3, #0x10
|
|
279
|
+
vshl.i8 q4, q2, #0x2
|
|
280
|
+
vsri.8 q2, q4, #0x1
|
|
281
|
+
vshl.i8 q4, q2, #0x3
|
|
282
|
+
vsri.8 q2, q4, #0x2
|
|
283
|
+
vshl.i8 q4, q2, #0x4
|
|
284
|
+
vsri.8 q2, q4, #0x3
|
|
285
|
+
vshl.i16 q4, q2, #0x8
|
|
286
|
+
vsri.8 q2, q4, #0x4
|
|
287
|
+
vshl.i32 q4, q2, #0x10
|
|
288
|
+
vsri.16 q2, q4, #0x8
|
|
289
|
+
vshl.i8 q4, q1, #0x2
|
|
290
|
+
vsri.8 q1, q4, #0x1
|
|
291
|
+
vshl.i8 q4, q1, #0x3
|
|
292
|
+
vsri.8 q1, q4, #0x2
|
|
293
|
+
vshl.i8 q4, q1, #0x4
|
|
294
|
+
vsri.8 q1, q4, #0x3
|
|
295
|
+
vshl.i16 q4, q1, #0x8
|
|
296
|
+
vsri.8 q1, q4, #0x4
|
|
297
|
+
vshl.i32 q4, q1, #0x10
|
|
298
|
+
vsri.16 q1, q4, #0x8
|
|
299
|
+
vsri.32 q1, q2, #0x10
|
|
300
|
+
vldrw.u32 q4, [r8]
|
|
301
|
+
vldrw.u32 q5, [r7]
|
|
302
|
+
veor q4, q4, q0
|
|
303
|
+
veor q5, q5, q1
|
|
304
|
+
vstrw.32 q4, [r8], #16
|
|
305
|
+
vstrw.32 q5, [r7], #16
|
|
306
|
+
|
|
307
|
+
keccak_f1600_x4_state_xor_bytes_asm_exit:
|
|
308
|
+
vpop {d8, d9, d10, d11, d12, d13, d14, d15}
|
|
309
|
+
pop.w {r4, r5, r6, r7, r8, r9, r10, r11, r12, pc}
|
|
310
|
+
nop
|
|
311
|
+
|
|
312
|
+
MLK_ASM_FN_SIZE(keccak_f1600_x4_state_xor_bytes_asm)
|
|
313
|
+
|
|
314
|
+
#endif /* MLK_FIPS202_ARMV81M_NEED_X4 && !MLK_CONFIG_MULTILEVEL_NO_SHARED */
|
|
@@ -0,0 +1,28 @@
|
|
|
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_FIPS202_NATIVE_AUTO_H
|
|
7
|
+
#define MLK_FIPS202_NATIVE_AUTO_H
|
|
8
|
+
|
|
9
|
+
/*
|
|
10
|
+
* Default FIPS202 backend
|
|
11
|
+
*/
|
|
12
|
+
#include "../../sys.h"
|
|
13
|
+
|
|
14
|
+
#if defined(MLK_SYS_AARCH64)
|
|
15
|
+
#include "aarch64/auto.h"
|
|
16
|
+
#endif
|
|
17
|
+
|
|
18
|
+
#if defined(MLK_SYS_X86_64) && defined(MLK_SYS_X86_64_AVX2)
|
|
19
|
+
#include "x86_64/keccak_f1600_x4_avx2.h"
|
|
20
|
+
#endif
|
|
21
|
+
|
|
22
|
+
/* We do not yet include the FIPS202 backend for Armv8.1-M+MVE by default
|
|
23
|
+
* as it is still experimental and undergoing review. */
|
|
24
|
+
/* #if defined(MLK_SYS_ARMV81M_MVE) */
|
|
25
|
+
/* #include "armv81m/mve.h" */
|
|
26
|
+
/* #endif */
|
|
27
|
+
|
|
28
|
+
#endif /* !MLK_FIPS202_NATIVE_AUTO_H */
|