pq_crypto 0.4.2 → 0.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/ci.yml +27 -2
- data/CHANGELOG.md +59 -0
- data/GET_STARTED.md +21 -16
- data/README.md +26 -0
- data/SECURITY.md +22 -16
- data/ext/pqcrypto/extconf.rb +183 -99
- data/ext/pqcrypto/mldsa_api.h +1 -118
- data/ext/pqcrypto/mlkem_api.h +1 -42
- data/ext/pqcrypto/pq_externalmu.c +88 -216
- data/ext/pqcrypto/pqcrypto_native_api.h +132 -0
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +234 -12
- data/ext/pqcrypto/pqcrypto_secure.c +429 -334
- data/ext/pqcrypto/pqcrypto_secure.h +13 -45
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/randombytes.h +9 -0
- data/ext/pqcrypto/vendor/.vendored +12 -5
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +105 -0
- data/ext/pqcrypto/vendor/mldsa-native/LICENSE +286 -0
- data/ext/pqcrypto/vendor/mldsa-native/META.yml +24 -0
- data/ext/pqcrypto/vendor/mldsa-native/README.md +221 -0
- data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +8 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +721 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +975 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +724 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +723 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +166 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +321 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c +21 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +385 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +73 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +277 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +244 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +182 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +117 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +438 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +105 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +71 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +62 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +376 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +204 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +259 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1077 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +987 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +41 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +26 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +35 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +37 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +27 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +36 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +69 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +32 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +20 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +638 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +136 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +29 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +488 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +16 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/xkcp.h +31 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +247 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +231 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +150 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +753 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +129 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +145 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +177 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +79 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +55 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +85 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +85 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +102 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +110 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +72 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +69 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +40 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +189 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +135 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +128 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +543 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +62 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +649 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +23 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +315 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +124 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +2311 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +2383 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +239 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +131 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +187 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +61 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +102 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +104 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +91 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +93 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +126 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +160 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +293 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +224 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +77 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +991 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +393 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +946 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +360 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +877 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +725 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +249 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +1511 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +806 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +268 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +104 -0
- data/ext/pqcrypto/vendor/mlkem-native/LICENSE +294 -0
- data/ext/pqcrypto/vendor/mlkem-native/META.yml +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/README.md +223 -0
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +86 -0
- data/ext/pqcrypto/vendor/mlkem-native/SECURITY.md +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +23 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +660 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +538 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +681 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +709 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +274 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +717 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +688 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +64 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +128 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +251 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +158 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +208 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +80 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +463 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +98 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +70 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +375 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +203 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +258 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1076 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +986 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +46 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +34 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +26 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +117 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/README.md +10 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +79 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +667 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +40 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +290 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +314 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +28 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +33 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +41 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2.S +451 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +622 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +156 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +446 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +326 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/README.md +16 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +122 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +177 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/intt.S +628 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/ntt.S +562 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_mulcache_compute_asm.S +127 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_reduce_asm.S +150 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tobytes_asm.S +117 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tomont_asm.S +98 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +261 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +314 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +368 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_asm.S +226 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +542 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +637 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md +11 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +128 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +45 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +81 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +145 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_izetas.inc +27 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +805 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas.inc +27 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas_basemul.inc +39 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/README.md +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +304 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +309 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +94 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +45 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +102 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/intt.S +719 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mulcache_compute.S +90 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntt.S +639 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttfrombytes.S +193 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntttobytes.S +181 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttunpack.S +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d10.S +382 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d11.S +448 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d4.S +163 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d5.S +220 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d10.S +228 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d11.S +277 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d4.S +180 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d5.S +192 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +502 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +750 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +998 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/reduce.S +218 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_asm.S +103 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +544 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont.S +155 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h +76 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +572 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +317 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +502 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +668 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +60 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +362 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +118 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/symmetric.h +70 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +260 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.c +20 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +464 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/zetas.inc +30 -0
- data/lib/pq_crypto/hybrid_kem.rb +10 -1
- data/lib/pq_crypto/version.rb +1 -1
- data/lib/pq_crypto.rb +5 -1
- data/script/vendor_libs.rb +228 -154
- metadata +236 -160
- data/ext/pqcrypto/vendor/pqclean/common/aes.c +0 -639
- data/ext/pqcrypto/vendor/pqclean/common/aes.h +0 -64
- data/ext/pqcrypto/vendor/pqclean/common/compat.h +0 -73
- data/ext/pqcrypto/vendor/pqclean/common/crypto_declassify.h +0 -7
- data/ext/pqcrypto/vendor/pqclean/common/fips202.c +0 -928
- data/ext/pqcrypto/vendor/pqclean/common/fips202.h +0 -166
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/feat.S +0 -168
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.c +0 -684
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.h +0 -60
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SIMD256.c +0 -1028
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SnP.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-unrolling.macros +0 -198
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile +0 -8
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile.Microsoft_nmake +0 -8
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/SIMD256-config.h +0 -3
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/align.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/brg_endian.h +0 -142
- data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.c +0 -101
- data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.h +0 -39
- data/ext/pqcrypto/vendor/pqclean/common/randombytes.c +0 -355
- data/ext/pqcrypto/vendor/pqclean/common/randombytes.h +0 -27
- data/ext/pqcrypto/vendor/pqclean/common/sha2.c +0 -769
- data/ext/pqcrypto/vendor/pqclean/common/sha2.h +0 -173
- data/ext/pqcrypto/vendor/pqclean/common/sp800-185.c +0 -156
- data/ext/pqcrypto/vendor/pqclean/common/sp800-185.h +0 -27
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.c +0 -83
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.c +0 -311
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.c +0 -198
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.c +0 -108
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.c +0 -299
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.c +0 -188
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.c +0 -83
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.c +0 -299
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.c +0 -188
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.c +0 -848
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.c +0 -799
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.c +0 -92
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.c +0 -823
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.c +0 -92
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric.h +0 -34
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
#ifndef MLD_SYMMETRIC_H
|
|
6
|
+
#define MLD_SYMMETRIC_H
|
|
7
|
+
|
|
8
|
+
#include "cbmc.h"
|
|
9
|
+
#include "common.h"
|
|
10
|
+
|
|
11
|
+
#include MLD_FIPS202_HEADER_FILE
|
|
12
|
+
#if !defined(MLD_CONFIG_SERIAL_FIPS202_ONLY)
|
|
13
|
+
#include MLD_FIPS202X4_HEADER_FILE
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
#define MLD_STREAM128_BLOCKBYTES SHAKE128_RATE
|
|
17
|
+
#define MLD_STREAM256_BLOCKBYTES SHAKE256_RATE
|
|
18
|
+
|
|
19
|
+
#define mld_xof256_ctx mld_shake256ctx
|
|
20
|
+
#define mld_xof256_init(CTX) mld_shake256_init(CTX)
|
|
21
|
+
|
|
22
|
+
#define mld_xof256_absorb_once(CTX, IN, INBYTES) \
|
|
23
|
+
do \
|
|
24
|
+
{ \
|
|
25
|
+
mld_shake256_absorb(CTX, IN, INBYTES); \
|
|
26
|
+
mld_shake256_finalize(CTX); \
|
|
27
|
+
} while (0)
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
#define mld_xof256_release(CTX) mld_shake256_release(CTX)
|
|
31
|
+
#define mld_xof256_squeezeblocks(OUT, OUTBLOCKS, STATE) \
|
|
32
|
+
mld_shake256_squeeze(OUT, (OUTBLOCKS) * SHAKE256_RATE, STATE)
|
|
33
|
+
|
|
34
|
+
#define mld_xof128_ctx mld_shake128ctx
|
|
35
|
+
#define mld_xof128_init(CTX) mld_shake128_init(CTX)
|
|
36
|
+
|
|
37
|
+
#define mld_xof128_absorb_once(CTX, IN, INBYTES) \
|
|
38
|
+
do \
|
|
39
|
+
{ \
|
|
40
|
+
mld_shake128_absorb(CTX, IN, INBYTES); \
|
|
41
|
+
mld_shake128_finalize(CTX); \
|
|
42
|
+
} while (0)
|
|
43
|
+
|
|
44
|
+
#define mld_xof128_release(CTX) mld_shake128_release(CTX)
|
|
45
|
+
#define mld_xof128_squeezeblocks(OUT, OUTBLOCKS, STATE) \
|
|
46
|
+
mld_shake128_squeeze(OUT, (OUTBLOCKS) * SHAKE128_RATE, STATE)
|
|
47
|
+
|
|
48
|
+
#define mld_xof256_x4_ctx mld_shake256x4ctx
|
|
49
|
+
#define mld_xof256_x4_init(CTX) mld_shake256x4_init((CTX))
|
|
50
|
+
#define mld_xof256_x4_absorb(CTX, IN, INBYTES) \
|
|
51
|
+
mld_shake256x4_absorb_once((CTX), (IN)[0], (IN)[1], (IN)[2], (IN)[3], \
|
|
52
|
+
(INBYTES))
|
|
53
|
+
#define mld_xof256_x4_squeezeblocks(BUF, NBLOCKS, CTX) \
|
|
54
|
+
mld_shake256x4_squeezeblocks((BUF)[0], (BUF)[1], (BUF)[2], (BUF)[3], \
|
|
55
|
+
(NBLOCKS), (CTX))
|
|
56
|
+
#define mld_xof256_x4_release(CTX) mld_shake256x4_release((CTX))
|
|
57
|
+
|
|
58
|
+
#define mld_xof128_x4_ctx mld_shake128x4ctx
|
|
59
|
+
#define mld_xof128_x4_init(CTX) mld_shake128x4_init((CTX))
|
|
60
|
+
#define mld_xof128_x4_absorb(CTX, IN, INBYTES) \
|
|
61
|
+
mld_shake128x4_absorb_once((CTX), (IN)[0], (IN)[1], (IN)[2], (IN)[3], \
|
|
62
|
+
(INBYTES))
|
|
63
|
+
#define mld_xof128_x4_squeezeblocks(BUF, NBLOCKS, CTX) \
|
|
64
|
+
mld_shake128x4_squeezeblocks((BUF)[0], (BUF)[1], (BUF)[2], (BUF)[3], \
|
|
65
|
+
(NBLOCKS), (CTX))
|
|
66
|
+
#define mld_xof128_x4_release(CTX) mld_shake128x4_release((CTX))
|
|
67
|
+
|
|
68
|
+
#endif /* !MLD_SYMMETRIC_H */
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* Copyright (c) The mldsa-native project authors
|
|
4
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
#ifndef MLD_SYS_H
|
|
8
|
+
#define MLD_SYS_H
|
|
9
|
+
|
|
10
|
+
#if !defined(MLD_CONFIG_NO_ASM) && (defined(__GNUC__) || defined(__clang__))
|
|
11
|
+
#define MLD_HAVE_INLINE_ASM
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
/* Try to find endianness, if not forced through CFLAGS already */
|
|
15
|
+
#if !defined(MLD_SYS_LITTLE_ENDIAN) && !defined(MLD_SYS_BIG_ENDIAN)
|
|
16
|
+
#if defined(__BYTE_ORDER__)
|
|
17
|
+
#if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
|
|
18
|
+
#define MLD_SYS_LITTLE_ENDIAN
|
|
19
|
+
#elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
|
|
20
|
+
#define MLD_SYS_BIG_ENDIAN
|
|
21
|
+
#else
|
|
22
|
+
#error "__BYTE_ORDER__ defined, but don't recognize value."
|
|
23
|
+
#endif
|
|
24
|
+
#endif /* __BYTE_ORDER__ */
|
|
25
|
+
|
|
26
|
+
/* MSVC does not define __BYTE_ORDER__. However, MSVC only supports
|
|
27
|
+
* little endian x86, x86_64, and AArch64. It is, hence, safe to assume
|
|
28
|
+
* little endian. */
|
|
29
|
+
#if defined(_MSC_VER) && (defined(_M_X64) || defined(_M_AMD64) || \
|
|
30
|
+
defined(_M_IX86) || defined(_M_ARM64))
|
|
31
|
+
#define MLD_SYS_LITTLE_ENDIAN
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
#endif /* !MLD_SYS_LITTLE_ENDIAN && !MLD_SYS_BIG_ENDIAN */
|
|
35
|
+
|
|
36
|
+
/* Check if we're running on an AArch64 little endian system. _M_ARM64 is set by
|
|
37
|
+
* MSVC. */
|
|
38
|
+
#if defined(__AARCH64EL__) || defined(_M_ARM64)
|
|
39
|
+
#define MLD_SYS_AARCH64
|
|
40
|
+
#endif
|
|
41
|
+
|
|
42
|
+
/* Check if we're running on an AArch64 big endian system. */
|
|
43
|
+
#if defined(__AARCH64EB__)
|
|
44
|
+
#define MLD_SYS_AARCH64_EB
|
|
45
|
+
#endif
|
|
46
|
+
|
|
47
|
+
/* Check if we're running on an Armv8.1-M system with MVE */
|
|
48
|
+
#if defined(__ARM_ARCH_8_1M_MAIN__) || defined(__ARM_FEATURE_MVE)
|
|
49
|
+
#define MLD_SYS_ARMV81M_MVE
|
|
50
|
+
#endif
|
|
51
|
+
|
|
52
|
+
#if defined(__x86_64__)
|
|
53
|
+
#define MLD_SYS_X86_64
|
|
54
|
+
#if defined(__AVX2__)
|
|
55
|
+
#define MLD_SYS_X86_64_AVX2
|
|
56
|
+
#endif
|
|
57
|
+
#endif /* __x86_64__ */
|
|
58
|
+
|
|
59
|
+
#if defined(MLD_SYS_LITTLE_ENDIAN) && defined(__powerpc64__)
|
|
60
|
+
#define MLD_SYS_PPC64LE
|
|
61
|
+
#endif
|
|
62
|
+
|
|
63
|
+
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 64
|
|
64
|
+
#define MLD_SYS_RISCV64
|
|
65
|
+
#endif
|
|
66
|
+
|
|
67
|
+
#if defined(MLD_SYS_RISCV64) && defined(__riscv_vector) && \
|
|
68
|
+
defined(__riscv_v_intrinsic)
|
|
69
|
+
#define MLD_SYS_RISCV64_RVV
|
|
70
|
+
#endif
|
|
71
|
+
|
|
72
|
+
#if defined(__riscv) && defined(__riscv_xlen) && __riscv_xlen == 32
|
|
73
|
+
#define MLD_SYS_RISCV32
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
#if defined(_WIN64) || defined(_WIN32)
|
|
77
|
+
#define MLD_SYS_WINDOWS
|
|
78
|
+
#endif
|
|
79
|
+
|
|
80
|
+
#if defined(__linux__)
|
|
81
|
+
#define MLD_SYS_LINUX
|
|
82
|
+
#endif
|
|
83
|
+
|
|
84
|
+
#if defined(__APPLE__)
|
|
85
|
+
#define MLD_SYS_APPLE
|
|
86
|
+
#endif
|
|
87
|
+
|
|
88
|
+
/* If MLD_FORCE_AARCH64 is set, assert that we're indeed on an AArch64 system.
|
|
89
|
+
*/
|
|
90
|
+
#if defined(MLD_FORCE_AARCH64) && !defined(MLD_SYS_AARCH64)
|
|
91
|
+
#error "MLD_FORCE_AARCH64 is set, but we don't seem to be on an AArch64 system."
|
|
92
|
+
#endif
|
|
93
|
+
|
|
94
|
+
/* If MLD_FORCE_AARCH64_EB is set, assert that we're indeed on a big endian
|
|
95
|
+
* AArch64 system. */
|
|
96
|
+
#if defined(MLD_FORCE_AARCH64_EB) && !defined(MLD_SYS_AARCH64_EB)
|
|
97
|
+
#error \
|
|
98
|
+
"MLD_FORCE_AARCH64_EB is set, but we don't seem to be on an AArch64 system."
|
|
99
|
+
#endif
|
|
100
|
+
|
|
101
|
+
/* If MLD_FORCE_X86_64 is set, assert that we're indeed on an X86_64 system. */
|
|
102
|
+
#if defined(MLD_FORCE_X86_64) && !defined(MLD_SYS_X86_64)
|
|
103
|
+
#error "MLD_FORCE_X86_64 is set, but we don't seem to be on an X86_64 system."
|
|
104
|
+
#endif
|
|
105
|
+
|
|
106
|
+
#if defined(MLD_FORCE_PPC64LE) && !defined(MLD_SYS_PPC64LE)
|
|
107
|
+
#error "MLD_FORCE_PPC64LE is set, but we don't seem to be on a PPC64LE system."
|
|
108
|
+
#endif
|
|
109
|
+
|
|
110
|
+
#if defined(MLD_FORCE_RISCV64) && !defined(MLD_SYS_RISCV64)
|
|
111
|
+
#error "MLD_FORCE_RISCV64 is set, but we don't seem to be on a RISCV64 system."
|
|
112
|
+
#endif
|
|
113
|
+
|
|
114
|
+
#if defined(MLD_FORCE_RISCV32) && !defined(MLD_SYS_RISCV32)
|
|
115
|
+
#error "MLD_FORCE_RISCV32 is set, but we don't seem to be on a RISCV32 system."
|
|
116
|
+
#endif
|
|
117
|
+
|
|
118
|
+
/*
|
|
119
|
+
* MLD_INLINE: Hint for inlining.
|
|
120
|
+
* - MSVC: __inline
|
|
121
|
+
* - C99+: inline
|
|
122
|
+
* - GCC/Clang C90: __attribute__((unused)) to silence warnings
|
|
123
|
+
* - Other C90: empty
|
|
124
|
+
*/
|
|
125
|
+
#if !defined(MLD_INLINE)
|
|
126
|
+
#if defined(_MSC_VER)
|
|
127
|
+
#define MLD_INLINE __inline
|
|
128
|
+
#elif defined(inline) || \
|
|
129
|
+
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L)
|
|
130
|
+
#define MLD_INLINE inline
|
|
131
|
+
#elif defined(__GNUC__) || defined(__clang__)
|
|
132
|
+
#define MLD_INLINE __attribute__((unused))
|
|
133
|
+
#else
|
|
134
|
+
#define MLD_INLINE
|
|
135
|
+
#endif
|
|
136
|
+
#endif /* !MLD_INLINE */
|
|
137
|
+
|
|
138
|
+
/*
|
|
139
|
+
* MLD_ALWAYS_INLINE: Force inlining.
|
|
140
|
+
* - MSVC: __forceinline
|
|
141
|
+
* - GCC/Clang C99+: MLD_INLINE __attribute__((always_inline))
|
|
142
|
+
* - Other: MLD_INLINE (no forced inlining)
|
|
143
|
+
*/
|
|
144
|
+
#if !defined(MLD_ALWAYS_INLINE)
|
|
145
|
+
#if defined(_MSC_VER)
|
|
146
|
+
#define MLD_ALWAYS_INLINE __forceinline
|
|
147
|
+
#elif (defined(__GNUC__) || defined(__clang__)) && \
|
|
148
|
+
(defined(inline) || \
|
|
149
|
+
(defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L))
|
|
150
|
+
#define MLD_ALWAYS_INLINE MLD_INLINE __attribute__((always_inline))
|
|
151
|
+
#else
|
|
152
|
+
#define MLD_ALWAYS_INLINE MLD_INLINE
|
|
153
|
+
#endif
|
|
154
|
+
#endif /* !MLD_ALWAYS_INLINE */
|
|
155
|
+
|
|
156
|
+
#ifndef MLD_STATIC_TESTABLE
|
|
157
|
+
#define MLD_STATIC_TESTABLE static
|
|
158
|
+
#endif
|
|
159
|
+
|
|
160
|
+
/*
|
|
161
|
+
* C90 does not have the restrict compiler directive yet.
|
|
162
|
+
* We don't use it in C90 builds.
|
|
163
|
+
*/
|
|
164
|
+
#if !defined(restrict)
|
|
165
|
+
#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
|
|
166
|
+
#define MLD_RESTRICT restrict
|
|
167
|
+
#else
|
|
168
|
+
#define MLD_RESTRICT
|
|
169
|
+
#endif
|
|
170
|
+
|
|
171
|
+
#else /* !restrict */
|
|
172
|
+
|
|
173
|
+
#define MLD_RESTRICT restrict
|
|
174
|
+
#endif /* restrict */
|
|
175
|
+
|
|
176
|
+
#define MLD_DEFAULT_ALIGN 32
|
|
177
|
+
#define MLD_ALIGN_UP(N) \
|
|
178
|
+
((((N) + (MLD_DEFAULT_ALIGN - 1)) / MLD_DEFAULT_ALIGN) * MLD_DEFAULT_ALIGN)
|
|
179
|
+
#if defined(__GNUC__)
|
|
180
|
+
#define MLD_ALIGN __attribute__((aligned(MLD_DEFAULT_ALIGN)))
|
|
181
|
+
#elif defined(_MSC_VER)
|
|
182
|
+
#define MLD_ALIGN __declspec(align(MLD_DEFAULT_ALIGN))
|
|
183
|
+
#else
|
|
184
|
+
#define MLD_ALIGN /* No known support for alignment constraints */
|
|
185
|
+
#endif
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
/* New X86_64 CPUs support Conflow-flow protection using the CET instructions.
|
|
189
|
+
* When enabled (through -fcf-protection=), all compilation units (including
|
|
190
|
+
* empty ones) need to support CET for this to work.
|
|
191
|
+
* For assembly, this means that source files need to signal support for
|
|
192
|
+
* CET by setting the appropriate note.gnu.property section.
|
|
193
|
+
* This can be achieved by including the <cet.h> header in all assembly file.
|
|
194
|
+
* This file also provides the _CET_ENDBR macro which needs to be placed at
|
|
195
|
+
* every potential target of an indirect branch.
|
|
196
|
+
* If CET is enabled _CET_ENDBR maps to the endbr64 instruction, otherwise
|
|
197
|
+
* it is empty.
|
|
198
|
+
* In case the compiler does not support CET (e.g., <gcc8, <clang11),
|
|
199
|
+
* the __CET__ macro is not set and we default to nothing.
|
|
200
|
+
* Note that we only issue _CET_ENDBR instructions through the MLD_ASM_FN_SYMBOL
|
|
201
|
+
* macro as the global symbols are the only possible targets of indirect
|
|
202
|
+
* branches in our code.
|
|
203
|
+
*/
|
|
204
|
+
#if defined(MLD_SYS_X86_64)
|
|
205
|
+
#if defined(__CET__)
|
|
206
|
+
#include <cet.h>
|
|
207
|
+
#define MLD_CET_ENDBR _CET_ENDBR
|
|
208
|
+
#else
|
|
209
|
+
#define MLD_CET_ENDBR
|
|
210
|
+
#endif
|
|
211
|
+
#endif /* MLD_SYS_X86_64 */
|
|
212
|
+
|
|
213
|
+
#if defined(MLD_CONFIG_CT_TESTING_ENABLED) && !defined(__ASSEMBLER__)
|
|
214
|
+
#include <valgrind/memcheck.h>
|
|
215
|
+
#define MLD_CT_TESTING_SECRET(ptr, len) \
|
|
216
|
+
VALGRIND_MAKE_MEM_UNDEFINED((ptr), (len))
|
|
217
|
+
#define MLD_CT_TESTING_DECLASSIFY(ptr, len) \
|
|
218
|
+
VALGRIND_MAKE_MEM_DEFINED((ptr), (len))
|
|
219
|
+
#else /* MLD_CONFIG_CT_TESTING_ENABLED && !__ASSEMBLER__ */
|
|
220
|
+
#define MLD_CT_TESTING_SECRET(ptr, len) \
|
|
221
|
+
do \
|
|
222
|
+
{ \
|
|
223
|
+
} while (0)
|
|
224
|
+
#define MLD_CT_TESTING_DECLASSIFY(ptr, len) \
|
|
225
|
+
do \
|
|
226
|
+
{ \
|
|
227
|
+
} while (0)
|
|
228
|
+
#endif /* !(MLD_CONFIG_CT_TESTING_ENABLED && !__ASSEMBLER__) */
|
|
229
|
+
|
|
230
|
+
#if defined(__GNUC__) || defined(__clang__)
|
|
231
|
+
#define MLD_MUST_CHECK_RETURN_VALUE __attribute__((warn_unused_result))
|
|
232
|
+
#else
|
|
233
|
+
#define MLD_MUST_CHECK_RETURN_VALUE
|
|
234
|
+
#endif
|
|
235
|
+
|
|
236
|
+
|
|
237
|
+
#if !defined(__ASSEMBLER__)
|
|
238
|
+
/* System capability enumeration */
|
|
239
|
+
typedef enum
|
|
240
|
+
{
|
|
241
|
+
/* x86_64 */
|
|
242
|
+
MLD_SYS_CAP_AVX2,
|
|
243
|
+
/* AArch64 */
|
|
244
|
+
MLD_SYS_CAP_SHA3
|
|
245
|
+
} mld_sys_cap;
|
|
246
|
+
|
|
247
|
+
#if !defined(MLD_CONFIG_CUSTOM_CAPABILITY_FUNC)
|
|
248
|
+
#include "cbmc.h"
|
|
249
|
+
|
|
250
|
+
MLD_MUST_CHECK_RETURN_VALUE
|
|
251
|
+
static MLD_INLINE int mld_sys_check_capability(mld_sys_cap cap)
|
|
252
|
+
__contract__(
|
|
253
|
+
ensures(return_value == 0 || return_value == 1)
|
|
254
|
+
)
|
|
255
|
+
{
|
|
256
|
+
/* By default, we rely on compile-time feature detection/specification:
|
|
257
|
+
* If a feature is enabled at compile-time, we assume it is supported by
|
|
258
|
+
* the host that the resulting library/binary will be built on.
|
|
259
|
+
* If this assumption is not true, you MUST overwrite this function.
|
|
260
|
+
* See the documentation of MLD_CONFIG_CUSTOM_CAPABILITY_FUNC in
|
|
261
|
+
* mldsa_native_config.h for more information. */
|
|
262
|
+
(void)cap;
|
|
263
|
+
return 1;
|
|
264
|
+
}
|
|
265
|
+
#endif /* !MLD_CONFIG_CUSTOM_CAPABILITY_FUNC */
|
|
266
|
+
#endif /* !__ASSEMBLER__ */
|
|
267
|
+
|
|
268
|
+
#endif /* !MLD_SYS_H */
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* WARNING: This file is auto-generated from scripts/autogen
|
|
8
|
+
* in the mldsa-native repository.
|
|
9
|
+
* Do not modify it directly.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
/*
|
|
14
|
+
* Table of zeta values used in the reference NTT and inverse NTT.
|
|
15
|
+
* See autogen for details.
|
|
16
|
+
*/
|
|
17
|
+
static const int32_t mld_zetas[MLDSA_N] = {
|
|
18
|
+
0, 25847, -2608894, -518909, 237124, -777960, -876248,
|
|
19
|
+
466468, 1826347, 2353451, -359251, -2091905, 3119733, -2884855,
|
|
20
|
+
3111497, 2680103, 2725464, 1024112, -1079900, 3585928, -549488,
|
|
21
|
+
-1119584, 2619752, -2108549, -2118186, -3859737, -1399561, -3277672,
|
|
22
|
+
1757237, -19422, 4010497, 280005, 2706023, 95776, 3077325,
|
|
23
|
+
3530437, -1661693, -3592148, -2537516, 3915439, -3861115, -3043716,
|
|
24
|
+
3574422, -2867647, 3539968, -300467, 2348700, -539299, -1699267,
|
|
25
|
+
-1643818, 3505694, -3821735, 3507263, -2140649, -1600420, 3699596,
|
|
26
|
+
811944, 531354, 954230, 3881043, 3900724, -2556880, 2071892,
|
|
27
|
+
-2797779, -3930395, -1528703, -3677745, -3041255, -1452451, 3475950,
|
|
28
|
+
2176455, -1585221, -1257611, 1939314, -4083598, -1000202, -3190144,
|
|
29
|
+
-3157330, -3632928, 126922, 3412210, -983419, 2147896, 2715295,
|
|
30
|
+
-2967645, -3693493, -411027, -2477047, -671102, -1228525, -22981,
|
|
31
|
+
-1308169, -381987, 1349076, 1852771, -1430430, -3343383, 264944,
|
|
32
|
+
508951, 3097992, 44288, -1100098, 904516, 3958618, -3724342,
|
|
33
|
+
-8578, 1653064, -3249728, 2389356, -210977, 759969, -1316856,
|
|
34
|
+
189548, -3553272, 3159746, -1851402, -2409325, -177440, 1315589,
|
|
35
|
+
1341330, 1285669, -1584928, -812732, -1439742, -3019102, -3881060,
|
|
36
|
+
-3628969, 3839961, 2091667, 3407706, 2316500, 3817976, -3342478,
|
|
37
|
+
2244091, -2446433, -3562462, 266997, 2434439, -1235728, 3513181,
|
|
38
|
+
-3520352, -3759364, -1197226, -3193378, 900702, 1859098, 909542,
|
|
39
|
+
819034, 495491, -1613174, -43260, -522500, -655327, -3122442,
|
|
40
|
+
2031748, 3207046, -3556995, -525098, -768622, -3595838, 342297,
|
|
41
|
+
286988, -2437823, 4108315, 3437287, -3342277, 1735879, 203044,
|
|
42
|
+
2842341, 2691481, -2590150, 1265009, 4055324, 1247620, 2486353,
|
|
43
|
+
1595974, -3767016, 1250494, 2635921, -3548272, -2994039, 1869119,
|
|
44
|
+
1903435, -1050970, -1333058, 1237275, -3318210, -1430225, -451100,
|
|
45
|
+
1312455, 3306115, -1962642, -1279661, 1917081, -2546312, -1374803,
|
|
46
|
+
1500165, 777191, 2235880, 3406031, -542412, -2831860, -1671176,
|
|
47
|
+
-1846953, -2584293, -3724270, 594136, -3776993, -2013608, 2432395,
|
|
48
|
+
2454455, -164721, 1957272, 3369112, 185531, -1207385, -3183426,
|
|
49
|
+
162844, 1616392, 3014001, 810149, 1652634, -3694233, -1799107,
|
|
50
|
+
-3038916, 3523897, 3866901, 269760, 2213111, -975884, 1717735,
|
|
51
|
+
472078, -426683, 1723600, -1803090, 1910376, -1667432, -1104333,
|
|
52
|
+
-260646, -3833893, -2939036, -2235985, -420899, -2286327, 183443,
|
|
53
|
+
-976891, 1612842, -3545687, -554416, 3919660, -48306, -1362209,
|
|
54
|
+
3937738, 1400424, -846154, 1976782,
|
|
55
|
+
};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
[//]: # (SPDX-License-Identifier: CC-BY-4.0)
|
|
2
|
+
|
|
3
|
+
# Building mlkem-native
|
|
4
|
+
|
|
5
|
+
### Prerequisites
|
|
6
|
+
|
|
7
|
+
To build **mlkem-native**, you need `make` and a C90 compiler. To use the test scripts, you need Python3 (>= 3.7).
|
|
8
|
+
|
|
9
|
+
### By hand
|
|
10
|
+
|
|
11
|
+
See [mlkem](mlkem).
|
|
12
|
+
|
|
13
|
+
### Using `make`
|
|
14
|
+
|
|
15
|
+
You can build and test **mlkem-native** as follows:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
make test # With native code backend (if available)
|
|
19
|
+
make OPT=0 test # With C backend
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
To merely build test components, use the following `make` targets:
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
make func
|
|
26
|
+
make kat
|
|
27
|
+
make acvp
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
To run them, add `run_`:
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
make run_func
|
|
34
|
+
make run_kat
|
|
35
|
+
make run_acvp
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The resulting binaries can be found in `test/build` (their full path is printed by `make`).
|
|
39
|
+
|
|
40
|
+
For benchmarking, specify the cycle counting method. Currently, **mlkem-native** is supporting NO, PERF, PMU, and MAC:
|
|
41
|
+
* `NO` means that no cycle counting will be used; this can be used to confirm that benchmarks compile fine.
|
|
42
|
+
* `PERF` uses the `perf` kernel module for cycle counting. Does not work on Apple platforms.
|
|
43
|
+
* `PMU` uses direct PMU access if available. On AArch64, this may require you to load a kernel module first, see [here](https://github.com/mupq/pqax?tab=readme-ov-file#enable-access-to-performance-counters). Does not work on Apple platforms.
|
|
44
|
+
* `MAC` is `perf`-based and works on some Apple platforms, at least Apple M1.
|
|
45
|
+
|
|
46
|
+
```
|
|
47
|
+
# CYCLES has to be one of PERF, PMU, MAC, NO
|
|
48
|
+
sudo make run_bench CYCLES=PERF
|
|
49
|
+
sudo make run_bench_components CYCLES=PERF
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Using `tests` script
|
|
53
|
+
|
|
54
|
+
For convenience, you can also use the [`./scripts/tests`](scripts/tests) script as a wrapper around `make`. For
|
|
55
|
+
example,
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
./scripts/tests func
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
will compile and run functionality tests. Similarly,
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
./scripts/tests bench -c PERF -r
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
will compile and run benchmarks, using PERF for cycle counting (`-c PERF`) and running as root (`-r`).
|
|
68
|
+
|
|
69
|
+
For detailed information on how to use the script, please refer to
|
|
70
|
+
`./scripts/tests --help`.
|
|
71
|
+
|
|
72
|
+
### Windows
|
|
73
|
+
|
|
74
|
+
You can also build **mlkem-native** on Windows using `nmake` and an MSVC compiler.
|
|
75
|
+
|
|
76
|
+
To build and run the tests (only support functional testing for non-opt implementation for now), use the following `nmake` targets:
|
|
77
|
+
```powershell
|
|
78
|
+
nmke /f .\Makefile.Microsoft_nmake quickcheck
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
# Checking the proofs
|
|
82
|
+
|
|
83
|
+
## CBMC
|
|
84
|
+
|
|
85
|
+
### Prerequisites
|
|
86
|
+
|
|
87
|
+
To run the CBMC proofs, you need specific versions of CBMC and the underlying solvers, e.g. as specified in our `nix` environment; see [nix/cbmc](nix/cbmc/).
|
|
88
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to setup and use `nix`.
|
|
89
|
+
|
|
90
|
+
### Running the CBMC proofs
|
|
91
|
+
|
|
92
|
+
Once you are in the `nix` shell or have all tools setup by hand, use `./scripts/tests cbmc` (or just `tests cbmc` in the `nix` shell) to re-check the CBMC proofs.
|
|
93
|
+
See `tests cbmc --help` for details on the command line options, and [proofs/cbmc](proofs/cbmc) for more details on the CBMC proofs in general.
|
|
94
|
+
|
|
95
|
+
## HOL-Light
|
|
96
|
+
|
|
97
|
+
### Prerequisites
|
|
98
|
+
|
|
99
|
+
To run the HOL-Light proofs, you need recent versions of HOL-Light and s2n-bignum, e.g. as specified in our `nix` environment; see [nix/s2n_bignum](nix/s2n_bignum) and [nix/hol_light](nix/hol_light).
|
|
100
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for instructions on how to setup and use `nix`.
|
|
101
|
+
|
|
102
|
+
### Running the HOL-Light proofs
|
|
103
|
+
|
|
104
|
+
Once you are in the `nix` shell or have all tools setup by hand, use `./scripts/tests hol_light` (or just `tests hol_light` in the `nix` shell) to re-check the HOL-Light proofs. Note that depending on the function, they will take a long time. See `tests hol_light --help` for details on the command line options, and [proofs/hol_light](proofs/hol_light) for more details on the HOL-Light proofs in general.
|