pq_crypto 0.6.8 → 0.6.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +11 -0
- data/README.md +1 -3
- data/ext/pqcrypto/pqcrypto_version.h +1 -1
- data/ext/pqcrypto/vendor/.vendored +7 -7
- data/ext/pqcrypto/vendor/mldsa-native/BUILDING.md +71 -0
- data/ext/pqcrypto/vendor/mldsa-native/README.md +26 -11
- data/ext/pqcrypto/vendor/mldsa-native/RELEASE.md +77 -150
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c +93 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.h +74 -59
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_asm.S +106 -40
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h +94 -92
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/capability.h +31 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h +55 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h +30 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/fips202.h +1 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +8 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +8 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/mve.h +12 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h +3 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/auto.h +53 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h +38 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h +38 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h +24 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S +574 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +46 -18
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S +679 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/keccakf1600_constants.c +13 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h +5 -6
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_intt_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_ntt_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_pointwise_montgomery_aarch64_asm.S +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_caddq_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_chknorm_aarch64_asm.S +6 -4
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_32_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_88_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_32_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_88_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_17_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_19_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_aarch64_asm.S +110 -120
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta2_aarch64_asm.S +109 -101
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta4_aarch64_asm.S +97 -93
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h +1 -9
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/meta.h +4 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/fastmul.h +74 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/slowmul.h +77 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/arith_native_rv32im.h +124 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_asm.S +331 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_slowmul_asm.S +381 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_ntt_rv32im_asm.S +304 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_ntt_rv32im_slowmul_asm.S +351 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_poly_pointwise_montgomery_rv32im_asm.S +139 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/rv32im_zetas.c +118 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/meta.h +6 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h +2 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_intt_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_ntt_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_nttunpack_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l4_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l5_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l7_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_caddq_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S +7 -5
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S +69 -67
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S +69 -67
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S +12 -16
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S +14 -18
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c +23 -27
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h +21 -42
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/params.h +28 -1
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.c +87 -28
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly.h +61 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.c +23 -19
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/poly_kl.h +30 -0
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.c +55 -107
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec.h +67 -107
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.c +16 -24
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/polyvec_lazy.h +27 -21
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/reduce.h +8 -8
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.c +191 -119
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sign.h +6 -3
- data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/sys.h +16 -42
- data/ext/pqcrypto/vendor/mlkem-native/BUILDING.md +72 -0
- data/ext/pqcrypto/vendor/mlkem-native/README.md +9 -5
- data/ext/pqcrypto/vendor/mlkem-native/RELEASE.md +64 -312
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.c +77 -34
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native.h +41 -13
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_asm.S +89 -33
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/mlkem_native_config.h +50 -46
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/capability.h +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h +30 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c +1 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h +4 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c +1 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c +15 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.h +23 -8
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.c +11 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202x4.h +7 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.c +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/keccakf1600.h +8 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_scalar_aarch64_asm.S +5 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x1_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x2_v84a_aarch64_asm.S +4 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_scalar_hybrid_aarch64_asm.S +8 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/aarch64/src/keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.S +8 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S +37 -19
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/auto.h +47 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x1_avx512.h +37 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx512.h +37 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h +24 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x1_avx512_asm.S +573 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx2_asm.S +46 -18
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccak_f1600_x4_avx512_asm.S +678 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/keccakf1600_constants.c +13 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/indcpa.c +1 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.c +7 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/kem.h +29 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h +156 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h +137 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/compress_d5_table.c +43 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d10_table.c +50 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d11_table.c +53 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d4_table.c +44 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/decompress_d5_table.c +53 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_intt_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_ntt_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d10_aarch64_asm.S +439 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d11_aarch64_asm.S +452 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d4_aarch64_asm.S +106 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_compress_d5_aarch64_asm.S +124 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d10_aarch64_asm.S +108 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d11_aarch64_asm.S +116 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d4_aarch64_asm.S +93 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_decompress_d5_aarch64_asm.S +104 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_frombytes_aarch64_asm.S +84 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_mulcache_compute_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_reduce_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tobytes_aarch64_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tomont_aarch64_asm.S +4 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S +4 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_rej_uniform_aarch64_asm.S +112 -104
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h +0 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/README.md +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/meta.h +16 -21
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h +1 -0
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_intt_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_ntt_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_poly_tomont_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_reduce_ppc_asm.S +6 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.c +5 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_debug.h +2 -2
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/rv64v_poly.c +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/arith_native_x86_64.h +5 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_intt_avx2_asm.S +36 -33
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntt_avx2_asm.S +67 -65
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttfrombytes_avx2_asm.S +8 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntttobytes_avx2_asm.S +6 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttunpack_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d10_avx2_asm.S +7 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d11_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d4_avx2_asm.S +7 -5
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d5_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d10_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d11_avx2_asm.S +6 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d4_avx2_asm.S +7 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d5_avx2_asm.S +6 -4
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_mulcache_compute_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S +118 -115
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S +174 -171
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S +230 -227
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_reduce_avx2_asm.S +17 -15
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_rej_uniform_avx2_asm.S +7 -6
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_tomont_avx2_asm.S +5 -3
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.c +4 -9
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly_k.h +1 -1
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/sys.h +31 -44
- data/ext/pqcrypto/vendor/mlkem-native/mlkem/src/verify.h +1 -1
- data/lib/pq_crypto/version.rb +1 -1
- data/script/vendor_libs.rb +6 -6
- metadata +36 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* RV32-IM ML-DSA pointwise polynomial multiplication with Montgomery
|
|
8
|
+
* reduction. Computes
|
|
9
|
+
*
|
|
10
|
+
* a[i] = (a[i] * b[i]) * R^-1 mod q, R = 2^32, |result| < q,
|
|
11
|
+
*
|
|
12
|
+
* for 0 <= i < 256, in-place in a.
|
|
13
|
+
*
|
|
14
|
+
* Modular arithmetic: signed Montgomery reduction. Write R = 2^32 and
|
|
15
|
+
* QINV = q^-1 mod R = 58728449. Unlike the NTT, neither operand is constant,
|
|
16
|
+
* so a twisted constant cannot be precomputed. For p = a*b, the kernel uses
|
|
17
|
+
* four multiplications:
|
|
18
|
+
*
|
|
19
|
+
* plo = low(p)
|
|
20
|
+
* phi = high(p)
|
|
21
|
+
* m = low(plo * QINV), interpreted as signed
|
|
22
|
+
* mhi = high(m * q)
|
|
23
|
+
* r = phi - mhi = (p - m*q) / R.
|
|
24
|
+
*
|
|
25
|
+
* The low words of p and m*q agree because m*q == plo (mod R), so p-m*q
|
|
26
|
+
* is divisible by R and the high-word subtraction computes its quotient.
|
|
27
|
+
* Consequently r == a*b*R^-1 (mod q).
|
|
28
|
+
*
|
|
29
|
+
* MLD_NTT_BOUND is the exclusive postcondition of the generic C and native
|
|
30
|
+
* forward-NTT interfaces and the exclusive input precondition of pointwise
|
|
31
|
+
* Montgomery multiplication. It is therefore the full input range exposed
|
|
32
|
+
* to this routine by the C/CBMC-facing interface, not an additional
|
|
33
|
+
* assembly-specific assumption.
|
|
34
|
+
*
|
|
35
|
+
* Inputs satisfy
|
|
36
|
+
*
|
|
37
|
+
* |a|, |b| < MLD_NTT_BOUND = 94279698,
|
|
38
|
+
* |p| < 94279698^2 = 8888661454971204
|
|
39
|
+
* < q*R/2 = 17996808470921216.
|
|
40
|
+
*
|
|
41
|
+
* Signed Montgomery reduction then gives |r| < |p|/R + q/2 < q. In
|
|
42
|
+
* particular, `phi-mhi` is in signed int32 range and cannot overflow. The
|
|
43
|
+
* q-bound is also the pointwise postcondition and the inverse-NTT input
|
|
44
|
+
* precondition, so the forward NTT, pointwise product, and inverse NTT
|
|
45
|
+
* compose under the shared contracts.
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
/*yaml
|
|
49
|
+
Name: poly_pointwise_montgomery_rv32im_asm
|
|
50
|
+
Description: RV32IM pointwise Montgomery multiplication of two polynomials
|
|
51
|
+
Signature: void mld_poly_pointwise_montgomery_rv32im_asm(int32_t a[256], const int32_t b[256])
|
|
52
|
+
ABI:
|
|
53
|
+
Architecture: riscv32
|
|
54
|
+
CallingConvention: ILP32
|
|
55
|
+
Features: [RV32M]
|
|
56
|
+
a0:
|
|
57
|
+
type: buffer
|
|
58
|
+
size_bytes: 1024
|
|
59
|
+
permissions: read/write
|
|
60
|
+
c_parameter: int32_t a[256]
|
|
61
|
+
description: Input/output polynomial (256 x int32_t)
|
|
62
|
+
a1:
|
|
63
|
+
type: buffer
|
|
64
|
+
size_bytes: 1024
|
|
65
|
+
permissions: read-only
|
|
66
|
+
c_parameter: const int32_t b[256]
|
|
67
|
+
description: Input polynomial (256 x int32_t)
|
|
68
|
+
*/
|
|
69
|
+
|
|
70
|
+
#include "../../../common.h"
|
|
71
|
+
#if defined(MLD_SYS_RISCV32_M) && \
|
|
72
|
+
defined(MLD_ARITH_BACKEND_RV32IM) && \
|
|
73
|
+
(!defined(MLD_CONFIG_NO_SIGN_API) || !defined(MLD_CONFIG_NO_VERIFY_API) || \
|
|
74
|
+
defined(MLD_CONFIG_REDUCE_RAM) || defined(MLD_UNIT_TEST)) && \
|
|
75
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
76
|
+
/* Without linker relaxation, GNU as resolves the branches to .L
|
|
77
|
+
* labels and leaves no relocations in the kernel. It uses the
|
|
78
|
+
* setting in force at the end of the file, so keep this outside
|
|
79
|
+
* the push/pop below. */
|
|
80
|
+
.option norelax
|
|
81
|
+
/* Keep RV32IMC builds byte-identical to the verified RV32IM code. */
|
|
82
|
+
.option push
|
|
83
|
+
.option norvc
|
|
84
|
+
|
|
85
|
+
/*
|
|
86
|
+
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
87
|
+
* dev/riscv32/src/mldsa_poly_pointwise_montgomery_rv32im_asm.S using scripts/simpasm. Do not modify it directly.
|
|
88
|
+
*/
|
|
89
|
+
|
|
90
|
+
.text
|
|
91
|
+
.balign 4
|
|
92
|
+
.global MLD_ASM_NAMESPACE(poly_pointwise_montgomery_rv32im_asm)
|
|
93
|
+
MLD_ASM_FN_SYMBOL(poly_pointwise_montgomery_rv32im_asm)
|
|
94
|
+
|
|
95
|
+
.cfi_startproc
|
|
96
|
+
addi sp, sp, -0x10
|
|
97
|
+
.cfi_adjust_cfa_offset 0x10
|
|
98
|
+
sw s0, 0x0(sp)
|
|
99
|
+
.cfi_rel_offset s0, 0x0
|
|
100
|
+
sw s1, 0x4(sp)
|
|
101
|
+
.cfi_rel_offset s1, 0x4
|
|
102
|
+
lui s0, 0x7fe
|
|
103
|
+
addi s0, s0, 0x1
|
|
104
|
+
lui s1, 0x3802
|
|
105
|
+
addi s1, s1, 0x1
|
|
106
|
+
addi t0, a0, 0x400
|
|
107
|
+
|
|
108
|
+
.Lmld_poly_pointwise_montgomery_rv32im_loop:
|
|
109
|
+
lw a2, 0x0(a0)
|
|
110
|
+
lw a3, 0x0(a1)
|
|
111
|
+
mul a4, a2, a3
|
|
112
|
+
mulh a5, a2, a3
|
|
113
|
+
mul a6, a4, s1
|
|
114
|
+
mulh a7, a6, s0
|
|
115
|
+
sub a2, a5, a7
|
|
116
|
+
sw a2, 0x0(a0)
|
|
117
|
+
addi a0, a0, 0x4
|
|
118
|
+
addi a1, a1, 0x4
|
|
119
|
+
bne a0, t0, .Lmld_poly_pointwise_montgomery_rv32im_loop
|
|
120
|
+
lw s0, 0x0(sp)
|
|
121
|
+
.cfi_restore s0
|
|
122
|
+
lw s1, 0x4(sp)
|
|
123
|
+
.cfi_restore s1
|
|
124
|
+
addi sp, sp, 0x10
|
|
125
|
+
.cfi_adjust_cfa_offset -0x10
|
|
126
|
+
ret
|
|
127
|
+
.cfi_endproc
|
|
128
|
+
|
|
129
|
+
MLD_ASM_FN_SIZE(poly_pointwise_montgomery_rv32im_asm)
|
|
130
|
+
|
|
131
|
+
.option pop
|
|
132
|
+
#endif /* MLD_SYS_RISCV32_M && MLD_ARITH_BACKEND_RV32IM && \
|
|
133
|
+
(!MLD_CONFIG_NO_SIGN_API || !MLD_CONFIG_NO_VERIFY_API || \
|
|
134
|
+
MLD_CONFIG_REDUCE_RAM || MLD_UNIT_TEST) && \
|
|
135
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
136
|
+
|
|
137
|
+
#if defined(__ELF__)
|
|
138
|
+
.section .note.GNU-stack,"",%progbits
|
|
139
|
+
#endif
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/*
|
|
7
|
+
* WARNING: This file is auto-generated from scripts/autogen
|
|
8
|
+
* in the mldsa-native repository.
|
|
9
|
+
* Do not modify it directly.
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
#include "../../../common.h"
|
|
13
|
+
|
|
14
|
+
#if defined(MLD_ARITH_BACKEND_RV32IM) && \
|
|
15
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
16
|
+
|
|
17
|
+
#include "arith_native_rv32im.h"
|
|
18
|
+
|
|
19
|
+
/*
|
|
20
|
+
* Table of zeta values used in the RV32-IM forward NTT.
|
|
21
|
+
* Each entry is a (zeta, w) Barrett pair, with zeta the plain
|
|
22
|
+
* centered twiddle (|zeta| <= q/2) and w = round(zeta * 2^32 / q)
|
|
23
|
+
* the Barrett multiplier. See autogen for details.
|
|
24
|
+
*/
|
|
25
|
+
MLD_ALIGN MLD_INTERNAL_DATA_DEFINITION const int32_t
|
|
26
|
+
mld_rv32im_ntt_zetas[510] = {
|
|
27
|
+
-3572223, -1830765815, 3765607, 1929875198, 3761513, 1927777021,
|
|
28
|
+
-3201494, -1640767044, -601683, -308362795, 3542485, 1815525077,
|
|
29
|
+
-2883726, -1477910808, 2682288, 1374673747, 2129892, 1091570561,
|
|
30
|
+
-3145678, -1612161320, 3764867, 1929495947, -1005239, -515185417,
|
|
31
|
+
-3201430, -1640734244, 557458, 285697463, -1221177, -625853735,
|
|
32
|
+
-3370349, -1727305304, 3602218, 1846138265, 3182878, 1631226336,
|
|
33
|
+
-4063053, -2082316400, 2740543, 1404529459, -3586446, -1838055109,
|
|
34
|
+
2663378, 1364982364, -3110818, -1594295555, 2101410, 1076973524,
|
|
35
|
+
-1674615, -858240904, 3704823, 1898723372, 1159875, 594436433,
|
|
36
|
+
-3524442, -1806278032, 394148, 202001019, 928749, 475984260,
|
|
37
|
+
-434125, -222489248, 1095468, 561427818, -3506380, -1797021249,
|
|
38
|
+
676590, 346752664, 2071829, 1061813248, -4018989, -2059733581,
|
|
39
|
+
-1335936, -684667771, 3241972, 1661512036, 2156050, 1104976547,
|
|
40
|
+
-3227876, -1654287830, 3415069, 1750224323, 1759347, 901666090,
|
|
41
|
+
1714295, 878576921, -817536, -418987550, -3574466, -1831915353,
|
|
42
|
+
2453983, 1257667337, 3756790, 1925356481, -1935799, -992097815,
|
|
43
|
+
1460718, 748618600, -1716988, -879957084, -3950053, -2024403852,
|
|
44
|
+
-642628, -329347125, -2897314, -1484874664, 3192354, 1636082790,
|
|
45
|
+
-3585098, -1837364258, 556856, 285388938, 3870317, 1983539117,
|
|
46
|
+
2815639, 1443016191, 2917338, 1495136972, 1853806, 950076368,
|
|
47
|
+
2283733, 1170414139, 3345963, 1714807468, 1858416, 952438995,
|
|
48
|
+
3073009, 1574918427, 1753, 898413, -1935420, -991903578,
|
|
49
|
+
1277625, 654783359, -2659525, -1363007700, -1455890, -746144248,
|
|
50
|
+
-2635473, -1350681039, 2660408, 1363460238, -1780227, -912367099,
|
|
51
|
+
3852015, 1974159335, -59148, -30313375, 2772600, 1420958686,
|
|
52
|
+
4183372, 2143979939, 1182243, 605900043, 87208, 44694137,
|
|
53
|
+
-3222807, -1651689966, 636927, 326425360, -3965306, -2032221021,
|
|
54
|
+
-3121440, -1599739335, -3956745, -2027833504, -2296397, -1176904444,
|
|
55
|
+
-274060, -140455867, -3284915, -1683520342, -3716946, -1904936414,
|
|
56
|
+
2508980, 1285853323, -27812, -14253662, 822541, 421552614,
|
|
57
|
+
2028118, 1039411342, 1009365, 517299994, -2454145, -1257750362,
|
|
58
|
+
1937570, 993005454, -1979497, -1014493059, 1596822, 818371958,
|
|
59
|
+
-3815725, -1955560694, -3956944, -2027935492, -3759465, -1926727420,
|
|
60
|
+
2811291, 1440787840, -1685153, -863641633, -3410568, -1747917558,
|
|
61
|
+
-2983781, -1529189038, 2678278, 1372618620, -3768948, -1931587462,
|
|
62
|
+
-1109516, -568627424, -3551006, -1819892093, 635956, 325927722,
|
|
63
|
+
4158088, 2131021878, -250446, -128353682, -2455377, -1258381762,
|
|
64
|
+
1528066, 783134478, -4146264, -2124962073, -1772588, -908452108,
|
|
65
|
+
482649, 247357819, 2192938, 1123881663, -1727088, -885133339,
|
|
66
|
+
1148858, 588790216, 2387513, 1223601433, -3611750, -1851023419,
|
|
67
|
+
-2962264, -1518161567, -268456, -137583815, -3180456, -1629985060,
|
|
68
|
+
-565603, -289871779, 3747250, 1920467227, 2296099, 1176751719,
|
|
69
|
+
169688, 86965173, 1239911, 635454918, -3838479, -1967222129,
|
|
70
|
+
2462444, 1262003603, 3195676, 1637785316, 2642980, 1354528380,
|
|
71
|
+
-3334383, -1708872713, 1254190, 642772911, -12417, -6363718,
|
|
72
|
+
-4166425, -2135294594, 2998219, 1536588520, 141835, 72690498,
|
|
73
|
+
-3488383, -1787797779, -89301, -45766801, 2513018, 1287922800,
|
|
74
|
+
1987814, 1018755525, -1354892, -694382729, 613238, 314284737,
|
|
75
|
+
-3197248, -1638590967, -1310261, -671509323, -2218467, -1136965286,
|
|
76
|
+
1736313, 889861155, -458740, -235104446, -1921994, -985022747,
|
|
77
|
+
235407, 120646188, 4040196, 2070602178, -3472069, -1779436847,
|
|
78
|
+
-3250154, -1665705315, 2039144, 1045062172, -1879878, -963438279,
|
|
79
|
+
3258457, 1669960606, -818761, -419615363, -2178965, -1116720494,
|
|
80
|
+
-2579253, -1321868265, -1623354, -831969619, 2105286, 1078959975,
|
|
81
|
+
1787943, 916321552, -2374402, -1216882040, -2033807, -1042326957,
|
|
82
|
+
-2391089, -1225434135, 586241, 300448763, -1179613, -604552167,
|
|
83
|
+
-2254727, -1155548552, 527981, 270590488, -2743411, -1405999311,
|
|
84
|
+
3482206, 1784632064, -1476985, -756955444, 1994046, 1021949428,
|
|
85
|
+
-4182915, -2143745726, 2491325, 1276805128, -1393159, -713994583,
|
|
86
|
+
-1300016, -666258756, 507927, 260312805, -1187885, -608791570,
|
|
87
|
+
-2362063, -1210558298, -724804, -371462360, -1834526, -940195359,
|
|
88
|
+
-1317678, -675310538, -3033742, -1554794072, -338420, -173440395,
|
|
89
|
+
2461387, 1261461890, 2647994, 1357098057, 3009748, 1542497137,
|
|
90
|
+
3035980, 1555941048, -2612853, -1339088280, 4148469, 2126092136,
|
|
91
|
+
621164, 318346816, 749577, 384158533, -4022750, -2061661095,
|
|
92
|
+
3901472, 1999506068, 3980599, 2040058690, 2569011, 1316619236,
|
|
93
|
+
-1226661, -628664287, -1615530, -827959816, 1723229, 883155599,
|
|
94
|
+
2925816, 1499481951, 1665318, 853476187, 2028038, 1039370342,
|
|
95
|
+
3374250, 1729304568, 1163598, 596344473, -3369273, -1726753853,
|
|
96
|
+
1356448, 695180180, 3994671, 2047270596, -11879, -6087993,
|
|
97
|
+
-2775755, -1422575624, -1370517, -702390549, 3020393, 1547952704,
|
|
98
|
+
2683270, 1375177022, 3363542, 1723816713, 214880, 110126092,
|
|
99
|
+
-2778788, -1424130038, 545376, 279505433, -770441, -394851342,
|
|
100
|
+
-3467665, -1777179795, 3105558, 1591599803, -1103344, -565464272,
|
|
101
|
+
2312838, 1185330464, 508145, 260424530, -553718, -283780712,
|
|
102
|
+
-653275, -334803717, 860144, 440824168, 3430436, 1758099917,
|
|
103
|
+
-459163, -235321234, 140244, 71875110, -1514152, -776003547,
|
|
104
|
+
348812, 178766299, -2185084, -1119856484, 3123762, 1600929361,
|
|
105
|
+
-327848, -168022240, 2358373, 1208667171, -2193087, -1123958025,
|
|
106
|
+
1011223, 518252220, -3014420, -1544891539, -1716814, -879867909,
|
|
107
|
+
-2354215, -1206536194, 2926054, 1499603926, -392707, -201262505,
|
|
108
|
+
-3818627, -1957047970, -303005, -155290192, 3531229, 1809756372,
|
|
109
|
+
-1922253, -985155484, -3974485, -2036925262, -3773731, -1934038751,
|
|
110
|
+
-2236726, -1146323031, 1900052, 973777462, -781875, -400711272,
|
|
111
|
+
1744507, 894060583, 1054478, 540420426, -731434, -374860238,
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
#else /* MLD_ARITH_BACKEND_RV32IM && !MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
115
|
+
|
|
116
|
+
MLD_EMPTY_CU(rv32im_zetas)
|
|
117
|
+
|
|
118
|
+
#endif /* !(MLD_ARITH_BACKEND_RV32IM && !MLD_CONFIG_MULTILEVEL_NO_SHARED) */
|
|
@@ -31,7 +31,6 @@
|
|
|
31
31
|
#define MLD_USE_NATIVE_POLYVECL_POINTWISE_ACC_MONTGOMERY_L7
|
|
32
32
|
|
|
33
33
|
#if !defined(__ASSEMBLER__)
|
|
34
|
-
#include <string.h>
|
|
35
34
|
#include "../../common.h"
|
|
36
35
|
#include "../api.h"
|
|
37
36
|
#include "src/arith_native_x86_64.h"
|
|
@@ -101,8 +100,9 @@ static MLD_INLINE int mld_rej_uniform_eta2_native(int32_t *r, unsigned len,
|
|
|
101
100
|
/* Constant time: Inputs and outputs to this function are secret.
|
|
102
101
|
* It is safe to leak which coefficients are accepted/rejected.
|
|
103
102
|
* The assembly implementation must not leak any other information about the
|
|
104
|
-
* accepted coefficients. Constant-time testing cannot cover this,
|
|
105
|
-
*
|
|
103
|
+
* accepted coefficients. Constant-time testing cannot cover this, but the
|
|
104
|
+
* HOL Light proof of the assembly does: its timing depends only on which
|
|
105
|
+
* coefficients are accepted.
|
|
106
106
|
* We declassify prior the input data and mark the outputs as secret.
|
|
107
107
|
*/
|
|
108
108
|
MLD_CT_TESTING_DECLASSIFY(buf, buflen);
|
|
@@ -130,8 +130,9 @@ static MLD_INLINE int mld_rej_uniform_eta4_native(int32_t *r, unsigned len,
|
|
|
130
130
|
/* Constant time: Inputs and outputs to this function are secret.
|
|
131
131
|
* It is safe to leak which coefficients are accepted/rejected.
|
|
132
132
|
* The assembly implementation must not leak any other information about the
|
|
133
|
-
* accepted coefficients. Constant-time testing cannot cover this,
|
|
134
|
-
*
|
|
133
|
+
* accepted coefficients. Constant-time testing cannot cover this, but the
|
|
134
|
+
* HOL Light proof of the assembly does: its timing depends only on which
|
|
135
|
+
* coefficients are accepted.
|
|
135
136
|
* We declassify prior the input data and mark the outputs as secret.
|
|
136
137
|
*/
|
|
137
138
|
MLD_CT_TESTING_DECLASSIFY(buf, buflen);
|
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
#ifndef MLD_NATIVE_X86_64_SRC_ARITH_NATIVE_X86_64_H
|
|
7
7
|
#define MLD_NATIVE_X86_64_SRC_ARITH_NATIVE_X86_64_H
|
|
8
8
|
#include "../../../common.h"
|
|
9
|
-
|
|
10
9
|
#include "consts.h"
|
|
11
10
|
|
|
12
11
|
#define MLD_AVX2_REJ_UNIFORM_BUFLEN \
|
|
@@ -209,7 +208,7 @@ __contract__(
|
|
|
209
208
|
|
|
210
209
|
#define mld_poly_chknorm_avx2_asm MLD_NAMESPACE(poly_chknorm_avx2_asm)
|
|
211
210
|
MLD_MUST_CHECK_RETURN_VALUE MLD_SYSV_ABI
|
|
212
|
-
int mld_poly_chknorm_avx2_asm(const int32_t *a,
|
|
211
|
+
int mld_poly_chknorm_avx2_asm(const int32_t *a, int64_t B)
|
|
213
212
|
/* This must be kept in sync with the HOL-Light specification
|
|
214
213
|
* in proofs/hol_light/x86_64/proofs/mldsa_poly_chknorm_avx2_asm.ml */
|
|
215
214
|
__contract__(
|
|
@@ -217,7 +216,7 @@ __contract__(
|
|
|
217
216
|
/* HOL Light precondition: abs(ival(x i)) < 2^31, i.e., a[i] != INT32_MIN */
|
|
218
217
|
requires(forall(k0, 0, MLDSA_N, a[k0] > INT32_MIN))
|
|
219
218
|
/* HOL Light precondition: 0 <= ival bound (asm computes B-1 internally) */
|
|
220
|
-
requires(B
|
|
219
|
+
requires(0 <= B && B <= INT32_MAX)
|
|
221
220
|
ensures(return_value == 0 || return_value == 1)
|
|
222
221
|
ensures((return_value == 0) == array_abs_bound(a, 0, MLDSA_N, B))
|
|
223
222
|
);
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
#include "../../../common.h"
|
|
44
|
-
#if defined(
|
|
44
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
45
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
45
46
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
46
47
|
|
|
47
48
|
/*
|
|
@@ -2320,13 +2321,14 @@ MLD_ASM_FN_SYMBOL(invntt_avx2_asm)
|
|
|
2320
2321
|
vmovdqa %ymm5, 0xe0(%rdi)
|
|
2321
2322
|
vmovdqa %ymm6, 0x160(%rdi)
|
|
2322
2323
|
vmovdqa %ymm7, 0x1e0(%rdi)
|
|
2324
|
+
vzeroupper
|
|
2323
2325
|
retq
|
|
2324
2326
|
.cfi_endproc
|
|
2325
2327
|
|
|
2326
2328
|
MLD_ASM_FN_SIZE(invntt_avx2_asm)
|
|
2327
2329
|
|
|
2328
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
2329
|
-
|
|
2330
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
2331
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
2330
2332
|
|
|
2331
2333
|
#if defined(__ELF__)
|
|
2332
2334
|
.section .note.GNU-stack,"",%progbits
|
|
@@ -41,7 +41,8 @@
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
#include "../../../common.h"
|
|
44
|
-
#if defined(
|
|
44
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
45
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
45
46
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
46
47
|
|
|
47
48
|
/*
|
|
@@ -2392,13 +2393,14 @@ MLD_ASM_FN_SYMBOL(ntt_avx2_asm)
|
|
|
2392
2393
|
vmovdqa %ymm4, 0x3a0(%rdi)
|
|
2393
2394
|
vmovdqa %ymm3, 0x3c0(%rdi)
|
|
2394
2395
|
vmovdqa %ymm11, 0x3e0(%rdi)
|
|
2396
|
+
vzeroupper
|
|
2395
2397
|
retq
|
|
2396
2398
|
.cfi_endproc
|
|
2397
2399
|
|
|
2398
2400
|
MLD_ASM_FN_SIZE(ntt_avx2_asm)
|
|
2399
2401
|
|
|
2400
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
2401
|
-
|
|
2402
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
2403
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
2402
2404
|
|
|
2403
2405
|
#if defined(__ELF__)
|
|
2404
2406
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_nttunpack_avx2_asm.S
CHANGED
|
@@ -35,7 +35,8 @@
|
|
|
35
35
|
*/
|
|
36
36
|
|
|
37
37
|
#include "../../../common.h"
|
|
38
|
-
#if defined(
|
|
38
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
39
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
39
40
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
40
41
|
|
|
41
42
|
/*
|
|
@@ -241,13 +242,14 @@ MLD_ASM_FN_SYMBOL(nttunpack_avx2_asm)
|
|
|
241
242
|
vmovdqa %ymm4, 0x3a0(%rdi)
|
|
242
243
|
vmovdqa %ymm3, 0x3c0(%rdi)
|
|
243
244
|
vmovdqa %ymm11, 0x3e0(%rdi)
|
|
245
|
+
vzeroupper
|
|
244
246
|
retq
|
|
245
247
|
.cfi_endproc
|
|
246
248
|
|
|
247
249
|
MLD_ASM_FN_SIZE(nttunpack_avx2_asm)
|
|
248
250
|
|
|
249
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
250
|
-
|
|
251
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
252
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
251
253
|
|
|
252
254
|
#if defined(__ELF__)
|
|
253
255
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l4_avx2_asm.S
CHANGED
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
#include "../../../common.h"
|
|
55
|
-
#if defined(
|
|
55
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
56
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
56
57
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
57
58
|
(defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 4)
|
|
58
59
|
|
|
@@ -160,13 +161,15 @@ Lmld_pointwise_acc_l4_avx2_looptop2:
|
|
|
160
161
|
addl $0x1, %eax
|
|
161
162
|
cmpl $0x10, %eax
|
|
162
163
|
jb Lmld_pointwise_acc_l4_avx2_looptop2
|
|
164
|
+
vzeroupper
|
|
163
165
|
retq
|
|
164
166
|
.cfi_endproc
|
|
165
167
|
|
|
166
168
|
MLD_ASM_FN_SIZE(pointwise_acc_l4_avx2_asm)
|
|
167
169
|
|
|
168
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
169
|
-
&&
|
|
170
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
171
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
172
|
+
(MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 4) */
|
|
170
173
|
|
|
171
174
|
#if defined(__ELF__)
|
|
172
175
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l5_avx2_asm.S
CHANGED
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
#include "../../../common.h"
|
|
55
|
-
#if defined(
|
|
55
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
56
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
56
57
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
57
58
|
(defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 5)
|
|
58
59
|
|
|
@@ -176,13 +177,15 @@ Lmld_pointwise_acc_l5_avx2_looptop2:
|
|
|
176
177
|
addl $0x1, %eax
|
|
177
178
|
cmpl $0x10, %eax
|
|
178
179
|
jb Lmld_pointwise_acc_l5_avx2_looptop2
|
|
180
|
+
vzeroupper
|
|
179
181
|
retq
|
|
180
182
|
.cfi_endproc
|
|
181
183
|
|
|
182
184
|
MLD_ASM_FN_SIZE(pointwise_acc_l5_avx2_asm)
|
|
183
185
|
|
|
184
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
185
|
-
&&
|
|
186
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
187
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
188
|
+
(MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 5) */
|
|
186
189
|
|
|
187
190
|
#if defined(__ELF__)
|
|
188
191
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l7_avx2_asm.S
CHANGED
|
@@ -52,7 +52,8 @@
|
|
|
52
52
|
*/
|
|
53
53
|
|
|
54
54
|
#include "../../../common.h"
|
|
55
|
-
#if defined(
|
|
55
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
56
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
56
57
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
57
58
|
(defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || MLDSA_L == 7)
|
|
58
59
|
|
|
@@ -208,13 +209,15 @@ Lmld_pointwise_acc_l7_avx2_looptop2:
|
|
|
208
209
|
addl $0x1, %eax
|
|
209
210
|
cmpl $0x10, %eax
|
|
210
211
|
jb Lmld_pointwise_acc_l7_avx2_looptop2
|
|
212
|
+
vzeroupper
|
|
211
213
|
retq
|
|
212
214
|
.cfi_endproc
|
|
213
215
|
|
|
214
216
|
MLD_ASM_FN_SIZE(pointwise_acc_l7_avx2_asm)
|
|
215
217
|
|
|
216
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
217
|
-
&&
|
|
218
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
219
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
220
|
+
(MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLDSA_L == 7) */
|
|
218
221
|
|
|
219
222
|
#if defined(__ELF__)
|
|
220
223
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_avx2_asm.S
CHANGED
|
@@ -46,7 +46,8 @@
|
|
|
46
46
|
*/
|
|
47
47
|
|
|
48
48
|
#include "../../../common.h"
|
|
49
|
-
#if defined(
|
|
49
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
50
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
50
51
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
51
52
|
|
|
52
53
|
/*
|
|
@@ -145,13 +146,14 @@ Lmld_pointwise_avx2_looptop1:
|
|
|
145
146
|
vpblendd $0x55, %ymm4, %ymm5, %ymm4 # ymm4 = ymm4[0],ymm5[1],ymm4[2],ymm5[3],ymm4[4],ymm5[5],ymm4[6],ymm5[7]
|
|
146
147
|
vmovdqa %ymm2, (%rdi)
|
|
147
148
|
vmovdqa %ymm4, 0x20(%rdi)
|
|
149
|
+
vzeroupper
|
|
148
150
|
retq
|
|
149
151
|
.cfi_endproc
|
|
150
152
|
|
|
151
153
|
MLD_ASM_FN_SIZE(pointwise_avx2_asm)
|
|
152
154
|
|
|
153
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
154
|
-
|
|
155
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
156
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
155
157
|
|
|
156
158
|
#if defined(__ELF__)
|
|
157
159
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_caddq_avx2_asm.S
CHANGED
|
@@ -38,7 +38,8 @@
|
|
|
38
38
|
|
|
39
39
|
#include "../../../common.h"
|
|
40
40
|
|
|
41
|
-
#if defined(
|
|
41
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
42
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
42
43
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
43
44
|
|
|
44
45
|
|
|
@@ -185,14 +186,15 @@ MLD_ASM_FN_SYMBOL(poly_caddq_avx2_asm)
|
|
|
185
186
|
vpand %ymm1, %ymm5, %ymm5
|
|
186
187
|
vpaddd 0x3e0(%rdi), %ymm5, %ymm5
|
|
187
188
|
vmovdqa %ymm5, 0x3e0(%rdi)
|
|
189
|
+
vzeroupper
|
|
188
190
|
retq
|
|
189
191
|
.cfi_endproc
|
|
190
192
|
|
|
191
193
|
MLD_ASM_FN_SIZE(poly_caddq_avx2_asm)
|
|
192
194
|
|
|
193
195
|
|
|
194
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
195
|
-
|
|
196
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
197
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
196
198
|
|
|
197
199
|
#if defined(__ELF__)
|
|
198
200
|
.section .note.GNU-stack,"",%progbits
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S
CHANGED
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
Check the infinity norm of the polynomial against the given bound B.
|
|
25
25
|
Returns 0 if the norm is strictly smaller than B; otherwise returns 1
|
|
26
26
|
(i.e. returns 1 if any |coefficient| >= B, 0 otherwise).
|
|
27
|
-
Signature: int mld_poly_chknorm_avx2_asm(const int32_t *a,
|
|
27
|
+
Signature: int mld_poly_chknorm_avx2_asm(const int32_t *a, int64_t B)
|
|
28
28
|
ABI:
|
|
29
29
|
Architecture: x86_64
|
|
30
30
|
CallingConvention: SysV
|
|
@@ -37,14 +37,15 @@
|
|
|
37
37
|
description: Input polynomial (256 x int32_t)
|
|
38
38
|
rsi:
|
|
39
39
|
type: scalar
|
|
40
|
-
c_parameter:
|
|
40
|
+
c_parameter: int64_t B
|
|
41
41
|
description: Norm bound (must be non-negative)
|
|
42
42
|
test_with: 131072 # representative non-negative bound (1 << 17)
|
|
43
43
|
*/
|
|
44
44
|
|
|
45
45
|
#include "../../../common.h"
|
|
46
46
|
|
|
47
|
-
#if defined(
|
|
47
|
+
#if defined(MLD_SYS_X86_64_AVX2) && \
|
|
48
|
+
defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
48
49
|
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
49
50
|
|
|
50
51
|
|
|
@@ -162,14 +163,15 @@ MLD_ASM_FN_SYMBOL(poly_chknorm_avx2_asm)
|
|
|
162
163
|
xorl %eax, %eax
|
|
163
164
|
vptest %ymm1, %ymm1
|
|
164
165
|
setne %al
|
|
166
|
+
vzeroupper
|
|
165
167
|
retq
|
|
166
168
|
.cfi_endproc
|
|
167
169
|
|
|
168
170
|
MLD_ASM_FN_SIZE(poly_chknorm_avx2_asm)
|
|
169
171
|
|
|
170
172
|
|
|
171
|
-
#endif /* MLD_ARITH_BACKEND_X86_64_DEFAULT &&
|
|
172
|
-
|
|
173
|
+
#endif /* MLD_SYS_X86_64_AVX2 && MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
174
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED */
|
|
173
175
|
|
|
174
176
|
#if defined(__ELF__)
|
|
175
177
|
.section .note.GNU-stack,"",%progbits
|