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,637 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#ifndef MLK_NATIVE_API_H
|
|
7
|
+
#define MLK_NATIVE_API_H
|
|
8
|
+
/*
|
|
9
|
+
* Native arithmetic interface
|
|
10
|
+
*
|
|
11
|
+
* This header is primarily for documentation purposes.
|
|
12
|
+
* It should not be included by backend implementations.
|
|
13
|
+
*
|
|
14
|
+
* To ensure consistency with backends, the header will be
|
|
15
|
+
* included automatically after inclusion of the active
|
|
16
|
+
* backend, to ensure consistency of function signatures,
|
|
17
|
+
* and run sanity checks.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
#include "../cbmc.h"
|
|
21
|
+
#include "../common.h"
|
|
22
|
+
|
|
23
|
+
/* Backends must return MLK_NATIVE_FUNC_SUCCESS upon success. */
|
|
24
|
+
#define MLK_NATIVE_FUNC_SUCCESS (0)
|
|
25
|
+
/* Backends may return MLK_NATIVE_FUNC_FALLBACK to signal to the frontend that
|
|
26
|
+
* the target/parameters are unsupported; typically, this would be because of
|
|
27
|
+
* dependencies on CPU features not detected on the host CPU. In this case,
|
|
28
|
+
* the frontend falls back to the default C implementation. */
|
|
29
|
+
#define MLK_NATIVE_FUNC_FALLBACK (-1)
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
/* Absolute exclusive upper bound for the output of the inverse NTT
|
|
33
|
+
*
|
|
34
|
+
* NOTE: This is the same bound as in poly.h and has to be kept
|
|
35
|
+
* in sync. */
|
|
36
|
+
#define MLK_INVNTT_BOUND (8 * MLKEM_Q)
|
|
37
|
+
|
|
38
|
+
/* Absolute exclusive upper bound for the output of the forward NTT
|
|
39
|
+
*
|
|
40
|
+
* NOTE: This is the same bound as in poly.h and has to be kept
|
|
41
|
+
* in sync. */
|
|
42
|
+
#define MLK_NTT_BOUND (8 * MLKEM_Q)
|
|
43
|
+
|
|
44
|
+
/*
|
|
45
|
+
* This is the C<->native interface allowing for the drop-in of
|
|
46
|
+
* native code for performance critical arithmetic components of ML-KEM.
|
|
47
|
+
*
|
|
48
|
+
* A _backend_ is a specific implementation of (part of) this interface.
|
|
49
|
+
*
|
|
50
|
+
* To add a function to a backend, define MLK_USE_NATIVE_XXX and
|
|
51
|
+
* implement `static inline xxx(...)` in the profile header.
|
|
52
|
+
*
|
|
53
|
+
* The only exception is MLK_USE_NATIVE_NTT_CUSTOM_ORDER. This option can
|
|
54
|
+
* be set if there are native implementations for all of NTT, invNTT, and
|
|
55
|
+
* base multiplication, and allows the native implementation to use a
|
|
56
|
+
* custom order of polynomial coefficients in NTT domain -- the use of such
|
|
57
|
+
* custom order is not an implementation-detail since the public matrix
|
|
58
|
+
* is generated in NTT domain. In this case, a permutation function
|
|
59
|
+
* mlk_poly_permute_bitrev_to_custom() needs to be provided that permutes
|
|
60
|
+
* polynomials in NTT domain from bitreversed to the custom order.
|
|
61
|
+
*/
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* Those functions are meant to be trivial wrappers around the chosen native
|
|
65
|
+
* implementation. The are static inline to avoid unnecessary calls.
|
|
66
|
+
* The macro before each declaration controls whether a native
|
|
67
|
+
* implementation is present.
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
#if defined(MLK_USE_NATIVE_NTT)
|
|
71
|
+
/*************************************************
|
|
72
|
+
* Name: mlk_ntt_native
|
|
73
|
+
*
|
|
74
|
+
* Description: Computes negacyclic number-theoretic transform (NTT) of
|
|
75
|
+
* a polynomial in place.
|
|
76
|
+
*
|
|
77
|
+
* The input polynomial is assumed to be in normal order.
|
|
78
|
+
* The output polynomial is in bitreversed order, or of a
|
|
79
|
+
* custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
80
|
+
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
81
|
+
* for more information.
|
|
82
|
+
*
|
|
83
|
+
* Arguments: - int16_t p[MLKEM_N]: pointer to in/output polynomial
|
|
84
|
+
**************************************************/
|
|
85
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
86
|
+
static MLK_INLINE int mlk_ntt_native(int16_t p[MLKEM_N])
|
|
87
|
+
__contract__(
|
|
88
|
+
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
89
|
+
requires(array_abs_bound(p, 0, MLKEM_N, MLKEM_Q))
|
|
90
|
+
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
91
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
92
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_abs_bound(p, 0, MLKEM_N, MLK_NTT_BOUND))
|
|
93
|
+
ensures((return_value == MLK_NATIVE_FUNC_FALLBACK) ==> array_abs_bound(p, 0, MLKEM_N, MLKEM_Q))
|
|
94
|
+
ensures((return_value == MLK_NATIVE_FUNC_FALLBACK) ==> array_unchanged(p, MLKEM_N))
|
|
95
|
+
);
|
|
96
|
+
#endif /* MLK_USE_NATIVE_NTT */
|
|
97
|
+
|
|
98
|
+
#if defined(MLK_USE_NATIVE_NTT_CUSTOM_ORDER)
|
|
99
|
+
/*
|
|
100
|
+
* This must only be set if NTT, invNTT, basemul, mulcache, and
|
|
101
|
+
* to/from byte stream conversions all have native implementations
|
|
102
|
+
* that are adapted to the custom order.
|
|
103
|
+
*/
|
|
104
|
+
#if !defined(MLK_USE_NATIVE_NTT) || !defined(MLK_USE_NATIVE_INTT) || \
|
|
105
|
+
!defined(MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE) || \
|
|
106
|
+
!defined(MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED) || \
|
|
107
|
+
!defined(MLK_USE_NATIVE_POLY_TOBYTES) || \
|
|
108
|
+
!defined(MLK_USE_NATIVE_POLY_FROMBYTES)
|
|
109
|
+
#error \
|
|
110
|
+
"Invalid native profile: MLK_USE_NATIVE_NTT_CUSTOM_ORDER can only be \
|
|
111
|
+
set if there are native implementations for NTT, invNTT, mulcache, basemul, \
|
|
112
|
+
and to/from bytes conversions."
|
|
113
|
+
#endif /* !MLK_USE_NATIVE_NTT || !MLK_USE_NATIVE_INTT || \
|
|
114
|
+
!MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE || \
|
|
115
|
+
!MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED || \
|
|
116
|
+
!MLK_USE_NATIVE_POLY_TOBYTES || !MLK_USE_NATIVE_POLY_FROMBYTES */
|
|
117
|
+
|
|
118
|
+
/*************************************************
|
|
119
|
+
* Name: mlk_poly_permute_bitrev_to_custom
|
|
120
|
+
*
|
|
121
|
+
* Description: When MLK_USE_NATIVE_NTT_CUSTOM_ORDER is defined,
|
|
122
|
+
* convert a polynomial in NTT domain from bitreversed
|
|
123
|
+
* order to the custom order output by the native NTT.
|
|
124
|
+
*
|
|
125
|
+
* This must only be defined if there is native code for
|
|
126
|
+
* all of (a) NTT, (b) invNTT, (c) basemul, (d) mulcache.
|
|
127
|
+
* Arguments: - int16_t p[MLKEM_N]: pointer to in/output polynomial
|
|
128
|
+
*
|
|
129
|
+
**************************************************/
|
|
130
|
+
static MLK_INLINE void mlk_poly_permute_bitrev_to_custom(int16_t p[MLKEM_N])
|
|
131
|
+
__contract__(
|
|
132
|
+
/* We don't specify that this should be a permutation, but only
|
|
133
|
+
* that it does not change the bound established at the end of mlk_gen_matrix. */
|
|
134
|
+
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
135
|
+
requires(array_bound(p, 0, MLKEM_N, 0, MLKEM_Q))
|
|
136
|
+
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
137
|
+
ensures(array_bound(p, 0, MLKEM_N, 0, MLKEM_Q)));
|
|
138
|
+
#endif /* MLK_USE_NATIVE_NTT_CUSTOM_ORDER */
|
|
139
|
+
|
|
140
|
+
#if defined(MLK_USE_NATIVE_INTT)
|
|
141
|
+
/*************************************************
|
|
142
|
+
* Name: mlk_intt_native
|
|
143
|
+
*
|
|
144
|
+
* Description: Computes inverse of negacyclic number-theoretic transform (NTT)
|
|
145
|
+
* of a polynomial in place.
|
|
146
|
+
*
|
|
147
|
+
* The input polynomial is in bitreversed order, or of a
|
|
148
|
+
* custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
149
|
+
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
150
|
+
* for more information.
|
|
151
|
+
* The output polynomial is assumed to be in normal order.
|
|
152
|
+
*
|
|
153
|
+
* Arguments: - uint16_t *a: pointer to in/output polynomial
|
|
154
|
+
**************************************************/
|
|
155
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
156
|
+
static MLK_INLINE int mlk_intt_native(int16_t p[MLKEM_N])
|
|
157
|
+
__contract__(
|
|
158
|
+
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
159
|
+
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
160
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
161
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_abs_bound(p, 0, MLKEM_N, MLK_INVNTT_BOUND))
|
|
162
|
+
ensures((return_value == MLK_NATIVE_FUNC_FALLBACK) ==> array_unchanged(p, MLKEM_N))
|
|
163
|
+
);
|
|
164
|
+
#endif /* MLK_USE_NATIVE_INTT */
|
|
165
|
+
|
|
166
|
+
#if defined(MLK_USE_NATIVE_POLY_REDUCE)
|
|
167
|
+
/*************************************************
|
|
168
|
+
* Name: mlk_poly_reduce_native
|
|
169
|
+
*
|
|
170
|
+
* Description: Applies modular reduction to all coefficients of a polynomial.
|
|
171
|
+
*
|
|
172
|
+
* Arguments: - int16_t r[MLKEM_N]: pointer to input/output polynomial
|
|
173
|
+
**************************************************/
|
|
174
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
175
|
+
static MLK_INLINE int mlk_poly_reduce_native(int16_t p[MLKEM_N])
|
|
176
|
+
__contract__(
|
|
177
|
+
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
178
|
+
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
179
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
180
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_bound(p, 0, MLKEM_N, 0, MLKEM_Q))
|
|
181
|
+
ensures((return_value == MLK_NATIVE_FUNC_FALLBACK) ==> array_unchanged(p, MLKEM_N))
|
|
182
|
+
);
|
|
183
|
+
#endif /* MLK_USE_NATIVE_POLY_REDUCE */
|
|
184
|
+
|
|
185
|
+
#if defined(MLK_USE_NATIVE_POLY_TOMONT)
|
|
186
|
+
/*************************************************
|
|
187
|
+
* Name: mlk_poly_tomont_native
|
|
188
|
+
*
|
|
189
|
+
* Description: Inplace conversion of all coefficients of a polynomial
|
|
190
|
+
* from normal domain to Montgomery domain
|
|
191
|
+
*
|
|
192
|
+
* Arguments: - int16_t r[MLKEM_N]: pointer to input/output polynomial
|
|
193
|
+
**************************************************/
|
|
194
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
195
|
+
static MLK_INLINE int mlk_poly_tomont_native(int16_t p[MLKEM_N])
|
|
196
|
+
__contract__(
|
|
197
|
+
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
198
|
+
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
199
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
200
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_abs_bound(p, 0, MLKEM_N, MLKEM_Q))
|
|
201
|
+
ensures((return_value == MLK_NATIVE_FUNC_FALLBACK) ==> array_unchanged(p, MLKEM_N))
|
|
202
|
+
);
|
|
203
|
+
#endif /* MLK_USE_NATIVE_POLY_TOMONT */
|
|
204
|
+
|
|
205
|
+
#if defined(MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE)
|
|
206
|
+
/*************************************************
|
|
207
|
+
* Name: mlk_poly_mulcache_compute_native
|
|
208
|
+
*
|
|
209
|
+
* Description: Compute multiplication cache for a polynomial
|
|
210
|
+
* in NTT domain.
|
|
211
|
+
*
|
|
212
|
+
* The purpose of the multiplication cache is to
|
|
213
|
+
* cache repeated computations required during a
|
|
214
|
+
* base multiplication of polynomials in NTT domain.
|
|
215
|
+
* The structure of the multiplication-cache is
|
|
216
|
+
* implementation defined.
|
|
217
|
+
*
|
|
218
|
+
* Arguments: INPUT:
|
|
219
|
+
* - mlk_poly: const pointer to input polynomial.
|
|
220
|
+
* This must be in NTT domain and inin bitreversed order, or of
|
|
221
|
+
* a custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
222
|
+
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
223
|
+
* for more information.
|
|
224
|
+
* OUTPUT
|
|
225
|
+
* - cache: pointer to multiplication cache
|
|
226
|
+
**************************************************/
|
|
227
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
228
|
+
static MLK_INLINE int mlk_poly_mulcache_compute_native(
|
|
229
|
+
int16_t cache[MLKEM_N / 2], const int16_t mlk_poly[MLKEM_N])
|
|
230
|
+
__contract__(
|
|
231
|
+
requires(memory_no_alias(cache, sizeof(int16_t) * (MLKEM_N / 2)))
|
|
232
|
+
requires(memory_no_alias(mlk_poly, sizeof(int16_t) * MLKEM_N))
|
|
233
|
+
assigns(memory_slice(cache, sizeof(int16_t) * (MLKEM_N / 2)))
|
|
234
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
235
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_abs_bound(cache, 0, MLKEM_N/2, MLKEM_Q))
|
|
236
|
+
);
|
|
237
|
+
#endif /* MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE */
|
|
238
|
+
|
|
239
|
+
#if defined(MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED)
|
|
240
|
+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 2
|
|
241
|
+
/*************************************************
|
|
242
|
+
* Name: poly_mulcache_compute_k2_native
|
|
243
|
+
*
|
|
244
|
+
* Description: Compute scalar product of length-2 polynomial vectors in NTT
|
|
245
|
+
* domain.
|
|
246
|
+
*
|
|
247
|
+
* Arguments: INPUT:
|
|
248
|
+
* - a: First polynomial vector operand.
|
|
249
|
+
* This must be in NTT domain and in bitreversed order, or of
|
|
250
|
+
* a custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
251
|
+
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
252
|
+
* for more information.
|
|
253
|
+
* - b: Second polynomial vector operand.
|
|
254
|
+
* As for a.
|
|
255
|
+
* - b_cache: Multiplication-cache for b.
|
|
256
|
+
* OUTPUT
|
|
257
|
+
* - r: The result of the scalar product. This is again
|
|
258
|
+
* in NTT domain, and of the same ordering as a and b.
|
|
259
|
+
**************************************************/
|
|
260
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
261
|
+
static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
|
|
262
|
+
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
|
|
263
|
+
const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
|
|
264
|
+
__contract__(
|
|
265
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
266
|
+
requires(memory_no_alias(a, sizeof(int16_t) * 2 * MLKEM_N))
|
|
267
|
+
requires(memory_no_alias(b, sizeof(int16_t) * 2 * MLKEM_N))
|
|
268
|
+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 2 * (MLKEM_N / 2)))
|
|
269
|
+
requires(array_bound(a, 0, 2 * MLKEM_N, 0, MLKEM_UINT12_LIMIT))
|
|
270
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
271
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
272
|
+
);
|
|
273
|
+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 */
|
|
274
|
+
|
|
275
|
+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 3
|
|
276
|
+
/*************************************************
|
|
277
|
+
* Name: poly_mulcache_compute_k3_native
|
|
278
|
+
*
|
|
279
|
+
* Description: Compute scalar product of length-3 polynomial vectors in NTT
|
|
280
|
+
* domain.
|
|
281
|
+
*
|
|
282
|
+
* Arguments: INPUT:
|
|
283
|
+
* - a: First polynomial vector operand.
|
|
284
|
+
* This must be in NTT domain and in bitreversed order, or of
|
|
285
|
+
* a custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
286
|
+
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
287
|
+
* for more information.
|
|
288
|
+
* - b: Second polynomial vector operand.
|
|
289
|
+
* As for a.
|
|
290
|
+
* - b_cache: Multiplication-cache for b.
|
|
291
|
+
* OUTPUT
|
|
292
|
+
* - r: The result of the scalar product. This is again
|
|
293
|
+
* in NTT domain, and of the same ordering as a and b.
|
|
294
|
+
**************************************************/
|
|
295
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
296
|
+
static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
|
|
297
|
+
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
|
|
298
|
+
const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
|
|
299
|
+
__contract__(
|
|
300
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
301
|
+
requires(memory_no_alias(a, sizeof(int16_t) * 3 * MLKEM_N))
|
|
302
|
+
requires(memory_no_alias(b, sizeof(int16_t) * 3 * MLKEM_N))
|
|
303
|
+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 3 * (MLKEM_N / 2)))
|
|
304
|
+
requires(array_bound(a, 0, 3 * MLKEM_N, 0, MLKEM_UINT12_LIMIT))
|
|
305
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
306
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
307
|
+
);
|
|
308
|
+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 3 */
|
|
309
|
+
|
|
310
|
+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
|
|
311
|
+
/*************************************************
|
|
312
|
+
* Name: poly_mulcache_compute_k4_native
|
|
313
|
+
*
|
|
314
|
+
* Description: Compute scalar product of length-4 polynomial vectors in NTT
|
|
315
|
+
* domain.
|
|
316
|
+
*
|
|
317
|
+
* Arguments: INPUT:
|
|
318
|
+
* - a: First polynomial vector operand.
|
|
319
|
+
* This must be in NTT domain and in bitreversed order, or of
|
|
320
|
+
* a custom order if MLK_USE_NATIVE_NTT_CUSTOM_ORDER is set.
|
|
321
|
+
* See the documentation of MLK_USE_NATIVE_NTT_CUSTOM_ORDER
|
|
322
|
+
* for more information.
|
|
323
|
+
* - b: Second polynomial vector operand.
|
|
324
|
+
* As for a.
|
|
325
|
+
* - b_cache: Multiplication-cache for b.
|
|
326
|
+
* OUTPUT
|
|
327
|
+
* - r: The result of the scalar product. This is again
|
|
328
|
+
* in NTT domain, and of the same ordering as a and b.
|
|
329
|
+
**************************************************/
|
|
330
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
331
|
+
static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
|
|
332
|
+
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
|
|
333
|
+
const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
|
|
334
|
+
__contract__(
|
|
335
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
336
|
+
requires(memory_no_alias(a, sizeof(int16_t) * 4 * MLKEM_N))
|
|
337
|
+
requires(memory_no_alias(b, sizeof(int16_t) * 4 * MLKEM_N))
|
|
338
|
+
requires(memory_no_alias(b_cache, sizeof(int16_t) * 4 * (MLKEM_N / 2)))
|
|
339
|
+
requires(array_bound(a, 0, 4 * MLKEM_N, 0, MLKEM_UINT12_LIMIT))
|
|
340
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
341
|
+
ensures(return_value == MLK_NATIVE_FUNC_FALLBACK || return_value == MLK_NATIVE_FUNC_SUCCESS)
|
|
342
|
+
);
|
|
343
|
+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
|
|
344
|
+
#endif /* MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED */
|
|
345
|
+
|
|
346
|
+
#if defined(MLK_USE_NATIVE_POLY_TOBYTES)
|
|
347
|
+
/*************************************************
|
|
348
|
+
* Name: mlk_poly_tobytes_native
|
|
349
|
+
*
|
|
350
|
+
* Description: Serialization of a polynomial.
|
|
351
|
+
* Signed coefficients are converted to
|
|
352
|
+
* unsigned form before serialization.
|
|
353
|
+
*
|
|
354
|
+
* Arguments: INPUT:
|
|
355
|
+
* - a: const pointer to input polynomial,
|
|
356
|
+
* with each coefficient in the range 0 .. Q-1
|
|
357
|
+
* OUTPUT
|
|
358
|
+
* - r: pointer to output byte array
|
|
359
|
+
* (of MLKEM_POLYBYTES bytes)
|
|
360
|
+
**************************************************/
|
|
361
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
362
|
+
static MLK_INLINE int mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
|
|
363
|
+
const int16_t a[MLKEM_N])
|
|
364
|
+
__contract__(
|
|
365
|
+
requires(memory_no_alias(r, MLKEM_POLYBYTES))
|
|
366
|
+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
367
|
+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_Q))
|
|
368
|
+
assigns(memory_slice(r, MLKEM_POLYBYTES))
|
|
369
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK)
|
|
370
|
+
);
|
|
371
|
+
#endif /* MLK_USE_NATIVE_POLY_TOBYTES */
|
|
372
|
+
|
|
373
|
+
#if defined(MLK_USE_NATIVE_POLY_FROMBYTES)
|
|
374
|
+
/*************************************************
|
|
375
|
+
* Name: mlk_poly_frombytes_native
|
|
376
|
+
*
|
|
377
|
+
* Description: Serialization of a polynomial.
|
|
378
|
+
* Signed coefficients are converted to
|
|
379
|
+
* unsigned form before serialization.
|
|
380
|
+
*
|
|
381
|
+
* Arguments: INPUT:
|
|
382
|
+
* - r: pointer to output polynomial in NTT domain
|
|
383
|
+
* OUTPUT
|
|
384
|
+
* - a: const pointer to input byte array
|
|
385
|
+
* (of MLKEM_POLYBYTES bytes)
|
|
386
|
+
**************************************************/
|
|
387
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
388
|
+
static MLK_INLINE int mlk_poly_frombytes_native(
|
|
389
|
+
int16_t a[MLKEM_N], const uint8_t r[MLKEM_POLYBYTES])
|
|
390
|
+
__contract__(
|
|
391
|
+
requires(memory_no_alias(r, MLKEM_POLYBYTES))
|
|
392
|
+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
393
|
+
assigns(memory_slice(a, sizeof(int16_t) * MLKEM_N))
|
|
394
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK)
|
|
395
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_bound(a, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT))
|
|
396
|
+
);
|
|
397
|
+
#endif /* MLK_USE_NATIVE_POLY_FROMBYTES */
|
|
398
|
+
|
|
399
|
+
#if defined(MLK_USE_NATIVE_REJ_UNIFORM)
|
|
400
|
+
/*************************************************
|
|
401
|
+
* Name: mlk_rej_uniform_native
|
|
402
|
+
*
|
|
403
|
+
* Description: Run rejection sampling on uniform random bytes to generate
|
|
404
|
+
* uniform random integers mod q
|
|
405
|
+
*
|
|
406
|
+
* Arguments: - int16_t *r: pointer to output buffer
|
|
407
|
+
* - unsigned len: requested number of 16-bit integers
|
|
408
|
+
* (uniform mod q).
|
|
409
|
+
* - const uint8_t *buf: pointer to input buffer
|
|
410
|
+
* (assumed to be uniform random bytes)
|
|
411
|
+
* - unsigned buflen: length of input buffer in bytes.
|
|
412
|
+
*
|
|
413
|
+
* Return -1 if the native implementation does not support the input lengths.
|
|
414
|
+
* Otherwise, returns non-negative number of sampled 16-bit integers (at most
|
|
415
|
+
* len).
|
|
416
|
+
**************************************************/
|
|
417
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
418
|
+
static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len,
|
|
419
|
+
const uint8_t *buf,
|
|
420
|
+
unsigned buflen)
|
|
421
|
+
__contract__(
|
|
422
|
+
requires(len <= 4096 && buflen <= 4096 && buflen % 3 == 0)
|
|
423
|
+
requires(memory_no_alias(r, sizeof(int16_t) * len))
|
|
424
|
+
requires(memory_no_alias(buf, buflen))
|
|
425
|
+
assigns(memory_slice(r, sizeof(int16_t) * len))
|
|
426
|
+
ensures(return_value != MLK_NATIVE_FUNC_FALLBACK
|
|
427
|
+
==> (0 <= return_value && return_value <= len))
|
|
428
|
+
ensures(return_value != MLK_NATIVE_FUNC_FALLBACK
|
|
429
|
+
==> array_bound(r, 0, (unsigned) return_value, 0, MLKEM_Q))
|
|
430
|
+
);
|
|
431
|
+
#endif /* MLK_USE_NATIVE_REJ_UNIFORM */
|
|
432
|
+
|
|
433
|
+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || (MLKEM_K == 2 || MLKEM_K == 3)
|
|
434
|
+
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D4)
|
|
435
|
+
/*************************************************
|
|
436
|
+
* Name: mlk_poly_compress_d4_native
|
|
437
|
+
*
|
|
438
|
+
* Description: Compression (4 bits) and subsequent serialization of a
|
|
439
|
+
* polynomial
|
|
440
|
+
*
|
|
441
|
+
* Arguments: - uint8_t *r: pointer to output byte array
|
|
442
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D4 bytes)
|
|
443
|
+
* - const int16_t a[MLKEM_N]: pointer to input polynomial
|
|
444
|
+
* Coefficients must be unsigned canonical,
|
|
445
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
446
|
+
**************************************************/
|
|
447
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
448
|
+
static MLK_INLINE int mlk_poly_compress_d4_native(
|
|
449
|
+
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4], const int16_t a[MLKEM_N])
|
|
450
|
+
__contract__(
|
|
451
|
+
requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D4))
|
|
452
|
+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
453
|
+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_Q))
|
|
454
|
+
assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D4))
|
|
455
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK));
|
|
456
|
+
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D4 */
|
|
457
|
+
|
|
458
|
+
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D10)
|
|
459
|
+
/*************************************************
|
|
460
|
+
* Name: mlk_poly_compress_d10_native
|
|
461
|
+
*
|
|
462
|
+
* Description: Compression (10 bits) and subsequent serialization of a
|
|
463
|
+
* polynomial
|
|
464
|
+
*
|
|
465
|
+
* Arguments: - uint8_t *r: pointer to output byte array
|
|
466
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D10 bytes)
|
|
467
|
+
* - const int16_t a[MLKEM_N]: pointer to input polynomial
|
|
468
|
+
* Coefficients must be unsigned canonical,
|
|
469
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
470
|
+
**************************************************/
|
|
471
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
472
|
+
static MLK_INLINE int mlk_poly_compress_d10_native(
|
|
473
|
+
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10], const int16_t a[MLKEM_N])
|
|
474
|
+
__contract__(
|
|
475
|
+
requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D10))
|
|
476
|
+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
477
|
+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_Q))
|
|
478
|
+
assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D10))
|
|
479
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK));
|
|
480
|
+
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D10 */
|
|
481
|
+
|
|
482
|
+
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D4)
|
|
483
|
+
/*************************************************
|
|
484
|
+
* Name: mlk_poly_decompress_d4
|
|
485
|
+
*
|
|
486
|
+
* Description: De-serialization and subsequent decompression (dv bits) of a
|
|
487
|
+
* polynomial; approximate inverse of poly_compress
|
|
488
|
+
*
|
|
489
|
+
* Arguments: - int16_t r[MLKEM_N]: pointer to output polynomial
|
|
490
|
+
* - const uint8_t *a: pointer to input byte array
|
|
491
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D4 bytes)
|
|
492
|
+
*
|
|
493
|
+
* Upon return, the coefficients of the output polynomial are unsigned-canonical
|
|
494
|
+
* (non-negative and smaller than MLKEM_Q).
|
|
495
|
+
*
|
|
496
|
+
**************************************************/
|
|
497
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
498
|
+
static MLK_INLINE int mlk_poly_decompress_d4_native(
|
|
499
|
+
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4])
|
|
500
|
+
__contract__(
|
|
501
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
502
|
+
requires(memory_no_alias(a, MLKEM_POLYCOMPRESSEDBYTES_D4))
|
|
503
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
504
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK)
|
|
505
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_bound(r, 0, MLKEM_N, 0, MLKEM_Q)));
|
|
506
|
+
#endif /* MLK_USE_NATIVE_POLY_DECOMPRESS_D4 */
|
|
507
|
+
|
|
508
|
+
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D10)
|
|
509
|
+
/*************************************************
|
|
510
|
+
* Name: mlk_poly_decompress_d10_native
|
|
511
|
+
*
|
|
512
|
+
* Description: De-serialization and subsequent decompression (10 bits) of a
|
|
513
|
+
* polynomial; approximate inverse of mlk_poly_compress_d10
|
|
514
|
+
*
|
|
515
|
+
* Arguments: - int16_t r[MLKEM_N]: pointer to output polynomial
|
|
516
|
+
* - const uint8_t *a: pointer to input byte array
|
|
517
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D10 bytes)
|
|
518
|
+
*
|
|
519
|
+
* Upon return, the coefficients of the output polynomial are unsigned-canonical
|
|
520
|
+
* (non-negative and smaller than MLKEM_Q).
|
|
521
|
+
*
|
|
522
|
+
**************************************************/
|
|
523
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
524
|
+
static MLK_INLINE int mlk_poly_decompress_d10_native(
|
|
525
|
+
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D10])
|
|
526
|
+
__contract__(
|
|
527
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
528
|
+
requires(memory_no_alias(a, MLKEM_POLYCOMPRESSEDBYTES_D10))
|
|
529
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
530
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK)
|
|
531
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_bound(r, 0, MLKEM_N, 0, MLKEM_Q)));
|
|
532
|
+
#endif /* MLK_USE_NATIVE_POLY_DECOMPRESS_D10 */
|
|
533
|
+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 2 || MLKEM_K == 3 */
|
|
534
|
+
|
|
535
|
+
#if defined(MLK_CONFIG_MULTILEVEL_WITH_SHARED) || MLKEM_K == 4
|
|
536
|
+
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D5)
|
|
537
|
+
/*************************************************
|
|
538
|
+
* Name: mlk_poly_compress_d5_native
|
|
539
|
+
*
|
|
540
|
+
* Description: Compression (5 bits) and subsequent serialization of a
|
|
541
|
+
* polynomial
|
|
542
|
+
*
|
|
543
|
+
* Arguments: - uint8_t *r: pointer to output byte array
|
|
544
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D5 bytes)
|
|
545
|
+
* - const int16_t a[MLKEM_N]: pointer to input polynomial
|
|
546
|
+
* Coefficients must be unsigned canonical,
|
|
547
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
548
|
+
**************************************************/
|
|
549
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
550
|
+
static MLK_INLINE int mlk_poly_compress_d5_native(
|
|
551
|
+
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5], const int16_t a[MLKEM_N])
|
|
552
|
+
__contract__(
|
|
553
|
+
requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D5))
|
|
554
|
+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
555
|
+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_Q))
|
|
556
|
+
assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D5))
|
|
557
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK));
|
|
558
|
+
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D5 */
|
|
559
|
+
|
|
560
|
+
#if defined(MLK_USE_NATIVE_POLY_COMPRESS_D11)
|
|
561
|
+
/*************************************************
|
|
562
|
+
* Name: mlk_poly_compress_d11_native
|
|
563
|
+
*
|
|
564
|
+
* Description: Compression (11 bits) and subsequent serialization of a
|
|
565
|
+
* polynomial
|
|
566
|
+
*
|
|
567
|
+
* Arguments: - uint8_t *r: pointer to output byte array
|
|
568
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D11 bytes)
|
|
569
|
+
* - const int16_t a[MLKEM_N]: pointer to input polynomial
|
|
570
|
+
* Coefficients must be unsigned canonical,
|
|
571
|
+
* i.e. in [0,1,..,MLKEM_Q-1].
|
|
572
|
+
**************************************************/
|
|
573
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
574
|
+
static MLK_INLINE int mlk_poly_compress_d11_native(
|
|
575
|
+
uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11], const int16_t a[MLKEM_N])
|
|
576
|
+
__contract__(
|
|
577
|
+
requires(memory_no_alias(r, MLKEM_POLYCOMPRESSEDBYTES_D11))
|
|
578
|
+
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
579
|
+
requires(array_bound(a, 0, MLKEM_N, 0, MLKEM_Q))
|
|
580
|
+
assigns(memory_slice(r, MLKEM_POLYCOMPRESSEDBYTES_D11))
|
|
581
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK));
|
|
582
|
+
#endif /* MLK_USE_NATIVE_POLY_COMPRESS_D11 */
|
|
583
|
+
|
|
584
|
+
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D5)
|
|
585
|
+
/*************************************************
|
|
586
|
+
* Name: mlk_poly_decompress_d5_native
|
|
587
|
+
*
|
|
588
|
+
* Description: De-serialization and subsequent decompression (dv bits) of a
|
|
589
|
+
* polynomial; approximate inverse of poly_compress
|
|
590
|
+
*
|
|
591
|
+
* Arguments: - int16_t r[MLKEM_N]: pointer to output polynomial
|
|
592
|
+
* - const uint8_t *a: pointer to input byte array
|
|
593
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D5 bytes)
|
|
594
|
+
*
|
|
595
|
+
* Upon return, the coefficients of the output polynomial are unsigned-canonical
|
|
596
|
+
* (non-negative and smaller than MLKEM_Q).
|
|
597
|
+
*
|
|
598
|
+
**************************************************/
|
|
599
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
600
|
+
static MLK_INLINE int mlk_poly_decompress_d5_native(
|
|
601
|
+
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5])
|
|
602
|
+
__contract__(
|
|
603
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
604
|
+
requires(memory_no_alias(a, MLKEM_POLYCOMPRESSEDBYTES_D5))
|
|
605
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
606
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK)
|
|
607
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_bound(r, 0, MLKEM_N, 0, MLKEM_Q)));
|
|
608
|
+
#endif /* MLK_USE_NATIVE_POLY_DECOMPRESS_D5 */
|
|
609
|
+
|
|
610
|
+
#if defined(MLK_USE_NATIVE_POLY_DECOMPRESS_D11)
|
|
611
|
+
/*************************************************
|
|
612
|
+
* Name: mlk_poly_decompress_d11_native
|
|
613
|
+
*
|
|
614
|
+
* Description: De-serialization and subsequent decompression (11 bits) of a
|
|
615
|
+
* polynomial; approximate inverse of mlk_poly_compress_d11
|
|
616
|
+
*
|
|
617
|
+
* Arguments: - int16_t r[MLKEM_N]: pointer to output polynomial
|
|
618
|
+
* - const uint8_t *a: pointer to input byte array
|
|
619
|
+
* (of length MLKEM_POLYCOMPRESSEDBYTES_D11 bytes)
|
|
620
|
+
*
|
|
621
|
+
* Upon return, the coefficients of the output polynomial are unsigned-canonical
|
|
622
|
+
* (non-negative and smaller than MLKEM_Q).
|
|
623
|
+
*
|
|
624
|
+
**************************************************/
|
|
625
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
626
|
+
static MLK_INLINE int mlk_poly_decompress_d11_native(
|
|
627
|
+
int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D11])
|
|
628
|
+
__contract__(
|
|
629
|
+
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
630
|
+
requires(memory_no_alias(a, MLKEM_POLYCOMPRESSEDBYTES_D11))
|
|
631
|
+
assigns(memory_slice(r, sizeof(int16_t) * MLKEM_N))
|
|
632
|
+
ensures(return_value == MLK_NATIVE_FUNC_SUCCESS || return_value == MLK_NATIVE_FUNC_FALLBACK)
|
|
633
|
+
ensures((return_value == MLK_NATIVE_FUNC_SUCCESS) ==> array_bound(r, 0, MLKEM_N, 0, MLKEM_Q)));
|
|
634
|
+
#endif /* MLK_USE_NATIVE_POLY_DECOMPRESS_D11 */
|
|
635
|
+
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
|
|
636
|
+
|
|
637
|
+
#endif /* !MLK_NATIVE_API_H */
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
#ifndef MLK_NATIVE_META_H
|
|
6
|
+
#define MLK_NATIVE_META_H
|
|
7
|
+
|
|
8
|
+
/*
|
|
9
|
+
* Default arithmetic backend
|
|
10
|
+
*/
|
|
11
|
+
#include "../sys.h"
|
|
12
|
+
|
|
13
|
+
#ifdef MLK_SYS_AARCH64
|
|
14
|
+
#include "aarch64/meta.h"
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
#ifdef MLK_SYS_X86_64_AVX2
|
|
18
|
+
#include "x86_64/meta.h"
|
|
19
|
+
#endif
|
|
20
|
+
|
|
21
|
+
#if defined(MLK_SYS_RISCV64_RVV)
|
|
22
|
+
#include "riscv64/meta.h"
|
|
23
|
+
#endif
|
|
24
|
+
|
|
25
|
+
#endif /* !MLK_NATIVE_META_H */
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[//]: # (SPDX-License-Identifier: CC-BY-4.0)
|
|
2
|
+
|
|
3
|
+
# RISC-V Vector Extension Backend
|
|
4
|
+
|
|
5
|
+
This is an arithmetic backend for CPUs implementing the RISC-V Vector Extension. The backend is functional for all physical `VLEN`, but the NTT and inverse NTT are so far only implemented for VLEN=256, falling back to the default C implementations for other VLENs.
|
|
6
|
+
|
|
7
|
+
## Requirements
|
|
8
|
+
|
|
9
|
+
- RISC-V 64-bit architecture
|
|
10
|
+
- Vector extension (RVV) version 1.0
|
|
11
|
+
- Standard "gc" extensions (integer and compressed instructions)
|