pq_crypto 0.6.4 → 0.6.6
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 +180 -0
- data/README.md +7 -0
- data/ext/pqcrypto/extconf.rb +4 -1
- data/ext/pqcrypto/pq_externalmu.c +35 -0
- data/ext/pqcrypto/pqcrypto_native_api.h +85 -75
- data/ext/pqcrypto/pqcrypto_ruby_secure.c +16 -9
- data/ext/pqcrypto/pqcrypto_secure.c +43 -33
- data/ext/pqcrypto/pqcrypto_secure.h +52 -47
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +7 -7
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +5 -2
- data/ext/pqcrypto/vendor/mldsa-native/LICENSE +21 -2
- data/ext/pqcrypto/vendor/mldsa-native/README.md +20 -7
- data/ext/pqcrypto/vendor/mldsa-native/RELEASE.md +160 -0
- data/ext/pqcrypto/vendor/mldsa-native/SECURITY.md +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/README.md +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +85 -59
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +292 -348
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +122 -76
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +184 -86
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +49 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +49 -81
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h +152 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h +25 -12
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +2 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.h +2 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202x4.c +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/keccakf1600.c +9 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/auto.h +19 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +7 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +7 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +12 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +12 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x1_v84a.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x2_v84a.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_scalar.h +6 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/api.h +11 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +9 -22
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +8 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/{state_extract_bytes_x4_mve.S → keccak_f1600_x4_state_extract_bytes_mve.S} +14 -14
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/{state_xor_bytes_x4_mve.S → keccak_f1600_x4_state_xor_bytes_mve.S} +12 -12
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +5 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +2 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +36 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +62 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +87 -54
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{intt_aarch64_asm.S → mldsa_intt_aarch64_asm.S} +39 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{ntt_aarch64_asm.S → mldsa_ntt_aarch64_asm.S} +39 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{pointwise_montgomery_aarch64_asm.S → mldsa_pointwise_montgomery_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_caddq_aarch64_asm.S → mldsa_poly_caddq_aarch64_asm.S} +19 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_chknorm_aarch64_asm.S → mldsa_poly_chknorm_aarch64_asm.S} +24 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_decompose_32_aarch64_asm.S → mldsa_poly_decompose_32_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_decompose_88_aarch64_asm.S → mldsa_poly_decompose_88_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_use_hint_32_aarch64_asm.S → mldsa_poly_use_hint_32_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{poly_use_hint_88_aarch64_asm.S → mldsa_poly_use_hint_88_aarch64_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{mld_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S → mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{polyz_unpack_17_aarch64_asm.S → mldsa_polyz_unpack_17_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{polyz_unpack_19_aarch64_asm.S → mldsa_polyz_unpack_19_aarch64_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_aarch64_asm.S → mldsa_rej_uniform_aarch64_asm.S} +48 -15
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_eta2_aarch64_asm.S → mldsa_rej_uniform_eta2_aarch64_asm.S} +42 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/{rej_uniform_eta4_aarch64_asm.S → mldsa_rej_uniform_eta4_aarch64_asm.S} +42 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +11 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +3 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +28 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +171 -49
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{intt_avx2_asm.S → mldsa_intt_avx2_asm.S} +23 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{ntt_avx2_asm.S → mldsa_ntt_avx2_asm.S} +23 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{nttunpack_avx2_asm.S → mldsa_nttunpack_avx2_asm.S} +17 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l4_avx2_asm.S → mldsa_pointwise_acc_l4_avx2_asm.S} +37 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l5_avx2_asm.S → mldsa_pointwise_acc_l5_avx2_asm.S} +37 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_acc_l7_avx2_asm.S → mldsa_pointwise_acc_l7_avx2_asm.S} +37 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{pointwise_avx2_asm.S → mldsa_pointwise_avx2_asm.S} +31 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/{poly_caddq_avx2_asm.S → mldsa_poly_caddq_avx2_asm.S} +18 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +176 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +490 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +489 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +123 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +125 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +355 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +355 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +132 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +205 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +176 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +27 -36
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +42 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +93 -17
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +74 -15
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +97 -11
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +7 -38
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +49 -7
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +16 -17
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +26 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +3 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +18 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +15 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/rounding.h +28 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +311 -246
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +245 -240
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +64 -5
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +5 -2
- data/ext/pqcrypto/vendor/mlkem-native/LICENSE +21 -3
- data/ext/pqcrypto/vendor/mlkem-native/README.md +4 -6
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +211 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/README.md +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +25 -34
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +79 -142
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +62 -71
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +77 -39
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/cbmc.h +25 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +48 -34
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +25 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +14 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/context.h +51 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +8 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/auto.h +20 -12
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +5 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +5 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +10 -7
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +10 -7
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_scalar.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x1_v84a.h +3 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x2_v84a.h +3 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h +6 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +3 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/api.h +11 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/mve.h +8 -22
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +8 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/{state_extract_bytes_x4_mve.S → keccak_f1600_x4_state_extract_bytes_mve.S} +14 -14
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/{state_xor_bytes_x4_mve.S → keccak_f1600_x4_state_xor_bytes_mve.S} +12 -12
- 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/keccak_f1600_x4_avx2_asm.S +36 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +22 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.h +20 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +39 -11
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +64 -15
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +44 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c +2 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +11 -10
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{intt_aarch64_asm.S → mlkem_intt_aarch64_asm.S} +16 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{ntt_aarch64_asm.S → mlkem_ntt_aarch64_asm.S} +10 -7
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_mulcache_compute_aarch64_asm.S → mlkem_poly_mulcache_compute_aarch64_asm.S} +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_reduce_aarch64_asm.S → mlkem_poly_reduce_aarch64_asm.S} +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tobytes_aarch64_asm.S → mlkem_poly_tobytes_aarch64_asm.S} +12 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{poly_tomont_aarch64_asm.S → mlkem_poly_tomont_aarch64_asm.S} +11 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S} +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S} +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S} +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/{rej_uniform_aarch64_asm.S → mlkem_rej_uniform_aarch64_asm.S} +17 -17
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +21 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{intt_ppc_asm.S → mlkem_intt_ppc_asm.S} +29 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{ntt_ppc_asm.S → mlkem_ntt_ppc_asm.S} +22 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{poly_tomont_ppc_asm.S → mlkem_poly_tomont_ppc_asm.S} +25 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/{reduce_ppc_asm.S → mlkem_reduce_ppc_asm.S} +22 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +6 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/meta.h +45 -25
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +20 -20
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.c +14 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{intt_avx2_asm.S → mlkem_intt_avx2_asm.S} +27 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntt_avx2_asm.S → mlkem_ntt_avx2_asm.S} +23 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttfrombytes_avx2_asm.S → mlkem_nttfrombytes_avx2_asm.S} +27 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{ntttobytes_avx2_asm.S → mlkem_ntttobytes_avx2_asm.S} +27 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{nttunpack_avx2_asm.S → mlkem_nttunpack_avx2_asm.S} +17 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d10_avx2_asm.S → mlkem_poly_compress_d10_avx2_asm.S} +34 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d11_avx2_asm.S → mlkem_poly_compress_d11_avx2_asm.S} +33 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d4_avx2_asm.S → mlkem_poly_compress_d4_avx2_asm.S} +34 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_compress_d5_avx2_asm.S → mlkem_poly_compress_d5_avx2_asm.S} +33 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d10_avx2_asm.S → mlkem_poly_decompress_d10_avx2_asm.S} +32 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d11_avx2_asm.S → mlkem_poly_decompress_d11_avx2_asm.S} +32 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d4_avx2_asm.S → mlkem_poly_decompress_d4_avx2_asm.S} +32 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_decompress_d5_avx2_asm.S → mlkem_poly_decompress_d5_avx2_asm.S} +32 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{poly_mulcache_compute_avx2_asm.S → mlkem_poly_mulcache_compute_avx2_asm.S} +29 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S} +35 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S} +35 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S → mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S} +35 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{reduce_avx2_asm.S → mlkem_reduce_avx2_asm.S} +17 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{rej_uniform_avx2_asm.S → mlkem_rej_uniform_avx2_asm.S} +40 -7
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/{tomont_avx2_asm.S → mlkem_tomont_avx2_asm.S} +20 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c +7 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h +6 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +25 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +33 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.c +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sampling.h +4 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +21 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +11 -10
- data/lib/pq_crypto/version.rb +1 -1
- data/script/vendor_libs.rb +6 -6
- metadata +79 -79
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_chknorm_avx2.c +0 -52
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_32_avx2.c +0 -157
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_decompose_88_avx2.c +0 -157
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_32_avx2.c +0 -103
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/poly_use_hint_88_avx2.c +0 -105
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_17_avx2.c +0 -94
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/polyz_unpack_19_avx2.c +0 -96
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_avx2.c +0 -126
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta2_avx2.c +0 -157
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_eta4_avx2.c +0 -141
|
@@ -6,6 +6,12 @@
|
|
|
6
6
|
/* References
|
|
7
7
|
* ==========
|
|
8
8
|
*
|
|
9
|
+
* - [FIPS140_3_IG]
|
|
10
|
+
* Implementation Guidance for FIPS 140-3 and the Cryptographic Module
|
|
11
|
+
* Validation Program
|
|
12
|
+
* National Institute of Standards and Technology
|
|
13
|
+
* https://csrc.nist.gov/projects/cryptographic-module-validation-program/fips-140-3-ig-announcements
|
|
14
|
+
*
|
|
9
15
|
* - [FIPS203]
|
|
10
16
|
* FIPS 203 Module-Lattice-Based Key-Encapsulation Mechanism Standard
|
|
11
17
|
* National Institute of Standards and Technology
|
|
@@ -23,6 +29,11 @@
|
|
|
23
29
|
* Make sure the configuration file is in the include path
|
|
24
30
|
* (this is "mlkem_native_config.h" by default, or MLK_CONFIG_FILE if defined).
|
|
25
31
|
*
|
|
32
|
+
* # API conventions
|
|
33
|
+
*
|
|
34
|
+
* Conventions shared by all functions below (return values, pointer validity,
|
|
35
|
+
* output buffers on error) are documented in API-CONVENTIONS.md.
|
|
36
|
+
*
|
|
26
37
|
* # Multi-level builds
|
|
27
38
|
*
|
|
28
39
|
* This header specifies a build of mlkem-native for a fixed security level.
|
|
@@ -31,51 +42,15 @@
|
|
|
31
42
|
* MLK_CONFIG_PARAMETER_SET accordingly for each, and #undef'ing the MLK_H
|
|
32
43
|
* guard to allow multiple inclusions.
|
|
33
44
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
36
|
-
*
|
|
37
|
-
|
|
38
|
-
* including this header.
|
|
39
|
-
*
|
|
40
|
-
* This method of configuration is deprecated.
|
|
41
|
-
* It will be removed in mlkem-native-v2.
|
|
42
|
-
*
|
|
43
|
-
* - MLK_CONFIG_API_PARAMETER_SET [required]
|
|
44
|
-
*
|
|
45
|
-
* The parameter set used for the build; 512, 768, or 1024.
|
|
46
|
-
*
|
|
47
|
-
* - MLK_CONFIG_API_NAMESPACE_PREFIX [required]
|
|
48
|
-
*
|
|
49
|
-
* The namespace prefix used for the build.
|
|
50
|
-
*
|
|
51
|
-
* NOTE:
|
|
52
|
-
* For a multi-level build, you must include the 512/768/1024 suffixes
|
|
53
|
-
* in MLK_CONFIG_API_NAMESPACE_PREFIX.
|
|
54
|
-
*
|
|
55
|
-
* - MLK_CONFIG_API_NO_SUPERCOP [optional]
|
|
56
|
-
*
|
|
57
|
-
* By default, this header will also expose the mlkem-native API in the
|
|
58
|
-
* SUPERCOP naming convention crypto_kem_xxx. If you don't want/need this,
|
|
59
|
-
* set MLK_CONFIG_API_NO_SUPERCOP. You must set this for a multi-level build.
|
|
60
|
-
*
|
|
61
|
-
* - MLK_CONFIG_API_CONSTANTS_ONLY [optional]
|
|
62
|
-
*
|
|
63
|
-
* If you don't want this header to expose any function declarations,
|
|
64
|
-
* but only constants for the sizes of key material, set
|
|
65
|
-
* MLK_CONFIG_API_CONSTANTS_ONLY. In this case, you don't need to set
|
|
66
|
-
* MLK_CONFIG_API_PARAMETER_SET or MLK_CONFIG_API_NAMESPACE_PREFIX,
|
|
67
|
-
* nor include a configuration.
|
|
68
|
-
*
|
|
69
|
-
* - MLK_CONFIG_API_QUALIFIER [optional]
|
|
70
|
-
*
|
|
71
|
-
* Qualifier to apply to external API.
|
|
72
|
-
*
|
|
73
|
-
******************************************************************************/
|
|
45
|
+
* In this case, the configuration file must also set
|
|
46
|
+
* MLK_CONFIG_MULTILEVEL_BUILD. Without it, the parameter set is not appended
|
|
47
|
+
* to the namespace prefix and all inclusions declare the same symbol names.
|
|
48
|
+
*/
|
|
74
49
|
|
|
75
50
|
/******************************* Key sizes ************************************/
|
|
76
51
|
|
|
77
52
|
/* Sizes of cryptographic material, per parameter set */
|
|
78
|
-
/* See mlkem/
|
|
53
|
+
/* See mlkem/src/params.h for the arithmetic expressions giving rise to these */
|
|
79
54
|
/* check-magic: off */
|
|
80
55
|
#define MLKEM512_SECRETKEYBYTES 1632
|
|
81
56
|
#define MLKEM512_PUBLICKEYBYTES 800
|
|
@@ -111,28 +86,35 @@
|
|
|
111
86
|
|
|
112
87
|
/****************************** Error codes ***********************************/
|
|
113
88
|
|
|
114
|
-
/* Generic failure condition
|
|
89
|
+
/* Generic failure condition. Currently not returned by any function;
|
|
90
|
+
* reserved for failures that no more specific code covers. */
|
|
115
91
|
#define MLK_ERR_FAIL (-1)
|
|
116
92
|
/* An allocation failed. This can only happen if MLK_CONFIG_CUSTOM_ALLOC_FREE
|
|
117
93
|
* is defined and the provided MLK_CUSTOM_ALLOC can fail. */
|
|
118
94
|
#define MLK_ERR_OUT_OF_MEMORY (-2)
|
|
119
|
-
/* An
|
|
95
|
+
/* An RNG failure occurred. Might be due to insufficient entropy or
|
|
120
96
|
* system misconfiguration. */
|
|
121
97
|
#define MLK_ERR_RNG_FAIL (-3)
|
|
122
|
-
|
|
123
|
-
|
|
98
|
+
/* Public key validation failed: the @[FIPS203, Section 7.2, 'modulus check']
|
|
99
|
+
* found a coefficient outside [0,q-1]. Returned by check_pk and by the
|
|
100
|
+
* encapsulation API. */
|
|
101
|
+
#define MLK_ERR_INVALID_PK (-4)
|
|
102
|
+
/* Secret key validation failed: the @[FIPS203, Section 7.3, 'hash check']
|
|
103
|
+
* found the embedded public key hash inconsistent. Returned by check_sk and
|
|
104
|
+
* by the decapsulation API. */
|
|
105
|
+
#define MLK_ERR_INVALID_SK (-5)
|
|
106
|
+
/* The 'Pairwise Consistency Test' @[FIPS140_3_IG, p.87] and
|
|
107
|
+
* @[FIPS203, Section 7.1, Pairwise Consistency] failed. Only possible when
|
|
108
|
+
* MLK_CONFIG_KEYGEN_PCT is enabled; signals that the freshly generated key
|
|
109
|
+
* pair failed its encaps/decaps self-test. */
|
|
110
|
+
#define MLK_ERR_PCT_FAIL (-6)
|
|
111
|
+
|
|
112
|
+
/********************* Namespacing and Qualifiers *****************************/
|
|
124
113
|
|
|
125
114
|
#define MLK_API_CONCAT_(x, y) x##y
|
|
126
115
|
#define MLK_API_CONCAT(x, y) MLK_API_CONCAT_(x, y)
|
|
127
116
|
#define MLK_API_CONCAT_UNDERSCORE(x, y) MLK_API_CONCAT(MLK_API_CONCAT(x, _), y)
|
|
128
117
|
|
|
129
|
-
#if !defined(MLK_CONFIG_API_PARAMETER_SET)
|
|
130
|
-
/* Recommended configuration via same config file as used for the build. */
|
|
131
|
-
|
|
132
|
-
/* For now, we derive the legacy API configuration MLK_CONFIG_API_XXX from
|
|
133
|
-
* the config file. In mlkem-native-v2, this will be removed and we will
|
|
134
|
-
* exclusively work with MLK_CONFIG_XXX. */
|
|
135
|
-
|
|
136
118
|
/* You need to make sure the config file is in the include path. */
|
|
137
119
|
#if defined(MLK_CONFIG_FILE)
|
|
138
120
|
#include MLK_CONFIG_FILE
|
|
@@ -140,35 +122,17 @@
|
|
|
140
122
|
#include "mlkem_native_config.h"
|
|
141
123
|
#endif
|
|
142
124
|
|
|
143
|
-
|
|
144
|
-
|
|
125
|
+
/* Namespace prefix for the public API symbols. For multi-level builds, the
|
|
126
|
+
* parameter set is appended to disambiguate the security levels. */
|
|
145
127
|
#if defined(MLK_CONFIG_MULTILEVEL_BUILD)
|
|
146
|
-
#define
|
|
128
|
+
#define MLK_API_NAMESPACE_PREFIX \
|
|
147
129
|
MLK_API_CONCAT(MLK_CONFIG_NAMESPACE_PREFIX, MLK_CONFIG_PARAMETER_SET)
|
|
148
130
|
#else
|
|
149
|
-
#define
|
|
150
|
-
#endif
|
|
151
|
-
|
|
152
|
-
#if defined(MLK_CONFIG_NO_SUPERCOP)
|
|
153
|
-
#define MLK_CONFIG_API_NO_SUPERCOP
|
|
154
|
-
#endif
|
|
155
|
-
|
|
156
|
-
#if defined(MLK_CONFIG_CONSTANTS_ONLY)
|
|
157
|
-
#define MLK_CONFIG_API_CONSTANTS_ONLY
|
|
131
|
+
#define MLK_API_NAMESPACE_PREFIX MLK_CONFIG_NAMESPACE_PREFIX
|
|
158
132
|
#endif
|
|
159
133
|
|
|
160
|
-
#if defined(MLK_CONFIG_EXTERNAL_API_QUALIFIER)
|
|
161
|
-
#define MLK_CONFIG_API_QUALIFIER MLK_CONFIG_EXTERNAL_API_QUALIFIER
|
|
162
|
-
#endif
|
|
163
|
-
|
|
164
|
-
#else /* !MLK_CONFIG_API_PARAMETER_SET */
|
|
165
|
-
|
|
166
|
-
#define MLK_API_LEGACY_CONFIG
|
|
167
|
-
|
|
168
|
-
#endif /* MLK_CONFIG_API_PARAMETER_SET */
|
|
169
|
-
|
|
170
134
|
#define MLK_API_NAMESPACE(sym) \
|
|
171
|
-
MLK_API_CONCAT_UNDERSCORE(
|
|
135
|
+
MLK_API_CONCAT_UNDERSCORE(MLK_API_NAMESPACE_PREFIX, sym)
|
|
172
136
|
|
|
173
137
|
#if defined(__GNUC__) || defined(__clang__)
|
|
174
138
|
#define MLK_API_MUST_CHECK_RETURN_VALUE __attribute__((warn_unused_result))
|
|
@@ -176,13 +140,15 @@
|
|
|
176
140
|
#define MLK_API_MUST_CHECK_RETURN_VALUE
|
|
177
141
|
#endif
|
|
178
142
|
|
|
179
|
-
#if defined(
|
|
180
|
-
#define MLK_API_QUALIFIER
|
|
143
|
+
#if defined(MLK_CONFIG_EXTERNAL_API_QUALIFIER)
|
|
144
|
+
#define MLK_API_QUALIFIER MLK_CONFIG_EXTERNAL_API_QUALIFIER
|
|
181
145
|
#else
|
|
182
146
|
#define MLK_API_QUALIFIER
|
|
183
147
|
#endif
|
|
184
148
|
|
|
185
|
-
|
|
149
|
+
/****************************** Function API **********************************/
|
|
150
|
+
|
|
151
|
+
#if !defined(MLK_CONFIG_CONSTANTS_ONLY)
|
|
186
152
|
|
|
187
153
|
#include <stdint.h>
|
|
188
154
|
|
|
@@ -191,6 +157,7 @@ extern "C"
|
|
|
191
157
|
{
|
|
192
158
|
#endif
|
|
193
159
|
|
|
160
|
+
#if !defined(MLK_CONFIG_NO_KEYPAIR_API)
|
|
194
161
|
/**
|
|
195
162
|
* Generate a public/private keypair for the ML-KEM key encapsulation mechanism.
|
|
196
163
|
*
|
|
@@ -207,15 +174,17 @@ extern "C"
|
|
|
207
174
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
208
175
|
*
|
|
209
176
|
* @retval 0 Success.
|
|
210
|
-
* @retval
|
|
177
|
+
* @retval MLK_ERR_PCT_FAIL MLK_CONFIG_KEYGEN_PCT enabled and PCT failed.
|
|
211
178
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
212
179
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
180
|
+
* @retval MLK_ERR_RNG_FAIL MLK_CONFIG_KEYGEN_PCT enabled and random
|
|
181
|
+
* number generation failed within the PCT.
|
|
213
182
|
*/
|
|
214
183
|
MLK_API_QUALIFIER
|
|
215
184
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
216
185
|
int MLK_API_NAMESPACE(keypair_derand)(
|
|
217
|
-
uint8_t pk[MLKEM_PUBLICKEYBYTES(
|
|
218
|
-
uint8_t sk[MLKEM_SECRETKEYBYTES(
|
|
186
|
+
uint8_t pk[MLKEM_PUBLICKEYBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
187
|
+
uint8_t sk[MLKEM_SECRETKEYBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
219
188
|
const uint8_t coins[2 * MLKEM_SYMBYTES]
|
|
220
189
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
221
190
|
,
|
|
@@ -239,7 +208,7 @@ int MLK_API_NAMESPACE(keypair_derand)(
|
|
|
239
208
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
240
209
|
*
|
|
241
210
|
* @retval 0 Success.
|
|
242
|
-
* @retval
|
|
211
|
+
* @retval MLK_ERR_PCT_FAIL MLK_CONFIG_KEYGEN_PCT enabled and PCT failed.
|
|
243
212
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
244
213
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
245
214
|
* @retval MLK_ERR_RNG_FAIL Random number generation failed.
|
|
@@ -247,15 +216,17 @@ int MLK_API_NAMESPACE(keypair_derand)(
|
|
|
247
216
|
MLK_API_QUALIFIER
|
|
248
217
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
249
218
|
int MLK_API_NAMESPACE(keypair)(
|
|
250
|
-
uint8_t pk[MLKEM_PUBLICKEYBYTES(
|
|
251
|
-
uint8_t sk[MLKEM_SECRETKEYBYTES(
|
|
219
|
+
uint8_t pk[MLKEM_PUBLICKEYBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
220
|
+
uint8_t sk[MLKEM_SECRETKEYBYTES(MLK_CONFIG_PARAMETER_SET)]
|
|
252
221
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
253
222
|
,
|
|
254
223
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context
|
|
255
224
|
#endif
|
|
256
225
|
);
|
|
257
226
|
#endif /* !MLK_CONFIG_NO_RANDOMIZED_API */
|
|
227
|
+
#endif /* !MLK_CONFIG_NO_KEYPAIR_API */
|
|
258
228
|
|
|
229
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API)
|
|
259
230
|
/**
|
|
260
231
|
* Generate ciphertext and shared secret for a given public key.
|
|
261
232
|
*
|
|
@@ -272,7 +243,7 @@ int MLK_API_NAMESPACE(keypair)(
|
|
|
272
243
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
273
244
|
*
|
|
274
245
|
* @retval 0 Success.
|
|
275
|
-
* @retval
|
|
246
|
+
* @retval MLK_ERR_INVALID_PK The 'modulus check' @[FIPS203, Section 7.2]
|
|
276
247
|
* for the public key failed.
|
|
277
248
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
278
249
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
@@ -280,9 +251,9 @@ int MLK_API_NAMESPACE(keypair)(
|
|
|
280
251
|
MLK_API_QUALIFIER
|
|
281
252
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
282
253
|
int MLK_API_NAMESPACE(enc_derand)(
|
|
283
|
-
uint8_t ct[MLKEM_CIPHERTEXTBYTES(
|
|
254
|
+
uint8_t ct[MLKEM_CIPHERTEXTBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
284
255
|
uint8_t ss[MLKEM_BYTES],
|
|
285
|
-
const uint8_t pk[MLKEM_PUBLICKEYBYTES(
|
|
256
|
+
const uint8_t pk[MLKEM_PUBLICKEYBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
286
257
|
const uint8_t coins[MLKEM_SYMBYTES]
|
|
287
258
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
288
259
|
,
|
|
@@ -306,7 +277,7 @@ int MLK_API_NAMESPACE(enc_derand)(
|
|
|
306
277
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
307
278
|
*
|
|
308
279
|
* @retval 0 Success.
|
|
309
|
-
* @retval
|
|
280
|
+
* @retval MLK_ERR_INVALID_PK The 'modulus check' @[FIPS203, Section 7.2]
|
|
310
281
|
* for the public key failed.
|
|
311
282
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
312
283
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
@@ -315,16 +286,18 @@ int MLK_API_NAMESPACE(enc_derand)(
|
|
|
315
286
|
MLK_API_QUALIFIER
|
|
316
287
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
317
288
|
int MLK_API_NAMESPACE(enc)(
|
|
318
|
-
uint8_t ct[MLKEM_CIPHERTEXTBYTES(
|
|
289
|
+
uint8_t ct[MLKEM_CIPHERTEXTBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
319
290
|
uint8_t ss[MLKEM_BYTES],
|
|
320
|
-
const uint8_t pk[MLKEM_PUBLICKEYBYTES(
|
|
291
|
+
const uint8_t pk[MLKEM_PUBLICKEYBYTES(MLK_CONFIG_PARAMETER_SET)]
|
|
321
292
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
322
293
|
,
|
|
323
294
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context
|
|
324
295
|
#endif
|
|
325
296
|
);
|
|
326
297
|
#endif /* !MLK_CONFIG_NO_RANDOMIZED_API */
|
|
298
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API */
|
|
327
299
|
|
|
300
|
+
#if !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
328
301
|
/**
|
|
329
302
|
* Generate shared secret for a given ciphertext and private key.
|
|
330
303
|
*
|
|
@@ -340,7 +313,7 @@ int MLK_API_NAMESPACE(enc)(
|
|
|
340
313
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
341
314
|
*
|
|
342
315
|
* @retval 0 Success.
|
|
343
|
-
* @retval
|
|
316
|
+
* @retval MLK_ERR_INVALID_SK The 'hash check' @[FIPS203, Section 7.3]
|
|
344
317
|
* for the secret key failed.
|
|
345
318
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
346
319
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
@@ -349,13 +322,14 @@ MLK_API_QUALIFIER
|
|
|
349
322
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
350
323
|
int MLK_API_NAMESPACE(dec)(
|
|
351
324
|
uint8_t ss[MLKEM_BYTES],
|
|
352
|
-
const uint8_t ct[MLKEM_CIPHERTEXTBYTES(
|
|
353
|
-
const uint8_t sk[MLKEM_SECRETKEYBYTES(
|
|
325
|
+
const uint8_t ct[MLKEM_CIPHERTEXTBYTES(MLK_CONFIG_PARAMETER_SET)],
|
|
326
|
+
const uint8_t sk[MLKEM_SECRETKEYBYTES(MLK_CONFIG_PARAMETER_SET)]
|
|
354
327
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
355
328
|
,
|
|
356
329
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context
|
|
357
330
|
#endif
|
|
358
331
|
);
|
|
332
|
+
#endif /* !MLK_CONFIG_NO_DECAPS_API */
|
|
359
333
|
|
|
360
334
|
|
|
361
335
|
/**
|
|
@@ -371,19 +345,21 @@ int MLK_API_NAMESPACE(dec)(
|
|
|
371
345
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
372
346
|
*
|
|
373
347
|
* @retval 0 Success.
|
|
374
|
-
* @retval
|
|
348
|
+
* @retval MLK_ERR_INVALID_PK Modulus check failed.
|
|
375
349
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
376
350
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
377
351
|
*/
|
|
352
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API)
|
|
378
353
|
MLK_API_QUALIFIER
|
|
379
354
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
380
355
|
int MLK_API_NAMESPACE(check_pk)(
|
|
381
|
-
const uint8_t pk[MLKEM_PUBLICKEYBYTES(
|
|
356
|
+
const uint8_t pk[MLKEM_PUBLICKEYBYTES(MLK_CONFIG_PARAMETER_SET)]
|
|
382
357
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
383
358
|
,
|
|
384
359
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context
|
|
385
360
|
#endif
|
|
386
361
|
);
|
|
362
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API */
|
|
387
363
|
|
|
388
364
|
/**
|
|
389
365
|
* Implements public key hash check mandated by FIPS 203, i.e., ensures that
|
|
@@ -398,64 +374,29 @@ int MLK_API_NAMESPACE(check_pk)(
|
|
|
398
374
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
399
375
|
*
|
|
400
376
|
* @retval 0 Success.
|
|
401
|
-
* @retval
|
|
377
|
+
* @retval MLK_ERR_INVALID_SK Public key hash check failed.
|
|
402
378
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
403
379
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
404
380
|
*/
|
|
381
|
+
#if !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
405
382
|
MLK_API_QUALIFIER
|
|
406
383
|
MLK_API_MUST_CHECK_RETURN_VALUE
|
|
407
384
|
int MLK_API_NAMESPACE(check_sk)(
|
|
408
|
-
const uint8_t sk[MLKEM_SECRETKEYBYTES(
|
|
385
|
+
const uint8_t sk[MLKEM_SECRETKEYBYTES(MLK_CONFIG_PARAMETER_SET)]
|
|
409
386
|
#ifdef MLK_CONFIG_CONTEXT_PARAMETER
|
|
410
387
|
,
|
|
411
388
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context
|
|
412
389
|
#endif
|
|
413
390
|
);
|
|
391
|
+
#endif /* !MLK_CONFIG_NO_DECAPS_API */
|
|
414
392
|
|
|
415
393
|
#ifdef __cplusplus
|
|
416
394
|
}
|
|
417
395
|
#endif
|
|
418
396
|
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
#
|
|
422
|
-
/* Export API in SUPERCOP naming scheme CRYPTO_xxx / crypto_kem_xxx */
|
|
423
|
-
#define CRYPTO_SECRETKEYBYTES MLKEM_SECRETKEYBYTES(MLK_CONFIG_API_PARAMETER_SET)
|
|
424
|
-
#define CRYPTO_PUBLICKEYBYTES MLKEM_PUBLICKEYBYTES(MLK_CONFIG_API_PARAMETER_SET)
|
|
425
|
-
#define CRYPTO_CIPHERTEXTBYTES \
|
|
426
|
-
MLKEM_CIPHERTEXTBYTES(MLK_CONFIG_API_PARAMETER_SET)
|
|
427
|
-
#define CRYPTO_SYMBYTES MLKEM_SYMBYTES
|
|
428
|
-
#define CRYPTO_BYTES MLKEM_BYTES
|
|
429
|
-
|
|
430
|
-
#define crypto_kem_keypair_derand MLK_API_NAMESPACE(keypair_derand)
|
|
431
|
-
#define crypto_kem_keypair MLK_API_NAMESPACE(keypair)
|
|
432
|
-
#define crypto_kem_enc_derand MLK_API_NAMESPACE(enc_derand)
|
|
433
|
-
#define crypto_kem_enc MLK_API_NAMESPACE(enc)
|
|
434
|
-
#define crypto_kem_dec MLK_API_NAMESPACE(dec)
|
|
435
|
-
#define crypto_kem_check_pk MLK_API_NAMESPACE(check_pk)
|
|
436
|
-
#define crypto_kem_check_sk MLK_API_NAMESPACE(check_sk)
|
|
437
|
-
|
|
438
|
-
#else /* !MLK_CONFIG_API_NO_SUPERCOP */
|
|
439
|
-
|
|
440
|
-
/* If the SUPERCOP API is not needed, we can undefine the various helper macros
|
|
441
|
-
* above. Otherwise, they are needed for lazy evaluation of crypto_kem_xxx. */
|
|
442
|
-
#if !defined(MLK_API_LEGACY_CONFIG)
|
|
443
|
-
#undef MLK_CONFIG_API_PARAMETER_SET
|
|
444
|
-
#undef MLK_CONFIG_API_NAMESPACE_PREFIX
|
|
445
|
-
#undef MLK_CONFIG_API_NO_SUPERCOP
|
|
446
|
-
#undef MLK_CONFIG_API_CONSTANTS_ONLY
|
|
447
|
-
#undef MLK_CONFIG_API_QUALIFIER
|
|
448
|
-
#endif /* !MLK_API_LEGACY_CONFIG */
|
|
449
|
-
|
|
450
|
-
#undef MLK_API_CONCAT
|
|
451
|
-
#undef MLK_API_CONCAT_
|
|
452
|
-
#undef MLK_API_CONCAT_UNDERSCORE
|
|
453
|
-
#undef MLK_API_NAMESPACE
|
|
454
|
-
#undef MLK_API_MUST_CHECK_RETURN_VALUE
|
|
455
|
-
#undef MLK_API_QUALIFIER
|
|
456
|
-
|
|
457
|
-
#endif /* MLK_CONFIG_API_NO_SUPERCOP */
|
|
458
|
-
#endif /* !MLK_CONFIG_API_CONSTANTS_ONLY */
|
|
397
|
+
#undef MLK_API_NAMESPACE_PREFIX
|
|
398
|
+
|
|
399
|
+
#endif /* !MLK_CONFIG_CONSTANTS_ONLY */
|
|
459
400
|
|
|
460
401
|
|
|
461
402
|
/***************************** Memory Usage **********************************/
|
|
@@ -492,10 +433,8 @@ int MLK_API_NAMESPACE(check_sk)(
|
|
|
492
433
|
|
|
493
434
|
/*
|
|
494
435
|
* MLK_TOTAL_ALLOC_*_KEYPAIR adapts based on MLK_CONFIG_KEYGEN_PCT.
|
|
495
|
-
* For legacy config, we don't know which options are used, so assume
|
|
496
|
-
* the worst case (PCT enabled).
|
|
497
436
|
*/
|
|
498
|
-
#if defined(
|
|
437
|
+
#if defined(MLK_CONFIG_KEYGEN_PCT)
|
|
499
438
|
#define MLK_TOTAL_ALLOC_512_KEYPAIR MLK_TOTAL_ALLOC_512_KEYPAIR_PCT
|
|
500
439
|
#define MLK_TOTAL_ALLOC_768_KEYPAIR MLK_TOTAL_ALLOC_768_KEYPAIR_PCT
|
|
501
440
|
#define MLK_TOTAL_ALLOC_1024_KEYPAIR MLK_TOTAL_ALLOC_1024_KEYPAIR_PCT
|
|
@@ -522,6 +461,4 @@ int MLK_API_NAMESPACE(check_sk)(
|
|
|
522
461
|
MLK_MAX3_(MLK_TOTAL_ALLOC_1024_KEYPAIR, MLK_TOTAL_ALLOC_1024_ENCAPS, \
|
|
523
462
|
MLK_TOTAL_ALLOC_1024_DECAPS)
|
|
524
463
|
|
|
525
|
-
#undef MLK_API_LEGACY_CONFIG
|
|
526
|
-
|
|
527
464
|
#endif /* !MLK_H */
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
* levels, you should include this file once with
|
|
23
23
|
* MLK_CONFIG_MULTILEVEL_WITH_SHARED set.
|
|
24
24
|
*
|
|
25
|
-
* (You could also follow the same pattern as for
|
|
25
|
+
* (You could also follow the same pattern as for mlkem_native.c
|
|
26
26
|
* and include it for every level, setting MLK_CONFIG_MULTILEVEL_NO_SHARED
|
|
27
27
|
* for all but one. For builds with MLK_CONFIG_MULTILEVEL_NO_SHARED, this
|
|
28
28
|
* file will then be ignored.)
|
|
@@ -60,46 +60,46 @@
|
|
|
60
60
|
|
|
61
61
|
#if defined(MLK_CONFIG_USE_NATIVE_BACKEND_ARITH)
|
|
62
62
|
#if defined(MLK_SYS_AARCH64)
|
|
63
|
-
#include "src/native/aarch64/src/
|
|
64
|
-
#include "src/native/aarch64/src/
|
|
65
|
-
#include "src/native/aarch64/src/
|
|
66
|
-
#include "src/native/aarch64/src/
|
|
67
|
-
#include "src/native/aarch64/src/
|
|
68
|
-
#include "src/native/aarch64/src/
|
|
69
|
-
#include "src/native/aarch64/src/
|
|
70
|
-
#include "src/native/aarch64/src/
|
|
71
|
-
#include "src/native/aarch64/src/
|
|
72
|
-
#include "src/native/aarch64/src/
|
|
63
|
+
#include "src/native/aarch64/src/mlkem_intt_aarch64_asm.S"
|
|
64
|
+
#include "src/native/aarch64/src/mlkem_ntt_aarch64_asm.S"
|
|
65
|
+
#include "src/native/aarch64/src/mlkem_poly_mulcache_compute_aarch64_asm.S"
|
|
66
|
+
#include "src/native/aarch64/src/mlkem_poly_reduce_aarch64_asm.S"
|
|
67
|
+
#include "src/native/aarch64/src/mlkem_poly_tobytes_aarch64_asm.S"
|
|
68
|
+
#include "src/native/aarch64/src/mlkem_poly_tomont_aarch64_asm.S"
|
|
69
|
+
#include "src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S"
|
|
70
|
+
#include "src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S"
|
|
71
|
+
#include "src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S"
|
|
72
|
+
#include "src/native/aarch64/src/mlkem_rej_uniform_aarch64_asm.S"
|
|
73
73
|
#endif /* MLK_SYS_AARCH64 */
|
|
74
74
|
#if defined(MLK_SYS_X86_64)
|
|
75
|
-
#include "src/native/x86_64/src/
|
|
76
|
-
#include "src/native/x86_64/src/
|
|
77
|
-
#include "src/native/x86_64/src/
|
|
78
|
-
#include "src/native/x86_64/src/
|
|
79
|
-
#include "src/native/x86_64/src/
|
|
80
|
-
#include "src/native/x86_64/src/
|
|
81
|
-
#include "src/native/x86_64/src/
|
|
82
|
-
#include "src/native/x86_64/src/
|
|
83
|
-
#include "src/native/x86_64/src/
|
|
84
|
-
#include "src/native/x86_64/src/
|
|
85
|
-
#include "src/native/x86_64/src/
|
|
86
|
-
#include "src/native/x86_64/src/
|
|
87
|
-
#include "src/native/x86_64/src/
|
|
88
|
-
#include "src/native/x86_64/src/
|
|
89
|
-
#include "src/native/x86_64/src/
|
|
90
|
-
#include "src/native/x86_64/src/
|
|
91
|
-
#include "src/native/x86_64/src/
|
|
92
|
-
#include "src/native/x86_64/src/
|
|
93
|
-
#include "src/native/x86_64/src/
|
|
94
|
-
#include "src/native/x86_64/src/
|
|
75
|
+
#include "src/native/x86_64/src/mlkem_intt_avx2_asm.S"
|
|
76
|
+
#include "src/native/x86_64/src/mlkem_ntt_avx2_asm.S"
|
|
77
|
+
#include "src/native/x86_64/src/mlkem_nttfrombytes_avx2_asm.S"
|
|
78
|
+
#include "src/native/x86_64/src/mlkem_ntttobytes_avx2_asm.S"
|
|
79
|
+
#include "src/native/x86_64/src/mlkem_nttunpack_avx2_asm.S"
|
|
80
|
+
#include "src/native/x86_64/src/mlkem_poly_compress_d10_avx2_asm.S"
|
|
81
|
+
#include "src/native/x86_64/src/mlkem_poly_compress_d11_avx2_asm.S"
|
|
82
|
+
#include "src/native/x86_64/src/mlkem_poly_compress_d4_avx2_asm.S"
|
|
83
|
+
#include "src/native/x86_64/src/mlkem_poly_compress_d5_avx2_asm.S"
|
|
84
|
+
#include "src/native/x86_64/src/mlkem_poly_decompress_d10_avx2_asm.S"
|
|
85
|
+
#include "src/native/x86_64/src/mlkem_poly_decompress_d11_avx2_asm.S"
|
|
86
|
+
#include "src/native/x86_64/src/mlkem_poly_decompress_d4_avx2_asm.S"
|
|
87
|
+
#include "src/native/x86_64/src/mlkem_poly_decompress_d5_avx2_asm.S"
|
|
88
|
+
#include "src/native/x86_64/src/mlkem_poly_mulcache_compute_avx2_asm.S"
|
|
89
|
+
#include "src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S"
|
|
90
|
+
#include "src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S"
|
|
91
|
+
#include "src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S"
|
|
92
|
+
#include "src/native/x86_64/src/mlkem_reduce_avx2_asm.S"
|
|
93
|
+
#include "src/native/x86_64/src/mlkem_rej_uniform_avx2_asm.S"
|
|
94
|
+
#include "src/native/x86_64/src/mlkem_tomont_avx2_asm.S"
|
|
95
95
|
#endif /* MLK_SYS_X86_64 */
|
|
96
96
|
#if defined(MLK_SYS_RISCV64)
|
|
97
97
|
#endif
|
|
98
98
|
#if defined(MLK_SYS_PPC64LE)
|
|
99
|
-
#include "src/native/ppc64le/src/
|
|
100
|
-
#include "src/native/ppc64le/src/
|
|
101
|
-
#include "src/native/ppc64le/src/
|
|
102
|
-
#include "src/native/ppc64le/src/
|
|
99
|
+
#include "src/native/ppc64le/src/mlkem_intt_ppc_asm.S"
|
|
100
|
+
#include "src/native/ppc64le/src/mlkem_ntt_ppc_asm.S"
|
|
101
|
+
#include "src/native/ppc64le/src/mlkem_poly_tomont_ppc_asm.S"
|
|
102
|
+
#include "src/native/ppc64le/src/mlkem_reduce_ppc_asm.S"
|
|
103
103
|
#endif /* MLK_SYS_PPC64LE */
|
|
104
104
|
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_ARITH */
|
|
105
105
|
|
|
@@ -116,8 +116,8 @@
|
|
|
116
116
|
#endif
|
|
117
117
|
#if defined(MLK_SYS_ARMV81M_MVE)
|
|
118
118
|
#include "src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S"
|
|
119
|
-
#include "src/fips202/native/armv81m/src/
|
|
120
|
-
#include "src/fips202/native/armv81m/src/
|
|
119
|
+
#include "src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S"
|
|
120
|
+
#include "src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S"
|
|
121
121
|
#endif
|
|
122
122
|
#endif /* MLK_CONFIG_USE_NATIVE_BACKEND_FIPS202 */
|
|
123
123
|
|
|
@@ -145,11 +145,6 @@
|
|
|
145
145
|
* Undefine macros from MLK_CONFIG_PARAMETER_SET-specific files
|
|
146
146
|
*/
|
|
147
147
|
/* mlkem/mlkem_native.h */
|
|
148
|
-
#undef CRYPTO_BYTES
|
|
149
|
-
#undef CRYPTO_CIPHERTEXTBYTES
|
|
150
|
-
#undef CRYPTO_PUBLICKEYBYTES
|
|
151
|
-
#undef CRYPTO_SECRETKEYBYTES
|
|
152
|
-
#undef CRYPTO_SYMBYTES
|
|
153
148
|
#undef MLKEM1024_BYTES
|
|
154
149
|
#undef MLKEM1024_CIPHERTEXTBYTES
|
|
155
150
|
#undef MLKEM1024_PUBLICKEYBYTES
|
|
@@ -176,17 +171,15 @@
|
|
|
176
171
|
#undef MLK_API_CONCAT
|
|
177
172
|
#undef MLK_API_CONCAT_
|
|
178
173
|
#undef MLK_API_CONCAT_UNDERSCORE
|
|
179
|
-
#undef MLK_API_LEGACY_CONFIG
|
|
180
174
|
#undef MLK_API_MUST_CHECK_RETURN_VALUE
|
|
181
175
|
#undef MLK_API_NAMESPACE
|
|
176
|
+
#undef MLK_API_NAMESPACE_PREFIX
|
|
182
177
|
#undef MLK_API_QUALIFIER
|
|
183
|
-
#undef MLK_CONFIG_API_CONSTANTS_ONLY
|
|
184
|
-
#undef MLK_CONFIG_API_NAMESPACE_PREFIX
|
|
185
|
-
#undef MLK_CONFIG_API_NO_SUPERCOP
|
|
186
|
-
#undef MLK_CONFIG_API_PARAMETER_SET
|
|
187
|
-
#undef MLK_CONFIG_API_QUALIFIER
|
|
188
178
|
#undef MLK_ERR_FAIL
|
|
179
|
+
#undef MLK_ERR_INVALID_PK
|
|
180
|
+
#undef MLK_ERR_INVALID_SK
|
|
189
181
|
#undef MLK_ERR_OUT_OF_MEMORY
|
|
182
|
+
#undef MLK_ERR_PCT_FAIL
|
|
190
183
|
#undef MLK_ERR_RNG_FAIL
|
|
191
184
|
#undef MLK_H
|
|
192
185
|
#undef MLK_MAX3_
|
|
@@ -208,13 +201,6 @@
|
|
|
208
201
|
#undef MLK_TOTAL_ALLOC_768_KEYPAIR
|
|
209
202
|
#undef MLK_TOTAL_ALLOC_768_KEYPAIR_NO_PCT
|
|
210
203
|
#undef MLK_TOTAL_ALLOC_768_KEYPAIR_PCT
|
|
211
|
-
#undef crypto_kem_check_pk
|
|
212
|
-
#undef crypto_kem_check_sk
|
|
213
|
-
#undef crypto_kem_dec
|
|
214
|
-
#undef crypto_kem_enc
|
|
215
|
-
#undef crypto_kem_enc_derand
|
|
216
|
-
#undef crypto_kem_keypair
|
|
217
|
-
#undef crypto_kem_keypair_derand
|
|
218
204
|
/* mlkem/src/common.h */
|
|
219
205
|
#undef MLK_ADD_PARAM_SET
|
|
220
206
|
#undef MLK_ALLOC
|
|
@@ -226,14 +212,12 @@
|
|
|
226
212
|
#undef MLK_COMMON_H
|
|
227
213
|
#undef MLK_CONCAT
|
|
228
214
|
#undef MLK_CONCAT_
|
|
229
|
-
#undef MLK_CONTEXT_PARAMETERS_0
|
|
230
|
-
#undef MLK_CONTEXT_PARAMETERS_1
|
|
231
|
-
#undef MLK_CONTEXT_PARAMETERS_2
|
|
232
|
-
#undef MLK_CONTEXT_PARAMETERS_3
|
|
233
|
-
#undef MLK_CONTEXT_PARAMETERS_4
|
|
234
215
|
#undef MLK_EMPTY_CU
|
|
235
216
|
#undef MLK_ERR_FAIL
|
|
217
|
+
#undef MLK_ERR_INVALID_PK
|
|
218
|
+
#undef MLK_ERR_INVALID_SK
|
|
236
219
|
#undef MLK_ERR_OUT_OF_MEMORY
|
|
220
|
+
#undef MLK_ERR_PCT_FAIL
|
|
237
221
|
#undef MLK_ERR_RNG_FAIL
|
|
238
222
|
#undef MLK_EXTERNAL_API
|
|
239
223
|
#undef MLK_FIPS202X4_HEADER_FILE
|
|
@@ -335,6 +319,14 @@
|
|
|
335
319
|
#undef mlk_poly_frommsg
|
|
336
320
|
#undef mlk_poly_tobytes
|
|
337
321
|
#undef mlk_poly_tomsg
|
|
322
|
+
/* mlkem/src/context.h */
|
|
323
|
+
#undef MLK_CONTEXT_H
|
|
324
|
+
#undef MLK_CONTEXT_PARAMETERS_0
|
|
325
|
+
#undef MLK_CONTEXT_PARAMETERS_1
|
|
326
|
+
#undef MLK_CONTEXT_PARAMETERS_2
|
|
327
|
+
#undef MLK_CONTEXT_PARAMETERS_3
|
|
328
|
+
#undef MLK_CONTEXT_PARAMETERS_4
|
|
329
|
+
#undef MLK_CONTEXT_UNUSED
|
|
338
330
|
/* mlkem/src/debug.h */
|
|
339
331
|
#undef MLK_DEBUG_H
|
|
340
332
|
#undef mlk_assert
|
|
@@ -401,6 +393,7 @@
|
|
|
401
393
|
#undef MLK_SYSV_ABI_SUPPORTED
|
|
402
394
|
#undef MLK_SYS_AARCH64
|
|
403
395
|
#undef MLK_SYS_AARCH64_EB
|
|
396
|
+
#undef MLK_SYS_AARCH64_NEON
|
|
404
397
|
#undef MLK_SYS_APPLE
|
|
405
398
|
#undef MLK_SYS_ARMV81M_MVE
|
|
406
399
|
#undef MLK_SYS_BIG_ENDIAN
|
|
@@ -487,23 +480,23 @@
|
|
|
487
480
|
/* mlkem/src/fips202/native/aarch64/x1_scalar.h */
|
|
488
481
|
#undef MLK_FIPS202_AARCH64_NEED_X1_SCALAR
|
|
489
482
|
#undef MLK_FIPS202_NATIVE_AARCH64_X1_SCALAR_H
|
|
490
|
-
#undef
|
|
483
|
+
#undef MLK_USE_NATIVE_FIPS202_X1
|
|
491
484
|
/* mlkem/src/fips202/native/aarch64/x1_v84a.h */
|
|
492
485
|
#undef MLK_FIPS202_AARCH64_NEED_X1_V84A
|
|
493
486
|
#undef MLK_FIPS202_NATIVE_AARCH64_X1_V84A_H
|
|
494
|
-
#undef
|
|
487
|
+
#undef MLK_USE_NATIVE_FIPS202_X1
|
|
495
488
|
/* mlkem/src/fips202/native/aarch64/x2_v84a.h */
|
|
496
489
|
#undef MLK_FIPS202_AARCH64_NEED_X2_V84A
|
|
497
490
|
#undef MLK_FIPS202_NATIVE_AARCH64_X2_V84A_H
|
|
498
|
-
#undef
|
|
491
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
499
492
|
/* mlkem/src/fips202/native/aarch64/x4_v8a_scalar.h */
|
|
500
493
|
#undef MLK_FIPS202_AARCH64_NEED_X4_V8A_SCALAR_HYBRID
|
|
501
494
|
#undef MLK_FIPS202_NATIVE_AARCH64_X4_V8A_SCALAR_H
|
|
502
|
-
#undef
|
|
495
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
503
496
|
/* mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h */
|
|
504
497
|
#undef MLK_FIPS202_AARCH64_NEED_X4_V8A_V84A_SCALAR_HYBRID
|
|
505
498
|
#undef MLK_FIPS202_NATIVE_AARCH64_X4_V8A_V84A_SCALAR_H
|
|
506
|
-
#undef
|
|
499
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
507
500
|
#endif /* MLK_SYS_AARCH64 */
|
|
508
501
|
#if defined(MLK_SYS_X86_64)
|
|
509
502
|
/*
|
|
@@ -512,7 +505,7 @@
|
|
|
512
505
|
/* mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h */
|
|
513
506
|
#undef MLK_FIPS202_NATIVE_X86_64_KECCAK_F1600_X4_AVX2_H
|
|
514
507
|
#undef MLK_FIPS202_X86_64_NEED_X4_AVX2
|
|
515
|
-
#undef
|
|
508
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
516
509
|
/* mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h */
|
|
517
510
|
#undef MLK_FIPS202_NATIVE_X86_64_SRC_FIPS202_NATIVE_X86_64_H
|
|
518
511
|
#undef mlk_keccak_f1600_x4_avx2_asm
|
|
@@ -528,12 +521,10 @@
|
|
|
528
521
|
#undef MLK_FIPS202_ARMV81M_NEED_X4
|
|
529
522
|
#undef MLK_FIPS202_NATIVE_ARMV81M
|
|
530
523
|
#undef MLK_FIPS202_NATIVE_ARMV81M_MVE_H
|
|
531
|
-
#undef
|
|
532
|
-
#undef
|
|
533
|
-
#undef
|
|
524
|
+
#undef MLK_USE_NATIVE_FIPS202_X4
|
|
525
|
+
#undef MLK_USE_NATIVE_FIPS202_X4_EXTRACT_BYTES
|
|
526
|
+
#undef MLK_USE_NATIVE_FIPS202_X4_XOR_BYTES
|
|
534
527
|
#undef mlk_keccak_f1600_x4_native_impl
|
|
535
|
-
#undef mlk_keccak_f1600_x4_state_extract_bytes
|
|
536
|
-
#undef mlk_keccak_f1600_x4_state_xor_bytes
|
|
537
528
|
/* mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h */
|
|
538
529
|
#undef MLK_FIPS202_NATIVE_ARMV81M_SRC_FIPS202_NATIVE_ARMV81M_H
|
|
539
530
|
#undef mlk_keccak_f1600_x4_mve_asm
|