pq_crypto 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/GET_STARTED.md +21 -16
- data/README.md +26 -0
- data/SECURITY.md +22 -16
- data/ext/pqcrypto/extconf.rb +148 -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 +129 -0
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +0 -3
- data/ext/pqcrypto/pqcrypto_secure.c +135 -117
- data/ext/pqcrypto/pqcrypto_secure.h +1 -42
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/randombytes.h +9 -0
- data/ext/pqcrypto/vendor/.vendored +10 -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/version.rb +1 -1
- data/lib/pq_crypto.rb +1 -1
- data/script/vendor_libs.rb +88 -159
- 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,315 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* Copyright (c) The mldsa-native project authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef MLD_NATIVE_X86_64_META_H
|
|
8
|
+
#define MLD_NATIVE_X86_64_META_H
|
|
9
|
+
|
|
10
|
+
/* Identifier for this backend so that source and assembly files
|
|
11
|
+
* in the build can be appropriately guarded. */
|
|
12
|
+
#define MLD_ARITH_BACKEND_X86_64_DEFAULT
|
|
13
|
+
|
|
14
|
+
#define MLD_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
15
|
+
#define MLD_USE_NATIVE_NTT
|
|
16
|
+
#define MLD_USE_NATIVE_INTT
|
|
17
|
+
#define MLD_USE_NATIVE_REJ_UNIFORM
|
|
18
|
+
#define MLD_USE_NATIVE_REJ_UNIFORM_ETA2
|
|
19
|
+
#define MLD_USE_NATIVE_REJ_UNIFORM_ETA4
|
|
20
|
+
#define MLD_USE_NATIVE_POLY_DECOMPOSE_32
|
|
21
|
+
#define MLD_USE_NATIVE_POLY_DECOMPOSE_88
|
|
22
|
+
#define MLD_USE_NATIVE_POLY_CADDQ
|
|
23
|
+
#define MLD_USE_NATIVE_POLY_USE_HINT_32
|
|
24
|
+
#define MLD_USE_NATIVE_POLY_USE_HINT_88
|
|
25
|
+
#define MLD_USE_NATIVE_POLY_CHKNORM
|
|
26
|
+
#define MLD_USE_NATIVE_POLYZ_UNPACK_17
|
|
27
|
+
#define MLD_USE_NATIVE_POLYZ_UNPACK_19
|
|
28
|
+
#define MLD_USE_NATIVE_POINTWISE_MONTGOMERY
|
|
29
|
+
#define MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L4
|
|
30
|
+
#define MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L5
|
|
31
|
+
#define MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L7
|
|
32
|
+
|
|
33
|
+
#if !defined(__ASSEMBLER__)
|
|
34
|
+
#include <string.h>
|
|
35
|
+
#include "../../common.h"
|
|
36
|
+
#include "../api.h"
|
|
37
|
+
#include "src/arith_native_x86_64.h"
|
|
38
|
+
|
|
39
|
+
static MLD_INLINE void mld_poly_permute_bitrev_to_custom(int32_t data[MLDSA_N])
|
|
40
|
+
{
|
|
41
|
+
if (mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
42
|
+
{
|
|
43
|
+
mld_nttunpack_avx2(data);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
48
|
+
static MLD_INLINE int mld_ntt_native(int32_t data[MLDSA_N])
|
|
49
|
+
{
|
|
50
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
51
|
+
{
|
|
52
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
mld_ntt_avx2(data, mld_qdata);
|
|
56
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
60
|
+
static MLD_INLINE int mld_intt_native(int32_t data[MLDSA_N])
|
|
61
|
+
{
|
|
62
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
63
|
+
{
|
|
64
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
65
|
+
}
|
|
66
|
+
mld_invntt_avx2(data, mld_qdata);
|
|
67
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
71
|
+
static MLD_INLINE int mld_rej_uniform_native(int32_t *r, unsigned len,
|
|
72
|
+
const uint8_t *buf,
|
|
73
|
+
unsigned buflen)
|
|
74
|
+
{
|
|
75
|
+
/* AVX2 implementation assumes specific buffer lengths */
|
|
76
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2) || len != MLDSA_N ||
|
|
77
|
+
buflen != MLD_AVX2_REJ_UNIFORM_BUFLEN)
|
|
78
|
+
{
|
|
79
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
/* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
|
|
83
|
+
return (int)mld_rej_uniform_avx2(r, buf);
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_ETA == 2
|
|
87
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
88
|
+
static MLD_INLINE int mld_rej_uniform_eta2_native(int32_t *r, unsigned len,
|
|
89
|
+
const uint8_t *buf,
|
|
90
|
+
unsigned buflen)
|
|
91
|
+
{
|
|
92
|
+
unsigned int outlen;
|
|
93
|
+
/* AVX2 implementation assumes specific buffer lengths */
|
|
94
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2) || len != MLDSA_N ||
|
|
95
|
+
buflen != MLD_AVX2_REJ_UNIFORM_ETA2_BUFLEN)
|
|
96
|
+
{
|
|
97
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/* Constant time: Inputs and outputs to this function are secret.
|
|
101
|
+
* It is safe to leak which coefficients are accepted/rejected.
|
|
102
|
+
* The assembly implementation must not leak any other information about the
|
|
103
|
+
* accepted coefficients. Constant-time testing cannot cover this, and we
|
|
104
|
+
* hence have to manually verify the assembly.
|
|
105
|
+
* We declassify prior the input data and mark the outputs as secret.
|
|
106
|
+
*/
|
|
107
|
+
MLD_CT_TESTING_DECLASSIFY(buf, buflen);
|
|
108
|
+
outlen = mld_rej_uniform_eta2_avx2(r, buf);
|
|
109
|
+
MLD_CT_TESTING_SECRET(r, sizeof(int32_t) * outlen);
|
|
110
|
+
/* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
|
|
111
|
+
return (int)outlen;
|
|
112
|
+
}
|
|
113
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_ETA == 2 */
|
|
114
|
+
|
|
115
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_ETA == 4
|
|
116
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
117
|
+
static MLD_INLINE int mld_rej_uniform_eta4_native(int32_t *r, unsigned len,
|
|
118
|
+
const uint8_t *buf,
|
|
119
|
+
unsigned buflen)
|
|
120
|
+
{
|
|
121
|
+
unsigned int outlen;
|
|
122
|
+
/* AVX2 implementation assumes specific buffer lengths */
|
|
123
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2) || len != MLDSA_N ||
|
|
124
|
+
buflen != MLD_AVX2_REJ_UNIFORM_ETA4_BUFLEN)
|
|
125
|
+
{
|
|
126
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
/* Constant time: Inputs and outputs to this function are secret.
|
|
130
|
+
* It is safe to leak which coefficients are accepted/rejected.
|
|
131
|
+
* The assembly implementation must not leak any other information about the
|
|
132
|
+
* accepted coefficients. Constant-time testing cannot cover this, and we
|
|
133
|
+
* hence have to manually verify the assembly.
|
|
134
|
+
* We declassify prior the input data and mark the outputs as secret.
|
|
135
|
+
*/
|
|
136
|
+
MLD_CT_TESTING_DECLASSIFY(buf, buflen);
|
|
137
|
+
outlen = mld_rej_uniform_eta4_avx2(r, buf);
|
|
138
|
+
MLD_CT_TESTING_SECRET(r, sizeof(int32_t) * outlen);
|
|
139
|
+
/* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
|
|
140
|
+
return (int)outlen;
|
|
141
|
+
}
|
|
142
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_ETA == 4 */
|
|
143
|
+
|
|
144
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
145
|
+
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
|
|
146
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
147
|
+
static MLD_INLINE int mld_poly_decompose_32_native(int32_t *a1, int32_t *a0)
|
|
148
|
+
{
|
|
149
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
150
|
+
{
|
|
151
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
152
|
+
}
|
|
153
|
+
mld_poly_decompose_32_avx2(a1, a0);
|
|
154
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
155
|
+
}
|
|
156
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
157
|
+
|| MLD_CONFIG_PARAMETER_SET == 87 */
|
|
158
|
+
|
|
159
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
|
|
160
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
161
|
+
static MLD_INLINE int mld_poly_decompose_88_native(int32_t *a1, int32_t *a0)
|
|
162
|
+
{
|
|
163
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
164
|
+
{
|
|
165
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
166
|
+
}
|
|
167
|
+
mld_poly_decompose_88_avx2(a1, a0);
|
|
168
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
169
|
+
}
|
|
170
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
171
|
+
*/
|
|
172
|
+
|
|
173
|
+
|
|
174
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
175
|
+
static MLD_INLINE int mld_poly_caddq_native(int32_t a[MLDSA_N])
|
|
176
|
+
{
|
|
177
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
178
|
+
{
|
|
179
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
180
|
+
}
|
|
181
|
+
mld_poly_caddq_avx2(a);
|
|
182
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
186
|
+
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
|
|
187
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
188
|
+
static MLD_INLINE int mld_poly_use_hint_32_native(int32_t *b, const int32_t *a,
|
|
189
|
+
const int32_t *h)
|
|
190
|
+
{
|
|
191
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
192
|
+
{
|
|
193
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
194
|
+
}
|
|
195
|
+
mld_poly_use_hint_32_avx2(b, a, h);
|
|
196
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
197
|
+
}
|
|
198
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
199
|
+
|| MLD_CONFIG_PARAMETER_SET == 87 */
|
|
200
|
+
|
|
201
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
|
|
202
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
203
|
+
static MLD_INLINE int mld_poly_use_hint_88_native(int32_t *b, const int32_t *a,
|
|
204
|
+
const int32_t *h)
|
|
205
|
+
{
|
|
206
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
207
|
+
{
|
|
208
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
209
|
+
}
|
|
210
|
+
mld_poly_use_hint_88_avx2(b, a, h);
|
|
211
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
212
|
+
}
|
|
213
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
214
|
+
*/
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
218
|
+
static MLD_INLINE int mld_poly_chknorm_native(const int32_t *a, int32_t B)
|
|
219
|
+
{
|
|
220
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
221
|
+
{
|
|
222
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
223
|
+
}
|
|
224
|
+
return mld_poly_chknorm_avx2(a, B);
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLD_CONFIG_PARAMETER_SET == 44
|
|
228
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
229
|
+
static MLD_INLINE int mld_polyz_unpack_17_native(int32_t *r, const uint8_t *a)
|
|
230
|
+
{
|
|
231
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
232
|
+
{
|
|
233
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
234
|
+
}
|
|
235
|
+
mld_polyz_unpack_17_avx2(r, a);
|
|
236
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
237
|
+
}
|
|
238
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
242
|
+
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87)
|
|
243
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
244
|
+
static MLD_INLINE int mld_polyz_unpack_19_native(int32_t *r, const uint8_t *a)
|
|
245
|
+
{
|
|
246
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
247
|
+
{
|
|
248
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
249
|
+
}
|
|
250
|
+
mld_polyz_unpack_19_avx2(r, a);
|
|
251
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
252
|
+
}
|
|
253
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
254
|
+
|| MLD_CONFIG_PARAMETER_SET == 87 */
|
|
255
|
+
|
|
256
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
257
|
+
static MLD_INLINE int mld_poly_pointwise_montgomery_native(
|
|
258
|
+
int32_t c[MLDSA_N], const int32_t a[MLDSA_N], const int32_t b[MLDSA_N])
|
|
259
|
+
{
|
|
260
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
261
|
+
{
|
|
262
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
263
|
+
}
|
|
264
|
+
mld_pointwise_avx2(c, a, b, mld_qdata);
|
|
265
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 4
|
|
269
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
270
|
+
static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l4_native(
|
|
271
|
+
int32_t w[MLDSA_N], const int32_t u[4][MLDSA_N],
|
|
272
|
+
const int32_t v[4][MLDSA_N])
|
|
273
|
+
{
|
|
274
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
275
|
+
{
|
|
276
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
277
|
+
}
|
|
278
|
+
mld_pointwise_acc_l4_avx2(w, u, v, mld_qdata);
|
|
279
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
280
|
+
}
|
|
281
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 4 */
|
|
282
|
+
|
|
283
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 5
|
|
284
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
285
|
+
static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l5_native(
|
|
286
|
+
int32_t w[MLDSA_N], const int32_t u[5][MLDSA_N],
|
|
287
|
+
const int32_t v[5][MLDSA_N])
|
|
288
|
+
{
|
|
289
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
290
|
+
{
|
|
291
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
292
|
+
}
|
|
293
|
+
mld_pointwise_acc_l5_avx2(w, u, v, mld_qdata);
|
|
294
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
295
|
+
}
|
|
296
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 5 */
|
|
297
|
+
|
|
298
|
+
#if defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 7
|
|
299
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
300
|
+
static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l7_native(
|
|
301
|
+
int32_t w[MLDSA_N], const int32_t u[7][MLDSA_N],
|
|
302
|
+
const int32_t v[7][MLDSA_N])
|
|
303
|
+
{
|
|
304
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_AVX2))
|
|
305
|
+
{
|
|
306
|
+
return MLD_NATIVE_FUNC_FALLBACK;
|
|
307
|
+
}
|
|
308
|
+
mld_pointwise_acc_l7_avx2(w, u, v, mld_qdata);
|
|
309
|
+
return MLD_NATIVE_FUNC_SUCCESS;
|
|
310
|
+
}
|
|
311
|
+
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 7 */
|
|
312
|
+
|
|
313
|
+
#endif /* !__ASSEMBLER__ */
|
|
314
|
+
|
|
315
|
+
#endif /* !MLD_NATIVE_X86_64_META_H */
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* Copyright (c) The mldsa-native project authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
5
|
+
*/
|
|
6
|
+
#ifndef MLD_NATIVE_X86_64_SRC_ARITH_NATIVE_X86_64_H
|
|
7
|
+
#define MLD_NATIVE_X86_64_SRC_ARITH_NATIVE_X86_64_H
|
|
8
|
+
#include "../../../common.h"
|
|
9
|
+
|
|
10
|
+
#include "consts.h"
|
|
11
|
+
|
|
12
|
+
#define MLD_AVX2_REJ_UNIFORM_BUFLEN \
|
|
13
|
+
(5 * 168) /* REJ_UNIFORM_NBLOCKS * SHAKE128_RATE */
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
/*
|
|
17
|
+
* Sampling 256 coefficients mod 15 using rejection sampling from 4 bits.
|
|
18
|
+
* Expected number of required bytes: (256 * (16/15))/2 = 136.5 bytes.
|
|
19
|
+
* We sample 1 block (=136 bytes) of SHAKE256_RATE output initially.
|
|
20
|
+
* Sampling 2 blocks initially results in slightly worse performance.
|
|
21
|
+
*/
|
|
22
|
+
#define MLD_AVX2_REJ_UNIFORM_ETA2_BUFLEN (1 * 136)
|
|
23
|
+
|
|
24
|
+
/*
|
|
25
|
+
* Sampling 256 coefficients mod 9 using rejection sampling from 4 bits.
|
|
26
|
+
* Expected number of required bytes: (256 * (16/9))/2 = 227.5 bytes.
|
|
27
|
+
* We sample 2 blocks (=272 bytes) of SHAKE256_RATE output initially.
|
|
28
|
+
*/
|
|
29
|
+
#define MLD_AVX2_REJ_UNIFORM_ETA4_BUFLEN (2 * 136)
|
|
30
|
+
|
|
31
|
+
#define mld_rej_uniform_table MLD_NAMESPACE(mld_rej_uniform_table)
|
|
32
|
+
extern const uint8_t mld_rej_uniform_table[256][8];
|
|
33
|
+
|
|
34
|
+
#define mld_ntt_avx2 MLD_NAMESPACE(ntt_avx2)
|
|
35
|
+
void mld_ntt_avx2(int32_t *r, const int32_t *qdata)
|
|
36
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
37
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_ntt.ml */
|
|
38
|
+
__contract__(
|
|
39
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
40
|
+
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
41
|
+
requires(qdata == mld_qdata)
|
|
42
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
43
|
+
/* check-magic: off */
|
|
44
|
+
ensures(array_abs_bound(r, 0, MLDSA_N, 42035262))
|
|
45
|
+
/* check-magic: on */
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
#define mld_invntt_avx2 MLD_NAMESPACE(invntt_avx2)
|
|
49
|
+
void mld_invntt_avx2(int32_t *r, const int32_t *qdata)
|
|
50
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
51
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_intt.ml */
|
|
52
|
+
__contract__(
|
|
53
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
54
|
+
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
55
|
+
requires(qdata == mld_qdata)
|
|
56
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
57
|
+
/* check-magic: off */
|
|
58
|
+
ensures(array_abs_bound(r, 0, MLDSA_N, 6285313))
|
|
59
|
+
/* check-magic: on */
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
#define mld_nttunpack_avx2 MLD_NAMESPACE(nttunpack_avx2)
|
|
63
|
+
void mld_nttunpack_avx2(int32_t *r);
|
|
64
|
+
|
|
65
|
+
#define mld_rej_uniform_avx2 MLD_NAMESPACE(mld_rej_uniform_avx2)
|
|
66
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
67
|
+
unsigned mld_rej_uniform_avx2(int32_t *r,
|
|
68
|
+
const uint8_t buf[MLD_AVX2_REJ_UNIFORM_BUFLEN]);
|
|
69
|
+
|
|
70
|
+
#define mld_rej_uniform_eta2_avx2 MLD_NAMESPACE(mld_rej_uniform_eta2_avx2)
|
|
71
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
72
|
+
unsigned mld_rej_uniform_eta2_avx2(
|
|
73
|
+
int32_t *r, const uint8_t buf[MLD_AVX2_REJ_UNIFORM_ETA2_BUFLEN]);
|
|
74
|
+
|
|
75
|
+
#define mld_rej_uniform_eta4_avx2 MLD_NAMESPACE(mld_rej_uniform_eta4_avx2)
|
|
76
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
77
|
+
unsigned mld_rej_uniform_eta4_avx2(
|
|
78
|
+
int32_t *r, const uint8_t buf[MLD_AVX2_REJ_UNIFORM_ETA4_BUFLEN]);
|
|
79
|
+
|
|
80
|
+
#define mld_poly_decompose_32_avx2 MLD_NAMESPACE(mld_poly_decompose_32_avx2)
|
|
81
|
+
void mld_poly_decompose_32_avx2(int32_t *a1, int32_t *a0);
|
|
82
|
+
|
|
83
|
+
#define mld_poly_decompose_88_avx2 MLD_NAMESPACE(mld_poly_decompose_88_avx2)
|
|
84
|
+
void mld_poly_decompose_88_avx2(int32_t *a1, int32_t *a0);
|
|
85
|
+
|
|
86
|
+
#define mld_poly_caddq_avx2 MLD_NAMESPACE(poly_caddq_avx2)
|
|
87
|
+
void mld_poly_caddq_avx2(int32_t *r);
|
|
88
|
+
|
|
89
|
+
#define mld_poly_use_hint_32_avx2 MLD_NAMESPACE(mld_poly_use_hint_32_avx2)
|
|
90
|
+
void mld_poly_use_hint_32_avx2(int32_t *b, const int32_t *a, const int32_t *h);
|
|
91
|
+
|
|
92
|
+
#define mld_poly_use_hint_88_avx2 MLD_NAMESPACE(mld_poly_use_hint_88_avx2)
|
|
93
|
+
void mld_poly_use_hint_88_avx2(int32_t *b, const int32_t *a, const int32_t *h);
|
|
94
|
+
|
|
95
|
+
#define mld_poly_chknorm_avx2 MLD_NAMESPACE(mld_poly_chknorm_avx2)
|
|
96
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
97
|
+
int mld_poly_chknorm_avx2(const int32_t *a, int32_t B);
|
|
98
|
+
|
|
99
|
+
#define mld_polyz_unpack_17_avx2 MLD_NAMESPACE(mld_polyz_unpack_17_avx2)
|
|
100
|
+
void mld_polyz_unpack_17_avx2(int32_t *r, const uint8_t *a);
|
|
101
|
+
|
|
102
|
+
#define mld_polyz_unpack_19_avx2 MLD_NAMESPACE(mld_polyz_unpack_19_avx2)
|
|
103
|
+
void mld_polyz_unpack_19_avx2(int32_t *r, const uint8_t *a);
|
|
104
|
+
|
|
105
|
+
#define mld_pointwise_avx2 MLD_NAMESPACE(pointwise_avx2)
|
|
106
|
+
void mld_pointwise_avx2(int32_t *c, const int32_t *a, const int32_t *b,
|
|
107
|
+
const int32_t *qdata);
|
|
108
|
+
|
|
109
|
+
#define mld_pointwise_acc_l4_avx2 MLD_NAMESPACE(pointwise_acc_l4_avx2)
|
|
110
|
+
void mld_pointwise_acc_l4_avx2(int32_t c[MLDSA_N], const int32_t a[4][MLDSA_N],
|
|
111
|
+
const int32_t b[4][MLDSA_N],
|
|
112
|
+
const int32_t *qdata);
|
|
113
|
+
|
|
114
|
+
#define mld_pointwise_acc_l5_avx2 MLD_NAMESPACE(pointwise_acc_l5_avx2)
|
|
115
|
+
void mld_pointwise_acc_l5_avx2(int32_t c[MLDSA_N], const int32_t a[5][MLDSA_N],
|
|
116
|
+
const int32_t b[5][MLDSA_N],
|
|
117
|
+
const int32_t *qdata);
|
|
118
|
+
|
|
119
|
+
#define mld_pointwise_acc_l7_avx2 MLD_NAMESPACE(pointwise_acc_l7_avx2)
|
|
120
|
+
void mld_pointwise_acc_l7_avx2(int32_t c[MLDSA_N], const int32_t a[7][MLDSA_N],
|
|
121
|
+
const int32_t b[7][MLDSA_N],
|
|
122
|
+
const int32_t *qdata);
|
|
123
|
+
|
|
124
|
+
#endif /* !MLD_NATIVE_X86_64_SRC_ARITH_NATIVE_X86_64_H */
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-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 mldsa-native repository.
|
|
9
|
+
* Do not modify it directly.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#include "../../../common.h"
|
|
13
|
+
|
|
14
|
+
#if defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
15
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
16
|
+
|
|
17
|
+
#include "consts.h"
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Table of zeta values used in the AVX2 forward and inverse NTT
|
|
21
|
+
* See autogen for details.
|
|
22
|
+
*/
|
|
23
|
+
MLD_ALIGN const int32_t mld_qdata[624] = {
|
|
24
|
+
8380417, 8380417, 8380417, 8380417, 8380417,
|
|
25
|
+
8380417, 8380417, 8380417, 58728449, 58728449,
|
|
26
|
+
58728449, 58728449, 58728449, 58728449, 58728449,
|
|
27
|
+
58728449, -8395782, -8395782, -8395782, -8395782,
|
|
28
|
+
-8395782, -8395782, -8395782, -8395782, 41978,
|
|
29
|
+
41978, 41978, 41978, 41978, 41978,
|
|
30
|
+
41978, 41978, -151046689, 1830765815, -1929875198,
|
|
31
|
+
-1927777021, 1640767044, 1477910808, 1612161320, 1640734244,
|
|
32
|
+
308362795, 308362795, 308362795, 308362795, -1815525077,
|
|
33
|
+
-1815525077, -1815525077, -1815525077, -1374673747, -1374673747,
|
|
34
|
+
-1374673747, -1374673747, -1091570561, -1091570561, -1091570561,
|
|
35
|
+
-1091570561, -1929495947, -1929495947, -1929495947, -1929495947,
|
|
36
|
+
515185417, 515185417, 515185417, 515185417, -285697463,
|
|
37
|
+
-285697463, -285697463, -285697463, 625853735, 625853735,
|
|
38
|
+
625853735, 625853735, 1727305304, 1727305304, 2082316400,
|
|
39
|
+
2082316400, -1364982364, -1364982364, 858240904, 858240904,
|
|
40
|
+
1806278032, 1806278032, 222489248, 222489248, -346752664,
|
|
41
|
+
-346752664, 684667771, 684667771, 1654287830, 1654287830,
|
|
42
|
+
-878576921, -878576921, -1257667337, -1257667337, -748618600,
|
|
43
|
+
-748618600, 329347125, 329347125, 1837364258, 1837364258,
|
|
44
|
+
-1443016191, -1443016191, -1170414139, -1170414139, -1846138265,
|
|
45
|
+
-1631226336, -1404529459, 1838055109, 1594295555, -1076973524,
|
|
46
|
+
-1898723372, -594436433, -202001019, -475984260, -561427818,
|
|
47
|
+
1797021249, -1061813248, 2059733581, -1661512036, -1104976547,
|
|
48
|
+
-1750224323, -901666090, 418987550, 1831915353, -1925356481,
|
|
49
|
+
992097815, 879957084, 2024403852, 1484874664, -1636082790,
|
|
50
|
+
-285388938, -1983539117, -1495136972, -950076368, -1714807468,
|
|
51
|
+
-952438995, -1574918427, 1350681039, -2143979939, 1599739335,
|
|
52
|
+
-1285853323, -993005454, -1440787840, 568627424, -783134478,
|
|
53
|
+
-588790216, 289871779, -1262003603, 2135294594, -1018755525,
|
|
54
|
+
-889861155, 1665705315, 1321868265, 1225434135, -1784632064,
|
|
55
|
+
666258756, 675310538, -1555941048, -1999506068, -1499481951,
|
|
56
|
+
-695180180, -1375177022, 1777179795, 334803717, -178766299,
|
|
57
|
+
-518252220, 1957047970, 1146323031, -654783359, -1974159335,
|
|
58
|
+
1651689966, 140455867, -1039411342, 1955560694, 1529189038,
|
|
59
|
+
-2131021878, -247357819, 1518161567, -86965173, 1708872713,
|
|
60
|
+
1787797779, 1638590967, -120646188, -1669960606, -916321552,
|
|
61
|
+
1155548552, 2143745726, 1210558298, -1261461890, -318346816,
|
|
62
|
+
628664287, -1729304568, 1422575624, 1424130038, -1185330464,
|
|
63
|
+
235321234, 168022240, 1206536194, 985155484, -894060583,
|
|
64
|
+
-898413, -1363460238, -605900043, 2027833504, 14253662,
|
|
65
|
+
1014493059, 863641633, 1819892093, 2124962073, -1223601433,
|
|
66
|
+
-1920467227, -1637785316, -1536588520, 694382729, 235104446,
|
|
67
|
+
-1045062172, 831969619, -300448763, 756955444, -260312805,
|
|
68
|
+
1554794072, 1339088280, -2040058690, -853476187, -2047270596,
|
|
69
|
+
-1723816713, -1591599803, -440824168, 1119856484, 1544891539,
|
|
70
|
+
155290192, -973777462, 991903578, 912367099, -44694137,
|
|
71
|
+
1176904444, -421552614, -818371958, 1747917558, -325927722,
|
|
72
|
+
908452108, 1851023419, -1176751719, -1354528380, -72690498,
|
|
73
|
+
-314284737, 985022747, 963438279, -1078959975, 604552167,
|
|
74
|
+
-1021949428, 608791570, 173440395, -2126092136, -1316619236,
|
|
75
|
+
-1039370342, 6087993, -110126092, 565464272, -1758099917,
|
|
76
|
+
-1600929361, 879867909, -1809756372, 400711272, 1363007700,
|
|
77
|
+
30313375, -326425360, 1683520342, -517299994, 2027935492,
|
|
78
|
+
-1372618620, 128353682, -1123881663, 137583815, -635454918,
|
|
79
|
+
-642772911, 45766801, 671509323, -2070602178, 419615363,
|
|
80
|
+
1216882040, -270590488, -1276805128, 371462360, -1357098057,
|
|
81
|
+
-384158533, 827959816, -596344473, 702390549, -279505433,
|
|
82
|
+
-260424530, -71875110, -1208667171, -1499603926, 2036925262,
|
|
83
|
+
-540420426, 746144248, -1420958686, 2032221021, 1904936414,
|
|
84
|
+
1257750362, 1926727420, 1931587462, 1258381762, 885133339,
|
|
85
|
+
1629985060, 1967222129, 6363718, -1287922800, 1136965286,
|
|
86
|
+
1779436847, 1116720494, 1042326957, 1405999311, 713994583,
|
|
87
|
+
940195359, -1542497137, 2061661095, -883155599, 1726753853,
|
|
88
|
+
-1547952704, 394851342, 283780712, 776003547, 1123958025,
|
|
89
|
+
201262505, 1934038751, 374860238, -3975713, 25847,
|
|
90
|
+
-2608894, -518909, 237124, -777960, -876248,
|
|
91
|
+
466468, 1826347, 1826347, 1826347, 1826347,
|
|
92
|
+
2353451, 2353451, 2353451, 2353451, -359251,
|
|
93
|
+
-359251, -359251, -359251, -2091905, -2091905,
|
|
94
|
+
-2091905, -2091905, 3119733, 3119733, 3119733,
|
|
95
|
+
3119733, -2884855, -2884855, -2884855, -2884855,
|
|
96
|
+
3111497, 3111497, 3111497, 3111497, 2680103,
|
|
97
|
+
2680103, 2680103, 2680103, 2725464, 2725464,
|
|
98
|
+
1024112, 1024112, -1079900, -1079900, 3585928,
|
|
99
|
+
3585928, -549488, -549488, -1119584, -1119584,
|
|
100
|
+
2619752, 2619752, -2108549, -2108549, -2118186,
|
|
101
|
+
-2118186, -3859737, -3859737, -1399561, -1399561,
|
|
102
|
+
-3277672, -3277672, 1757237, 1757237, -19422,
|
|
103
|
+
-19422, 4010497, 4010497, 280005, 280005,
|
|
104
|
+
2706023, 95776, 3077325, 3530437, -1661693,
|
|
105
|
+
-3592148, -2537516, 3915439, -3861115, -3043716,
|
|
106
|
+
3574422, -2867647, 3539968, -300467, 2348700,
|
|
107
|
+
-539299, -1699267, -1643818, 3505694, -3821735,
|
|
108
|
+
3507263, -2140649, -1600420, 3699596, 811944,
|
|
109
|
+
531354, 954230, 3881043, 3900724, -2556880,
|
|
110
|
+
2071892, -2797779, -3930395, -3677745, -1452451,
|
|
111
|
+
2176455, -1257611, -4083598, -3190144, -3632928,
|
|
112
|
+
3412210, 2147896, -2967645, -411027, -671102,
|
|
113
|
+
-22981, -381987, 1852771, -3343383, 508951,
|
|
114
|
+
44288, 904516, -3724342, 1653064, 2389356,
|
|
115
|
+
759969, 189548, 3159746, -2409325, 1315589,
|
|
116
|
+
1285669, -812732, -3019102, -3628969, -1528703,
|
|
117
|
+
-3041255, 3475950, -1585221, 1939314, -1000202,
|
|
118
|
+
-3157330, 126922, -983419, 2715295, -3693493,
|
|
119
|
+
-2477047, -1228525, -1308169, 1349076, -1430430,
|
|
120
|
+
264944, 3097992, -1100098, 3958618, -8578,
|
|
121
|
+
-3249728, -210977, -1316856, -3553272, -1851402,
|
|
122
|
+
-177440, 1341330, -1584928, -1439742, -3881060,
|
|
123
|
+
3839961, 2091667, -3342478, 266997, -3520352,
|
|
124
|
+
900702, 495491, -655327, -3556995, 342297,
|
|
125
|
+
3437287, 2842341, 4055324, -3767016, -2994039,
|
|
126
|
+
-1333058, -451100, -1279661, 1500165, -542412,
|
|
127
|
+
-2584293, -2013608, 1957272, -3183426, 810149,
|
|
128
|
+
-3038916, 2213111, -426683, -1667432, -2939036,
|
|
129
|
+
183443, -554416, 3937738, 3407706, 2244091,
|
|
130
|
+
2434439, -3759364, 1859098, -1613174, -3122442,
|
|
131
|
+
-525098, 286988, -3342277, 2691481, 1247620,
|
|
132
|
+
1250494, 1869119, 1237275, 1312455, 1917081,
|
|
133
|
+
777191, -2831860, -3724270, 2432395, 3369112,
|
|
134
|
+
162844, 1652634, 3523897, -975884, 1723600,
|
|
135
|
+
-1104333, -2235985, -976891, 3919660, 1400424,
|
|
136
|
+
2316500, -2446433, -1235728, -1197226, 909542,
|
|
137
|
+
-43260, 2031748, -768622, -2437823, 1735879,
|
|
138
|
+
-2590150, 2486353, 2635921, 1903435, -3318210,
|
|
139
|
+
3306115, -2546312, 2235880, -1671176, 594136,
|
|
140
|
+
2454455, 185531, 1616392, -3694233, 3866901,
|
|
141
|
+
1717735, -1803090, -260646, -420899, 1612842,
|
|
142
|
+
-48306, -846154, 3817976, -3562462, 3513181,
|
|
143
|
+
-3193378, 819034, -522500, 3207046, -3595838,
|
|
144
|
+
4108315, 203044, 1265009, 1595974, -3548272,
|
|
145
|
+
-1050970, -1430225, -1962642, -1374803, 3406031,
|
|
146
|
+
-1846953, -3776993, -164721, -1207385, 3014001,
|
|
147
|
+
-1799107, 269760, 472078, 1910376, -3833893,
|
|
148
|
+
-2286327, -3545687, -1362209, 1976782,
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
#else /* MLD_ARITH_BACKEND_X86_64_DEFAULT && !MLD_CONFIG_MULTILEVEL_NO_SHARED \
|
|
152
|
+
*/
|
|
153
|
+
|
|
154
|
+
MLD_EMPTY_CU(avx2_consts)
|
|
155
|
+
|
|
156
|
+
#endif /* !(MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
157
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED) */
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-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 mldsa-native repository.
|
|
9
|
+
* Do not modify it directly.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#ifndef MLD_NATIVE_X86_64_SRC_CONSTS_H
|
|
13
|
+
#define MLD_NATIVE_X86_64_SRC_CONSTS_H
|
|
14
|
+
#include "../../../common.h"
|
|
15
|
+
#define MLD_AVX2_BACKEND_DATA_OFFSET_8XQ 0
|
|
16
|
+
#define MLD_AVX2_BACKEND_DATA_OFFSET_8XQINV 8
|
|
17
|
+
#define MLD_AVX2_BACKEND_DATA_OFFSET_8XDIV_QINV 16
|
|
18
|
+
#define MLD_AVX2_BACKEND_DATA_OFFSET_8XDIV 24
|
|
19
|
+
#define MLD_AVX2_BACKEND_DATA_OFFSET_ZETAS_QINV 32
|
|
20
|
+
#define MLD_AVX2_BACKEND_DATA_OFFSET_ZETAS 328
|
|
21
|
+
|
|
22
|
+
#ifndef __ASSEMBLER__
|
|
23
|
+
#define mld_qdata MLD_NAMESPACE(qdata)
|
|
24
|
+
extern const int32_t mld_qdata[624];
|
|
25
|
+
#endif
|
|
26
|
+
|
|
27
|
+
#endif /* !MLD_NATIVE_X86_64_SRC_CONSTS_H */
|