pq_crypto 0.4.2 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +25 -0
- data/GET_STARTED.md +21 -16
- data/README.md +26 -0
- data/SECURITY.md +22 -16
- data/ext/pqcrypto/extconf.rb +148 -99
- data/ext/pqcrypto/mldsa_api.h +1 -118
- data/ext/pqcrypto/mlkem_api.h +1 -42
- data/ext/pqcrypto/pq_externalmu.c +88 -216
- data/ext/pqcrypto/pqcrypto_native_api.h +129 -0
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +0 -3
- data/ext/pqcrypto/pqcrypto_secure.c +135 -117
- data/ext/pqcrypto/pqcrypto_secure.h +1 -42
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/randombytes.h +9 -0
- data/ext/pqcrypto/vendor/.vendored +10 -5
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +105 -0
- data/ext/pqcrypto/vendor/mldsa-native/LICENSE +286 -0
- data/ext/pqcrypto/vendor/mldsa-native/META.yml +24 -0
- data/ext/pqcrypto/vendor/mldsa-native/README.md +221 -0
- data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +8 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +721 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +975 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +724 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +723 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +166 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +321 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c +21 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +385 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +73 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +130 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.c +277 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +244 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +182 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.h +117 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +438 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.h +105 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +71 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/fips202_native_aarch64.h +62 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +376 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +204 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +259 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1077 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +987 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +41 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +26 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +35 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +37 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +27 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +36 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +69 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/README.md +10 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +32 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h +20 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +638 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +136 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +29 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.c +488 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/KeccakP_1600_times4_SIMD256.h +16 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/xkcp.h +31 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +247 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c +231 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +150 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/intt.S +753 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l4.S +129 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l5.S +145 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mld_polyvecl_pointwise_acc_montgomery_l7.S +177 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/ntt.S +653 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/pointwise_montgomery.S +79 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_caddq_asm.S +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_chknorm_asm.S +55 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_32_asm.S +85 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_decompose_88_asm.S +85 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_32_asm.S +102 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/poly_use_hint_88_asm.S +110 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_17_asm.S +72 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_19_asm.S +69 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c +40 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_asm.S +189 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_asm.S +135 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_asm.S +128 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c +543 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c +62 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +649 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +23 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +315 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +124 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c +157 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h +27 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/intt.S +2311 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/ntt.S +2383 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/nttunpack.S +239 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise.S +131 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l4.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l5.S +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/pointwise_acc_l7.S +187 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_caddq_avx2.c +61 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +52 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +102 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +104 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +91 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +93 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +126 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +155 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c +160 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +293 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +224 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +77 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +991 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +393 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +946 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +360 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +877 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +725 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/randombytes.h +26 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +249 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +1511 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +806 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/symmetric.h +68 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +268 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/zetas.inc +55 -0
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +104 -0
- data/ext/pqcrypto/vendor/mlkem-native/LICENSE +294 -0
- data/ext/pqcrypto/vendor/mlkem-native/META.yml +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/README.md +223 -0
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +86 -0
- data/ext/pqcrypto/vendor/mlkem-native/SECURITY.md +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +23 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +660 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +538 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +681 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +709 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +274 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +717 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +688 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +64 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h +128 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +251 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +158 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +208 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +80 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +463 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +98 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +70 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/fips202_native_aarch64.h +69 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_asm.S +375 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_asm.S +203 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_asm.S +258 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_asm.S +1076 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_asm.S +986 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccakf1600_round_constants.c +46 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +34 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +26 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +117 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/README.md +10 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +79 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h +35 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +667 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +40 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S +290 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S +314 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +28 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +33 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +41 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2.S +451 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +622 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +156 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +446 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +326 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/README.md +16 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +122 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +177 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/intt.S +628 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/ntt.S +562 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_mulcache_compute_asm.S +127 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_reduce_asm.S +150 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tobytes_asm.S +117 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/poly_tomont_asm.S +98 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +261 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +314 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +368 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_asm.S +226 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c +542 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +637 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md +11 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +128 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +45 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +81 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +145 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_izetas.inc +27 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +805 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas.inc +27 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_zetas_basemul.inc +39 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/README.md +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +304 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +309 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +94 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +45 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c +102 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/intt.S +719 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mulcache_compute.S +90 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntt.S +639 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttfrombytes.S +193 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/ntttobytes.S +181 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/nttunpack.S +174 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d10.S +382 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d11.S +448 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d4.S +163 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_compress_d5.S +220 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d10.S +228 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d11.S +277 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d4.S +180 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/poly_decompress_d5.S +192 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k2.S +502 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k3.S +750 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/polyvec_basemul_acc_montgomery_cached_asm_k4.S +998 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/reduce.S +218 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_asm.S +103 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c +544 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont.S +155 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h +76 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +572 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +317 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +502 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +668 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/randombytes.h +60 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +362 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +118 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/symmetric.h +70 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +260 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.c +20 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +464 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/zetas.inc +30 -0
- data/lib/pq_crypto/version.rb +1 -1
- data/lib/pq_crypto.rb +1 -1
- data/script/vendor_libs.rb +88 -159
- metadata +236 -160
- data/ext/pqcrypto/vendor/pqclean/common/aes.c +0 -639
- data/ext/pqcrypto/vendor/pqclean/common/aes.h +0 -64
- data/ext/pqcrypto/vendor/pqclean/common/compat.h +0 -73
- data/ext/pqcrypto/vendor/pqclean/common/crypto_declassify.h +0 -7
- data/ext/pqcrypto/vendor/pqclean/common/fips202.c +0 -928
- data/ext/pqcrypto/vendor/pqclean/common/fips202.h +0 -166
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/feat.S +0 -168
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.c +0 -684
- data/ext/pqcrypto/vendor/pqclean/common/keccak2x/fips202x2.h +0 -60
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SIMD256.c +0 -1028
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-times4-SnP.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/KeccakP-1600-unrolling.macros +0 -198
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile +0 -8
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/Makefile.Microsoft_nmake +0 -8
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/SIMD256-config.h +0 -3
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/align.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/common/keccak4x/brg_endian.h +0 -142
- data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.c +0 -101
- data/ext/pqcrypto/vendor/pqclean/common/nistseedexpander.h +0 -39
- data/ext/pqcrypto/vendor/pqclean/common/randombytes.c +0 -355
- data/ext/pqcrypto/vendor/pqclean/common/randombytes.h +0 -27
- data/ext/pqcrypto/vendor/pqclean/common/sha2.c +0 -769
- data/ext/pqcrypto/vendor/pqclean/common/sha2.h +0 -173
- data/ext/pqcrypto/vendor/pqclean/common/sp800-185.c +0 -156
- data/ext/pqcrypto/vendor/pqclean/common/sp800-185.h +0 -27
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.c +0 -83
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.c +0 -311
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.c +0 -198
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-1024/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.c +0 -108
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.c +0 -299
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.c +0 -188
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-512/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/api.h +0 -18
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.c +0 -83
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/cbd.h +0 -11
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.c +0 -327
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/indcpa.h +0 -22
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.c +0 -164
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/kem.h +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.c +0 -146
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/ntt.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/params.h +0 -36
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.c +0 -299
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/poly.h +0 -37
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.c +0 -188
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/polyvec.h +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.c +0 -41
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/reduce.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric-shake.c +0 -71
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/symmetric.h +0 -30
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.c +0 -67
- data/ext/pqcrypto/vendor/pqclean/crypto_kem/ml-kem-768/clean/verify.h +0 -13
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.c +0 -848
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-44/clean/symmetric.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.c +0 -799
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.c +0 -92
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-65/clean/symmetric.h +0 -34
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/LICENSE +0 -5
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile +0 -19
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/Makefile.Microsoft_nmake +0 -23
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/api.h +0 -50
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.c +0 -98
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/ntt.h +0 -10
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.c +0 -261
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/packing.h +0 -31
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/params.h +0 -44
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.c +0 -823
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/poly.h +0 -52
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.c +0 -415
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/polyvec.h +0 -65
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.c +0 -69
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/reduce.h +0 -17
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.c +0 -92
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/rounding.h +0 -14
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.c +0 -407
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/sign.h +0 -47
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric-shake.c +0 -26
- data/ext/pqcrypto/vendor/pqclean/crypto_sign/ml-dsa-87/clean/symmetric.h +0 -34
|
@@ -0,0 +1,709 @@
|
|
|
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
|
+
* - [FIPS140_3_IG]
|
|
10
|
+
* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
11
|
+
* Validation Program
|
|
12
|
+
* National Institute of Standards and Technology
|
|
13
|
+
* https://csrc.nist.gov/projects/cryptographic-module-validation-program/fips-140-3-ig-announcements
|
|
14
|
+
*
|
|
15
|
+
* - [FIPS203]
|
|
16
|
+
* FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
|
|
17
|
+
* National Institute of Standards and Technology
|
|
18
|
+
* https://csrc.nist.gov/pubs/fips/203/final
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
#ifndef MLK_CONFIG_H
|
|
22
|
+
#define MLK_CONFIG_H
|
|
23
|
+
|
|
24
|
+
/******************************************************************************
|
|
25
|
+
* Name: MLK_CONFIG_PARAMETER_SET
|
|
26
|
+
*
|
|
27
|
+
* Description: Specifies the parameter set for ML-KEM
|
|
28
|
+
* - MLK_CONFIG_PARAMETER_SET=512 corresponds to ML-KEM-512
|
|
29
|
+
* - MLK_CONFIG_PARAMETER_SET=768 corresponds to ML-KEM-768
|
|
30
|
+
* - MLK_CONFIG_PARAMETER_SET=1024 corresponds to ML-KEM-1024
|
|
31
|
+
*
|
|
32
|
+
* If you want to support multiple parameter sets, build the
|
|
33
|
+
* library multiple times and set MLK_CONFIG_MULTILEVEL_BUILD.
|
|
34
|
+
* See MLK_CONFIG_MULTILEVEL_BUILD for how to do this while
|
|
35
|
+
* minimizing code duplication.
|
|
36
|
+
*
|
|
37
|
+
* This can also be set using CFLAGS.
|
|
38
|
+
*
|
|
39
|
+
*****************************************************************************/
|
|
40
|
+
#ifndef MLK_CONFIG_PARAMETER_SET
|
|
41
|
+
#define MLK_CONFIG_PARAMETER_SET \
|
|
42
|
+
768 /* Change this for different security strengths */
|
|
43
|
+
#endif
|
|
44
|
+
|
|
45
|
+
/******************************************************************************
|
|
46
|
+
* Name: MLK_CONFIG_FILE
|
|
47
|
+
*
|
|
48
|
+
* Description: If defined, this is a header that will be included instead
|
|
49
|
+
* of the default configuration file mlkem/mlkem_native_config.h.
|
|
50
|
+
*
|
|
51
|
+
* When you need to build mlkem-native in multiple configurations,
|
|
52
|
+
* using varying MLK_CONFIG_FILE can be more convenient
|
|
53
|
+
* then configuring everything through CFLAGS.
|
|
54
|
+
*
|
|
55
|
+
* To use, MLK_CONFIG_FILE _must_ be defined prior
|
|
56
|
+
* to the inclusion of any mlkem-native headers. For example,
|
|
57
|
+
* it can be set by passing `-DMLK_CONFIG_FILE="..."`
|
|
58
|
+
* on the command line.
|
|
59
|
+
*
|
|
60
|
+
*****************************************************************************/
|
|
61
|
+
/* #define MLK_CONFIG_FILE "mlkem_native_config.h" */
|
|
62
|
+
|
|
63
|
+
/******************************************************************************
|
|
64
|
+
* Name: MLK_CONFIG_NAMESPACE_PREFIX
|
|
65
|
+
*
|
|
66
|
+
* Description: The prefix to use to namespace global symbols from mlkem/.
|
|
67
|
+
*
|
|
68
|
+
* In a multi-level build, level-dependent symbols will
|
|
69
|
+
* additionally be prefixed with the parameter set (512/768/1024).
|
|
70
|
+
*
|
|
71
|
+
* This can also be set using CFLAGS.
|
|
72
|
+
*
|
|
73
|
+
*****************************************************************************/
|
|
74
|
+
#if !defined(MLK_CONFIG_NAMESPACE_PREFIX)
|
|
75
|
+
#define MLK_CONFIG_NAMESPACE_PREFIX MLK_DEFAULT_NAMESPACE_PREFIX
|
|
76
|
+
#endif
|
|
77
|
+
|
|
78
|
+
/******************************************************************************
|
|
79
|
+
* Name: MLK_CONFIG_MULTILEVEL_BUILD
|
|
80
|
+
*
|
|
81
|
+
* Description: Set this if the build is part of a multi-level build supporting
|
|
82
|
+
* multiple parameter sets.
|
|
83
|
+
*
|
|
84
|
+
* If you need only a single parameter set, keep this unset.
|
|
85
|
+
*
|
|
86
|
+
* To build mlkem-native with support for all parameter sets,
|
|
87
|
+
* build it three times -- once per parameter set -- and set the
|
|
88
|
+
* option MLK_CONFIG_MULTILEVEL_WITH_SHARED for exactly one of
|
|
89
|
+
* them, and MLK_CONFIG_MULTILEVEL_NO_SHARED for the others.
|
|
90
|
+
* MLK_CONFIG_MULTILEVEL_BUILD should be set for all of them.
|
|
91
|
+
*
|
|
92
|
+
* See examples/multilevel_build for an example.
|
|
93
|
+
*
|
|
94
|
+
* This can also be set using CFLAGS.
|
|
95
|
+
*
|
|
96
|
+
*****************************************************************************/
|
|
97
|
+
/* #define MLK_CONFIG_MULTILEVEL_BUILD */
|
|
98
|
+
|
|
99
|
+
/******************************************************************************
|
|
100
|
+
* Name: MLK_CONFIG_EXTERNAL_API_QUALIFIER
|
|
101
|
+
*
|
|
102
|
+
* Description: If set, this option provides an additional function
|
|
103
|
+
* qualifier to be added to declarations of mlkem-native's
|
|
104
|
+
* public API.
|
|
105
|
+
*
|
|
106
|
+
* The primary use case for this option are single-CU builds
|
|
107
|
+
* where the public API exposed by mlkem-native is wrapped by
|
|
108
|
+
* another API in the consuming application. In this case,
|
|
109
|
+
* even mlkem-native's public API can be marked `static`.
|
|
110
|
+
*
|
|
111
|
+
*****************************************************************************/
|
|
112
|
+
/* #define MLK_CONFIG_EXTERNAL_API_QUALIFIER */
|
|
113
|
+
|
|
114
|
+
/******************************************************************************
|
|
115
|
+
* Name: MLK_CONFIG_NO_RANDOMIZED_API
|
|
116
|
+
*
|
|
117
|
+
* Description: If this option is set, mlkem-native will be built without the
|
|
118
|
+
* randomized API functions (crypto_kem_keypair and
|
|
119
|
+
* crypto_kem_enc).
|
|
120
|
+
* This allows users to build mlkem-native without providing a
|
|
121
|
+
* randombytes() implementation if they only need the
|
|
122
|
+
* deterministic API
|
|
123
|
+
* (crypto_kem_keypair_derand, crypto_kem_enc_derand,
|
|
124
|
+
* crypto_kem_dec).
|
|
125
|
+
*
|
|
126
|
+
* NOTE: This option is incompatible with MLK_CONFIG_KEYGEN_PCT
|
|
127
|
+
* as the current PCT implementation requires crypto_kem_enc().
|
|
128
|
+
*
|
|
129
|
+
*****************************************************************************/
|
|
130
|
+
/* #define MLK_CONFIG_NO_RANDOMIZED_API */
|
|
131
|
+
|
|
132
|
+
/******************************************************************************
|
|
133
|
+
* Name: MLK_CONFIG_NO_SUPERCOP
|
|
134
|
+
*
|
|
135
|
+
* Description: By default, mlkem_native.h exposes the mlkem-native API in the
|
|
136
|
+
* SUPERCOP naming convention (crypto_kem_xxx). If you don't need
|
|
137
|
+
* this, set MLK_CONFIG_NO_SUPERCOP.
|
|
138
|
+
*
|
|
139
|
+
* NOTE: You must set this for a multi-level build as the SUPERCOP
|
|
140
|
+
* naming does not disambiguate between the parameter sets.
|
|
141
|
+
*
|
|
142
|
+
*****************************************************************************/
|
|
143
|
+
/* #define MLK_CONFIG_NO_SUPERCOP */
|
|
144
|
+
|
|
145
|
+
/******************************************************************************
|
|
146
|
+
* Name: MLK_CONFIG_CONSTANTS_ONLY
|
|
147
|
+
*
|
|
148
|
+
* Description: If you only need the size constants (MLKEM_PUBLICKEYBYTES, etc.)
|
|
149
|
+
* but no function declarations, set MLK_CONFIG_CONSTANTS_ONLY.
|
|
150
|
+
*
|
|
151
|
+
* This only affects the public header mlkem_native.h, not
|
|
152
|
+
* the implementation.
|
|
153
|
+
*
|
|
154
|
+
*****************************************************************************/
|
|
155
|
+
/* #define MLK_CONFIG_CONSTANTS_ONLY */
|
|
156
|
+
|
|
157
|
+
/******************************************************************************
|
|
158
|
+
*
|
|
159
|
+
* Build-only configuration options
|
|
160
|
+
*
|
|
161
|
+
* The remaining configurations are build-options only.
|
|
162
|
+
* They do not affect the API described in mlkem_native.h.
|
|
163
|
+
*
|
|
164
|
+
*****************************************************************************/
|
|
165
|
+
|
|
166
|
+
#if defined(MLK_BUILD_INTERNAL)
|
|
167
|
+
/******************************************************************************
|
|
168
|
+
* Name: MLK_CONFIG_MULTILEVEL_WITH_SHARED
|
|
169
|
+
*
|
|
170
|
+
* Description: This is for multi-level builds of mlkem-native only. If you
|
|
171
|
+
* need only a single parameter set, keep this unset.
|
|
172
|
+
*
|
|
173
|
+
* If this is set, all MLK_CONFIG_PARAMETER_SET-independent
|
|
174
|
+
* code will be included in the build, including code needed only
|
|
175
|
+
* for other parameter sets.
|
|
176
|
+
*
|
|
177
|
+
* Example: mlk_poly_cbd3 is only needed for
|
|
178
|
+
* MLK_CONFIG_PARAMETER_SET == 512. Yet, if this option is set
|
|
179
|
+
* for a build with MLK_CONFIG_PARAMETER_SET == 768/1024, it
|
|
180
|
+
* would be included.
|
|
181
|
+
*
|
|
182
|
+
* To build mlkem-native with support for all parameter sets,
|
|
183
|
+
* build it three times -- once per parameter set -- and set the
|
|
184
|
+
* option MLK_CONFIG_MULTILEVEL_WITH_SHARED for exactly one of
|
|
185
|
+
* them, and MLK_CONFIG_MULTILEVEL_NO_SHARED for the others.
|
|
186
|
+
* MLK_CONFIG_MULTILEVEL_BUILD should be set for all of them.
|
|
187
|
+
*
|
|
188
|
+
* See examples/multilevel_build for an example.
|
|
189
|
+
*
|
|
190
|
+
* This can also be set using CFLAGS.
|
|
191
|
+
*
|
|
192
|
+
*****************************************************************************/
|
|
193
|
+
/* #define MLK_CONFIG_MULTILEVEL_WITH_SHARED */
|
|
194
|
+
|
|
195
|
+
/******************************************************************************
|
|
196
|
+
* Name: MLK_CONFIG_MULTILEVEL_NO_SHARED
|
|
197
|
+
*
|
|
198
|
+
* Description: This is for multi-level builds of mlkem-native only. If you
|
|
199
|
+
* need only a single parameter set, keep this unset.
|
|
200
|
+
*
|
|
201
|
+
* If this is set, no MLK_CONFIG_PARAMETER_SET-independent code
|
|
202
|
+
* will be included in the build.
|
|
203
|
+
*
|
|
204
|
+
* To build mlkem-native with support for all parameter sets,
|
|
205
|
+
* build it three times -- once per parameter set -- and set the
|
|
206
|
+
* option MLK_CONFIG_MULTILEVEL_WITH_SHARED for exactly one of
|
|
207
|
+
* them, and MLK_CONFIG_MULTILEVEL_NO_SHARED for the others.
|
|
208
|
+
* MLK_CONFIG_MULTILEVEL_BUILD should be set for all of them.
|
|
209
|
+
*
|
|
210
|
+
* See examples/multilevel_build for an example.
|
|
211
|
+
*
|
|
212
|
+
* This can also be set using CFLAGS.
|
|
213
|
+
*
|
|
214
|
+
*****************************************************************************/
|
|
215
|
+
/* #define MLK_CONFIG_MULTILEVEL_NO_SHARED */
|
|
216
|
+
|
|
217
|
+
/******************************************************************************
|
|
218
|
+
* Name: MLK_CONFIG_MONOBUILD_KEEP_SHARED_HEADERS
|
|
219
|
+
*
|
|
220
|
+
* Description: This is only relevant for single compilation unit (SCU)
|
|
221
|
+
* builds of mlkem-native. In this case, it determines whether
|
|
222
|
+
* directives defined in parameter-set-independent headers should
|
|
223
|
+
* be #undef'ined or not at the of the SCU file. This is needed
|
|
224
|
+
* in multilevel builds.
|
|
225
|
+
*
|
|
226
|
+
* See examples/multilevel_build_native for an example.
|
|
227
|
+
*
|
|
228
|
+
* This can also be set using CFLAGS.
|
|
229
|
+
*
|
|
230
|
+
*****************************************************************************/
|
|
231
|
+
/* #define MLK_CONFIG_MONOBUILD_KEEP_SHARED_HEADERS */
|
|
232
|
+
|
|
233
|
+
/******************************************************************************
|
|
234
|
+
* Name: MLK_CONFIG_USE_NATIVE_BACKEND_ARITH
|
|
235
|
+
*
|
|
236
|
+
* Description: Determines whether an native arithmetic backend should be used.
|
|
237
|
+
*
|
|
238
|
+
* The arithmetic backend covers performance critical functions
|
|
239
|
+
* such as the number-theoretic transform (NTT).
|
|
240
|
+
*
|
|
241
|
+
* If this option is unset, the C backend will be used.
|
|
242
|
+
*
|
|
243
|
+
* If this option is set, the arithmetic backend to be use is
|
|
244
|
+
* determined by MLK_CONFIG_ARITH_BACKEND_FILE: If the latter is
|
|
245
|
+
* unset, the default backend for your the target architecture
|
|
246
|
+
* will be used. If set, it must be the name of a backend metadata
|
|
247
|
+
* file.
|
|
248
|
+
*
|
|
249
|
+
* This can also be set using CFLAGS.
|
|
250
|
+
*
|
|
251
|
+
*****************************************************************************/
|
|
252
|
+
#if !defined(MLK_CONFIG_USE_NATIVE_BACKEND_ARITH)
|
|
253
|
+
/* #define MLK_CONFIG_USE_NATIVE_BACKEND_ARITH */
|
|
254
|
+
#endif
|
|
255
|
+
|
|
256
|
+
/******************************************************************************
|
|
257
|
+
* Name: MLK_CONFIG_ARITH_BACKEND_FILE
|
|
258
|
+
*
|
|
259
|
+
* Description: The arithmetic backend to use.
|
|
260
|
+
*
|
|
261
|
+
* If MLK_CONFIG_USE_NATIVE_BACKEND_ARITH is unset, this option
|
|
262
|
+
* is ignored.
|
|
263
|
+
*
|
|
264
|
+
* If MLK_CONFIG_USE_NATIVE_BACKEND_ARITH is set, this option must
|
|
265
|
+
* either be undefined or the filename of an arithmetic backend.
|
|
266
|
+
* If unset, the default backend will be used.
|
|
267
|
+
*
|
|
268
|
+
* This can be set using CFLAGS.
|
|
269
|
+
*
|
|
270
|
+
*****************************************************************************/
|
|
271
|
+
#if defined(MLK_CONFIG_USE_NATIVE_BACKEND_ARITH) && \
|
|
272
|
+
!defined(MLK_CONFIG_ARITH_BACKEND_FILE)
|
|
273
|
+
#define MLK_CONFIG_ARITH_BACKEND_FILE "native/meta.h"
|
|
274
|
+
#endif
|
|
275
|
+
|
|
276
|
+
/******************************************************************************
|
|
277
|
+
* Name: MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202
|
|
278
|
+
*
|
|
279
|
+
* Description: Determines whether an native FIPS202 backend should be used.
|
|
280
|
+
*
|
|
281
|
+
* The FIPS202 backend covers 1x/2x/4x-fold Keccak-f1600, which is
|
|
282
|
+
* the performance bottleneck of SHA3 and SHAKE.
|
|
283
|
+
*
|
|
284
|
+
* If this option is unset, the C backend will be used.
|
|
285
|
+
*
|
|
286
|
+
* If this option is set, the FIPS202 backend to be use is
|
|
287
|
+
* determined by MLK_CONFIG_FIPS202_BACKEND_FILE: If the latter is
|
|
288
|
+
* unset, the default backend for your the target architecture
|
|
289
|
+
* will be used. If set, it must be the name of a backend metadata
|
|
290
|
+
* file.
|
|
291
|
+
*
|
|
292
|
+
* This can also be set using CFLAGS.
|
|
293
|
+
*
|
|
294
|
+
*****************************************************************************/
|
|
295
|
+
#if !defined(MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202)
|
|
296
|
+
/* #define MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202 */
|
|
297
|
+
#endif
|
|
298
|
+
|
|
299
|
+
/******************************************************************************
|
|
300
|
+
* Name: MLK_CONFIG_FIPS202_BACKEND_FILE
|
|
301
|
+
*
|
|
302
|
+
* Description: The FIPS-202 backend to use.
|
|
303
|
+
*
|
|
304
|
+
* If MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202 is set, this option
|
|
305
|
+
* must either be undefined or the filename of a FIPS202 backend.
|
|
306
|
+
* If unset, the default backend will be used.
|
|
307
|
+
*
|
|
308
|
+
* This can be set using CFLAGS.
|
|
309
|
+
*
|
|
310
|
+
*****************************************************************************/
|
|
311
|
+
#if defined(MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202) && \
|
|
312
|
+
!defined(MLK_CONFIG_FIPS202_BACKEND_FILE)
|
|
313
|
+
#define MLK_CONFIG_FIPS202_BACKEND_FILE "fips202/native/auto.h"
|
|
314
|
+
#endif
|
|
315
|
+
|
|
316
|
+
/******************************************************************************
|
|
317
|
+
* Name: MLK_CONFIG_FIPS202_CUSTOM_HEADER
|
|
318
|
+
*
|
|
319
|
+
* Description: Custom header to use for FIPS-202
|
|
320
|
+
*
|
|
321
|
+
* This should only be set if you intend to use a custom
|
|
322
|
+
* FIPS-202 implementation, different from the one shipped
|
|
323
|
+
* with mlkem-native.
|
|
324
|
+
*
|
|
325
|
+
* If set, it must be the name of a file serving as the
|
|
326
|
+
* replacement for mlkem/fips202/fips202.h, and exposing
|
|
327
|
+
* the same API (see FIPS202.md).
|
|
328
|
+
*
|
|
329
|
+
*****************************************************************************/
|
|
330
|
+
/* #define MLK_CONFIG_FIPS202_CUSTOM_HEADER "SOME_FILE.h" */
|
|
331
|
+
|
|
332
|
+
/******************************************************************************
|
|
333
|
+
* Name: MLK_CONFIG_FIPS202X4_CUSTOM_HEADER
|
|
334
|
+
*
|
|
335
|
+
* Description: Custom header to use for FIPS-202-X4
|
|
336
|
+
*
|
|
337
|
+
* This should only be set if you intend to use a custom
|
|
338
|
+
* FIPS-202 implementation, different from the one shipped
|
|
339
|
+
* with mlkem-native.
|
|
340
|
+
*
|
|
341
|
+
* If set, it must be the name of a file serving as the
|
|
342
|
+
* replacement for mlkem/fips202/fips202x4.h, and exposing
|
|
343
|
+
* the same API (see FIPS202.md).
|
|
344
|
+
*
|
|
345
|
+
*****************************************************************************/
|
|
346
|
+
/* #define MLK_CONFIG_FIPS202X4_CUSTOM_HEADER "SOME_FILE.h" */
|
|
347
|
+
|
|
348
|
+
/******************************************************************************
|
|
349
|
+
* Name: MLK_CONFIG_CUSTOM_ZEROIZE
|
|
350
|
+
*
|
|
351
|
+
* Description: In compliance with @[FIPS203, Section 3.3], mlkem-native
|
|
352
|
+
* zeroizes intermediate stack buffers before returning from
|
|
353
|
+
* function calls.
|
|
354
|
+
*
|
|
355
|
+
* Set this option and define `mlk_zeroize` if you want to
|
|
356
|
+
* use a custom method to zeroize intermediate stack buffers.
|
|
357
|
+
* The default implementation uses SecureZeroMemory on Windows
|
|
358
|
+
* and a memset + compiler barrier otherwise. If neither of those
|
|
359
|
+
* is available on the target platform, compilation will fail,
|
|
360
|
+
* and you will need to use MLK_CONFIG_CUSTOM_ZEROIZE to provide
|
|
361
|
+
* a custom implementation of `mlk_zeroize()`.
|
|
362
|
+
*
|
|
363
|
+
* WARNING:
|
|
364
|
+
* The explicit stack zeroization conducted by mlkem-native
|
|
365
|
+
* reduces the likelihood of data leaking on the stack, but
|
|
366
|
+
* does not eliminate it! The C standard makes no guarantee about
|
|
367
|
+
* where a compiler allocates structures and whether/where it makes
|
|
368
|
+
* copies of them. Also, in addition to entire structures, there
|
|
369
|
+
* may also be potentially exploitable leakage of individual values
|
|
370
|
+
* on the stack.
|
|
371
|
+
*
|
|
372
|
+
* If you need bullet-proof zeroization of the stack, you need to
|
|
373
|
+
* consider additional measures instead of of what this feature
|
|
374
|
+
* provides. In this case, you can set mlk_zeroize to a no-op.
|
|
375
|
+
*
|
|
376
|
+
*****************************************************************************/
|
|
377
|
+
/* #define MLK_CONFIG_CUSTOM_ZEROIZE
|
|
378
|
+
#if !defined(__ASSEMBLER__)
|
|
379
|
+
#include <stdint.h>
|
|
380
|
+
#include "src/sys.h"
|
|
381
|
+
static MLK_INLINE void mlk_zeroize(void *ptr, size_t len)
|
|
382
|
+
{
|
|
383
|
+
... your implementation ...
|
|
384
|
+
}
|
|
385
|
+
#endif
|
|
386
|
+
*/
|
|
387
|
+
|
|
388
|
+
/******************************************************************************
|
|
389
|
+
* Name: MLK_CONFIG_CUSTOM_RANDOMBYTES
|
|
390
|
+
*
|
|
391
|
+
* Description: mlkem-native does not provide a secure randombytes
|
|
392
|
+
* implementation. Such an implementation has to be provided by the
|
|
393
|
+
* consumer.
|
|
394
|
+
*
|
|
395
|
+
* If this option is not set, mlkem-native expects a function
|
|
396
|
+
* int randombytes(uint8_t *out, size_t outlen).
|
|
397
|
+
* It is expected to return zero on success, and non-zero on
|
|
398
|
+
* failure. In case of failure, the top level APIs will return a
|
|
399
|
+
* MLK_ERR_RNG_FAIL error code.
|
|
400
|
+
*
|
|
401
|
+
* Set this option and define `mlk_randombytes` (with the same
|
|
402
|
+
* signature and behaviour) if you want to use a custom method to
|
|
403
|
+
* sample randombytes with a different name or signature.
|
|
404
|
+
*
|
|
405
|
+
*****************************************************************************/
|
|
406
|
+
/* #define MLK_CONFIG_CUSTOM_RANDOMBYTES
|
|
407
|
+
#if !defined(__ASSEMBLER__)
|
|
408
|
+
#include <stdint.h>
|
|
409
|
+
#include "src/sys.h"
|
|
410
|
+
static MLK_INLINE int mlk_randombytes(uint8_t *ptr, size_t len)
|
|
411
|
+
{
|
|
412
|
+
... your implementation ...
|
|
413
|
+
return 0;
|
|
414
|
+
}
|
|
415
|
+
#endif
|
|
416
|
+
*/
|
|
417
|
+
|
|
418
|
+
/******************************************************************************
|
|
419
|
+
* Name: MLK_CONFIG_CUSTOM_CAPABILITY_FUNC
|
|
420
|
+
*
|
|
421
|
+
* Description: mlkem-native backends may rely on specific hardware features.
|
|
422
|
+
* Those backends will only be included in an mlkem-native build
|
|
423
|
+
* if support for the respective features is enabled at
|
|
424
|
+
* compile-time. However, when building for a heteroneous set
|
|
425
|
+
* of CPUs to run the resulting binary/library on, feature
|
|
426
|
+
* detection at _runtime_ is needed to decided whether a backend
|
|
427
|
+
* can be used or not.
|
|
428
|
+
*
|
|
429
|
+
* Set this option and define `mlk_sys_check_capability` if you
|
|
430
|
+
* want to use a custom method to dispatch between implementations.
|
|
431
|
+
*
|
|
432
|
+
* If this option is not set, mlkem-native uses compile-time
|
|
433
|
+
* feature detection only to decide which backend to use.
|
|
434
|
+
*
|
|
435
|
+
* If you compile mlkem-native on a system with different
|
|
436
|
+
* capabilities than the system that the resulting binary/library
|
|
437
|
+
* will be run on, you must use this option.
|
|
438
|
+
*
|
|
439
|
+
*****************************************************************************/
|
|
440
|
+
/* #define MLK_CONFIG_CUSTOM_CAPABILITY_FUNC
|
|
441
|
+
static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap)
|
|
442
|
+
__contract__(
|
|
443
|
+
ensures(return_value == 0 || return_value == 1)
|
|
444
|
+
)
|
|
445
|
+
{
|
|
446
|
+
... your implementation ...
|
|
447
|
+
}
|
|
448
|
+
*/
|
|
449
|
+
|
|
450
|
+
/******************************************************************************
|
|
451
|
+
* Name: MLK_CONFIG_CUSTOM_ALLOC_FREE [EXPERIMENTAL]
|
|
452
|
+
*
|
|
453
|
+
* Description: Set this option and define `MLK_CUSTOM_ALLOC` and
|
|
454
|
+
* `MLK_CUSTOM_FREE` if you want to use custom allocation for
|
|
455
|
+
* large local structures or buffers.
|
|
456
|
+
*
|
|
457
|
+
* By default, all buffers/structures are allocated on the stack.
|
|
458
|
+
* If this option is set, most of them will be allocated via
|
|
459
|
+
* MLK_CUSTOM_ALLOC.
|
|
460
|
+
*
|
|
461
|
+
* Parameters to MLK_CUSTOM_ALLOC:
|
|
462
|
+
* - T* v: Target pointer to declare.
|
|
463
|
+
* - T: Type of structure to be allocated
|
|
464
|
+
* - N: Number of elements to be allocated.
|
|
465
|
+
*
|
|
466
|
+
* Parameters to MLK_CUSTOM_FREE:
|
|
467
|
+
* - T* v: Target pointer to free. May be NULL.
|
|
468
|
+
* - T: Type of structure to be freed.
|
|
469
|
+
* - N: Number of elements to be freed.
|
|
470
|
+
*
|
|
471
|
+
* WARNING: This option is experimental!
|
|
472
|
+
* Its scope, configuration and function/macro signatures may
|
|
473
|
+
* change at any time. We expect a stable API for v2.
|
|
474
|
+
*
|
|
475
|
+
* NOTE: Even if this option is set, some allocations further down
|
|
476
|
+
* the call stack will still be made from the stack, consuming up
|
|
477
|
+
* to 3KB of stack space. Those will likely be added to the scope
|
|
478
|
+
* of this option in the future.
|
|
479
|
+
*
|
|
480
|
+
* NOTE: MLK_CUSTOM_ALLOC need not guarantee a successful
|
|
481
|
+
* allocation nor include error handling. Upon failure, the
|
|
482
|
+
* target pointer should simply be set to NULL. The calling
|
|
483
|
+
* code will handle this case and invoke MLK_CUSTOM_FREE.
|
|
484
|
+
*
|
|
485
|
+
*****************************************************************************/
|
|
486
|
+
/* #define MLK_CONFIG_CUSTOM_ALLOC_FREE
|
|
487
|
+
#if !defined(__ASSEMBLER__)
|
|
488
|
+
#include <stdlib.h>
|
|
489
|
+
#define MLK_CUSTOM_ALLOC(v, T, N) \
|
|
490
|
+
T* (v) = (T *)aligned_alloc(MLK_DEFAULT_ALIGN, \
|
|
491
|
+
MLK_ALIGN_UP(sizeof(T) * (N)))
|
|
492
|
+
#define MLK_CUSTOM_FREE(v, T, N) free(v)
|
|
493
|
+
#endif
|
|
494
|
+
*/
|
|
495
|
+
|
|
496
|
+
/******************************************************************************
|
|
497
|
+
* Name: MLK_CONFIG_CUSTOM_MEMCPY
|
|
498
|
+
*
|
|
499
|
+
* Description: Set this option and define `mlk_memcpy` if you want to
|
|
500
|
+
* use a custom method to copy memory instead of the standard
|
|
501
|
+
* library memcpy function.
|
|
502
|
+
*
|
|
503
|
+
* The custom implementation must have the same signature and
|
|
504
|
+
* behavior as the standard memcpy function:
|
|
505
|
+
* void *mlk_memcpy(void *dest, const void *src, size_t n)
|
|
506
|
+
*
|
|
507
|
+
*****************************************************************************/
|
|
508
|
+
/* #define MLK_CONFIG_CUSTOM_MEMCPY
|
|
509
|
+
#if !defined(__ASSEMBLER__)
|
|
510
|
+
#include <stdint.h>
|
|
511
|
+
#include "src/sys.h"
|
|
512
|
+
static MLK_INLINE void *mlk_memcpy(void *dest, const void *src, size_t n)
|
|
513
|
+
{
|
|
514
|
+
... your implementation ...
|
|
515
|
+
}
|
|
516
|
+
#endif
|
|
517
|
+
*/
|
|
518
|
+
|
|
519
|
+
/******************************************************************************
|
|
520
|
+
* Name: MLK_CONFIG_CUSTOM_MEMSET
|
|
521
|
+
*
|
|
522
|
+
* Description: Set this option and define `mlk_memset` if you want to
|
|
523
|
+
* use a custom method to set memory instead of the standard
|
|
524
|
+
* library memset function.
|
|
525
|
+
*
|
|
526
|
+
* The custom implementation must have the same signature and
|
|
527
|
+
* behavior as the standard memset function:
|
|
528
|
+
* void *mlk_memset(void *s, int c, size_t n)
|
|
529
|
+
*
|
|
530
|
+
*****************************************************************************/
|
|
531
|
+
/* #define MLK_CONFIG_CUSTOM_MEMSET
|
|
532
|
+
#if !defined(__ASSEMBLER__)
|
|
533
|
+
#include <stdint.h>
|
|
534
|
+
#include "src/sys.h"
|
|
535
|
+
static MLK_INLINE void *mlk_memset(void *s, int c, size_t n)
|
|
536
|
+
{
|
|
537
|
+
... your implementation ...
|
|
538
|
+
}
|
|
539
|
+
#endif
|
|
540
|
+
*/
|
|
541
|
+
|
|
542
|
+
/******************************************************************************
|
|
543
|
+
* Name: MLK_CONFIG_INTERNAL_API_QUALIFIER
|
|
544
|
+
*
|
|
545
|
+
* Description: If set, this option provides an additional function
|
|
546
|
+
* qualifier to be added to declarations of internal API.
|
|
547
|
+
*
|
|
548
|
+
* The primary use case for this option are single-CU builds,
|
|
549
|
+
* in which case this option can be set to `static`.
|
|
550
|
+
*
|
|
551
|
+
*****************************************************************************/
|
|
552
|
+
/* #define MLK_CONFIG_INTERNAL_API_QUALIFIER */
|
|
553
|
+
|
|
554
|
+
/******************************************************************************
|
|
555
|
+
* Name: MLK_CONFIG_CT_TESTING_ENABLED
|
|
556
|
+
*
|
|
557
|
+
* Description: If set, mlkem-native annotates data as secret / public using
|
|
558
|
+
* valgrind's annotations VALGRIND_MAKE_MEM_UNDEFINED and
|
|
559
|
+
* VALGRIND_MAKE_MEM_DEFINED, enabling various checks for secret-
|
|
560
|
+
* dependent control flow of variable time execution (depending
|
|
561
|
+
* on the exact version of valgrind installed).
|
|
562
|
+
*
|
|
563
|
+
*****************************************************************************/
|
|
564
|
+
/* #define MLK_CONFIG_CT_TESTING_ENABLED */
|
|
565
|
+
|
|
566
|
+
/******************************************************************************
|
|
567
|
+
* Name: MLK_CONFIG_NO_ASM
|
|
568
|
+
*
|
|
569
|
+
* Description: If this option is set, mlkem-native will be built without
|
|
570
|
+
* use of native code or inline assembly.
|
|
571
|
+
*
|
|
572
|
+
* By default, inline assembly is used to implement value barriers.
|
|
573
|
+
* Without inline assembly, mlkem-native will use a global volatile
|
|
574
|
+
* 'opt blocker' instead; see verify.h.
|
|
575
|
+
*
|
|
576
|
+
* Inline assembly is also used to implement a secure zeroization
|
|
577
|
+
* function on non-Windows platforms. If this option is set and
|
|
578
|
+
* the target platform is not Windows, you MUST set
|
|
579
|
+
* MLK_CONFIG_CUSTOM_ZEROIZE and provide a custom zeroization
|
|
580
|
+
* function.
|
|
581
|
+
*
|
|
582
|
+
* If this option is set, MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202 and
|
|
583
|
+
* and MLK_CONFIG_USE_NATIVE_BACKEND_ARITH will be ignored, and no
|
|
584
|
+
* native backends will be used.
|
|
585
|
+
*
|
|
586
|
+
*****************************************************************************/
|
|
587
|
+
/* #define MLK_CONFIG_NO_ASM */
|
|
588
|
+
|
|
589
|
+
/******************************************************************************
|
|
590
|
+
* Name: MLK_CONFIG_NO_ASM_VALUE_BARRIER
|
|
591
|
+
*
|
|
592
|
+
* Description: If this option is set, mlkem-native will be built without
|
|
593
|
+
* use of native code or inline assembly for value barriers.
|
|
594
|
+
*
|
|
595
|
+
* By default, inline assembly (if available) is used to implement
|
|
596
|
+
* value barriers.
|
|
597
|
+
* Without inline assembly, mlkem-native will use a global volatile
|
|
598
|
+
* 'opt blocker' instead; see verify.h.
|
|
599
|
+
*
|
|
600
|
+
*****************************************************************************/
|
|
601
|
+
/* #define MLk_CONFIG_NO_ASM_VALUE_BARRIER */
|
|
602
|
+
|
|
603
|
+
/******************************************************************************
|
|
604
|
+
* Name: MLK_CONFIG_KEYGEN_PCT
|
|
605
|
+
*
|
|
606
|
+
* Description: Compliance with @[FIPS140_3_IG, p.87] requires a
|
|
607
|
+
* Pairwise Consistency Test (PCT) to be carried out on a freshly
|
|
608
|
+
* generated keypair before it can be exported.
|
|
609
|
+
*
|
|
610
|
+
* Set this option if such a check should be implemented.
|
|
611
|
+
* In this case, crypto_kem_keypair_derand and crypto_kem_keypair
|
|
612
|
+
* will return a non-zero error code if the PCT failed.
|
|
613
|
+
*
|
|
614
|
+
* NOTE: This feature will drastically lower the performance of
|
|
615
|
+
* key generation.
|
|
616
|
+
*
|
|
617
|
+
*****************************************************************************/
|
|
618
|
+
/* #define MLK_CONFIG_KEYGEN_PCT */
|
|
619
|
+
|
|
620
|
+
/******************************************************************************
|
|
621
|
+
* Name: MLK_CONFIG_KEYGEN_PCT_BREAKAGE_TEST
|
|
622
|
+
*
|
|
623
|
+
* Description: If this option is set, the user must provide a runtime
|
|
624
|
+
* function `static inline int mlk_break_pct() { ... }` to
|
|
625
|
+
* indicate whether the PCT should be made fail.
|
|
626
|
+
*
|
|
627
|
+
* This option only has an effect if MLK_CONFIG_KEYGEN_PCT is set.
|
|
628
|
+
*
|
|
629
|
+
*****************************************************************************/
|
|
630
|
+
/* #define MLK_CONFIG_KEYGEN_PCT_BREAKAGE_TEST
|
|
631
|
+
#if !defined(__ASSEMBLER__)
|
|
632
|
+
#include "src/sys.h"
|
|
633
|
+
static MLK_INLINE int mlk_break_pct(void)
|
|
634
|
+
{
|
|
635
|
+
... return 0/1 depending on whether PCT should be broken ...
|
|
636
|
+
}
|
|
637
|
+
#endif
|
|
638
|
+
*/
|
|
639
|
+
|
|
640
|
+
/******************************************************************************
|
|
641
|
+
* Name: MLK_CONFIG_SERIAL_FIPS202_ONLY
|
|
642
|
+
*
|
|
643
|
+
* Description: Set this to use a FIPS202 implementation with global state
|
|
644
|
+
* that supports only one active Keccak computation at a time
|
|
645
|
+
* (e.g. some hardware accelerators).
|
|
646
|
+
*
|
|
647
|
+
* If this option is set, batched Keccak operations are
|
|
648
|
+
* disabled for rejection sampling during matrix generation.
|
|
649
|
+
* Instead, matrix entries will be generated one at a time.
|
|
650
|
+
*
|
|
651
|
+
* This allows offloading Keccak computations to a hardware
|
|
652
|
+
* accelerator that holds only a single Keccak state locally,
|
|
653
|
+
* rather than requiring support for batched (4x) Keccak states.
|
|
654
|
+
*
|
|
655
|
+
* NOTE: Depending on the target CPU, disabling batched Keccak
|
|
656
|
+
* may reduce performance when using software FIPS202
|
|
657
|
+
* implementations. Only enable this when you have to.
|
|
658
|
+
*
|
|
659
|
+
*****************************************************************************/
|
|
660
|
+
/* #define MLK_CONFIG_SERIAL_FIPS202_ONLY */
|
|
661
|
+
|
|
662
|
+
/******************************************************************************
|
|
663
|
+
* Name: MLK_CONFIG_CONTEXT_PARAMETER
|
|
664
|
+
*
|
|
665
|
+
* Description: Set this to add a context parameter that is provided to public
|
|
666
|
+
* API functions and is then available in custom callbacks.
|
|
667
|
+
*
|
|
668
|
+
* The type of the context parameter is configured via
|
|
669
|
+
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
670
|
+
*
|
|
671
|
+
*****************************************************************************/
|
|
672
|
+
/* #define MLK_CONFIG_CONTEXT_PARAMETER */
|
|
673
|
+
|
|
674
|
+
/******************************************************************************
|
|
675
|
+
* Name: MLK_CONFIG_CONTEXT_PARAMETER_TYPE
|
|
676
|
+
*
|
|
677
|
+
* Description: Set this to define the type for the context parameter used by
|
|
678
|
+
* MLK_CONFIG_CONTEXT_PARAMETER.
|
|
679
|
+
*
|
|
680
|
+
* This is only relevant if MLK_CONFIG_CONTEXT_PARAMETER is set.
|
|
681
|
+
*
|
|
682
|
+
*****************************************************************************/
|
|
683
|
+
/* #define MLK_CONFIG_CONTEXT_PARAMETER_TYPE void* */
|
|
684
|
+
|
|
685
|
+
/************************* Config internals ********************************/
|
|
686
|
+
|
|
687
|
+
#endif /* MLK_BUILD_INTERNAL */
|
|
688
|
+
|
|
689
|
+
/* Default namespace
|
|
690
|
+
*
|
|
691
|
+
* Don't change this. If you need a different namespace, re-define
|
|
692
|
+
* MLK_CONFIG_NAMESPACE_PREFIX above instead, and remove the following.
|
|
693
|
+
*
|
|
694
|
+
* The default MLKEM namespace is
|
|
695
|
+
*
|
|
696
|
+
* PQCP_MLKEM_NATIVE_MLKEM<LEVEL>_
|
|
697
|
+
*
|
|
698
|
+
* e.g., PQCP_MLKEM_NATIVE_MLKEM512_
|
|
699
|
+
*/
|
|
700
|
+
|
|
701
|
+
#if MLK_CONFIG_PARAMETER_SET == 512
|
|
702
|
+
#define MLK_DEFAULT_NAMESPACE_PREFIX PQCP_MLKEM_NATIVE_MLKEM512
|
|
703
|
+
#elif MLK_CONFIG_PARAMETER_SET == 768
|
|
704
|
+
#define MLK_DEFAULT_NAMESPACE_PREFIX PQCP_MLKEM_NATIVE_MLKEM768
|
|
705
|
+
#elif MLK_CONFIG_PARAMETER_SET == 1024
|
|
706
|
+
#define MLK_DEFAULT_NAMESPACE_PREFIX PQCP_MLKEM_NATIVE_MLKEM1024
|
|
707
|
+
#endif
|
|
708
|
+
|
|
709
|
+
#endif /* !MLK_CONFIG_H */
|