pq_crypto 0.6.8 → 0.6.9
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 +11 -0
- data/README.md +1 -3
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +7 -7
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +71 -0
- data/ext/pqcrypto/vendor/mldsa-native/README.md +26 -11
- data/ext/pqcrypto/vendor/mldsa-native/RELEASE.md +77 -150
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +93 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +74 -59
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +106 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +94 -92
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/capability.h +31 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +55 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +30 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +8 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +8 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +12 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +3 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/auto.h +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h +38 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h +38 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +24 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S +574 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +46 -18
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S +679 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +13 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +5 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_intt_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_ntt_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_pointwise_montgomery_aarch64_asm.S +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_caddq_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_chknorm_aarch64_asm.S +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_32_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_88_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_32_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_88_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_17_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_19_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_aarch64_asm.S +110 -120
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta2_aarch64_asm.S +109 -101
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta4_aarch64_asm.S +97 -93
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +1 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +4 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/fastmul.h +74 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/slowmul.h +77 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/arith_native_rv32im.h +124 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_asm.S +331 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_slowmul_asm.S +381 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_ntt_rv32im_asm.S +304 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_ntt_rv32im_slowmul_asm.S +351 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_poly_pointwise_montgomery_rv32im_asm.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/rv32im_zetas.c +118 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +6 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +2 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_intt_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_ntt_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_nttunpack_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l4_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l5_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l7_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_caddq_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +7 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +69 -67
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +69 -67
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +12 -16
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +14 -18
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +23 -27
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +21 -42
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +28 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +87 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +61 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +23 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +30 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +55 -107
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +67 -107
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +16 -24
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +27 -21
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +8 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +191 -119
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +16 -42
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +72 -0
- data/ext/pqcrypto/vendor/mlkem-native/README.md +9 -5
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +64 -312
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -34
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +41 -13
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +89 -33
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +50 -46
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/capability.h +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +1 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +4 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +1 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +15 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +23 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +11 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +7 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +8 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +8 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/auto.h +47 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h +37 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h +37 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +24 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S +573 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +46 -18
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S +678 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +13 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +1 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +7 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +29 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +156 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +137 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/compress_d5_table.c +43 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d10_table.c +50 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d11_table.c +53 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d4_table.c +44 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d5_table.c +53 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_intt_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_ntt_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d10_aarch64_asm.S +439 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d11_aarch64_asm.S +452 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d4_aarch64_asm.S +106 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d5_aarch64_asm.S +124 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d10_aarch64_asm.S +108 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d11_aarch64_asm.S +116 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d4_aarch64_asm.S +93 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d5_aarch64_asm.S +104 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_frombytes_aarch64_asm.S +84 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_mulcache_compute_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_reduce_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tobytes_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tomont_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_rej_uniform_aarch64_asm.S +112 -104
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +0 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +16 -21
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +1 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_intt_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_ntt_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_poly_tomont_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_reduce_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +5 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +5 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_intt_avx2_asm.S +36 -33
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntt_avx2_asm.S +67 -65
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttfrombytes_avx2_asm.S +8 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntttobytes_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttunpack_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d10_avx2_asm.S +7 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d11_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d4_avx2_asm.S +7 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d5_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d10_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d11_avx2_asm.S +6 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d4_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d5_avx2_asm.S +6 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_mulcache_compute_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S +118 -115
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S +174 -171
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S +230 -227
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_reduce_avx2_asm.S +17 -15
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_rej_uniform_avx2_asm.S +7 -6
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_tomont_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +4 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +31 -44
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +1 -1
- data/lib/pq_crypto/version.rb +1 -1
- data/script/vendor_libs.rb +6 -6
- metadata +36 -1
|
@@ -77,8 +77,13 @@
|
|
|
77
77
|
#if defined(MLK_CONFIG_USE_NATIVE_BACKEND_ARITH)
|
|
78
78
|
#if defined(MLK_SYS_AARCH64)
|
|
79
79
|
#include "src/native/aarch64/src/aarch64_zetas.c"
|
|
80
|
+
#include "src/native/aarch64/src/compress_d5_table.c"
|
|
81
|
+
#include "src/native/aarch64/src/decompress_d10_table.c"
|
|
82
|
+
#include "src/native/aarch64/src/decompress_d11_table.c"
|
|
83
|
+
#include "src/native/aarch64/src/decompress_d4_table.c"
|
|
84
|
+
#include "src/native/aarch64/src/decompress_d5_table.c"
|
|
80
85
|
#include "src/native/aarch64/src/rej_uniform_table.c"
|
|
81
|
-
#endif
|
|
86
|
+
#endif /* MLK_SYS_AARCH64 */
|
|
82
87
|
#if defined(MLK_SYS_X86_64)
|
|
83
88
|
#include "src/native/x86_64/src/compress_consts.c"
|
|
84
89
|
#include "src/native/x86_64/src/consts.c"
|
|
@@ -188,6 +193,8 @@
|
|
|
188
193
|
#undef MLK_COMMON_H
|
|
189
194
|
#undef MLK_CONCAT
|
|
190
195
|
#undef MLK_CONCAT_
|
|
196
|
+
#undef MLK_CT_TESTING_DECLASSIFY
|
|
197
|
+
#undef MLK_CT_TESTING_SECRET
|
|
191
198
|
#undef MLK_EMPTY_CU
|
|
192
199
|
#undef MLK_ERR_FAIL
|
|
193
200
|
#undef MLK_ERR_INVALID_PK
|
|
@@ -199,6 +206,7 @@
|
|
|
199
206
|
#undef MLK_FIPS202X4_HEADER_FILE
|
|
200
207
|
#undef MLK_FIPS202_HEADER_FILE
|
|
201
208
|
#undef MLK_FREE
|
|
209
|
+
#undef MLK_HAVE_INLINE_ASM
|
|
202
210
|
#undef MLK_INTERNAL_API
|
|
203
211
|
#undef MLK_INTERNAL_DATA_DECLARATION
|
|
204
212
|
#undef MLK_INTERNAL_DATA_DEFINITION
|
|
@@ -281,6 +289,8 @@
|
|
|
281
289
|
/*
|
|
282
290
|
* Undefine macros from MLK_CONFIG_PARAMETER_SET-generic files
|
|
283
291
|
*/
|
|
292
|
+
/* mlkem/src/capability.h */
|
|
293
|
+
#undef MLK_CAPABILITY_H
|
|
284
294
|
/* mlkem/src/compress.h */
|
|
285
295
|
#undef MLK_COMPRESS_H
|
|
286
296
|
#undef mlk_poly_compress_d10
|
|
@@ -351,38 +361,6 @@
|
|
|
351
361
|
#undef mlk_xof_x4_init
|
|
352
362
|
#undef mlk_xof_x4_release
|
|
353
363
|
#undef mlk_xof_x4_squeezeblocks
|
|
354
|
-
/* mlkem/src/sys.h */
|
|
355
|
-
#undef MLK_ALIGN
|
|
356
|
-
#undef MLK_ALIGN_UP
|
|
357
|
-
#undef MLK_ALWAYS_INLINE
|
|
358
|
-
#undef MLK_CET_ENDBR
|
|
359
|
-
#undef MLK_CT_TESTING_DECLASSIFY
|
|
360
|
-
#undef MLK_CT_TESTING_SECRET
|
|
361
|
-
#undef MLK_DEFAULT_ALIGN
|
|
362
|
-
#undef MLK_HAVE_INLINE_ASM
|
|
363
|
-
#undef MLK_INLINE
|
|
364
|
-
#undef MLK_MUST_CHECK_RETURN_VALUE
|
|
365
|
-
#undef MLK_NOINLINE
|
|
366
|
-
#undef MLK_RESTRICT
|
|
367
|
-
#undef MLK_STATIC_TESTABLE
|
|
368
|
-
#undef MLK_SYSV_ABI
|
|
369
|
-
#undef MLK_SYSV_ABI_SUPPORTED
|
|
370
|
-
#undef MLK_SYS_AARCH64
|
|
371
|
-
#undef MLK_SYS_AARCH64_EB
|
|
372
|
-
#undef MLK_SYS_AARCH64_NEON
|
|
373
|
-
#undef MLK_SYS_APPLE
|
|
374
|
-
#undef MLK_SYS_ARMV81M_MVE
|
|
375
|
-
#undef MLK_SYS_BIG_ENDIAN
|
|
376
|
-
#undef MLK_SYS_H
|
|
377
|
-
#undef MLK_SYS_LINUX
|
|
378
|
-
#undef MLK_SYS_LITTLE_ENDIAN
|
|
379
|
-
#undef MLK_SYS_PPC64LE
|
|
380
|
-
#undef MLK_SYS_RISCV32
|
|
381
|
-
#undef MLK_SYS_RISCV64
|
|
382
|
-
#undef MLK_SYS_RISCV64_RVV
|
|
383
|
-
#undef MLK_SYS_WINDOWS
|
|
384
|
-
#undef MLK_SYS_X86_64
|
|
385
|
-
#undef MLK_SYS_X86_64_AVX2
|
|
386
364
|
/* mlkem/src/verify.h */
|
|
387
365
|
#undef MLK_USE_ASM_VALUE_BARRIER
|
|
388
366
|
#undef MLK_VERIFY_H
|
|
@@ -397,7 +375,6 @@
|
|
|
397
375
|
* Undefine macros from FIPS-202 files
|
|
398
376
|
*/
|
|
399
377
|
/* mlkem/src/fips202/fips202.h */
|
|
400
|
-
#undef FIPS202_X4_DEFAULT_IMPLEMENTATION
|
|
401
378
|
#undef MLK_FIPS202_FIPS202_H
|
|
402
379
|
#undef SHA3_256_HASHBYTES
|
|
403
380
|
#undef SHA3_256_RATE
|
|
@@ -478,13 +455,25 @@
|
|
|
478
455
|
/*
|
|
479
456
|
* Undefine macros from native code (FIPS202, x86_64)
|
|
480
457
|
*/
|
|
458
|
+
/* mlkem/src/fips202/native/x86_64/auto.h */
|
|
459
|
+
#undef MLK_FIPS202_NATIVE_X86_64_AUTO_H
|
|
460
|
+
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h */
|
|
461
|
+
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X1_AVX512_H
|
|
462
|
+
#undef MLK_FIPS202_X86_64_NEED_X1_AVX512
|
|
463
|
+
#undef MLK_USE_NATIVE_FIPS202_X1
|
|
481
464
|
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h */
|
|
482
465
|
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X4_AVX2_H
|
|
483
466
|
#undef MLK_FIPS202_X86_64_NEED_X4_AVX2
|
|
484
467
|
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
468
|
+
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h */
|
|
469
|
+
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X4_AVX512_H
|
|
470
|
+
#undef MLK_FIPS202_X86_64_NEED_X4_AVX512
|
|
471
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
485
472
|
/* mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h */
|
|
486
473
|
#undef MLK_FIPS202_NATIVE_X86_64_SRC_FIPS202_NATIVE_X86_64_H
|
|
474
|
+
#undef mlk_keccak_f1600_x1_avx512_asm
|
|
487
475
|
#undef mlk_keccak_f1600_x4_avx2_asm
|
|
476
|
+
#undef mlk_keccak_f1600_x4_avx512_asm
|
|
488
477
|
#undef mlk_keccak_rho56
|
|
489
478
|
#undef mlk_keccak_rho8
|
|
490
479
|
#undef mlk_keccakf1600_round_constants
|
|
@@ -528,6 +517,15 @@
|
|
|
528
517
|
#undef MLK_USE_NATIVE_INTT
|
|
529
518
|
#undef MLK_USE_NATIVE_NTT
|
|
530
519
|
#undef MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED
|
|
520
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D10
|
|
521
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D11
|
|
522
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D4
|
|
523
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D5
|
|
524
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D10
|
|
525
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D11
|
|
526
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D4
|
|
527
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D5
|
|
528
|
+
#undef MLK_USE_NATIVE_POLY_FROMBYTES
|
|
531
529
|
#undef MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE
|
|
532
530
|
#undef MLK_USE_NATIVE_POLY_REDUCE
|
|
533
531
|
#undef MLK_USE_NATIVE_POLY_TOBYTES
|
|
@@ -535,6 +533,11 @@
|
|
|
535
533
|
#undef MLK_USE_NATIVE_REJ_UNIFORM
|
|
536
534
|
/* mlkem/src/native/aarch64/src/arith_native_aarch64.h */
|
|
537
535
|
#undef MLK_NATIVE_AARCH64_SRC_ARITH_NATIVE_AARCH64_H
|
|
536
|
+
#undef mlk_aarch64_compress_d5_table
|
|
537
|
+
#undef mlk_aarch64_decompress_d10_table
|
|
538
|
+
#undef mlk_aarch64_decompress_d11_table
|
|
539
|
+
#undef mlk_aarch64_decompress_d4_table
|
|
540
|
+
#undef mlk_aarch64_decompress_d5_table
|
|
538
541
|
#undef mlk_aarch64_invntt_zetas_layer12345
|
|
539
542
|
#undef mlk_aarch64_invntt_zetas_layer67
|
|
540
543
|
#undef mlk_aarch64_ntt_zetas_layer12345
|
|
@@ -543,6 +546,15 @@
|
|
|
543
546
|
#undef mlk_aarch64_zetas_mulcache_twisted_native
|
|
544
547
|
#undef mlk_intt_aarch64_asm
|
|
545
548
|
#undef mlk_ntt_aarch64_asm
|
|
549
|
+
#undef mlk_poly_compress_d10_aarch64_asm
|
|
550
|
+
#undef mlk_poly_compress_d11_aarch64_asm
|
|
551
|
+
#undef mlk_poly_compress_d4_aarch64_asm
|
|
552
|
+
#undef mlk_poly_compress_d5_aarch64_asm
|
|
553
|
+
#undef mlk_poly_decompress_d10_aarch64_asm
|
|
554
|
+
#undef mlk_poly_decompress_d11_aarch64_asm
|
|
555
|
+
#undef mlk_poly_decompress_d4_aarch64_asm
|
|
556
|
+
#undef mlk_poly_decompress_d5_aarch64_asm
|
|
557
|
+
#undef mlk_poly_frombytes_aarch64_asm
|
|
546
558
|
#undef mlk_poly_mulcache_compute_aarch64_asm
|
|
547
559
|
#undef mlk_poly_reduce_aarch64_asm
|
|
548
560
|
#undef mlk_poly_tobytes_aarch64_asm
|
|
@@ -689,4 +701,35 @@
|
|
|
689
701
|
#undef mlk_ppc_qdata
|
|
690
702
|
#endif /* MLK_SYS_PPC64LE */
|
|
691
703
|
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_ARITH */
|
|
704
|
+
/* mlkem/src/sys.h */
|
|
705
|
+
#undef MLK_ALIGN
|
|
706
|
+
#undef MLK_ALIGN_UP
|
|
707
|
+
#undef MLK_ALWAYS_INLINE
|
|
708
|
+
#undef MLK_CET_ENDBR
|
|
709
|
+
#undef MLK_DEFAULT_ALIGN
|
|
710
|
+
#undef MLK_INLINE
|
|
711
|
+
#undef MLK_MUST_CHECK_RETURN_VALUE
|
|
712
|
+
#undef MLK_NOINLINE
|
|
713
|
+
#undef MLK_RESTRICT
|
|
714
|
+
#undef MLK_STATIC_TESTABLE
|
|
715
|
+
#undef MLK_SYSV_ABI
|
|
716
|
+
#undef MLK_SYSV_ABI_SUPPORTED
|
|
717
|
+
#undef MLK_SYS_AARCH64
|
|
718
|
+
#undef MLK_SYS_AARCH64_EB
|
|
719
|
+
#undef MLK_SYS_AARCH64_NEON
|
|
720
|
+
#undef MLK_SYS_APPLE
|
|
721
|
+
#undef MLK_SYS_ARMV81M_MVE
|
|
722
|
+
#undef MLK_SYS_BIG_ENDIAN
|
|
723
|
+
#undef MLK_SYS_H
|
|
724
|
+
#undef MLK_SYS_LINUX
|
|
725
|
+
#undef MLK_SYS_LITTLE_ENDIAN
|
|
726
|
+
#undef MLK_SYS_PPC64LE
|
|
727
|
+
#undef MLK_SYS_PPC64LE_POWER8_VECTOR
|
|
728
|
+
#undef MLK_SYS_RISCV32
|
|
729
|
+
#undef MLK_SYS_RISCV64
|
|
730
|
+
#undef MLK_SYS_RISCV64_RVV
|
|
731
|
+
#undef MLK_SYS_WINDOWS
|
|
732
|
+
#undef MLK_SYS_X86_64
|
|
733
|
+
#undef MLK_SYS_X86_64_AVX2
|
|
734
|
+
#undef MLK_SYS_X86_64_AVX512
|
|
692
735
|
#endif /* !MLK_CONFIG_MONOBUILD_KEEP_SHARED_HEADERS */
|
|
@@ -32,7 +32,9 @@
|
|
|
32
32
|
* # API conventions
|
|
33
33
|
*
|
|
34
34
|
* Conventions shared by all functions below (return values, pointer validity,
|
|
35
|
-
* output buffers on error) are documented in
|
|
35
|
+
* buffer overlap, output buffers on error) are documented in
|
|
36
|
+
* API-CONVENTIONS.md. In particular, buffers passed to the same function must
|
|
37
|
+
* not overlap.
|
|
36
38
|
*
|
|
37
39
|
* # Multi-level builds
|
|
38
40
|
*
|
|
@@ -109,11 +111,7 @@
|
|
|
109
111
|
* pair failed its encaps/decaps self-test. */
|
|
110
112
|
#define MLK_ERR_PCT_FAIL (-6)
|
|
111
113
|
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
#define MLK_API_CONCAT_(x, y) x##y
|
|
115
|
-
#define MLK_API_CONCAT(x, y) MLK_API_CONCAT_(x, y)
|
|
116
|
-
#define MLK_API_CONCAT_UNDERSCORE(x, y) MLK_API_CONCAT(MLK_API_CONCAT(x, _), y)
|
|
114
|
+
/****************************** Configuration *********************************/
|
|
117
115
|
|
|
118
116
|
/* You need to make sure the config file is in the include path. */
|
|
119
117
|
#if defined(MLK_CONFIG_FILE)
|
|
@@ -122,6 +120,14 @@
|
|
|
122
120
|
#include "mlkem_native_config.h"
|
|
123
121
|
#endif
|
|
124
122
|
|
|
123
|
+
/********************* Namespacing and Qualifiers *****************************/
|
|
124
|
+
|
|
125
|
+
#if !defined(MLK_CONFIG_CONSTANTS_ONLY)
|
|
126
|
+
|
|
127
|
+
#define MLK_API_CONCAT_(x, y) x##y
|
|
128
|
+
#define MLK_API_CONCAT(x, y) MLK_API_CONCAT_(x, y)
|
|
129
|
+
#define MLK_API_CONCAT_UNDERSCORE(x, y) MLK_API_CONCAT(MLK_API_CONCAT(x, _), y)
|
|
130
|
+
|
|
125
131
|
/* Namespace prefix for the public API symbols. For multi-level builds, the
|
|
126
132
|
* parameter set is appended to disambiguate the security levels. */
|
|
127
133
|
#if defined(MLK_CONFIG_MULTILEVEL_BUILD)
|
|
@@ -148,8 +154,6 @@
|
|
|
148
154
|
|
|
149
155
|
/****************************** Function API **********************************/
|
|
150
156
|
|
|
151
|
-
#if !defined(MLK_CONFIG_CONSTANTS_ONLY)
|
|
152
|
-
|
|
153
157
|
#include <stdint.h>
|
|
154
158
|
|
|
155
159
|
#ifdef __cplusplus
|
|
@@ -161,7 +165,16 @@ extern "C"
|
|
|
161
165
|
/**
|
|
162
166
|
* Generate a public/private keypair for the ML-KEM key encapsulation mechanism.
|
|
163
167
|
*
|
|
164
|
-
* @spec{Implements @[FIPS203, Algorithm 16, ML-KEM.KeyGen_Internal].
|
|
168
|
+
* @spec{Implements @[FIPS203, Algorithm 16, ML-KEM.KeyGen_Internal]. When
|
|
169
|
+
* `MLK_CONFIG_KEYGEN_PCT` is enabled, also performs the encapsulation-key
|
|
170
|
+
* modulus check, decapsulation-key hash check, and pairwise consistency test
|
|
171
|
+
* described in steps 2-4 of @[FIPS203, Section 7.1, Key pair check].}
|
|
172
|
+
*
|
|
173
|
+
* @note If MLK_CONFIG_KEYGEN_PCT is enabled, the keypair is written to
|
|
174
|
+
* the output buffers before the PCT is run, and zeroized if the PCT
|
|
175
|
+
* fails. A keypair failing the PCT is thus temporarily present in
|
|
176
|
+
* the output buffers. If this is a concern, pass buffers that are
|
|
177
|
+
* not accessible to untrusted parties, and copy out upon success.
|
|
165
178
|
*
|
|
166
179
|
* @param[out] pk Output public key, an array of
|
|
167
180
|
* MLKEM{512,768,1024}_PUBLICKEYBYTES bytes.
|
|
@@ -197,7 +210,16 @@ int MLK_API_NAMESPACE(keypair_derand)(
|
|
|
197
210
|
/**
|
|
198
211
|
* Generate a public/private keypair for the ML-KEM key encapsulation mechanism.
|
|
199
212
|
*
|
|
200
|
-
* @spec{Implements @[FIPS203, Algorithm 19, ML-KEM.KeyGen].
|
|
213
|
+
* @spec{Implements @[FIPS203, Algorithm 19, ML-KEM.KeyGen]. When
|
|
214
|
+
* `MLK_CONFIG_KEYGEN_PCT` is enabled, also performs the encapsulation-key
|
|
215
|
+
* modulus check, decapsulation-key hash check, and pairwise consistency test
|
|
216
|
+
* described in steps 2-4 of @[FIPS203, Section 7.1, Key pair check].}
|
|
217
|
+
*
|
|
218
|
+
* @note If MLK_CONFIG_KEYGEN_PCT is enabled, the keypair is written to
|
|
219
|
+
* the output buffers before the PCT is run, and zeroized if the PCT
|
|
220
|
+
* fails. A keypair failing the PCT is thus temporarily present in
|
|
221
|
+
* the output buffers. If this is a concern, pass buffers that are
|
|
222
|
+
* not accessible to untrusted parties, and copy out upon success.
|
|
201
223
|
*
|
|
202
224
|
* @param[out] pk Output public key, an array of
|
|
203
225
|
* MLKEM{512,768,1024}_PUBLICKEYBYTES bytes.
|
|
@@ -230,7 +252,9 @@ int MLK_API_NAMESPACE(keypair)(
|
|
|
230
252
|
/**
|
|
231
253
|
* Generate ciphertext and shared secret for a given public key.
|
|
232
254
|
*
|
|
233
|
-
* @spec{Implements @[FIPS203, Algorithm 17, ML-KEM.Encaps_Internal]
|
|
255
|
+
* @spec{Implements @[FIPS203, Algorithm 17, ML-KEM.Encaps_Internal] and
|
|
256
|
+
* performs the encapsulation-key modulus check from
|
|
257
|
+
* @[FIPS203, Section 7.2, Encapsulation key check] before using the key.}
|
|
234
258
|
*
|
|
235
259
|
* @param[out] ct Output ciphertext, an array of
|
|
236
260
|
* MLKEM{512,768,1024}_CIPHERTEXTBYTES bytes.
|
|
@@ -265,7 +289,9 @@ int MLK_API_NAMESPACE(enc_derand)(
|
|
|
265
289
|
/**
|
|
266
290
|
* Generate ciphertext and shared secret for a given public key.
|
|
267
291
|
*
|
|
268
|
-
* @spec{Implements @[FIPS203, Algorithm 20, ML-KEM.Encaps]
|
|
292
|
+
* @spec{Implements @[FIPS203, Algorithm 20, ML-KEM.Encaps] and performs the
|
|
293
|
+
* encapsulation-key modulus check from
|
|
294
|
+
* @[FIPS203, Section 7.2, Encapsulation key check] before using the key.}
|
|
269
295
|
*
|
|
270
296
|
* @param[out] ct Output ciphertext, an array of
|
|
271
297
|
* MLKEM{512,768,1024}_CIPHERTEXTBYTES bytes.
|
|
@@ -301,7 +327,9 @@ int MLK_API_NAMESPACE(enc)(
|
|
|
301
327
|
/**
|
|
302
328
|
* Generate shared secret for a given ciphertext and private key.
|
|
303
329
|
*
|
|
304
|
-
* @spec{Implements @[FIPS203, Algorithm 21, ML-KEM.Decaps]
|
|
330
|
+
* @spec{Implements @[FIPS203, Algorithm 21, ML-KEM.Decaps] and performs the
|
|
331
|
+
* decapsulation-key hash check from
|
|
332
|
+
* @[FIPS203, Section 7.3, Decapsulation key check] before using the key.}
|
|
305
333
|
*
|
|
306
334
|
* @param[out] ss Output shared secret, an array of MLKEM_BYTES bytes.
|
|
307
335
|
* @param[in] ct Input ciphertext, an array of
|
|
@@ -62,6 +62,15 @@
|
|
|
62
62
|
#if defined(MLK_SYS_AARCH64)
|
|
63
63
|
#include "src/native/aarch64/src/mlkem_intt_aarch64_asm.S"
|
|
64
64
|
#include "src/native/aarch64/src/mlkem_ntt_aarch64_asm.S"
|
|
65
|
+
#include "src/native/aarch64/src/mlkem_poly_compress_d10_aarch64_asm.S"
|
|
66
|
+
#include "src/native/aarch64/src/mlkem_poly_compress_d11_aarch64_asm.S"
|
|
67
|
+
#include "src/native/aarch64/src/mlkem_poly_compress_d4_aarch64_asm.S"
|
|
68
|
+
#include "src/native/aarch64/src/mlkem_poly_compress_d5_aarch64_asm.S"
|
|
69
|
+
#include "src/native/aarch64/src/mlkem_poly_decompress_d10_aarch64_asm.S"
|
|
70
|
+
#include "src/native/aarch64/src/mlkem_poly_decompress_d11_aarch64_asm.S"
|
|
71
|
+
#include "src/native/aarch64/src/mlkem_poly_decompress_d4_aarch64_asm.S"
|
|
72
|
+
#include "src/native/aarch64/src/mlkem_poly_decompress_d5_aarch64_asm.S"
|
|
73
|
+
#include "src/native/aarch64/src/mlkem_poly_frombytes_aarch64_asm.S"
|
|
65
74
|
#include "src/native/aarch64/src/mlkem_poly_mulcache_compute_aarch64_asm.S"
|
|
66
75
|
#include "src/native/aarch64/src/mlkem_poly_reduce_aarch64_asm.S"
|
|
67
76
|
#include "src/native/aarch64/src/mlkem_poly_tobytes_aarch64_asm.S"
|
|
@@ -112,7 +121,9 @@
|
|
|
112
121
|
#include "src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S"
|
|
113
122
|
#endif /* MLK_SYS_AARCH64 */
|
|
114
123
|
#if defined(MLK_SYS_X86_64)
|
|
124
|
+
#include "src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S"
|
|
115
125
|
#include "src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S"
|
|
126
|
+
#include "src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S"
|
|
116
127
|
#endif
|
|
117
128
|
#if defined(MLK_SYS_ARMV81M_MVE)
|
|
118
129
|
#include "src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S"
|
|
@@ -121,6 +132,13 @@
|
|
|
121
132
|
#endif
|
|
122
133
|
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202 */
|
|
123
134
|
|
|
135
|
+
/* Mark the stack non-executable even if no assembly is included above */
|
|
136
|
+
#if defined(__ELF__)
|
|
137
|
+
/* clang-format off */
|
|
138
|
+
.section .note.GNU-stack,"",%progbits
|
|
139
|
+
/* clang-format on */
|
|
140
|
+
#endif
|
|
141
|
+
|
|
124
142
|
|
|
125
143
|
/* Macro #undef's
|
|
126
144
|
*
|
|
@@ -212,6 +230,8 @@
|
|
|
212
230
|
#undef MLK_COMMON_H
|
|
213
231
|
#undef MLK_CONCAT
|
|
214
232
|
#undef MLK_CONCAT_
|
|
233
|
+
#undef MLK_CT_TESTING_DECLASSIFY
|
|
234
|
+
#undef MLK_CT_TESTING_SECRET
|
|
215
235
|
#undef MLK_EMPTY_CU
|
|
216
236
|
#undef MLK_ERR_FAIL
|
|
217
237
|
#undef MLK_ERR_INVALID_PK
|
|
@@ -223,6 +243,7 @@
|
|
|
223
243
|
#undef MLK_FIPS202X4_HEADER_FILE
|
|
224
244
|
#undef MLK_FIPS202_HEADER_FILE
|
|
225
245
|
#undef MLK_FREE
|
|
246
|
+
#undef MLK_HAVE_INLINE_ASM
|
|
226
247
|
#undef MLK_INTERNAL_API
|
|
227
248
|
#undef MLK_INTERNAL_DATA_DECLARATION
|
|
228
249
|
#undef MLK_INTERNAL_DATA_DEFINITION
|
|
@@ -305,6 +326,8 @@
|
|
|
305
326
|
/*
|
|
306
327
|
* Undefine macros from MLK_CONFIG_PARAMETER_SET-generic files
|
|
307
328
|
*/
|
|
329
|
+
/* mlkem/src/capability.h */
|
|
330
|
+
#undef MLK_CAPABILITY_H
|
|
308
331
|
/* mlkem/src/compress.h */
|
|
309
332
|
#undef MLK_COMPRESS_H
|
|
310
333
|
#undef mlk_poly_compress_d10
|
|
@@ -375,38 +398,6 @@
|
|
|
375
398
|
#undef mlk_xof_x4_init
|
|
376
399
|
#undef mlk_xof_x4_release
|
|
377
400
|
#undef mlk_xof_x4_squeezeblocks
|
|
378
|
-
/* mlkem/src/sys.h */
|
|
379
|
-
#undef MLK_ALIGN
|
|
380
|
-
#undef MLK_ALIGN_UP
|
|
381
|
-
#undef MLK_ALWAYS_INLINE
|
|
382
|
-
#undef MLK_CET_ENDBR
|
|
383
|
-
#undef MLK_CT_TESTING_DECLASSIFY
|
|
384
|
-
#undef MLK_CT_TESTING_SECRET
|
|
385
|
-
#undef MLK_DEFAULT_ALIGN
|
|
386
|
-
#undef MLK_HAVE_INLINE_ASM
|
|
387
|
-
#undef MLK_INLINE
|
|
388
|
-
#undef MLK_MUST_CHECK_RETURN_VALUE
|
|
389
|
-
#undef MLK_NOINLINE
|
|
390
|
-
#undef MLK_RESTRICT
|
|
391
|
-
#undef MLK_STATIC_TESTABLE
|
|
392
|
-
#undef MLK_SYSV_ABI
|
|
393
|
-
#undef MLK_SYSV_ABI_SUPPORTED
|
|
394
|
-
#undef MLK_SYS_AARCH64
|
|
395
|
-
#undef MLK_SYS_AARCH64_EB
|
|
396
|
-
#undef MLK_SYS_AARCH64_NEON
|
|
397
|
-
#undef MLK_SYS_APPLE
|
|
398
|
-
#undef MLK_SYS_ARMV81M_MVE
|
|
399
|
-
#undef MLK_SYS_BIG_ENDIAN
|
|
400
|
-
#undef MLK_SYS_H
|
|
401
|
-
#undef MLK_SYS_LINUX
|
|
402
|
-
#undef MLK_SYS_LITTLE_ENDIAN
|
|
403
|
-
#undef MLK_SYS_PPC64LE
|
|
404
|
-
#undef MLK_SYS_RISCV32
|
|
405
|
-
#undef MLK_SYS_RISCV64
|
|
406
|
-
#undef MLK_SYS_RISCV64_RVV
|
|
407
|
-
#undef MLK_SYS_WINDOWS
|
|
408
|
-
#undef MLK_SYS_X86_64
|
|
409
|
-
#undef MLK_SYS_X86_64_AVX2
|
|
410
401
|
/* mlkem/src/verify.h */
|
|
411
402
|
#undef MLK_USE_ASM_VALUE_BARRIER
|
|
412
403
|
#undef MLK_VERIFY_H
|
|
@@ -421,7 +412,6 @@
|
|
|
421
412
|
* Undefine macros from FIPS-202 files
|
|
422
413
|
*/
|
|
423
414
|
/* mlkem/src/fips202/fips202.h */
|
|
424
|
-
#undef FIPS202_X4_DEFAULT_IMPLEMENTATION
|
|
425
415
|
#undef MLK_FIPS202_FIPS202_H
|
|
426
416
|
#undef SHA3_256_HASHBYTES
|
|
427
417
|
#undef SHA3_256_RATE
|
|
@@ -502,13 +492,25 @@
|
|
|
502
492
|
/*
|
|
503
493
|
* Undefine macros from native code (FIPS202, x86_64)
|
|
504
494
|
*/
|
|
495
|
+
/* mlkem/src/fips202/native/x86_64/auto.h */
|
|
496
|
+
#undef MLK_FIPS202_NATIVE_X86_64_AUTO_H
|
|
497
|
+
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h */
|
|
498
|
+
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X1_AVX512_H
|
|
499
|
+
#undef MLK_FIPS202_X86_64_NEED_X1_AVX512
|
|
500
|
+
#undef MLK_USE_NATIVE_FIPS202_X1
|
|
505
501
|
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h */
|
|
506
502
|
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X4_AVX2_H
|
|
507
503
|
#undef MLK_FIPS202_X86_64_NEED_X4_AVX2
|
|
508
504
|
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
505
|
+
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h */
|
|
506
|
+
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X4_AVX512_H
|
|
507
|
+
#undef MLK_FIPS202_X86_64_NEED_X4_AVX512
|
|
508
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
509
509
|
/* mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h */
|
|
510
510
|
#undef MLK_FIPS202_NATIVE_X86_64_SRC_FIPS202_NATIVE_X86_64_H
|
|
511
|
+
#undef mlk_keccak_f1600_x1_avx512_asm
|
|
511
512
|
#undef mlk_keccak_f1600_x4_avx2_asm
|
|
513
|
+
#undef mlk_keccak_f1600_x4_avx512_asm
|
|
512
514
|
#undef mlk_keccak_rho56
|
|
513
515
|
#undef mlk_keccak_rho8
|
|
514
516
|
#undef mlk_keccakf1600_round_constants
|
|
@@ -552,6 +554,15 @@
|
|
|
552
554
|
#undef MLK_USE_NATIVE_INTT
|
|
553
555
|
#undef MLK_USE_NATIVE_NTT
|
|
554
556
|
#undef MLK_USE_NATIVE_POLYVEC_BASEMUL_ACC_MONTGOMERY_CACHED
|
|
557
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D10
|
|
558
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D11
|
|
559
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D4
|
|
560
|
+
#undef MLK_USE_NATIVE_POLY_COMPRESS_D5
|
|
561
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D10
|
|
562
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D11
|
|
563
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D4
|
|
564
|
+
#undef MLK_USE_NATIVE_POLY_DECOMPRESS_D5
|
|
565
|
+
#undef MLK_USE_NATIVE_POLY_FROMBYTES
|
|
555
566
|
#undef MLK_USE_NATIVE_POLY_MULCACHE_COMPUTE
|
|
556
567
|
#undef MLK_USE_NATIVE_POLY_REDUCE
|
|
557
568
|
#undef MLK_USE_NATIVE_POLY_TOBYTES
|
|
@@ -559,6 +570,11 @@
|
|
|
559
570
|
#undef MLK_USE_NATIVE_REJ_UNIFORM
|
|
560
571
|
/* mlkem/src/native/aarch64/src/arith_native_aarch64.h */
|
|
561
572
|
#undef MLK_NATIVE_AARCH64_SRC_ARITH_NATIVE_AARCH64_H
|
|
573
|
+
#undef mlk_aarch64_compress_d5_table
|
|
574
|
+
#undef mlk_aarch64_decompress_d10_table
|
|
575
|
+
#undef mlk_aarch64_decompress_d11_table
|
|
576
|
+
#undef mlk_aarch64_decompress_d4_table
|
|
577
|
+
#undef mlk_aarch64_decompress_d5_table
|
|
562
578
|
#undef mlk_aarch64_invntt_zetas_layer12345
|
|
563
579
|
#undef mlk_aarch64_invntt_zetas_layer67
|
|
564
580
|
#undef mlk_aarch64_ntt_zetas_layer12345
|
|
@@ -567,6 +583,15 @@
|
|
|
567
583
|
#undef mlk_aarch64_zetas_mulcache_twisted_native
|
|
568
584
|
#undef mlk_intt_aarch64_asm
|
|
569
585
|
#undef mlk_ntt_aarch64_asm
|
|
586
|
+
#undef mlk_poly_compress_d10_aarch64_asm
|
|
587
|
+
#undef mlk_poly_compress_d11_aarch64_asm
|
|
588
|
+
#undef mlk_poly_compress_d4_aarch64_asm
|
|
589
|
+
#undef mlk_poly_compress_d5_aarch64_asm
|
|
590
|
+
#undef mlk_poly_decompress_d10_aarch64_asm
|
|
591
|
+
#undef mlk_poly_decompress_d11_aarch64_asm
|
|
592
|
+
#undef mlk_poly_decompress_d4_aarch64_asm
|
|
593
|
+
#undef mlk_poly_decompress_d5_aarch64_asm
|
|
594
|
+
#undef mlk_poly_frombytes_aarch64_asm
|
|
570
595
|
#undef mlk_poly_mulcache_compute_aarch64_asm
|
|
571
596
|
#undef mlk_poly_reduce_aarch64_asm
|
|
572
597
|
#undef mlk_poly_tobytes_aarch64_asm
|
|
@@ -713,4 +738,35 @@
|
|
|
713
738
|
#undef mlk_ppc_qdata
|
|
714
739
|
#endif /* MLK_SYS_PPC64LE */
|
|
715
740
|
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_ARITH */
|
|
741
|
+
/* mlkem/src/sys.h */
|
|
742
|
+
#undef MLK_ALIGN
|
|
743
|
+
#undef MLK_ALIGN_UP
|
|
744
|
+
#undef MLK_ALWAYS_INLINE
|
|
745
|
+
#undef MLK_CET_ENDBR
|
|
746
|
+
#undef MLK_DEFAULT_ALIGN
|
|
747
|
+
#undef MLK_INLINE
|
|
748
|
+
#undef MLK_MUST_CHECK_RETURN_VALUE
|
|
749
|
+
#undef MLK_NOINLINE
|
|
750
|
+
#undef MLK_RESTRICT
|
|
751
|
+
#undef MLK_STATIC_TESTABLE
|
|
752
|
+
#undef MLK_SYSV_ABI
|
|
753
|
+
#undef MLK_SYSV_ABI_SUPPORTED
|
|
754
|
+
#undef MLK_SYS_AARCH64
|
|
755
|
+
#undef MLK_SYS_AARCH64_EB
|
|
756
|
+
#undef MLK_SYS_AARCH64_NEON
|
|
757
|
+
#undef MLK_SYS_APPLE
|
|
758
|
+
#undef MLK_SYS_ARMV81M_MVE
|
|
759
|
+
#undef MLK_SYS_BIG_ENDIAN
|
|
760
|
+
#undef MLK_SYS_H
|
|
761
|
+
#undef MLK_SYS_LINUX
|
|
762
|
+
#undef MLK_SYS_LITTLE_ENDIAN
|
|
763
|
+
#undef MLK_SYS_PPC64LE
|
|
764
|
+
#undef MLK_SYS_PPC64LE_POWER8_VECTOR
|
|
765
|
+
#undef MLK_SYS_RISCV32
|
|
766
|
+
#undef MLK_SYS_RISCV64
|
|
767
|
+
#undef MLK_SYS_RISCV64_RVV
|
|
768
|
+
#undef MLK_SYS_WINDOWS
|
|
769
|
+
#undef MLK_SYS_X86_64
|
|
770
|
+
#undef MLK_SYS_X86_64_AVX2
|
|
771
|
+
#undef MLK_SYS_X86_64_AVX512
|
|
716
772
|
#endif /* !MLK_CONFIG_MONOBUILD_KEEP_SHARED_HEADERS */
|
|
@@ -160,16 +160,55 @@
|
|
|
160
160
|
*/
|
|
161
161
|
/* #define MLK_CONFIG_CONSTANTS_ONLY */
|
|
162
162
|
|
|
163
|
+
/**
|
|
164
|
+
* MLK_CONFIG_KEYGEN_PCT
|
|
165
|
+
*
|
|
166
|
+
* Compliance with @[FIPS140_3_IG, p.87] requires a Pairwise Consistency
|
|
167
|
+
* Test (PCT) to be carried out on a freshly generated keypair before it
|
|
168
|
+
* can be exported.
|
|
169
|
+
*
|
|
170
|
+
* Set this option if such a check should be implemented. In this case,
|
|
171
|
+
* keypair_derand and keypair will return
|
|
172
|
+
* MLK_ERR_PCT_FAIL if the PCT failed.
|
|
173
|
+
*
|
|
174
|
+
* @note This feature will drastically lower the performance of key
|
|
175
|
+
* generation.
|
|
176
|
+
*/
|
|
177
|
+
/* #define MLK_CONFIG_KEYGEN_PCT */
|
|
178
|
+
|
|
179
|
+
/**
|
|
180
|
+
* MLK_CONFIG_CONTEXT_PARAMETER
|
|
181
|
+
*
|
|
182
|
+
* Set this to add a context parameter that is provided to public API
|
|
183
|
+
* functions and is then available in custom callbacks.
|
|
184
|
+
*
|
|
185
|
+
* The type of the context parameter is configured via
|
|
186
|
+
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
187
|
+
*
|
|
188
|
+
* The context is passed to MLK_CUSTOM_ALLOC and MLK_CUSTOM_FREE; see
|
|
189
|
+
* MLK_CONFIG_CUSTOM_ALLOC_FREE.
|
|
190
|
+
*/
|
|
191
|
+
/* #define MLK_CONFIG_CONTEXT_PARAMETER */
|
|
192
|
+
|
|
193
|
+
/**
|
|
194
|
+
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE
|
|
195
|
+
*
|
|
196
|
+
* Set this to define the type for the context parameter used by
|
|
197
|
+
* MLK_CONFIG_CONTEXT_PARAMETER.
|
|
198
|
+
*
|
|
199
|
+
* This is only relevant if MLK_CONFIG_CONTEXT_PARAMETER is set.
|
|
200
|
+
*/
|
|
201
|
+
/* #define MLK_CONFIG_CONTEXT_PARAMETER_TYPE void* */
|
|
202
|
+
|
|
163
203
|
/******************************************************************************
|
|
164
204
|
*
|
|
165
205
|
* Build-only configuration options
|
|
166
206
|
*
|
|
167
|
-
* The remaining configurations
|
|
168
|
-
*
|
|
207
|
+
* The remaining configurations only affect the build, not the API
|
|
208
|
+
* described in mlkem_native.h.
|
|
169
209
|
*
|
|
170
210
|
*****************************************************************************/
|
|
171
211
|
|
|
172
|
-
#if defined(MLK_BUILD_INTERNAL)
|
|
173
212
|
/**
|
|
174
213
|
* MLK_CONFIG_MULTILEVEL_WITH_SHARED
|
|
175
214
|
*
|
|
@@ -426,6 +465,8 @@
|
|
|
426
465
|
* must use this option.
|
|
427
466
|
*/
|
|
428
467
|
/* #define MLK_CONFIG_CUSTOM_CAPABILITY_FUNC
|
|
468
|
+
#if !defined(__ASSEMBLER__)
|
|
469
|
+
#include "src/sys.h"
|
|
429
470
|
static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap)
|
|
430
471
|
__contract__(
|
|
431
472
|
ensures(return_value == 0 || return_value == 1)
|
|
@@ -433,10 +474,11 @@
|
|
|
433
474
|
{
|
|
434
475
|
... your implementation ...
|
|
435
476
|
}
|
|
477
|
+
#endif
|
|
436
478
|
*/
|
|
437
479
|
|
|
438
480
|
/**
|
|
439
|
-
* MLK_CONFIG_CUSTOM_ALLOC_FREE
|
|
481
|
+
* MLK_CONFIG_CUSTOM_ALLOC_FREE
|
|
440
482
|
*
|
|
441
483
|
* Set this option and define `MLK_CUSTOM_ALLOC` and `MLK_CUSTOM_FREE` if
|
|
442
484
|
* you want to use custom allocation for large local structures or buffers.
|
|
@@ -454,9 +496,10 @@
|
|
|
454
496
|
* - T: Type of structure to be freed.
|
|
455
497
|
* - N: Number of elements to be freed.
|
|
456
498
|
*
|
|
457
|
-
*
|
|
458
|
-
*
|
|
459
|
-
*
|
|
499
|
+
* If MLK_CONFIG_CONTEXT_PARAMETER is set, both macros receive the
|
|
500
|
+
* context as a fourth parameter, e.g. MLK_CUSTOM_ALLOC(v, T, N, context):
|
|
501
|
+
* - context: The context passed to the public API function, of type
|
|
502
|
+
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
460
503
|
*
|
|
461
504
|
* @note Even if this option is set, some allocations further down the call
|
|
462
505
|
* stack will still be made from the stack, consuming up to 3KB of
|
|
@@ -575,22 +618,6 @@
|
|
|
575
618
|
*/
|
|
576
619
|
/* #define MLK_CONFIG_NO_ASM_VALUE_BARRIER */
|
|
577
620
|
|
|
578
|
-
/**
|
|
579
|
-
* MLK_CONFIG_KEYGEN_PCT
|
|
580
|
-
*
|
|
581
|
-
* Compliance with @[FIPS140_3_IG, p.87] requires a Pairwise Consistency
|
|
582
|
-
* Test (PCT) to be carried out on a freshly generated keypair before it
|
|
583
|
-
* can be exported.
|
|
584
|
-
*
|
|
585
|
-
* Set this option if such a check should be implemented. In this case,
|
|
586
|
-
* keypair_derand and keypair will return
|
|
587
|
-
* MLK_ERR_PCT_FAIL if the PCT failed.
|
|
588
|
-
*
|
|
589
|
-
* @note This feature will drastically lower the performance of key
|
|
590
|
-
* generation.
|
|
591
|
-
*/
|
|
592
|
-
/* #define MLK_CONFIG_KEYGEN_PCT */
|
|
593
|
-
|
|
594
621
|
/**
|
|
595
622
|
* MLK_CONFIG_KEYGEN_PCT_BREAKAGE_TEST
|
|
596
623
|
*
|
|
@@ -631,31 +658,8 @@
|
|
|
631
658
|
*/
|
|
632
659
|
/* #define MLK_CONFIG_SERIAL_FIPS202_ONLY */
|
|
633
660
|
|
|
634
|
-
/**
|
|
635
|
-
* MLK_CONFIG_CONTEXT_PARAMETER
|
|
636
|
-
*
|
|
637
|
-
* Set this to add a context parameter that is provided to public API
|
|
638
|
-
* functions and is then available in custom callbacks.
|
|
639
|
-
*
|
|
640
|
-
* The type of the context parameter is configured via
|
|
641
|
-
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
642
|
-
*/
|
|
643
|
-
/* #define MLK_CONFIG_CONTEXT_PARAMETER */
|
|
644
|
-
|
|
645
|
-
/**
|
|
646
|
-
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE
|
|
647
|
-
*
|
|
648
|
-
* Set this to define the type for the context parameter used by
|
|
649
|
-
* MLK_CONFIG_CONTEXT_PARAMETER.
|
|
650
|
-
*
|
|
651
|
-
* This is only relevant if MLK_CONFIG_CONTEXT_PARAMETER is set.
|
|
652
|
-
*/
|
|
653
|
-
/* #define MLK_CONFIG_CONTEXT_PARAMETER_TYPE void* */
|
|
654
|
-
|
|
655
661
|
/************************* Config internals ********************************/
|
|
656
662
|
|
|
657
|
-
#endif /* MLK_BUILD_INTERNAL */
|
|
658
|
-
|
|
659
663
|
/* Default namespace
|
|
660
664
|
*
|
|
661
665
|
* Don't change this. If you need a different namespace, re-define
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mlkem-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
#ifndef MLK_CAPABILITY_H
|
|
6
|
+
#define MLK_CAPABILITY_H
|
|
7
|
+
|
|
8
|
+
#include "sys.h"
|
|
9
|
+
|
|
10
|
+
#if !defined(MLK_CONFIG_CUSTOM_CAPABILITY_FUNC) && !defined(__ASSEMBLER__)
|
|
11
|
+
#include "cbmc.h"
|
|
12
|
+
|
|
13
|
+
MLK_MUST_CHECK_RETURN_VALUE
|
|
14
|
+
static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap)
|
|
15
|
+
__contract__(
|
|
16
|
+
ensures(return_value == 0 || return_value == 1)
|
|
17
|
+
)
|
|
18
|
+
{
|
|
19
|
+
/* By default, we rely on compile-time feature detection/specification:
|
|
20
|
+
* If a feature is enabled at compile-time, we assume it is supported by
|
|
21
|
+
* the host that the resulting library/binary will be built on.
|
|
22
|
+
* If this assumption is not true, you MUST overwrite this function.
|
|
23
|
+
* See the documentation of MLK_CONFIG_CUSTOM_CAPABILITY_FUNC in
|
|
24
|
+
* mlkem_native_config.h for more information. */
|
|
25
|
+
(void)cap;
|
|
26
|
+
return 1;
|
|
27
|
+
}
|
|
28
|
+
#endif /* !MLK_CONFIG_CUSTOM_CAPABILITY_FUNC && !__ASSEMBLER__ */
|
|
29
|
+
|
|
30
|
+
#endif /* !MLK_CAPABILITY_H */
|