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