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
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
|
|
39
39
|
static MLD_INLINE void mld_poly_permute_bitrev_to_custom(int32_t data[MLDSA_N])
|
|
40
40
|
{
|
|
41
|
-
if (mld_sys_check_capability(
|
|
41
|
+
if (mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
42
42
|
{
|
|
43
43
|
mld_nttunpack_avx2_asm(data);
|
|
44
44
|
}
|
|
@@ -47,7 +47,7 @@ static MLD_INLINE void mld_poly_permute_bitrev_to_custom(int32_t data[MLDSA_N])
|
|
|
47
47
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
48
48
|
static MLD_INLINE int mld_ntt_native(int32_t data[MLDSA_N])
|
|
49
49
|
{
|
|
50
|
-
if (!mld_sys_check_capability(
|
|
50
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
51
51
|
{
|
|
52
52
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
53
53
|
}
|
|
@@ -59,7 +59,7 @@ static MLD_INLINE int mld_ntt_native(int32_t data[MLDSA_N])
|
|
|
59
59
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
60
60
|
static MLD_INLINE int mld_intt_native(int32_t data[MLDSA_N])
|
|
61
61
|
{
|
|
62
|
-
if (!mld_sys_check_capability(
|
|
62
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
63
63
|
{
|
|
64
64
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
65
65
|
}
|
|
@@ -73,14 +73,14 @@ static MLD_INLINE int mld_rej_uniform_native(int32_t *r, unsigned len,
|
|
|
73
73
|
unsigned buflen)
|
|
74
74
|
{
|
|
75
75
|
/* AVX2 implementation assumes specific buffer lengths */
|
|
76
|
-
if (!mld_sys_check_capability(
|
|
76
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2) || len != MLDSA_N ||
|
|
77
77
|
buflen != MLD_AVX2_REJ_UNIFORM_BUFLEN)
|
|
78
78
|
{
|
|
79
79
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
82
|
/* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
|
|
83
|
-
return (int)
|
|
83
|
+
return (int)mld_rej_uniform_avx2_asm(r, buf, mld_rej_uniform_table);
|
|
84
84
|
}
|
|
85
85
|
|
|
86
86
|
#if !defined(MLD_CONFIG_NO_KEYPAIR_API)
|
|
@@ -92,7 +92,7 @@ static MLD_INLINE int mld_rej_uniform_eta2_native(int32_t *r, unsigned len,
|
|
|
92
92
|
{
|
|
93
93
|
unsigned int outlen;
|
|
94
94
|
/* AVX2 implementation assumes specific buffer lengths */
|
|
95
|
-
if (!mld_sys_check_capability(
|
|
95
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2) || len != MLDSA_N ||
|
|
96
96
|
buflen != MLD_AVX2_REJ_UNIFORM_ETA2_BUFLEN)
|
|
97
97
|
{
|
|
98
98
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
@@ -106,7 +106,7 @@ static MLD_INLINE int mld_rej_uniform_eta2_native(int32_t *r, unsigned len,
|
|
|
106
106
|
* We declassify prior the input data and mark the outputs as secret.
|
|
107
107
|
*/
|
|
108
108
|
MLD_CT_TESTING_DECLASSIFY(buf, buflen);
|
|
109
|
-
outlen =
|
|
109
|
+
outlen = mld_rej_uniform_eta2_avx2_asm(r, buf, mld_rej_uniform_table);
|
|
110
110
|
MLD_CT_TESTING_SECRET(r, sizeof(int32_t) * outlen);
|
|
111
111
|
/* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
|
|
112
112
|
return (int)outlen;
|
|
@@ -121,7 +121,7 @@ static MLD_INLINE int mld_rej_uniform_eta4_native(int32_t *r, unsigned len,
|
|
|
121
121
|
{
|
|
122
122
|
unsigned int outlen;
|
|
123
123
|
/* AVX2 implementation assumes specific buffer lengths */
|
|
124
|
-
if (!mld_sys_check_capability(
|
|
124
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2) || len != MLDSA_N ||
|
|
125
125
|
buflen != MLD_AVX2_REJ_UNIFORM_ETA4_BUFLEN)
|
|
126
126
|
{
|
|
127
127
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
@@ -135,7 +135,7 @@ static MLD_INLINE int mld_rej_uniform_eta4_native(int32_t *r, unsigned len,
|
|
|
135
135
|
* We declassify prior the input data and mark the outputs as secret.
|
|
136
136
|
*/
|
|
137
137
|
MLD_CT_TESTING_DECLASSIFY(buf, buflen);
|
|
138
|
-
outlen =
|
|
138
|
+
outlen = mld_rej_uniform_eta4_avx2_asm(r, buf, mld_rej_uniform_table);
|
|
139
139
|
MLD_CT_TESTING_SECRET(r, sizeof(int32_t) * outlen);
|
|
140
140
|
/* Safety: outlen is at most MLDSA_N and, hence, this cast is safe. */
|
|
141
141
|
return (int)outlen;
|
|
@@ -149,11 +149,11 @@ static MLD_INLINE int mld_rej_uniform_eta4_native(int32_t *r, unsigned len,
|
|
|
149
149
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
150
150
|
static MLD_INLINE int mld_poly_decompose_32_native(int32_t *a1, int32_t *a0)
|
|
151
151
|
{
|
|
152
|
-
if (!mld_sys_check_capability(
|
|
152
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
153
153
|
{
|
|
154
154
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
mld_poly_decompose_32_avx2_asm(a1, a0);
|
|
157
157
|
return MLD_NATIVE_FUNC_SUCCESS;
|
|
158
158
|
}
|
|
159
159
|
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
@@ -163,11 +163,11 @@ static MLD_INLINE int mld_poly_decompose_32_native(int32_t *a1, int32_t *a0)
|
|
|
163
163
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
164
164
|
static MLD_INLINE int mld_poly_decompose_88_native(int32_t *a1, int32_t *a0)
|
|
165
165
|
{
|
|
166
|
-
if (!mld_sys_check_capability(
|
|
166
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
167
167
|
{
|
|
168
168
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
169
169
|
}
|
|
170
|
-
|
|
170
|
+
mld_poly_decompose_88_avx2_asm(a1, a0);
|
|
171
171
|
return MLD_NATIVE_FUNC_SUCCESS;
|
|
172
172
|
}
|
|
173
173
|
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
@@ -177,7 +177,7 @@ static MLD_INLINE int mld_poly_decompose_88_native(int32_t *a1, int32_t *a0)
|
|
|
177
177
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
178
178
|
static MLD_INLINE int mld_poly_caddq_native(int32_t a[MLDSA_N])
|
|
179
179
|
{
|
|
180
|
-
if (!mld_sys_check_capability(
|
|
180
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
181
181
|
{
|
|
182
182
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
183
183
|
}
|
|
@@ -191,11 +191,11 @@ static MLD_INLINE int mld_poly_caddq_native(int32_t a[MLDSA_N])
|
|
|
191
191
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
192
192
|
static MLD_INLINE int mld_poly_use_hint_32_native(int32_t *a, const int32_t *h)
|
|
193
193
|
{
|
|
194
|
-
if (!mld_sys_check_capability(
|
|
194
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
195
195
|
{
|
|
196
196
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
197
197
|
}
|
|
198
|
-
|
|
198
|
+
mld_poly_use_hint_32_avx2_asm(a, h);
|
|
199
199
|
return MLD_NATIVE_FUNC_SUCCESS;
|
|
200
200
|
}
|
|
201
201
|
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
@@ -205,11 +205,11 @@ static MLD_INLINE int mld_poly_use_hint_32_native(int32_t *a, const int32_t *h)
|
|
|
205
205
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
206
206
|
static MLD_INLINE int mld_poly_use_hint_88_native(int32_t *a, const int32_t *h)
|
|
207
207
|
{
|
|
208
|
-
if (!mld_sys_check_capability(
|
|
208
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
209
209
|
{
|
|
210
210
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
211
211
|
}
|
|
212
|
-
|
|
212
|
+
mld_poly_use_hint_88_avx2_asm(a, h);
|
|
213
213
|
return MLD_NATIVE_FUNC_SUCCESS;
|
|
214
214
|
}
|
|
215
215
|
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
@@ -219,11 +219,11 @@ static MLD_INLINE int mld_poly_use_hint_88_native(int32_t *a, const int32_t *h)
|
|
|
219
219
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
220
220
|
static MLD_INLINE int mld_poly_chknorm_native(const int32_t *a, int32_t B)
|
|
221
221
|
{
|
|
222
|
-
if (!mld_sys_check_capability(
|
|
222
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
223
223
|
{
|
|
224
224
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
225
225
|
}
|
|
226
|
-
return
|
|
226
|
+
return mld_poly_chknorm_avx2_asm(a, B);
|
|
227
227
|
}
|
|
228
228
|
|
|
229
229
|
#if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
@@ -231,11 +231,11 @@ static MLD_INLINE int mld_poly_chknorm_native(const int32_t *a, int32_t B)
|
|
|
231
231
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
232
232
|
static MLD_INLINE int mld_polyz_unpack_17_native(int32_t *r, const uint8_t *a)
|
|
233
233
|
{
|
|
234
|
-
if (!mld_sys_check_capability(
|
|
234
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
235
235
|
{
|
|
236
236
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
237
237
|
}
|
|
238
|
-
|
|
238
|
+
mld_polyz_unpack_17_avx2_asm(r, a);
|
|
239
239
|
return MLD_NATIVE_FUNC_SUCCESS;
|
|
240
240
|
}
|
|
241
241
|
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 44 \
|
|
@@ -246,11 +246,11 @@ static MLD_INLINE int mld_polyz_unpack_17_native(int32_t *r, const uint8_t *a)
|
|
|
246
246
|
MLD_MUST_CHECK_RETURN_VALUE
|
|
247
247
|
static MLD_INLINE int mld_polyz_unpack_19_native(int32_t *r, const uint8_t *a)
|
|
248
248
|
{
|
|
249
|
-
if (!mld_sys_check_capability(
|
|
249
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
250
250
|
{
|
|
251
251
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
252
252
|
}
|
|
253
|
-
|
|
253
|
+
mld_polyz_unpack_19_avx2_asm(r, a);
|
|
254
254
|
return MLD_NATIVE_FUNC_SUCCESS;
|
|
255
255
|
}
|
|
256
256
|
#endif /* MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
@@ -263,7 +263,7 @@ MLD_MUST_CHECK_RETURN_VALUE
|
|
|
263
263
|
static MLD_INLINE int mld_poly_pointwise_montgomery_native(
|
|
264
264
|
int32_t a[MLDSA_N], const int32_t b[MLDSA_N])
|
|
265
265
|
{
|
|
266
|
-
if (!mld_sys_check_capability(
|
|
266
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
267
267
|
{
|
|
268
268
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
269
269
|
}
|
|
@@ -279,7 +279,7 @@ static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l4_native(
|
|
|
279
279
|
int32_t w[MLDSA_N], const int32_t u[4][MLDSA_N],
|
|
280
280
|
const int32_t v[4][MLDSA_N])
|
|
281
281
|
{
|
|
282
|
-
if (!mld_sys_check_capability(
|
|
282
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
283
283
|
{
|
|
284
284
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
285
285
|
}
|
|
@@ -294,7 +294,7 @@ static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l5_native(
|
|
|
294
294
|
int32_t w[MLDSA_N], const int32_t u[5][MLDSA_N],
|
|
295
295
|
const int32_t v[5][MLDSA_N])
|
|
296
296
|
{
|
|
297
|
-
if (!mld_sys_check_capability(
|
|
297
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
298
298
|
{
|
|
299
299
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
300
300
|
}
|
|
@@ -309,7 +309,7 @@ static MLD_INLINE int mld_polyvecl_pointwise_acc_montgomery_l7_native(
|
|
|
309
309
|
int32_t w[MLDSA_N], const int32_t u[7][MLDSA_N],
|
|
310
310
|
const int32_t v[7][MLDSA_N])
|
|
311
311
|
{
|
|
312
|
-
if (!mld_sys_check_capability(
|
|
312
|
+
if (!mld_sys_check_capability(MLD_SYS_CAP_X86_64_AVX2))
|
|
313
313
|
{
|
|
314
314
|
return MLD_NATIVE_FUNC_FALLBACK;
|
|
315
315
|
}
|
|
@@ -32,11 +32,13 @@
|
|
|
32
32
|
MLD_INTERNAL_DATA_DECLARATION const uint8_t mld_rej_uniform_table[256][8];
|
|
33
33
|
|
|
34
34
|
#define mld_ntt_avx2_asm MLD_NAMESPACE(ntt_avx2_asm)
|
|
35
|
+
MLD_SYSV_ABI
|
|
35
36
|
void mld_ntt_avx2_asm(int32_t *r, const int32_t *qdata)
|
|
36
37
|
/* This must be kept in sync with the HOL-Light specification
|
|
37
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
38
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_ntt_avx2_asm.ml */
|
|
38
39
|
__contract__(
|
|
39
40
|
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
41
|
+
/* check-magic: 8380417 == MLDSA_Q */
|
|
40
42
|
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
41
43
|
requires(qdata == mld_qdata)
|
|
42
44
|
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
@@ -46,9 +48,10 @@ __contract__(
|
|
|
46
48
|
);
|
|
47
49
|
|
|
48
50
|
#define mld_invntt_avx2_asm MLD_NAMESPACE(invntt_avx2_asm)
|
|
51
|
+
MLD_SYSV_ABI
|
|
49
52
|
void mld_invntt_avx2_asm(int32_t *r, const int32_t *qdata)
|
|
50
53
|
/* This must be kept in sync with the HOL-Light specification
|
|
51
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
54
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_intt_avx2_asm.ml */
|
|
52
55
|
__contract__(
|
|
53
56
|
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
54
57
|
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
@@ -60,9 +63,10 @@ __contract__(
|
|
|
60
63
|
);
|
|
61
64
|
|
|
62
65
|
#define mld_nttunpack_avx2_asm MLD_NAMESPACE(nttunpack_avx2_asm)
|
|
66
|
+
MLD_SYSV_ABI
|
|
63
67
|
void mld_nttunpack_avx2_asm(int32_t *r)
|
|
64
68
|
/* This must be kept in sync with the HOL-Light specification
|
|
65
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
69
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_nttunpack_avx2_asm.ml */
|
|
66
70
|
__contract__(
|
|
67
71
|
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
68
72
|
requires(array_abs_bound(r, 0, MLDSA_N, 8380417))
|
|
@@ -73,35 +77,97 @@ __contract__(
|
|
|
73
77
|
r[i] == old(*(int32_t (*)[MLDSA_N])r)[j])))
|
|
74
78
|
);
|
|
75
79
|
|
|
76
|
-
#define
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
+
#define mld_rej_uniform_avx2_asm MLD_NAMESPACE(rej_uniform_avx2_asm)
|
|
81
|
+
/* This contract must be kept in sync with the HOL-Light specification
|
|
82
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_rej_uniform_avx2_asm.ml */
|
|
83
|
+
MLD_MUST_CHECK_RETURN_VALUE MLD_SYSV_ABI
|
|
84
|
+
unsigned mld_rej_uniform_avx2_asm(
|
|
85
|
+
int32_t *r, const uint8_t buf[MLD_AVX2_REJ_UNIFORM_BUFLEN],
|
|
86
|
+
const uint8_t table[256][8])
|
|
87
|
+
__contract__(
|
|
88
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
89
|
+
requires(memory_no_alias(buf, 840))
|
|
90
|
+
requires(table == mld_rej_uniform_table)
|
|
91
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
92
|
+
ensures(return_value <= MLDSA_N)
|
|
93
|
+
ensures(array_bound(r, 0, return_value, 0, MLDSA_Q))
|
|
94
|
+
);
|
|
80
95
|
|
|
81
96
|
#if !defined(MLD_CONFIG_NO_KEYPAIR_API)
|
|
82
|
-
#define
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
97
|
+
#define mld_rej_uniform_eta2_avx2_asm MLD_NAMESPACE(rej_uniform_eta2_avx2_asm)
|
|
98
|
+
/* This contract must be kept in sync with the HOL-Light specification
|
|
99
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_rej_uniform_eta2_avx2_asm.ml */
|
|
100
|
+
MLD_MUST_CHECK_RETURN_VALUE MLD_SYSV_ABI
|
|
101
|
+
unsigned mld_rej_uniform_eta2_avx2_asm(
|
|
102
|
+
int32_t *r, const uint8_t buf[MLD_AVX2_REJ_UNIFORM_ETA2_BUFLEN],
|
|
103
|
+
const uint8_t table[256][8])
|
|
104
|
+
__contract__(
|
|
105
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
106
|
+
requires(memory_no_alias(buf, MLD_AVX2_REJ_UNIFORM_ETA2_BUFLEN))
|
|
107
|
+
requires(table == mld_rej_uniform_table)
|
|
108
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
109
|
+
ensures(return_value <= MLDSA_N)
|
|
110
|
+
ensures(array_abs_bound(r, 0, return_value, 3))
|
|
111
|
+
);
|
|
112
|
+
|
|
113
|
+
#define mld_rej_uniform_eta4_avx2_asm MLD_NAMESPACE(rej_uniform_eta4_avx2_asm)
|
|
114
|
+
/* This contract must be kept in sync with the HOL-Light specification
|
|
115
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_rej_uniform_eta4_avx2_asm.ml */
|
|
116
|
+
MLD_MUST_CHECK_RETURN_VALUE MLD_SYSV_ABI
|
|
117
|
+
unsigned mld_rej_uniform_eta4_avx2_asm(
|
|
118
|
+
int32_t *r, const uint8_t buf[MLD_AVX2_REJ_UNIFORM_ETA4_BUFLEN],
|
|
119
|
+
const uint8_t table[256][8])
|
|
120
|
+
__contract__(
|
|
121
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
122
|
+
requires(memory_no_alias(buf, MLD_AVX2_REJ_UNIFORM_ETA4_BUFLEN))
|
|
123
|
+
requires(table == mld_rej_uniform_table)
|
|
124
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
125
|
+
ensures(return_value <= MLDSA_N)
|
|
126
|
+
ensures(array_abs_bound(r, 0, return_value, 5))
|
|
127
|
+
);
|
|
91
128
|
#endif /* !MLD_CONFIG_NO_KEYPAIR_API */
|
|
92
129
|
|
|
93
130
|
#if !defined(MLD_CONFIG_NO_SIGN_API)
|
|
94
|
-
#define
|
|
95
|
-
|
|
131
|
+
#define mld_poly_decompose_32_avx2_asm MLD_NAMESPACE(poly_decompose_32_avx2_asm)
|
|
132
|
+
MLD_SYSV_ABI
|
|
133
|
+
void mld_poly_decompose_32_avx2_asm(int32_t *a1, int32_t *a0)
|
|
134
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
135
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_poly_decompose_32_avx2_asm.ml */
|
|
136
|
+
__contract__(
|
|
137
|
+
requires(memory_no_alias(a1, sizeof(int32_t) * MLDSA_N))
|
|
138
|
+
requires(memory_no_alias(a0, sizeof(int32_t) * MLDSA_N))
|
|
139
|
+
requires(array_bound(a0, 0, MLDSA_N, 0, MLDSA_Q))
|
|
140
|
+
assigns(memory_slice(a1, sizeof(int32_t) * MLDSA_N))
|
|
141
|
+
assigns(memory_slice(a0, sizeof(int32_t) * MLDSA_N))
|
|
142
|
+
/* check-magic: 16 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 32)) */
|
|
143
|
+
ensures(array_bound(a1, 0, MLDSA_N, 0, 16))
|
|
144
|
+
/* check-magic: 261889 == (MLDSA_Q - 1) / 32 + 1 */
|
|
145
|
+
ensures(array_abs_bound(a0, 0, MLDSA_N, 261889))
|
|
146
|
+
);
|
|
96
147
|
|
|
97
|
-
#define
|
|
98
|
-
|
|
148
|
+
#define mld_poly_decompose_88_avx2_asm MLD_NAMESPACE(poly_decompose_88_avx2_asm)
|
|
149
|
+
MLD_SYSV_ABI
|
|
150
|
+
void mld_poly_decompose_88_avx2_asm(int32_t *a1, int32_t *a0)
|
|
151
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
152
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_poly_decompose_88_avx2_asm.ml */
|
|
153
|
+
__contract__(
|
|
154
|
+
requires(memory_no_alias(a1, sizeof(int32_t) * MLDSA_N))
|
|
155
|
+
requires(memory_no_alias(a0, sizeof(int32_t) * MLDSA_N))
|
|
156
|
+
requires(array_bound(a0, 0, MLDSA_N, 0, MLDSA_Q))
|
|
157
|
+
assigns(memory_slice(a1, sizeof(int32_t) * MLDSA_N))
|
|
158
|
+
assigns(memory_slice(a0, sizeof(int32_t) * MLDSA_N))
|
|
159
|
+
/* check-magic: 44 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 88)) */
|
|
160
|
+
ensures(array_bound(a1, 0, MLDSA_N, 0, 44))
|
|
161
|
+
/* check-magic: 95233 == (MLDSA_Q - 1) / 88 + 1 */
|
|
162
|
+
ensures(array_abs_bound(a0, 0, MLDSA_N, 95233))
|
|
163
|
+
);
|
|
99
164
|
#endif /* !MLD_CONFIG_NO_SIGN_API */
|
|
100
165
|
|
|
101
166
|
#define mld_poly_caddq_avx2_asm MLD_NAMESPACE(poly_caddq_avx2_asm)
|
|
167
|
+
MLD_SYSV_ABI
|
|
102
168
|
void mld_poly_caddq_avx2_asm(int32_t *r)
|
|
103
169
|
/* This must be kept in sync with the HOL-Light specification
|
|
104
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
170
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_poly_caddq_avx2_asm.ml */
|
|
105
171
|
__contract__(
|
|
106
172
|
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
107
173
|
requires(array_abs_bound(r, 0, MLDSA_N, MLDSA_Q))
|
|
@@ -110,99 +176,155 @@ __contract__(
|
|
|
110
176
|
);
|
|
111
177
|
|
|
112
178
|
#if !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
113
|
-
#define
|
|
114
|
-
|
|
179
|
+
#define mld_poly_use_hint_32_avx2_asm MLD_NAMESPACE(poly_use_hint_32_avx2_asm)
|
|
180
|
+
MLD_SYSV_ABI
|
|
181
|
+
void mld_poly_use_hint_32_avx2_asm(int32_t *a, const int32_t *h)
|
|
182
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
183
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_poly_use_hint_32_avx2_asm.ml */
|
|
184
|
+
__contract__(
|
|
185
|
+
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
186
|
+
requires(memory_no_alias(h, sizeof(int32_t) * MLDSA_N))
|
|
187
|
+
requires(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
|
|
188
|
+
requires(array_bound(h, 0, MLDSA_N, 0, 2))
|
|
189
|
+
assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
|
|
190
|
+
/* check-magic: 16 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 32)) */
|
|
191
|
+
ensures(array_bound(a, 0, MLDSA_N, 0, 16))
|
|
192
|
+
);
|
|
115
193
|
|
|
116
|
-
#define
|
|
117
|
-
|
|
194
|
+
#define mld_poly_use_hint_88_avx2_asm MLD_NAMESPACE(poly_use_hint_88_avx2_asm)
|
|
195
|
+
MLD_SYSV_ABI
|
|
196
|
+
void mld_poly_use_hint_88_avx2_asm(int32_t *a, const int32_t *h)
|
|
197
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
198
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_poly_use_hint_88_avx2_asm.ml */
|
|
199
|
+
__contract__(
|
|
200
|
+
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
201
|
+
requires(memory_no_alias(h, sizeof(int32_t) * MLDSA_N))
|
|
202
|
+
requires(array_bound(a, 0, MLDSA_N, 0, MLDSA_Q))
|
|
203
|
+
requires(array_bound(h, 0, MLDSA_N, 0, 2))
|
|
204
|
+
assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
|
|
205
|
+
/* check-magic: 44 == (MLDSA_Q - 1) / (2 * ((MLDSA_Q - 1) / 88)) */
|
|
206
|
+
ensures(array_bound(a, 0, MLDSA_N, 0, 44))
|
|
207
|
+
);
|
|
118
208
|
#endif /* !MLD_CONFIG_NO_VERIFY_API */
|
|
119
209
|
|
|
120
|
-
#define
|
|
121
|
-
MLD_MUST_CHECK_RETURN_VALUE
|
|
122
|
-
int
|
|
210
|
+
#define mld_poly_chknorm_avx2_asm MLD_NAMESPACE(poly_chknorm_avx2_asm)
|
|
211
|
+
MLD_MUST_CHECK_RETURN_VALUE MLD_SYSV_ABI
|
|
212
|
+
int mld_poly_chknorm_avx2_asm(const int32_t *a, int32_t B)
|
|
213
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
214
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_poly_chknorm_avx2_asm.ml */
|
|
215
|
+
__contract__(
|
|
216
|
+
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
217
|
+
/* HOL Light precondition: abs(ival(x i)) < 2^31, i.e., a[i] != INT32_MIN */
|
|
218
|
+
requires(forall(k0, 0, MLDSA_N, a[k0] > INT32_MIN))
|
|
219
|
+
/* HOL Light precondition: 0 <= ival bound (asm computes B-1 internally) */
|
|
220
|
+
requires(B >= 0)
|
|
221
|
+
ensures(return_value == 0 || return_value == 1)
|
|
222
|
+
ensures((return_value == 0) == array_abs_bound(a, 0, MLDSA_N, B))
|
|
223
|
+
);
|
|
123
224
|
|
|
124
225
|
#if !defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API)
|
|
125
|
-
#define
|
|
126
|
-
|
|
226
|
+
#define mld_polyz_unpack_17_avx2_asm MLD_NAMESPACE(polyz_unpack_17_avx2_asm)
|
|
227
|
+
MLD_SYSV_ABI
|
|
228
|
+
void mld_polyz_unpack_17_avx2_asm(int32_t *r, const uint8_t *a)
|
|
229
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
230
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_polyz_unpack_17_avx2_asm.ml */
|
|
231
|
+
__contract__(
|
|
232
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
233
|
+
requires(memory_no_alias(a, 576))
|
|
234
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
235
|
+
ensures(array_bound(r, 0, MLDSA_N, -((1 << 17) - 1), (1 << 17) + 1))
|
|
236
|
+
);
|
|
127
237
|
|
|
128
|
-
#define
|
|
129
|
-
|
|
238
|
+
#define mld_polyz_unpack_19_avx2_asm MLD_NAMESPACE(polyz_unpack_19_avx2_asm)
|
|
239
|
+
MLD_SYSV_ABI
|
|
240
|
+
void mld_polyz_unpack_19_avx2_asm(int32_t *r, const uint8_t *a)
|
|
241
|
+
/* This must be kept in sync with the HOL-Light specification
|
|
242
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_polyz_unpack_19_avx2_asm.ml */
|
|
243
|
+
__contract__(
|
|
244
|
+
requires(memory_no_alias(r, sizeof(int32_t) * MLDSA_N))
|
|
245
|
+
requires(memory_no_alias(a, 640))
|
|
246
|
+
assigns(memory_slice(r, sizeof(int32_t) * MLDSA_N))
|
|
247
|
+
ensures(array_bound(r, 0, MLDSA_N, -((1 << 19) - 1), (1 << 19) + 1))
|
|
248
|
+
);
|
|
130
249
|
#endif /* !MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API */
|
|
131
250
|
|
|
132
251
|
#define mld_pointwise_avx2_asm MLD_NAMESPACE(pointwise_avx2_asm)
|
|
252
|
+
MLD_SYSV_ABI
|
|
133
253
|
void mld_pointwise_avx2_asm(int32_t *a, const int32_t *b, const int32_t *qdata)
|
|
134
254
|
/* This must be kept in sync with the HOL-Light specification
|
|
135
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
255
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_pointwise_avx2_asm.ml */
|
|
136
256
|
__contract__(
|
|
137
257
|
requires(memory_no_alias(a, sizeof(int32_t) * MLDSA_N))
|
|
138
258
|
requires(memory_no_alias(b, sizeof(int32_t) * MLDSA_N))
|
|
139
|
-
/*
|
|
140
|
-
|
|
141
|
-
|
|
259
|
+
/* Input bound MLD_NTT_BOUND = 9 * MLD_FQMUL_BOUND, the guaranteed bound of
|
|
260
|
+
* any forward NTT implementation. Hardcoded here to keep this header free
|
|
261
|
+
* of poly.h. */
|
|
262
|
+
/* check-magic: 94279698 == 9 * ((5 * MLDSA_Q + 3) / 4) */
|
|
263
|
+
requires(array_abs_bound(a, 0, MLDSA_N, 94279698))
|
|
264
|
+
requires(array_abs_bound(b, 0, MLDSA_N, 94279698))
|
|
142
265
|
requires(qdata == mld_qdata)
|
|
143
266
|
assigns(memory_slice(a, sizeof(int32_t) * MLDSA_N))
|
|
144
267
|
ensures(array_abs_bound(a, 0, MLDSA_N, 8380417))
|
|
145
|
-
/* check-magic: on */
|
|
146
268
|
);
|
|
147
269
|
|
|
148
270
|
#define mld_pointwise_acc_l4_avx2_asm MLD_NAMESPACE(pointwise_acc_l4_avx2_asm)
|
|
271
|
+
MLD_SYSV_ABI
|
|
149
272
|
void mld_pointwise_acc_l4_avx2_asm(int32_t c[MLDSA_N],
|
|
150
273
|
const int32_t a[4][MLDSA_N],
|
|
151
274
|
const int32_t b[4][MLDSA_N],
|
|
152
275
|
const int32_t *qdata)
|
|
153
276
|
/* This must be kept in sync with the HOL-Light specification
|
|
154
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
277
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_pointwise_acc_l4_avx2_asm.ml */
|
|
155
278
|
__contract__(
|
|
156
279
|
requires(memory_no_alias(c, sizeof(int32_t) * MLDSA_N))
|
|
157
280
|
requires(memory_no_alias(a, sizeof(int32_t) * 4 * MLDSA_N))
|
|
158
281
|
requires(memory_no_alias(b, sizeof(int32_t) * 4 * MLDSA_N))
|
|
159
|
-
/* check-magic: off */
|
|
160
282
|
requires(forall(l0, 0, 4, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
|
|
161
|
-
|
|
283
|
+
/* check-magic: 94279698 == 9 * ((5 * MLDSA_Q + 3) / 4) */
|
|
284
|
+
requires(forall(l1, 0, 4, array_abs_bound(b[l1], 0, MLDSA_N, 94279698)))
|
|
162
285
|
requires(qdata == mld_qdata)
|
|
163
286
|
assigns(memory_slice(c, sizeof(int32_t) * MLDSA_N))
|
|
164
287
|
ensures(array_abs_bound(c, 0, MLDSA_N, 8380417))
|
|
165
|
-
/* check-magic: on */
|
|
166
288
|
);
|
|
167
289
|
|
|
168
290
|
#define mld_pointwise_acc_l5_avx2_asm MLD_NAMESPACE(pointwise_acc_l5_avx2_asm)
|
|
291
|
+
MLD_SYSV_ABI
|
|
169
292
|
void mld_pointwise_acc_l5_avx2_asm(int32_t c[MLDSA_N],
|
|
170
293
|
const int32_t a[5][MLDSA_N],
|
|
171
294
|
const int32_t b[5][MLDSA_N],
|
|
172
295
|
const int32_t *qdata)
|
|
173
296
|
/* This must be kept in sync with the HOL-Light specification
|
|
174
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
297
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_pointwise_acc_l5_avx2_asm.ml */
|
|
175
298
|
__contract__(
|
|
176
299
|
requires(memory_no_alias(c, sizeof(int32_t) * MLDSA_N))
|
|
177
300
|
requires(memory_no_alias(a, sizeof(int32_t) * 5 * MLDSA_N))
|
|
178
301
|
requires(memory_no_alias(b, sizeof(int32_t) * 5 * MLDSA_N))
|
|
179
|
-
/* check-magic: off */
|
|
180
302
|
requires(forall(l0, 0, 5, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
|
|
181
|
-
|
|
303
|
+
/* check-magic: 94279698 == 9 * ((5 * MLDSA_Q + 3) / 4) */
|
|
304
|
+
requires(forall(l1, 0, 5, array_abs_bound(b[l1], 0, MLDSA_N, 94279698)))
|
|
182
305
|
requires(qdata == mld_qdata)
|
|
183
306
|
assigns(memory_slice(c, sizeof(int32_t) * MLDSA_N))
|
|
184
307
|
ensures(array_abs_bound(c, 0, MLDSA_N, 8380417))
|
|
185
|
-
/* check-magic: on */
|
|
186
308
|
);
|
|
187
309
|
|
|
188
310
|
#define mld_pointwise_acc_l7_avx2_asm MLD_NAMESPACE(pointwise_acc_l7_avx2_asm)
|
|
311
|
+
MLD_SYSV_ABI
|
|
189
312
|
void mld_pointwise_acc_l7_avx2_asm(int32_t c[MLDSA_N],
|
|
190
313
|
const int32_t a[7][MLDSA_N],
|
|
191
314
|
const int32_t b[7][MLDSA_N],
|
|
192
315
|
const int32_t *qdata)
|
|
193
316
|
/* This must be kept in sync with the HOL-Light specification
|
|
194
|
-
* in proofs/hol_light/x86_64/proofs/
|
|
317
|
+
* in proofs/hol_light/x86_64/proofs/mldsa_pointwise_acc_l7_avx2_asm.ml */
|
|
195
318
|
__contract__(
|
|
196
319
|
requires(memory_no_alias(c, sizeof(int32_t) * MLDSA_N))
|
|
197
320
|
requires(memory_no_alias(a, sizeof(int32_t) * 7 * MLDSA_N))
|
|
198
321
|
requires(memory_no_alias(b, sizeof(int32_t) * 7 * MLDSA_N))
|
|
199
|
-
/* check-magic: off */
|
|
200
322
|
requires(forall(l0, 0, 7, array_abs_bound(a[l0], 0, MLDSA_N, 8380417)))
|
|
201
|
-
|
|
323
|
+
/* check-magic: 94279698 == 9 * ((5 * MLDSA_Q + 3) / 4) */
|
|
324
|
+
requires(forall(l1, 0, 7, array_abs_bound(b[l1], 0, MLDSA_N, 94279698)))
|
|
202
325
|
requires(qdata == mld_qdata)
|
|
203
326
|
assigns(memory_slice(c, sizeof(int32_t) * MLDSA_N))
|
|
204
327
|
ensures(array_abs_bound(c, 0, MLDSA_N, 8380417))
|
|
205
|
-
/* check-magic: on */
|
|
206
328
|
);
|
|
207
329
|
|
|
208
330
|
#endif /* !MLD_NATIVE_X86_64_SRC_ARITH_NATIVE_X86_64_H */
|
|
@@ -18,13 +18,35 @@
|
|
|
18
18
|
* AVX2 Dilithium implementation @[REF_AVX2].
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/*yaml
|
|
22
|
+
Name: invntt_avx2_asm
|
|
23
|
+
Description: x86_64 AVX2 inverse NTT
|
|
24
|
+
Signature: void mld_invntt_avx2_asm(int32_t *r, const int32_t *qdata)
|
|
25
|
+
ABI:
|
|
26
|
+
Architecture: x86_64
|
|
27
|
+
CallingConvention: SysV
|
|
28
|
+
Features: [AVX2]
|
|
29
|
+
rdi:
|
|
30
|
+
type: buffer
|
|
31
|
+
size_bytes: 1024
|
|
32
|
+
permissions: read/write
|
|
33
|
+
c_parameter: int32_t *r
|
|
34
|
+
description: Input/output polynomial (256 x int32_t)
|
|
35
|
+
rsi:
|
|
36
|
+
type: buffer
|
|
37
|
+
size_bytes: 2496
|
|
38
|
+
permissions: read-only
|
|
39
|
+
c_parameter: const int32_t *qdata
|
|
40
|
+
description: Precomputed constants (624 x int32_t)
|
|
41
|
+
*/
|
|
42
|
+
|
|
21
43
|
#include "../../../common.h"
|
|
22
44
|
#if defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
23
45
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
24
46
|
|
|
25
47
|
/*
|
|
26
48
|
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
27
|
-
* dev/x86_64/src/
|
|
49
|
+
* dev/x86_64/src/mldsa_intt_avx2_asm.S using scripts/simpasm. Do not modify it directly.
|
|
28
50
|
*/
|
|
29
51
|
|
|
30
52
|
.text
|
|
@@ -18,13 +18,35 @@
|
|
|
18
18
|
* AVX2 Dilithium implementation @[REF_AVX2].
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/*yaml
|
|
22
|
+
Name: ntt_avx2_asm
|
|
23
|
+
Description: x86_64 AVX2 forward NTT
|
|
24
|
+
Signature: void mld_ntt_avx2_asm(int32_t *r, const int32_t *qdata)
|
|
25
|
+
ABI:
|
|
26
|
+
Architecture: x86_64
|
|
27
|
+
CallingConvention: SysV
|
|
28
|
+
Features: [AVX2]
|
|
29
|
+
rdi:
|
|
30
|
+
type: buffer
|
|
31
|
+
size_bytes: 1024
|
|
32
|
+
permissions: read/write
|
|
33
|
+
c_parameter: int32_t *r
|
|
34
|
+
description: Input/output polynomial (256 x int32_t)
|
|
35
|
+
rsi:
|
|
36
|
+
type: buffer
|
|
37
|
+
size_bytes: 2496
|
|
38
|
+
permissions: read-only
|
|
39
|
+
c_parameter: const int32_t *qdata
|
|
40
|
+
description: Precomputed constants (624 x int32_t)
|
|
41
|
+
*/
|
|
42
|
+
|
|
21
43
|
#include "../../../common.h"
|
|
22
44
|
#if defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
23
45
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
24
46
|
|
|
25
47
|
/*
|
|
26
48
|
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
27
|
-
* dev/x86_64/src/
|
|
49
|
+
* dev/x86_64/src/mldsa_ntt_avx2_asm.S using scripts/simpasm. Do not modify it directly.
|
|
28
50
|
*/
|
|
29
51
|
|
|
30
52
|
.text
|
|
@@ -18,13 +18,29 @@
|
|
|
18
18
|
* AVX2 Dilithium implementation @[REF_AVX2].
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
|
+
/*yaml
|
|
22
|
+
Name: nttunpack_avx2_asm
|
|
23
|
+
Description: x86_64 AVX2 NTT coefficient unpacking/permutation
|
|
24
|
+
Signature: void mld_nttunpack_avx2_asm(int32_t *r)
|
|
25
|
+
ABI:
|
|
26
|
+
Architecture: x86_64
|
|
27
|
+
CallingConvention: SysV
|
|
28
|
+
Features: [AVX2]
|
|
29
|
+
rdi:
|
|
30
|
+
type: buffer
|
|
31
|
+
size_bytes: 1024
|
|
32
|
+
permissions: read/write
|
|
33
|
+
c_parameter: int32_t *r
|
|
34
|
+
description: Input/output polynomial (256 x int32_t)
|
|
35
|
+
*/
|
|
36
|
+
|
|
21
37
|
#include "../../../common.h"
|
|
22
38
|
#if defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
23
39
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
24
40
|
|
|
25
41
|
/*
|
|
26
42
|
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
27
|
-
* dev/x86_64/src/
|
|
43
|
+
* dev/x86_64/src/mldsa_nttunpack_avx2_asm.S using scripts/simpasm. Do not modify it directly.
|
|
28
44
|
*/
|
|
29
45
|
|
|
30
46
|
.text
|