pq_crypto 0.3.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +56 -0
- data/CHANGELOG.md +62 -0
- data/GET_STARTED.md +366 -40
- data/README.md +76 -233
- data/SECURITY.md +107 -82
- data/ext/pqcrypto/extconf.rb +169 -87
- data/ext/pqcrypto/mldsa_api.h +1 -48
- data/ext/pqcrypto/mlkem_api.h +1 -18
- data/ext/pqcrypto/pq_externalmu.c +89 -204
- data/ext/pqcrypto/pqcrypto_native_api.h +129 -0
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +484 -84
- data/ext/pqcrypto/pqcrypto_secure.c +203 -78
- data/ext/pqcrypto/pqcrypto_secure.h +53 -14
- data/ext/pqcrypto/pqcrypto_version.h +7 -0
- 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/algorithm_registry.rb +200 -0
- data/lib/pq_crypto/hybrid_kem.rb +1 -12
- data/lib/pq_crypto/kem.rb +104 -13
- data/lib/pq_crypto/pkcs8.rb +387 -0
- data/lib/pq_crypto/serialization.rb +1 -14
- data/lib/pq_crypto/signature.rb +123 -17
- data/lib/pq_crypto/spki.rb +131 -0
- data/lib/pq_crypto/version.rb +1 -1
- data/lib/pq_crypto.rb +79 -20
- data/script/vendor_libs.rb +88 -155
- metadata +241 -73
- 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-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-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
|
@@ -0,0 +1,502 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* References
|
|
7
|
+
* ==========
|
|
8
|
+
*
|
|
9
|
+
* - [FIPS203]
|
|
10
|
+
* FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
|
|
11
|
+
* National Institute of Standards and Technology
|
|
12
|
+
* https://csrc.nist.gov/pubs/fips/203/final
|
|
13
|
+
*
|
|
14
|
+
* - [NeonNTT]
|
|
15
|
+
* Neon NTT: Faster Dilithium, Kyber, and Saber on Cortex-A72 and Apple M1
|
|
16
|
+
* Becker, Hwang, Kannwischer, Yang, Yang
|
|
17
|
+
* https://eprint.iacr.org/2021/986
|
|
18
|
+
*
|
|
19
|
+
* - [REF]
|
|
20
|
+
* CRYSTALS-Kyber C reference implementation
|
|
21
|
+
* Bos, Ducas, Kiltz, Lepoint, Lyubashevsky, Schanck, Schwabe, Seiler, Stehlé
|
|
22
|
+
* https://github.com/pq-crystals/kyber/tree/main/ref
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#include "poly_k.h"
|
|
26
|
+
|
|
27
|
+
#include "debug.h"
|
|
28
|
+
#include "sampling.h"
|
|
29
|
+
#include "symmetric.h"
|
|
30
|
+
|
|
31
|
+
/* Parameter set namespacing
|
|
32
|
+
* This is to facilitate building multiple instances
|
|
33
|
+
* of mlkem-native (e.g. with varying parameter sets)
|
|
34
|
+
* within a single compilation unit. */
|
|
35
|
+
#define mlk_poly_cbd_eta1 MLK_ADD_PARAM_SET(mlk_poly_cbd_eta1)
|
|
36
|
+
#define mlk_poly_cbd_eta2 MLK_ADD_PARAM_SET(mlk_poly_cbd_eta2)
|
|
37
|
+
#define mlk_polyvec_basemul_acc_montgomery_cached_c \
|
|
38
|
+
MLK_ADD_PARAM_SET(mlk_polyvec_basemul_acc_montgomery_cached_c)
|
|
39
|
+
/* End of parameter set namespacing */
|
|
40
|
+
|
|
41
|
+
/* Reference: `polyvec_compress()` in the reference implementation @[REF]
|
|
42
|
+
* - In contrast to the reference implementation, we assume
|
|
43
|
+
* unsigned canonical coefficients here.
|
|
44
|
+
* The reference implementation works with coefficients
|
|
45
|
+
* in the range (-MLKEM_Q+1,...,MLKEM_Q-1). */
|
|
46
|
+
MLK_INTERNAL_API
|
|
47
|
+
void mlk_polyvec_compress_du(uint8_t r[MLKEM_POLYVECCOMPRESSEDBYTES_DU],
|
|
48
|
+
const mlk_polyvec *a)
|
|
49
|
+
{
|
|
50
|
+
unsigned i;
|
|
51
|
+
mlk_assert_bound_2d(a->vec, MLKEM_K, MLKEM_N, 0, MLKEM_Q);
|
|
52
|
+
|
|
53
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
54
|
+
{
|
|
55
|
+
mlk_poly_compress_du(r + i * MLKEM_POLYCOMPRESSEDBYTES_DU, &a->vec[i]);
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
/* Reference: `polyvec_decompress()` in the reference implementation @[REF]. */
|
|
60
|
+
MLK_INTERNAL_API
|
|
61
|
+
void mlk_polyvec_decompress_du(mlk_polyvec *r,
|
|
62
|
+
const uint8_t a[MLKEM_POLYVECCOMPRESSEDBYTES_DU])
|
|
63
|
+
{
|
|
64
|
+
unsigned i;
|
|
65
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
66
|
+
{
|
|
67
|
+
mlk_poly_decompress_du(&r->vec[i], a + i * MLKEM_POLYCOMPRESSEDBYTES_DU);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
mlk_assert_bound_2d(r->vec, MLKEM_K, MLKEM_N, 0, MLKEM_Q);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/* Reference: `polyvec_tobytes()` in the reference implementation @[REF].
|
|
74
|
+
* - In contrast to the reference implementation, we assume
|
|
75
|
+
* unsigned canonical coefficients here.
|
|
76
|
+
* The reference implementation works with coefficients
|
|
77
|
+
* in the range (-MLKEM_Q+1,...,MLKEM_Q-1). */
|
|
78
|
+
MLK_INTERNAL_API
|
|
79
|
+
void mlk_polyvec_tobytes(uint8_t r[MLKEM_POLYVECBYTES], const mlk_polyvec *a)
|
|
80
|
+
{
|
|
81
|
+
unsigned i;
|
|
82
|
+
mlk_assert_bound_2d(a->vec, MLKEM_K, MLKEM_N, 0, MLKEM_Q);
|
|
83
|
+
|
|
84
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
85
|
+
__loop__(
|
|
86
|
+
assigns(i, memory_slice(r, MLKEM_POLYVECBYTES))
|
|
87
|
+
invariant(i <= MLKEM_K)
|
|
88
|
+
)
|
|
89
|
+
{
|
|
90
|
+
mlk_poly_tobytes(&r[i * MLKEM_POLYBYTES], &a->vec[i]);
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/* Reference: `polyvec_frombytes()` in the reference implementation @[REF]. */
|
|
95
|
+
MLK_INTERNAL_API
|
|
96
|
+
void mlk_polyvec_frombytes(mlk_polyvec *r, const uint8_t a[MLKEM_POLYVECBYTES])
|
|
97
|
+
{
|
|
98
|
+
unsigned i;
|
|
99
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
100
|
+
{
|
|
101
|
+
mlk_poly_frombytes(&r->vec[i], a + i * MLKEM_POLYBYTES);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
mlk_assert_bound_2d(r->vec, MLKEM_K, MLKEM_N, 0, MLKEM_UINT12_LIMIT);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/* Reference: `polyvec_ntt()` in the reference implementation @[REF]. */
|
|
108
|
+
MLK_INTERNAL_API
|
|
109
|
+
void mlk_polyvec_ntt(mlk_polyvec *r)
|
|
110
|
+
{
|
|
111
|
+
unsigned i;
|
|
112
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
113
|
+
{
|
|
114
|
+
mlk_poly_ntt(&r->vec[i]);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
mlk_assert_abs_bound_2d(r->vec, MLKEM_K, MLKEM_N, MLK_NTT_BOUND);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/* Reference: `polyvec_invntt_tomont()` in the reference implementation @[REF].
|
|
121
|
+
* - We normalize at the beginning of the inverse NTT,
|
|
122
|
+
* while the reference implementation normalizes at
|
|
123
|
+
* the end. This allows us to drop a call to `poly_reduce()`
|
|
124
|
+
* from the base multiplication. */
|
|
125
|
+
MLK_INTERNAL_API
|
|
126
|
+
void mlk_polyvec_invntt_tomont(mlk_polyvec *r)
|
|
127
|
+
{
|
|
128
|
+
unsigned i;
|
|
129
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
130
|
+
{
|
|
131
|
+
mlk_poly_invntt_tomont(&r->vec[i]);
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
mlk_assert_abs_bound_2d(r->vec, MLKEM_K, MLKEM_N, MLK_INVNTT_BOUND);
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
/* Reference: `polyvec_basemul_acc_montgomery()` in the
|
|
138
|
+
* reference implementation @[REF].
|
|
139
|
+
* - We use a multiplication cache ('mulcache') here
|
|
140
|
+
* which is not present in the reference implementation @[REF].
|
|
141
|
+
* This idea originates from @[NeonNTT] and is used
|
|
142
|
+
* at the C level here.
|
|
143
|
+
* - We compute the coefficients of the scalar product in 32-bit
|
|
144
|
+
* coefficients and perform only a single modular reduction
|
|
145
|
+
* at the end. The reference implementation uses 2 * MLKEM_K
|
|
146
|
+
* more modular reductions since it reduces after every modular
|
|
147
|
+
* multiplication. */
|
|
148
|
+
MLK_STATIC_TESTABLE void mlk_polyvec_basemul_acc_montgomery_cached_c(
|
|
149
|
+
mlk_poly *r, const mlk_polyvec *a, const mlk_polyvec *b,
|
|
150
|
+
const mlk_polyvec_mulcache *b_cache)
|
|
151
|
+
__contract__(
|
|
152
|
+
requires(memory_no_alias(r, sizeof(mlk_poly)))
|
|
153
|
+
requires(memory_no_alias(a, sizeof(mlk_polyvec)))
|
|
154
|
+
requires(memory_no_alias(b, sizeof(mlk_polyvec)))
|
|
155
|
+
requires(memory_no_alias(b_cache, sizeof(mlk_polyvec_mulcache)))
|
|
156
|
+
requires(forall(k1, 0, MLKEM_K,
|
|
157
|
+
array_bound(a->vec[k1].coeffs, 0, MLKEM_N, 0, MLKEM_UINT12_LIMIT)))
|
|
158
|
+
assigns(memory_slice(r, sizeof(mlk_poly)))
|
|
159
|
+
)
|
|
160
|
+
{
|
|
161
|
+
unsigned i;
|
|
162
|
+
mlk_assert_bound_2d(a->vec, MLKEM_K, MLKEM_N, 0, MLKEM_UINT12_LIMIT);
|
|
163
|
+
|
|
164
|
+
for (i = 0; i < MLKEM_N / 2; i++)
|
|
165
|
+
__loop__(invariant(i <= MLKEM_N / 2))
|
|
166
|
+
{
|
|
167
|
+
unsigned k;
|
|
168
|
+
int32_t t[2] = {0};
|
|
169
|
+
for (k = 0; k < MLKEM_K; k++)
|
|
170
|
+
__loop__(
|
|
171
|
+
invariant(k <= MLKEM_K &&
|
|
172
|
+
t[0] <= (int32_t) k * 2 * MLKEM_UINT12_LIMIT * 32768 &&
|
|
173
|
+
t[0] >= - ((int32_t) k * 2 * MLKEM_UINT12_LIMIT * 32768) &&
|
|
174
|
+
t[1] <= ((int32_t) k * 2 * MLKEM_UINT12_LIMIT * 32768) &&
|
|
175
|
+
t[1] >= - ((int32_t) k * 2 * MLKEM_UINT12_LIMIT * 32768)))
|
|
176
|
+
{
|
|
177
|
+
t[0] += (int32_t)a->vec[k].coeffs[2 * i + 1] * b_cache->vec[k].coeffs[i];
|
|
178
|
+
t[0] += (int32_t)a->vec[k].coeffs[2 * i] * b->vec[k].coeffs[2 * i];
|
|
179
|
+
t[1] += (int32_t)a->vec[k].coeffs[2 * i] * b->vec[k].coeffs[2 * i + 1];
|
|
180
|
+
t[1] += (int32_t)a->vec[k].coeffs[2 * i + 1] * b->vec[k].coeffs[2 * i];
|
|
181
|
+
}
|
|
182
|
+
r->coeffs[2 * i + 0] = mlk_montgomery_reduce(t[0]);
|
|
183
|
+
r->coeffs[2 * i + 1] = mlk_montgomery_reduce(t[1]);
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
MLK_INTERNAL_API
|
|
188
|
+
void mlk_polyvec_basemul_acc_montgomery_cached(
|
|
189
|
+
mlk_poly *r, const mlk_polyvec *a, const mlk_polyvec *b,
|
|
190
|
+
const mlk_polyvec_mulcache *b_cache)
|
|
191
|
+
{
|
|
192
|
+
#if defined(MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED)
|
|
193
|
+
{
|
|
194
|
+
int ret;
|
|
195
|
+
mlk_assert_bound_2d(a->vec, MLKEM_K, MLKEM_N, 0, MLKEM_UINT12_LIMIT);
|
|
196
|
+
#if MLKEM_K == 2
|
|
197
|
+
ret = mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
|
|
198
|
+
r->coeffs, (const int16_t *)a, (const int16_t *)b,
|
|
199
|
+
(const int16_t *)b_cache);
|
|
200
|
+
#elif MLKEM_K == 3
|
|
201
|
+
ret = mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
|
|
202
|
+
r->coeffs, (const int16_t *)a, (const int16_t *)b,
|
|
203
|
+
(const int16_t *)b_cache);
|
|
204
|
+
#elif MLKEM_K == 4
|
|
205
|
+
ret = mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
|
|
206
|
+
r->coeffs, (const int16_t *)a, (const int16_t *)b,
|
|
207
|
+
(const int16_t *)b_cache);
|
|
208
|
+
#endif
|
|
209
|
+
if (ret == MLK_NATIVE_FUNC_SUCCESS)
|
|
210
|
+
{
|
|
211
|
+
return;
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
#endif /* MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED */
|
|
215
|
+
|
|
216
|
+
mlk_polyvec_basemul_acc_montgomery_cached_c(r, a, b, b_cache);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
/* Reference: Does not exist in the reference implementation @[REF].
|
|
220
|
+
* - The reference implementation does not use a
|
|
221
|
+
* multiplication cache ('mulcache'). This idea originates
|
|
222
|
+
* from @[NeonNTT] and is used at the C level here. */
|
|
223
|
+
MLK_INTERNAL_API
|
|
224
|
+
void mlk_polyvec_mulcache_compute(mlk_polyvec_mulcache *x, const mlk_polyvec *a)
|
|
225
|
+
{
|
|
226
|
+
unsigned i;
|
|
227
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
228
|
+
{
|
|
229
|
+
mlk_poly_mulcache_compute(&x->vec[i], &a->vec[i]);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
/* Reference: `polyvec_reduce()` in the reference implementation @[REF].
|
|
234
|
+
* - We use _unsigned_ canonical outputs, while the reference
|
|
235
|
+
* implementation uses _signed_ canonical outputs.
|
|
236
|
+
* Accordingly, we need a conditional addition of MLKEM_Q
|
|
237
|
+
* here to go from signed to unsigned representatives.
|
|
238
|
+
* This conditional addition is then dropped from all
|
|
239
|
+
* polynomial compression functions instead (see `compress.c`). */
|
|
240
|
+
MLK_INTERNAL_API
|
|
241
|
+
void mlk_polyvec_reduce(mlk_polyvec *r)
|
|
242
|
+
{
|
|
243
|
+
unsigned i;
|
|
244
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
245
|
+
{
|
|
246
|
+
mlk_poly_reduce(&r->vec[i]);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
mlk_assert_bound_2d(r->vec, MLKEM_K, MLKEM_N, 0, MLKEM_Q);
|
|
250
|
+
}
|
|
251
|
+
|
|
252
|
+
/* Reference: `polyvec_add()` in the reference implementation @[REF].
|
|
253
|
+
* - We use destructive version (output=first input) to avoid
|
|
254
|
+
* reasoning about aliasing in the CBMC specification */
|
|
255
|
+
MLK_INTERNAL_API
|
|
256
|
+
void mlk_polyvec_add(mlk_polyvec *r, const mlk_polyvec *b)
|
|
257
|
+
{
|
|
258
|
+
unsigned i;
|
|
259
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
260
|
+
__loop__(
|
|
261
|
+
assigns(i, memory_slice(r, sizeof(mlk_polyvec)))
|
|
262
|
+
invariant(i <= MLKEM_K)
|
|
263
|
+
invariant(forall(j0, i, MLKEM_K,
|
|
264
|
+
forall(k0, 0, MLKEM_N,
|
|
265
|
+
((int32_t)r->vec[j0].coeffs[k0] + b->vec[j0].coeffs[k0] <= INT16_MAX) &&
|
|
266
|
+
((int32_t)r->vec[j0].coeffs[k0] + b->vec[j0].coeffs[k0] >= INT16_MIN))))
|
|
267
|
+
invariant(forall(j2, 0, i,
|
|
268
|
+
forall(k2, 0, MLKEM_N,
|
|
269
|
+
(r->vec[j2].coeffs[k2] <= INT16_MAX) &&
|
|
270
|
+
(r->vec[j2].coeffs[k2] >= INT16_MIN))))
|
|
271
|
+
)
|
|
272
|
+
{
|
|
273
|
+
mlk_poly_add(&r->vec[i], &b->vec[i]);
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
/* Reference: `polyvec_tomont()` in the reference implementation @[REF]. */
|
|
278
|
+
MLK_INTERNAL_API
|
|
279
|
+
void mlk_polyvec_tomont(mlk_polyvec *r)
|
|
280
|
+
{
|
|
281
|
+
unsigned i;
|
|
282
|
+
for (i = 0; i < MLKEM_K; i++)
|
|
283
|
+
{
|
|
284
|
+
mlk_poly_tomont(&r->vec[i]);
|
|
285
|
+
}
|
|
286
|
+
|
|
287
|
+
mlk_assert_abs_bound_2d(r->vec, MLKEM_K, MLKEM_N, MLKEM_Q);
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
|
|
291
|
+
/*************************************************
|
|
292
|
+
* Name: mlk_poly_cbd_eta1
|
|
293
|
+
*
|
|
294
|
+
* Description: Given an array of uniformly random bytes, compute
|
|
295
|
+
* polynomial with coefficients distributed according to
|
|
296
|
+
* a centered binomial distribution with parameter MLKEM_ETA1.
|
|
297
|
+
*
|
|
298
|
+
* Arguments: - mlk_poly *r: pointer to output polynomial
|
|
299
|
+
* - const uint8_t *buf: pointer to input byte array
|
|
300
|
+
*
|
|
301
|
+
* Specification: Implements @[FIPS203, Algorithm 8, SamplePolyCBD_eta1], where
|
|
302
|
+
* eta1 is specified per parameter set in @[FIPS203, Table 2]
|
|
303
|
+
* and represented as MLKEM_ETA1 here.
|
|
304
|
+
*
|
|
305
|
+
**************************************************/
|
|
306
|
+
|
|
307
|
+
/* Reference: `poly_cbd_eta1` in the reference implementation @[REF]. */
|
|
308
|
+
static MLK_INLINE void mlk_poly_cbd_eta1(
|
|
309
|
+
mlk_poly *r, const uint8_t buf[MLKEM_ETA1 * MLKEM_N / 4])
|
|
310
|
+
__contract__(
|
|
311
|
+
requires(memory_no_alias(r, sizeof(mlk_poly)))
|
|
312
|
+
requires(memory_no_alias(buf, MLKEM_ETA1 * MLKEM_N / 4))
|
|
313
|
+
assigns(memory_slice(r, sizeof(mlk_poly)))
|
|
314
|
+
ensures(array_abs_bound(r->coeffs, 0, MLKEM_N, MLKEM_ETA1 + 1))
|
|
315
|
+
)
|
|
316
|
+
{
|
|
317
|
+
#if MLKEM_ETA1 == 2
|
|
318
|
+
mlk_poly_cbd2(r, buf);
|
|
319
|
+
#elif MLKEM_ETA1 == 3
|
|
320
|
+
mlk_poly_cbd3(r, buf);
|
|
321
|
+
#else
|
|
322
|
+
#error "Invalid value of MLKEM_ETA1"
|
|
323
|
+
#endif
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
/* Reference: Does not exist in the reference implementation @[REF].
|
|
327
|
+
* - This implements a x4-batched version of `poly_getnoise_eta1()`
|
|
328
|
+
* from the reference implementation, to leverage
|
|
329
|
+
* batched Keccak-f1600.*/
|
|
330
|
+
MLK_INTERNAL_API
|
|
331
|
+
void mlk_poly_getnoise_eta1_4x(mlk_poly *r0, mlk_poly *r1, mlk_poly *r2,
|
|
332
|
+
mlk_poly *r3, const uint8_t seed[MLKEM_SYMBYTES],
|
|
333
|
+
uint8_t nonce0, uint8_t nonce1, uint8_t nonce2,
|
|
334
|
+
uint8_t nonce3)
|
|
335
|
+
{
|
|
336
|
+
MLK_ALIGN uint8_t buf[4][MLK_ALIGN_UP(MLKEM_ETA1 * MLKEM_N / 4)];
|
|
337
|
+
MLK_ALIGN uint8_t extkey[4][MLK_ALIGN_UP(MLKEM_SYMBYTES + 1)];
|
|
338
|
+
mlk_memcpy(extkey[0], seed, MLKEM_SYMBYTES);
|
|
339
|
+
mlk_memcpy(extkey[1], seed, MLKEM_SYMBYTES);
|
|
340
|
+
mlk_memcpy(extkey[2], seed, MLKEM_SYMBYTES);
|
|
341
|
+
mlk_memcpy(extkey[3], seed, MLKEM_SYMBYTES);
|
|
342
|
+
extkey[0][MLKEM_SYMBYTES] = nonce0;
|
|
343
|
+
extkey[1][MLKEM_SYMBYTES] = nonce1;
|
|
344
|
+
extkey[2][MLKEM_SYMBYTES] = nonce2;
|
|
345
|
+
extkey[3][MLKEM_SYMBYTES] = nonce3;
|
|
346
|
+
|
|
347
|
+
#if !defined(FIPS202_X4_DEFAULT_IMPLEMENTATION) && \
|
|
348
|
+
!defined(MLK_CONFIG_SERIAL_FIPS202_ONLY)
|
|
349
|
+
mlk_prf_eta1_x4(buf, extkey);
|
|
350
|
+
#else
|
|
351
|
+
mlk_prf_eta1(buf[0], extkey[0]);
|
|
352
|
+
mlk_prf_eta1(buf[1], extkey[1]);
|
|
353
|
+
mlk_prf_eta1(buf[2], extkey[2]);
|
|
354
|
+
if (r3 != NULL)
|
|
355
|
+
{
|
|
356
|
+
mlk_prf_eta1(buf[3], extkey[3]);
|
|
357
|
+
}
|
|
358
|
+
#endif /* !(!FIPS202_X4_DEFAULT_IMPLEMENTATION && \
|
|
359
|
+
!MLK_CONFIG_SERIAL_FIPS202_ONLY) */
|
|
360
|
+
|
|
361
|
+
mlk_poly_cbd_eta1(r0, buf[0]);
|
|
362
|
+
mlk_poly_cbd_eta1(r1, buf[1]);
|
|
363
|
+
mlk_poly_cbd_eta1(r2, buf[2]);
|
|
364
|
+
if (r3 != NULL)
|
|
365
|
+
{
|
|
366
|
+
mlk_poly_cbd_eta1(r3, buf[3]);
|
|
367
|
+
mlk_assert_abs_bound(r3, MLKEM_N, MLKEM_ETA1 + 1);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
mlk_assert_abs_bound(r0, MLKEM_N, MLKEM_ETA1 + 1);
|
|
371
|
+
mlk_assert_abs_bound(r1, MLKEM_N, MLKEM_ETA1 + 1);
|
|
372
|
+
mlk_assert_abs_bound(r2, MLKEM_N, MLKEM_ETA1 + 1);
|
|
373
|
+
|
|
374
|
+
/* Specification: Partially implements
|
|
375
|
+
* @[FIPS203, Section 3.3, Destruction of intermediate values] */
|
|
376
|
+
mlk_zeroize(buf, sizeof(buf));
|
|
377
|
+
mlk_zeroize(extkey, sizeof(extkey));
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
#if MLKEM_K == 2 || MLKEM_K == 4
|
|
381
|
+
/*************************************************
|
|
382
|
+
* Name: mlk_poly_cbd_eta2
|
|
383
|
+
*
|
|
384
|
+
* Description: Given an array of uniformly random bytes, compute
|
|
385
|
+
* polynomial with coefficients distributed according to
|
|
386
|
+
* a centered binomial distribution with parameter MLKEM_ETA2.
|
|
387
|
+
*
|
|
388
|
+
* Arguments: - mlk_poly *r: pointer to output polynomial
|
|
389
|
+
* - const uint8_t *buf: pointer to input byte array
|
|
390
|
+
*
|
|
391
|
+
* Specification: Implements @[FIPS203, Algorithm 8, SamplePolyCBD_eta2], where
|
|
392
|
+
* eta2 is specified per parameter set in @[FIPS203, Table 2]
|
|
393
|
+
* and represented as MLKEM_ETA2 here.
|
|
394
|
+
*
|
|
395
|
+
**************************************************/
|
|
396
|
+
|
|
397
|
+
/* Reference: `poly_cbd_eta2` in the reference implementation @[REF]. */
|
|
398
|
+
static MLK_INLINE void mlk_poly_cbd_eta2(
|
|
399
|
+
mlk_poly *r, const uint8_t buf[MLKEM_ETA2 * MLKEM_N / 4])
|
|
400
|
+
__contract__(
|
|
401
|
+
requires(memory_no_alias(r, sizeof(mlk_poly)))
|
|
402
|
+
requires(memory_no_alias(buf, MLKEM_ETA2 * MLKEM_N / 4))
|
|
403
|
+
assigns(memory_slice(r, sizeof(mlk_poly)))
|
|
404
|
+
ensures(array_abs_bound(r->coeffs, 0, MLKEM_N, MLKEM_ETA2 + 1)))
|
|
405
|
+
{
|
|
406
|
+
#if MLKEM_ETA2 == 2
|
|
407
|
+
mlk_poly_cbd2(r, buf);
|
|
408
|
+
#else
|
|
409
|
+
#error "Invalid value of MLKEM_ETA2"
|
|
410
|
+
#endif
|
|
411
|
+
}
|
|
412
|
+
|
|
413
|
+
/* Reference: `poly_getnoise_eta2()` in the reference implementation @[REF].
|
|
414
|
+
* - We include buffer zeroization. */
|
|
415
|
+
MLK_INTERNAL_API
|
|
416
|
+
void mlk_poly_getnoise_eta2(mlk_poly *r, const uint8_t seed[MLKEM_SYMBYTES],
|
|
417
|
+
uint8_t nonce)
|
|
418
|
+
{
|
|
419
|
+
MLK_ALIGN uint8_t buf[MLKEM_ETA2 * MLKEM_N / 4];
|
|
420
|
+
MLK_ALIGN uint8_t extkey[MLKEM_SYMBYTES + 1];
|
|
421
|
+
|
|
422
|
+
mlk_memcpy(extkey, seed, MLKEM_SYMBYTES);
|
|
423
|
+
extkey[MLKEM_SYMBYTES] = nonce;
|
|
424
|
+
mlk_prf_eta2(buf, extkey);
|
|
425
|
+
|
|
426
|
+
mlk_poly_cbd_eta2(r, buf);
|
|
427
|
+
|
|
428
|
+
mlk_assert_abs_bound(r, MLKEM_N, MLKEM_ETA2 + 1);
|
|
429
|
+
|
|
430
|
+
/* Specification: Partially implements
|
|
431
|
+
* @[FIPS203, Section 3.3, Destruction of intermediate values] */
|
|
432
|
+
mlk_zeroize(buf, sizeof(buf));
|
|
433
|
+
mlk_zeroize(extkey, sizeof(extkey));
|
|
434
|
+
}
|
|
435
|
+
#endif /* MLKEM_K == 2 || MLKEM_K == 4 */
|
|
436
|
+
|
|
437
|
+
#if MLKEM_K == 2
|
|
438
|
+
/* Reference: Does not exist in the reference implementation @[REF].
|
|
439
|
+
* - This implements a x4-batched version of `poly_getnoise_eta1()`
|
|
440
|
+
* and `poly_getnoise_eta2()` from the reference implementation,
|
|
441
|
+
* leveraging batched Keccak-f1600.
|
|
442
|
+
* - If a x4-batched Keccak-f1600 is available, we squeeze
|
|
443
|
+
* more random data than needed for the eta2 calls, to be
|
|
444
|
+
* be able to use a x4-batched Keccak-f1600. */
|
|
445
|
+
MLK_INTERNAL_API
|
|
446
|
+
void mlk_poly_getnoise_eta1122_4x(mlk_poly *r0, mlk_poly *r1, mlk_poly *r2,
|
|
447
|
+
mlk_poly *r3,
|
|
448
|
+
const uint8_t seed[MLKEM_SYMBYTES],
|
|
449
|
+
uint8_t nonce0, uint8_t nonce1,
|
|
450
|
+
uint8_t nonce2, uint8_t nonce3)
|
|
451
|
+
{
|
|
452
|
+
#if MLKEM_ETA2 >= MLKEM_ETA1
|
|
453
|
+
#error mlk_poly_getnoise_eta1122_4x assumes MLKEM_ETA1 > MLKEM_ETA2
|
|
454
|
+
#endif
|
|
455
|
+
MLK_ALIGN uint8_t buf[4][MLK_ALIGN_UP(MLKEM_ETA1 * MLKEM_N / 4)];
|
|
456
|
+
MLK_ALIGN uint8_t extkey[4][MLK_ALIGN_UP(MLKEM_SYMBYTES + 1)];
|
|
457
|
+
|
|
458
|
+
mlk_memcpy(extkey[0], seed, MLKEM_SYMBYTES);
|
|
459
|
+
mlk_memcpy(extkey[1], seed, MLKEM_SYMBYTES);
|
|
460
|
+
mlk_memcpy(extkey[2], seed, MLKEM_SYMBYTES);
|
|
461
|
+
mlk_memcpy(extkey[3], seed, MLKEM_SYMBYTES);
|
|
462
|
+
extkey[0][MLKEM_SYMBYTES] = nonce0;
|
|
463
|
+
extkey[1][MLKEM_SYMBYTES] = nonce1;
|
|
464
|
+
extkey[2][MLKEM_SYMBYTES] = nonce2;
|
|
465
|
+
extkey[3][MLKEM_SYMBYTES] = nonce3;
|
|
466
|
+
|
|
467
|
+
/* On systems with fast batched Keccak, we use 4-fold batched PRF,
|
|
468
|
+
* even though that means generating more random data in buf[2] and buf[3]
|
|
469
|
+
* than necessary. */
|
|
470
|
+
#if !defined(FIPS202_X4_DEFAULT_IMPLEMENTATION) && \
|
|
471
|
+
!defined(MLK_CONFIG_SERIAL_FIPS202_ONLY)
|
|
472
|
+
mlk_prf_eta1_x4(buf, extkey);
|
|
473
|
+
#else
|
|
474
|
+
mlk_prf_eta1(buf[0], extkey[0]);
|
|
475
|
+
mlk_prf_eta1(buf[1], extkey[1]);
|
|
476
|
+
mlk_prf_eta2(buf[2], extkey[2]);
|
|
477
|
+
mlk_prf_eta2(buf[3], extkey[3]);
|
|
478
|
+
#endif /* !(!FIPS202_X4_DEFAULT_IMPLEMENTATION && \
|
|
479
|
+
!MLK_CONFIG_SERIAL_FIPS202_ONLY) */
|
|
480
|
+
|
|
481
|
+
mlk_poly_cbd_eta1(r0, buf[0]);
|
|
482
|
+
mlk_poly_cbd_eta1(r1, buf[1]);
|
|
483
|
+
mlk_poly_cbd_eta2(r2, buf[2]);
|
|
484
|
+
mlk_poly_cbd_eta2(r3, buf[3]);
|
|
485
|
+
|
|
486
|
+
mlk_assert_abs_bound(r0, MLKEM_N, MLKEM_ETA1 + 1);
|
|
487
|
+
mlk_assert_abs_bound(r1, MLKEM_N, MLKEM_ETA1 + 1);
|
|
488
|
+
mlk_assert_abs_bound(r2, MLKEM_N, MLKEM_ETA2 + 1);
|
|
489
|
+
mlk_assert_abs_bound(r3, MLKEM_N, MLKEM_ETA2 + 1);
|
|
490
|
+
|
|
491
|
+
/* Specification: Partially implements
|
|
492
|
+
* @[FIPS203, Section 3.3, Destruction of intermediate values] */
|
|
493
|
+
mlk_zeroize(buf, sizeof(buf));
|
|
494
|
+
mlk_zeroize(extkey, sizeof(extkey));
|
|
495
|
+
}
|
|
496
|
+
#endif /* MLKEM_K == 2 */
|
|
497
|
+
|
|
498
|
+
/* To facilitate single-compilation-unit (SCU) builds, undefine all macros.
|
|
499
|
+
* Don't modify by hand -- this is auto-generated by scripts/autogen. */
|
|
500
|
+
#undef mlk_poly_cbd_eta1
|
|
501
|
+
#undef mlk_poly_cbd_eta2
|
|
502
|
+
#undef mlk_polyvec_basemul_acc_montgomery_cached_c
|