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
|
@@ -1255,9 +1255,6 @@ static VALUE pqcrypto__native_mldsa_mu_builder_finalize(VALUE self, VALUE builde
|
|
|
1255
1255
|
|
|
1256
1256
|
rb_nogvl(pq_mu_finalize_nogvl, &call, NULL, NULL, RB_NOGVL_OFFLOAD_SAFE);
|
|
1257
1257
|
|
|
1258
|
-
if (call.result != PQ_SUCCESS) {
|
|
1259
|
-
pq_mu_builder_release(wrapper->builder);
|
|
1260
|
-
}
|
|
1261
1258
|
wrapper->builder = NULL;
|
|
1262
1259
|
|
|
1263
1260
|
if (call.result != PQ_SUCCESS) {
|
|
@@ -22,12 +22,7 @@
|
|
|
22
22
|
#error "OpenSSL 3.0 or later is required for pq_crypto"
|
|
23
23
|
#endif
|
|
24
24
|
|
|
25
|
-
#
|
|
26
|
-
#error "PQClean-backed algorithms are required. Run: bundle exec rake vendor"
|
|
27
|
-
#endif
|
|
28
|
-
|
|
29
|
-
#include "mlkem_api.h"
|
|
30
|
-
#include "mldsa_api.h"
|
|
25
|
+
#include "pqcrypto_native_api.h"
|
|
31
26
|
|
|
32
27
|
void pq_secure_wipe(void *ptr, size_t len) {
|
|
33
28
|
if (ptr == NULL) {
|
|
@@ -223,8 +218,7 @@ static int xwing_expand_secret_key(hybrid_expanded_secret_key_t *expanded_key,
|
|
|
223
218
|
if (EVP_DigestFinalXOF(ctx, expanded, sizeof(expanded)) != 1)
|
|
224
219
|
goto cleanup;
|
|
225
220
|
|
|
226
|
-
ret =
|
|
227
|
-
expanded_key->mlkem_sk, expanded);
|
|
221
|
+
ret = pqcr_mlkem768_keypair_derand(expanded_key->mlkem_pk, expanded_key->mlkem_sk, expanded);
|
|
228
222
|
if (ret != 0) {
|
|
229
223
|
ret = PQ_ERROR_KEYPAIR;
|
|
230
224
|
goto cleanup;
|
|
@@ -248,31 +242,36 @@ cleanup:
|
|
|
248
242
|
return ret;
|
|
249
243
|
}
|
|
250
244
|
|
|
251
|
-
#define PQ_MLKEM_VARIANTS(X)
|
|
252
|
-
X(mlkem,
|
|
253
|
-
X(mlkem512,
|
|
254
|
-
X(mlkem1024,
|
|
255
|
-
|
|
256
|
-
#define PQ_DEFINE_MLKEM_SHIMS(prefix,
|
|
257
|
-
int pq_##prefix##_keypair(uint8_t *pk, uint8_t *sk) {
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
return
|
|
275
|
-
|
|
245
|
+
#define PQ_MLKEM_VARIANTS(X) \
|
|
246
|
+
X(mlkem, pqcr_mlkem768) \
|
|
247
|
+
X(mlkem512, pqcr_mlkem512) \
|
|
248
|
+
X(mlkem1024, pqcr_mlkem1024)
|
|
249
|
+
|
|
250
|
+
#define PQ_DEFINE_MLKEM_SHIMS(prefix, native) \
|
|
251
|
+
int pq_##prefix##_keypair(uint8_t *pk, uint8_t *sk) { \
|
|
252
|
+
if (!pk || !sk) { \
|
|
253
|
+
return PQ_ERROR_BUFFER; \
|
|
254
|
+
} \
|
|
255
|
+
return native##_keypair(pk, sk) == 0 ? PQ_SUCCESS : PQ_ERROR_KEYPAIR; \
|
|
256
|
+
} \
|
|
257
|
+
int pq_##prefix##_keypair_from_seed(uint8_t *pk, uint8_t *sk, const uint8_t *seed64) {\
|
|
258
|
+
if (!pk || !sk || !seed64) { \
|
|
259
|
+
return PQ_ERROR_BUFFER; \
|
|
260
|
+
} \
|
|
261
|
+
return native##_keypair_derand(pk, sk, seed64) == 0 ? PQ_SUCCESS \
|
|
262
|
+
: PQ_ERROR_KEYPAIR; \
|
|
263
|
+
} \
|
|
264
|
+
int pq_##prefix##_encapsulate(uint8_t *ct, uint8_t *ss, const uint8_t *pk) { \
|
|
265
|
+
if (!ct || !ss || !pk) { \
|
|
266
|
+
return PQ_ERROR_BUFFER; \
|
|
267
|
+
} \
|
|
268
|
+
return native##_enc(ct, ss, pk) == 0 ? PQ_SUCCESS : PQ_ERROR_ENCAPSULATE; \
|
|
269
|
+
} \
|
|
270
|
+
int pq_##prefix##_decapsulate(uint8_t *ss, const uint8_t *ct, const uint8_t *sk) { \
|
|
271
|
+
if (!ss || !ct || !sk) { \
|
|
272
|
+
return PQ_ERROR_BUFFER; \
|
|
273
|
+
} \
|
|
274
|
+
return native##_dec(ss, ct, sk) == 0 ? PQ_SUCCESS : PQ_ERROR_DECAPSULATE; \
|
|
276
275
|
}
|
|
277
276
|
|
|
278
277
|
PQ_MLKEM_VARIANTS(PQ_DEFINE_MLKEM_SHIMS)
|
|
@@ -299,136 +298,152 @@ static int pq_testing_mlkem_encapsulate_from_seed_with(
|
|
|
299
298
|
: PQ_ERROR_ENCAPSULATE;
|
|
300
299
|
}
|
|
301
300
|
|
|
302
|
-
#define PQ_DEFINE_MLKEM_TESTING_SHIMS(prefix,
|
|
303
|
-
int pq_testing_##prefix##_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
|
|
304
|
-
const uint8_t *seed, size_t seed_len) {
|
|
305
|
-
return pq_testing_mlkem_keypair_from_seed_with(
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
const uint8_t *
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
ciphertext, shared_secret, public_key, seed, seed_len, \
|
|
314
|
-
PQCLEAN_##pqclean##_crypto_kem_enc_derand); \
|
|
301
|
+
#define PQ_DEFINE_MLKEM_TESTING_SHIMS(prefix, native) \
|
|
302
|
+
int pq_testing_##prefix##_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, \
|
|
303
|
+
const uint8_t *seed, size_t seed_len) { \
|
|
304
|
+
return pq_testing_mlkem_keypair_from_seed_with(public_key, secret_key, seed, seed_len, \
|
|
305
|
+
native##_keypair_derand); \
|
|
306
|
+
} \
|
|
307
|
+
int pq_testing_##prefix##_encapsulate_from_seed(uint8_t *ciphertext, uint8_t *shared_secret,\
|
|
308
|
+
const uint8_t *public_key, \
|
|
309
|
+
const uint8_t *seed, size_t seed_len) { \
|
|
310
|
+
return pq_testing_mlkem_encapsulate_from_seed_with(ciphertext, shared_secret, public_key,\
|
|
311
|
+
seed, seed_len, native##_enc_derand);\
|
|
315
312
|
}
|
|
316
313
|
|
|
317
314
|
PQ_MLKEM_VARIANTS(PQ_DEFINE_MLKEM_TESTING_SHIMS)
|
|
318
315
|
|
|
319
316
|
#undef PQ_DEFINE_MLKEM_TESTING_SHIMS
|
|
320
317
|
|
|
321
|
-
#define PQ_DEFINE_MLDSA_SIGN_KEYPAIR(prefix,
|
|
322
|
-
int pq_##prefix##_keypair(uint8_t *public_key, uint8_t *secret_key) {
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
318
|
+
#define PQ_DEFINE_MLDSA_SIGN_KEYPAIR(prefix, native) \
|
|
319
|
+
int pq_##prefix##_keypair(uint8_t *public_key, uint8_t *secret_key) { \
|
|
320
|
+
if (!public_key || !secret_key) { \
|
|
321
|
+
return PQ_ERROR_BUFFER; \
|
|
322
|
+
} \
|
|
323
|
+
return native##_keypair(public_key, secret_key) == 0 ? PQ_SUCCESS \
|
|
324
|
+
: PQ_ERROR_KEYPAIR; \
|
|
326
325
|
}
|
|
327
326
|
|
|
328
|
-
PQ_DEFINE_MLDSA_SIGN_KEYPAIR(sign,
|
|
329
|
-
PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa44_sign,
|
|
330
|
-
PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa87_sign,
|
|
327
|
+
PQ_DEFINE_MLDSA_SIGN_KEYPAIR(sign, pqcr_mldsa65)
|
|
328
|
+
PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa44_sign, pqcr_mldsa44)
|
|
329
|
+
PQ_DEFINE_MLDSA_SIGN_KEYPAIR(mldsa87_sign, pqcr_mldsa87)
|
|
331
330
|
|
|
332
331
|
#undef PQ_DEFINE_MLDSA_SIGN_KEYPAIR
|
|
333
332
|
|
|
334
|
-
#define PQ_DEFINE_MLDSA_SIGN(name,
|
|
335
|
-
int pq_##name(uint8_t *signature, size_t *signature_len, const uint8_t *message,
|
|
336
|
-
size_t message_len, const uint8_t *secret_key) {
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
333
|
+
#define PQ_DEFINE_MLDSA_SIGN(name, native) \
|
|
334
|
+
int pq_##name(uint8_t *signature, size_t *signature_len, const uint8_t *message, \
|
|
335
|
+
size_t message_len, const uint8_t *secret_key) { \
|
|
336
|
+
if (!signature || !signature_len || !secret_key || (message_len > 0 && !message)) {\
|
|
337
|
+
return PQ_ERROR_BUFFER; \
|
|
338
|
+
} \
|
|
339
|
+
return native##_signature(signature, signature_len, message, message_len, NULL, 0,\
|
|
340
|
+
secret_key) == 0 \
|
|
341
|
+
? PQ_SUCCESS \
|
|
342
|
+
: PQ_ERROR_SIGN; \
|
|
341
343
|
}
|
|
342
344
|
|
|
343
|
-
PQ_DEFINE_MLDSA_SIGN(sign,
|
|
344
|
-
PQ_DEFINE_MLDSA_SIGN(mldsa44_sign,
|
|
345
|
-
PQ_DEFINE_MLDSA_SIGN(mldsa87_sign,
|
|
345
|
+
PQ_DEFINE_MLDSA_SIGN(sign, pqcr_mldsa65)
|
|
346
|
+
PQ_DEFINE_MLDSA_SIGN(mldsa44_sign, pqcr_mldsa44)
|
|
347
|
+
PQ_DEFINE_MLDSA_SIGN(mldsa87_sign, pqcr_mldsa87)
|
|
346
348
|
|
|
347
349
|
#undef PQ_DEFINE_MLDSA_SIGN
|
|
348
350
|
|
|
349
|
-
#define PQ_DEFINE_MLDSA_VERIFY(name,
|
|
351
|
+
#define PQ_DEFINE_MLDSA_VERIFY(name, native) \
|
|
350
352
|
int pq_##name(const uint8_t *signature, size_t signature_len, const uint8_t *message, \
|
|
351
|
-
size_t message_len, const uint8_t *public_key) {
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
size_t message_len, const uint8_t *public_key) { \
|
|
354
|
+
if (!signature || !public_key || (message_len > 0 && !message)) { \
|
|
355
|
+
return PQ_ERROR_BUFFER; \
|
|
356
|
+
} \
|
|
357
|
+
return native##_verify(signature, signature_len, message, message_len, NULL, 0, \
|
|
358
|
+
public_key) == 0 \
|
|
354
359
|
? PQ_SUCCESS \
|
|
355
360
|
: PQ_ERROR_VERIFY; \
|
|
356
361
|
}
|
|
357
362
|
|
|
358
|
-
PQ_DEFINE_MLDSA_VERIFY(verify,
|
|
359
|
-
PQ_DEFINE_MLDSA_VERIFY(mldsa44_verify,
|
|
360
|
-
PQ_DEFINE_MLDSA_VERIFY(mldsa87_verify,
|
|
363
|
+
PQ_DEFINE_MLDSA_VERIFY(verify, pqcr_mldsa65)
|
|
364
|
+
PQ_DEFINE_MLDSA_VERIFY(mldsa44_verify, pqcr_mldsa44)
|
|
365
|
+
PQ_DEFINE_MLDSA_VERIFY(mldsa87_verify, pqcr_mldsa87)
|
|
361
366
|
|
|
362
367
|
#undef PQ_DEFINE_MLDSA_VERIFY
|
|
363
368
|
|
|
364
|
-
static int pq_testing_mldsa_keypair_from_seed_with(uint8_t *public_key, uint8_t *secret_key,
|
|
365
|
-
const uint8_t *seed, size_t seed_len,
|
|
366
|
-
int (*keypair)(uint8_t *, uint8_t *)) {
|
|
367
|
-
int rc;
|
|
368
|
-
if (!public_key || !secret_key || !seed || seed_len != 32 || !keypair) {
|
|
369
|
-
return PQ_ERROR_BUFFER;
|
|
370
|
-
}
|
|
371
|
-
|
|
372
|
-
pq_testing_set_seed(seed, seed_len);
|
|
373
|
-
rc = keypair(public_key, secret_key);
|
|
374
|
-
pq_testing_clear_seed();
|
|
375
|
-
return rc == 0 ? PQ_SUCCESS : PQ_ERROR_KEYPAIR;
|
|
376
|
-
}
|
|
377
|
-
|
|
378
369
|
static int pq_testing_mldsa_sign_from_seed_with(
|
|
379
370
|
uint8_t *signature, size_t *signature_len, const uint8_t *message, size_t message_len,
|
|
380
371
|
const uint8_t *secret_key, const uint8_t *seed, size_t seed_len,
|
|
381
|
-
int (*
|
|
382
|
-
|
|
383
|
-
|
|
372
|
+
int (*signature_internal)(uint8_t *, size_t *, const uint8_t *, size_t, const uint8_t *, size_t,
|
|
373
|
+
const uint8_t *, const uint8_t *, int),
|
|
374
|
+
size_t (*prepare_prefix)(uint8_t *, const uint8_t *, size_t, const uint8_t *, size_t, int)) {
|
|
375
|
+
uint8_t pre[MLDSA_DOMAIN_SEPARATION_MAX_BYTES];
|
|
376
|
+
size_t pre_len;
|
|
377
|
+
|
|
378
|
+
if (!signature || !signature_len || !secret_key || !seed || seed_len != MLDSA_RNDBYTES ||
|
|
379
|
+
!signature_internal || !prepare_prefix || (message_len > 0 && !message)) {
|
|
384
380
|
return PQ_ERROR_BUFFER;
|
|
385
381
|
}
|
|
386
382
|
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
383
|
+
/*
|
|
384
|
+
* mldsa-native's signature_internal is lower-level than the public pure
|
|
385
|
+
* ML-DSA signing API. It expects the FIPS 204 domain-separation prefix explicitly. Passing
|
|
386
|
+
* NULL/0 signs CRH(tr, message) instead of CRH(tr, 0x00 || ctxlen || ctx || message),
|
|
387
|
+
* which produces signatures that do not verify through the public pure-ML-DSA API
|
|
388
|
+
* and do not match ACVP/KAT sigGen vectors.
|
|
389
|
+
*/
|
|
390
|
+
pre_len = prepare_prefix(pre, NULL, 0, NULL, 0, MLDSA_PREHASH_NONE);
|
|
391
|
+
if (pre_len == 0) {
|
|
392
|
+
return PQ_ERROR_SIGN;
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
return signature_internal(signature, signature_len, message, message_len, pre, pre_len, seed,
|
|
396
|
+
secret_key, 0) == 0
|
|
397
|
+
? PQ_SUCCESS
|
|
398
|
+
: PQ_ERROR_SIGN;
|
|
391
399
|
}
|
|
392
400
|
|
|
393
|
-
/*
|
|
394
|
-
* Production ML-DSA seed expansion for RFC 9881 seed-format PKCS#8 imports.
|
|
395
|
-
*
|
|
396
|
-
* PQClean does not expose a public crypto_sign_keypair_derand entrypoint for
|
|
397
|
-
* ML-DSA. This deliberately reuses pq_crypto's thread-local seed-replay
|
|
398
|
-
* randombytes() path, the same path covered by Patch 8 KATs, and is surfaced
|
|
399
|
-
* only through the Ruby PKCS#8 opt-in gate.
|
|
400
|
-
*/
|
|
401
401
|
int pq_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
|
|
402
|
-
|
|
403
|
-
|
|
402
|
+
if (!public_key || !secret_key || !seed32) {
|
|
403
|
+
return PQ_ERROR_BUFFER;
|
|
404
|
+
}
|
|
405
|
+
return pqcr_mldsa44_keypair_internal(public_key, secret_key, seed32) == 0 ? PQ_SUCCESS
|
|
406
|
+
: PQ_ERROR_KEYPAIR;
|
|
404
407
|
}
|
|
405
408
|
|
|
406
409
|
int pq_mldsa_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
|
|
407
|
-
|
|
408
|
-
|
|
410
|
+
if (!public_key || !secret_key || !seed32) {
|
|
411
|
+
return PQ_ERROR_BUFFER;
|
|
412
|
+
}
|
|
413
|
+
return pqcr_mldsa65_keypair_internal(public_key, secret_key, seed32) == 0 ? PQ_SUCCESS
|
|
414
|
+
: PQ_ERROR_KEYPAIR;
|
|
409
415
|
}
|
|
410
416
|
|
|
411
417
|
int pq_mldsa87_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key, const uint8_t *seed32) {
|
|
412
|
-
|
|
413
|
-
|
|
418
|
+
if (!public_key || !secret_key || !seed32) {
|
|
419
|
+
return PQ_ERROR_BUFFER;
|
|
420
|
+
}
|
|
421
|
+
return pqcr_mldsa87_keypair_internal(public_key, secret_key, seed32) == 0 ? PQ_SUCCESS
|
|
422
|
+
: PQ_ERROR_KEYPAIR;
|
|
414
423
|
}
|
|
415
424
|
|
|
416
425
|
int pq_testing_mldsa_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
|
|
417
426
|
const uint8_t *seed, size_t seed_len) {
|
|
418
|
-
|
|
419
|
-
|
|
427
|
+
if (seed_len != MLDSA_SEEDBYTES) {
|
|
428
|
+
return PQ_ERROR_BUFFER;
|
|
429
|
+
}
|
|
430
|
+
return pq_mldsa_keypair_from_seed(public_key, secret_key, seed);
|
|
420
431
|
}
|
|
421
432
|
|
|
422
433
|
int pq_testing_mldsa44_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
|
|
423
434
|
const uint8_t *seed, size_t seed_len) {
|
|
424
|
-
|
|
425
|
-
|
|
435
|
+
if (seed_len != MLDSA_SEEDBYTES) {
|
|
436
|
+
return PQ_ERROR_BUFFER;
|
|
437
|
+
}
|
|
438
|
+
return pq_mldsa44_keypair_from_seed(public_key, secret_key, seed);
|
|
426
439
|
}
|
|
427
440
|
|
|
428
441
|
int pq_testing_mldsa87_keypair_from_seed(uint8_t *public_key, uint8_t *secret_key,
|
|
429
442
|
const uint8_t *seed, size_t seed_len) {
|
|
430
|
-
|
|
431
|
-
|
|
443
|
+
if (seed_len != MLDSA_SEEDBYTES) {
|
|
444
|
+
return PQ_ERROR_BUFFER;
|
|
445
|
+
}
|
|
446
|
+
return pq_mldsa87_keypair_from_seed(public_key, secret_key, seed);
|
|
432
447
|
}
|
|
433
448
|
|
|
434
449
|
int pq_testing_mldsa_sign_from_seed(uint8_t *signature, size_t *signature_len,
|
|
@@ -437,7 +452,8 @@ int pq_testing_mldsa_sign_from_seed(uint8_t *signature, size_t *signature_len,
|
|
|
437
452
|
size_t seed_len) {
|
|
438
453
|
return pq_testing_mldsa_sign_from_seed_with(signature, signature_len, message, message_len,
|
|
439
454
|
secret_key, seed, seed_len,
|
|
440
|
-
|
|
455
|
+
pqcr_mldsa65_signature_internal,
|
|
456
|
+
pqcr_mldsa65_prepare_domain_separation_prefix);
|
|
441
457
|
}
|
|
442
458
|
|
|
443
459
|
int pq_testing_mldsa44_sign_from_seed(uint8_t *signature, size_t *signature_len,
|
|
@@ -446,7 +462,8 @@ int pq_testing_mldsa44_sign_from_seed(uint8_t *signature, size_t *signature_len,
|
|
|
446
462
|
size_t seed_len) {
|
|
447
463
|
return pq_testing_mldsa_sign_from_seed_with(signature, signature_len, message, message_len,
|
|
448
464
|
secret_key, seed, seed_len,
|
|
449
|
-
|
|
465
|
+
pqcr_mldsa44_signature_internal,
|
|
466
|
+
pqcr_mldsa44_prepare_domain_separation_prefix);
|
|
450
467
|
}
|
|
451
468
|
|
|
452
469
|
int pq_testing_mldsa87_sign_from_seed(uint8_t *signature, size_t *signature_len,
|
|
@@ -455,7 +472,8 @@ int pq_testing_mldsa87_sign_from_seed(uint8_t *signature, size_t *signature_len,
|
|
|
455
472
|
size_t seed_len) {
|
|
456
473
|
return pq_testing_mldsa_sign_from_seed_with(signature, signature_len, message, message_len,
|
|
457
474
|
secret_key, seed, seed_len,
|
|
458
|
-
|
|
475
|
+
pqcr_mldsa87_signature_internal,
|
|
476
|
+
pqcr_mldsa87_prepare_domain_separation_prefix);
|
|
459
477
|
}
|
|
460
478
|
|
|
461
479
|
int pq_hybrid_kem_keypair(uint8_t *public_key, uint8_t *secret_key) {
|
|
@@ -512,7 +530,7 @@ int pq_hybrid_kem_encapsulate(uint8_t *ciphertext, uint8_t *shared_secret,
|
|
|
512
530
|
memset(x25519_ss, 0, sizeof(x25519_ss));
|
|
513
531
|
memset(x25519_ephemeral_sk, 0, sizeof(x25519_ephemeral_sk));
|
|
514
532
|
|
|
515
|
-
if (
|
|
533
|
+
if (pqcr_mlkem768_enc(ct.mlkem_ct, mlkem_ss, pk.mlkem_pk) != 0) {
|
|
516
534
|
ret = PQ_ERROR_ENCAPSULATE;
|
|
517
535
|
goto cleanup;
|
|
518
536
|
}
|
|
@@ -566,7 +584,7 @@ int pq_hybrid_kem_decapsulate(uint8_t *shared_secret, const uint8_t *ciphertext,
|
|
|
566
584
|
goto cleanup;
|
|
567
585
|
}
|
|
568
586
|
|
|
569
|
-
if (
|
|
587
|
+
if (pqcr_mlkem768_dec(mlkem_ss, ct.mlkem_ct, expanded.mlkem_sk) != 0) {
|
|
570
588
|
ret = PQ_ERROR_DECAPSULATE;
|
|
571
589
|
goto cleanup;
|
|
572
590
|
}
|
|
@@ -5,48 +5,7 @@
|
|
|
5
5
|
#include <stdlib.h>
|
|
6
6
|
#include <string.h>
|
|
7
7
|
|
|
8
|
-
#
|
|
9
|
-
#error "PQClean sources are required to build pq_crypto. Run: bundle exec rake vendor"
|
|
10
|
-
#endif
|
|
11
|
-
|
|
12
|
-
#include "mlkem_api.h"
|
|
13
|
-
#include "mldsa_api.h"
|
|
14
|
-
|
|
15
|
-
#define MLKEM512_PUBLICKEYBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
16
|
-
#define MLKEM512_SECRETKEYBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
17
|
-
#define MLKEM512_CIPHERTEXTBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_CIPHERTEXTBYTES
|
|
18
|
-
#define MLKEM512_SHAREDSECRETBYTES PQCLEAN_MLKEM512_CLEAN_CRYPTO_BYTES
|
|
19
|
-
|
|
20
|
-
#define MLKEM768_PUBLICKEYBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
21
|
-
#define MLKEM768_SECRETKEYBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
22
|
-
#define MLKEM768_CIPHERTEXTBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_CIPHERTEXTBYTES
|
|
23
|
-
#define MLKEM768_SHAREDSECRETBYTES PQCLEAN_MLKEM768_CLEAN_CRYPTO_BYTES
|
|
24
|
-
|
|
25
|
-
#define MLKEM1024_PUBLICKEYBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
26
|
-
#define MLKEM1024_SECRETKEYBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
27
|
-
#define MLKEM1024_CIPHERTEXTBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_CIPHERTEXTBYTES
|
|
28
|
-
#define MLKEM1024_SHAREDSECRETBYTES PQCLEAN_MLKEM1024_CLEAN_CRYPTO_BYTES
|
|
29
|
-
|
|
30
|
-
#define MLKEM_PUBLICKEYBYTES MLKEM768_PUBLICKEYBYTES
|
|
31
|
-
#define MLKEM_SECRETKEYBYTES MLKEM768_SECRETKEYBYTES
|
|
32
|
-
#define MLKEM_CIPHERTEXTBYTES MLKEM768_CIPHERTEXTBYTES
|
|
33
|
-
#define MLKEM_SHAREDSECRETBYTES MLKEM768_SHAREDSECRETBYTES
|
|
34
|
-
|
|
35
|
-
#define MLDSA44_PUBLICKEYBYTES PQCLEAN_MLDSA44_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
36
|
-
#define MLDSA44_SECRETKEYBYTES PQCLEAN_MLDSA44_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
37
|
-
#define MLDSA44_BYTES PQCLEAN_MLDSA44_CLEAN_CRYPTO_BYTES
|
|
38
|
-
|
|
39
|
-
#define MLDSA65_PUBLICKEYBYTES PQCLEAN_MLDSA65_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
40
|
-
#define MLDSA65_SECRETKEYBYTES PQCLEAN_MLDSA65_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
41
|
-
#define MLDSA65_BYTES PQCLEAN_MLDSA65_CLEAN_CRYPTO_BYTES
|
|
42
|
-
|
|
43
|
-
#define MLDSA87_PUBLICKEYBYTES PQCLEAN_MLDSA87_CLEAN_CRYPTO_PUBLICKEYBYTES
|
|
44
|
-
#define MLDSA87_SECRETKEYBYTES PQCLEAN_MLDSA87_CLEAN_CRYPTO_SECRETKEYBYTES
|
|
45
|
-
#define MLDSA87_BYTES PQCLEAN_MLDSA87_CLEAN_CRYPTO_BYTES
|
|
46
|
-
|
|
47
|
-
#define MLDSA_PUBLICKEYBYTES MLDSA65_PUBLICKEYBYTES
|
|
48
|
-
#define MLDSA_SECRETKEYBYTES MLDSA65_SECRETKEYBYTES
|
|
49
|
-
#define MLDSA_BYTES MLDSA65_BYTES
|
|
8
|
+
#include "pqcrypto_native_api.h"
|
|
50
9
|
|
|
51
10
|
#define X25519_PUBLICKEYBYTES 32
|
|
52
11
|
#define X25519_SECRETKEYBYTES 32
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
backend=PQ Code Package native only
|
|
2
|
+
pqclean=removed
|
|
3
|
+
mlkem_native_repo=https://github.com/pq-code-package/mlkem-native.git
|
|
4
|
+
mlkem_native_ref=v1.1.0
|
|
5
|
+
mlkem_native_commit=d2cae2be522a67bfae26100fdb520576f1b2ef90
|
|
6
|
+
mlkem_native_tree_sha256=368ad66b3a8092dd919d5646eb8507b8336e8f9f09c43b779dbf864700b5b8fb
|
|
7
|
+
mldsa_native_repo=https://github.com/pq-code-package/mldsa-native.git
|
|
8
|
+
mldsa_native_ref=v1.0.0-beta
|
|
9
|
+
mldsa_native_commit=db65535319d9750d75d34c6d170677415f9d2c46
|
|
10
|
+
mldsa_native_tree_sha256=9c73cd6c185bb6885a7cf0ecb56a5282a5657aa5e6c32f68f442d941baa92b3d
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
[//]: # (SPDX-License-Identifier: CC-BY-4.0)
|
|
2
|
+
|
|
3
|
+
# Building mldsa-native
|
|
4
|
+
|
|
5
|
+
### Prerequisites
|
|
6
|
+
|
|
7
|
+
To build **mldsa-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 [mldsa](mldsa).
|
|
12
|
+
|
|
13
|
+
### Using `make`
|
|
14
|
+
|
|
15
|
+
You can build and test **mldsa-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, **mldsa-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 **mldsa-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.
|
|
105
|
+
|