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,331 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* References
|
|
7
|
+
* ==========
|
|
8
|
+
*
|
|
9
|
+
* - [NeonNTT_Autoformalised]
|
|
10
|
+
* Neon NTT - (Auto)formalised
|
|
11
|
+
* Hanno Becker
|
|
12
|
+
* https://eprint.iacr.org/2026/1223
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* RV32-IM ML-DSA inverse NTT, fast-multiplier variant.
|
|
17
|
+
*
|
|
18
|
+
* Thin wrapper: the kernel body is shared via mldsa_intt_rv32im_asm.i, which
|
|
19
|
+
* computes the Barrett low(t*q) reduction with a single multiply by q here.
|
|
20
|
+
* `native/rv32im/fastmul.h` selects this wrapper; the slow-multiplier variant
|
|
21
|
+
* lives in mldsa_intt_rv32im_slowmul_asm.S.
|
|
22
|
+
* The coarse Barrett output bound used by the shared kernel is proved in
|
|
23
|
+
* @[NeonNTT_Autoformalised, Section 13.2].
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
/*yaml
|
|
27
|
+
Name: intt_rv32im_fastmul_asm
|
|
28
|
+
Description: RV32IM ML-DSA inverse NTT optimized for fast multipliers
|
|
29
|
+
Signature: void mld_intt_rv32im_fastmul_asm(int32_t r[256], const int32_t zetas[510])
|
|
30
|
+
ABI:
|
|
31
|
+
Architecture: riscv32
|
|
32
|
+
CallingConvention: ILP32
|
|
33
|
+
Features: [RV32M]
|
|
34
|
+
a0:
|
|
35
|
+
type: buffer
|
|
36
|
+
size_bytes: 1024
|
|
37
|
+
permissions: read/write
|
|
38
|
+
c_parameter: int32_t r[256]
|
|
39
|
+
description: Input/output polynomial (256 x int32_t)
|
|
40
|
+
a1:
|
|
41
|
+
type: buffer
|
|
42
|
+
size_bytes: 2040
|
|
43
|
+
permissions: read-only
|
|
44
|
+
c_parameter: const int32_t zetas[510]
|
|
45
|
+
description: Forward-NTT twiddle table reused in reverse
|
|
46
|
+
*/
|
|
47
|
+
|
|
48
|
+
#include "../../../common.h"
|
|
49
|
+
#if defined(MLD_SYS_RISCV32_M) && \
|
|
50
|
+
defined(MLD_ARITH_BACKEND_RV32IM) && \
|
|
51
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
52
|
+
defined(MLD_RV32IM_NEED_FASTMUL)
|
|
53
|
+
/* Without linker relaxation, GNU as resolves the branches to .L
|
|
54
|
+
* labels and leaves no relocations in the kernel. It uses the
|
|
55
|
+
* setting in force at the end of the file, so keep this outside
|
|
56
|
+
* the push/pop below. */
|
|
57
|
+
.option norelax
|
|
58
|
+
/* Keep RV32IMC builds byte-identical to the verified RV32IM code. */
|
|
59
|
+
.option push
|
|
60
|
+
.option norvc
|
|
61
|
+
|
|
62
|
+
/*
|
|
63
|
+
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
64
|
+
* dev/riscv32/src/mldsa_intt_rv32im_asm.S using scripts/simpasm. Do not modify it directly.
|
|
65
|
+
*/
|
|
66
|
+
|
|
67
|
+
.text
|
|
68
|
+
.balign 4
|
|
69
|
+
.global MLD_ASM_NAMESPACE(intt_rv32im_fastmul_asm)
|
|
70
|
+
MLD_ASM_FN_SYMBOL(intt_rv32im_fastmul_asm)
|
|
71
|
+
|
|
72
|
+
.cfi_startproc
|
|
73
|
+
addi sp, sp, -0x20
|
|
74
|
+
.cfi_adjust_cfa_offset 0x20
|
|
75
|
+
sw s0, 0x0(sp)
|
|
76
|
+
.cfi_rel_offset s0, 0x0
|
|
77
|
+
sw s1, 0x4(sp)
|
|
78
|
+
.cfi_rel_offset s1, 0x4
|
|
79
|
+
sw s2, 0x8(sp)
|
|
80
|
+
.cfi_rel_offset s2, 0x8
|
|
81
|
+
sw s3, 0xc(sp)
|
|
82
|
+
.cfi_rel_offset s3, 0xc
|
|
83
|
+
sw s4, 0x10(sp)
|
|
84
|
+
.cfi_rel_offset s4, 0x10
|
|
85
|
+
sw s5, 0x14(sp)
|
|
86
|
+
.cfi_rel_offset s5, 0x14
|
|
87
|
+
sw s6, 0x18(sp)
|
|
88
|
+
.cfi_rel_offset s6, 0x18
|
|
89
|
+
sw s7, 0x1c(sp)
|
|
90
|
+
.cfi_rel_offset s7, 0x1c
|
|
91
|
+
lui t0, 0x7fe
|
|
92
|
+
addi t0, t0, 0x1
|
|
93
|
+
addi a1, a1, 0x7f8
|
|
94
|
+
mv t2, a0
|
|
95
|
+
addi t3, a0, 0x400
|
|
96
|
+
|
|
97
|
+
.Lmld_intt_rv32im_p1_outer:
|
|
98
|
+
addi a1, a1, -0x18
|
|
99
|
+
lw s0, 0x0(a1)
|
|
100
|
+
lw s1, 0x4(a1)
|
|
101
|
+
lw s2, 0x8(a1)
|
|
102
|
+
lw s3, 0xc(a1)
|
|
103
|
+
lw s4, 0x10(a1)
|
|
104
|
+
lw s5, 0x14(a1)
|
|
105
|
+
lw a2, 0x0(t2)
|
|
106
|
+
lw a3, 0x4(t2)
|
|
107
|
+
lw a4, 0x8(t2)
|
|
108
|
+
lw a5, 0xc(t2)
|
|
109
|
+
sub a6, a3, a2
|
|
110
|
+
add a2, a2, a3
|
|
111
|
+
mulh a7, a6, s5
|
|
112
|
+
mul a3, a6, s4
|
|
113
|
+
mul a7, a7, t0
|
|
114
|
+
sub a3, a3, a7
|
|
115
|
+
sub a6, a5, a4
|
|
116
|
+
add a4, a4, a5
|
|
117
|
+
mulh a7, a6, s3
|
|
118
|
+
mul a5, a6, s2
|
|
119
|
+
mul a7, a7, t0
|
|
120
|
+
sub a5, a5, a7
|
|
121
|
+
sub a6, a4, a2
|
|
122
|
+
add a2, a2, a4
|
|
123
|
+
mulh a7, a6, s1
|
|
124
|
+
mul a4, a6, s0
|
|
125
|
+
mul a7, a7, t0
|
|
126
|
+
sub a4, a4, a7
|
|
127
|
+
sub a6, a5, a3
|
|
128
|
+
add a3, a3, a5
|
|
129
|
+
mulh a7, a6, s1
|
|
130
|
+
mul a5, a6, s0
|
|
131
|
+
mul a7, a7, t0
|
|
132
|
+
sub a5, a5, a7
|
|
133
|
+
sw a2, 0x0(t2)
|
|
134
|
+
sw a3, 0x4(t2)
|
|
135
|
+
sw a4, 0x8(t2)
|
|
136
|
+
sw a5, 0xc(t2)
|
|
137
|
+
addi t2, t2, 0x10
|
|
138
|
+
bne t2, t3, .Lmld_intt_rv32im_p1_outer
|
|
139
|
+
mv t2, a0
|
|
140
|
+
addi t3, a0, 0x400
|
|
141
|
+
|
|
142
|
+
.Lmld_intt_rv32im_p2_outer:
|
|
143
|
+
addi a1, a1, -0x18
|
|
144
|
+
lw s0, 0x0(a1)
|
|
145
|
+
lw s1, 0x4(a1)
|
|
146
|
+
lw s2, 0x8(a1)
|
|
147
|
+
lw s3, 0xc(a1)
|
|
148
|
+
lw s4, 0x10(a1)
|
|
149
|
+
lw s5, 0x14(a1)
|
|
150
|
+
addi t4, t2, 0x10
|
|
151
|
+
|
|
152
|
+
.Lmld_intt_rv32im_p2_inner:
|
|
153
|
+
lw a2, 0x0(t2)
|
|
154
|
+
lw a3, 0x10(t2)
|
|
155
|
+
lw a4, 0x20(t2)
|
|
156
|
+
lw a5, 0x30(t2)
|
|
157
|
+
sub a6, a3, a2
|
|
158
|
+
add a2, a2, a3
|
|
159
|
+
mulh a7, a6, s5
|
|
160
|
+
mul a3, a6, s4
|
|
161
|
+
mul a7, a7, t0
|
|
162
|
+
sub a3, a3, a7
|
|
163
|
+
sub a6, a5, a4
|
|
164
|
+
add a4, a4, a5
|
|
165
|
+
mulh a7, a6, s3
|
|
166
|
+
mul a5, a6, s2
|
|
167
|
+
mul a7, a7, t0
|
|
168
|
+
sub a5, a5, a7
|
|
169
|
+
sub a6, a4, a2
|
|
170
|
+
add a2, a2, a4
|
|
171
|
+
mulh a7, a6, s1
|
|
172
|
+
mul a4, a6, s0
|
|
173
|
+
mul a7, a7, t0
|
|
174
|
+
sub a4, a4, a7
|
|
175
|
+
sub a6, a5, a3
|
|
176
|
+
add a3, a3, a5
|
|
177
|
+
mulh a7, a6, s1
|
|
178
|
+
mul a5, a6, s0
|
|
179
|
+
mul a7, a7, t0
|
|
180
|
+
sub a5, a5, a7
|
|
181
|
+
sw a2, 0x0(t2)
|
|
182
|
+
sw a3, 0x10(t2)
|
|
183
|
+
sw a4, 0x20(t2)
|
|
184
|
+
sw a5, 0x30(t2)
|
|
185
|
+
addi t2, t2, 0x4
|
|
186
|
+
bne t2, t4, .Lmld_intt_rv32im_p2_inner
|
|
187
|
+
addi t2, t2, 0x30
|
|
188
|
+
bne t2, t3, .Lmld_intt_rv32im_p2_outer
|
|
189
|
+
mv t2, a0
|
|
190
|
+
addi t3, a0, 0x400
|
|
191
|
+
|
|
192
|
+
.Lmld_intt_rv32im_p3_outer:
|
|
193
|
+
addi a1, a1, -0x18
|
|
194
|
+
lw s0, 0x0(a1)
|
|
195
|
+
lw s1, 0x4(a1)
|
|
196
|
+
lw s2, 0x8(a1)
|
|
197
|
+
lw s3, 0xc(a1)
|
|
198
|
+
lw s4, 0x10(a1)
|
|
199
|
+
lw s5, 0x14(a1)
|
|
200
|
+
addi t4, t2, 0x40
|
|
201
|
+
|
|
202
|
+
.Lmld_intt_rv32im_p3_inner:
|
|
203
|
+
lw a2, 0x0(t2)
|
|
204
|
+
lw a3, 0x40(t2)
|
|
205
|
+
lw a4, 0x80(t2)
|
|
206
|
+
lw a5, 0xc0(t2)
|
|
207
|
+
sub a6, a3, a2
|
|
208
|
+
add a2, a2, a3
|
|
209
|
+
mulh a7, a6, s5
|
|
210
|
+
mul a3, a6, s4
|
|
211
|
+
mul a7, a7, t0
|
|
212
|
+
sub a3, a3, a7
|
|
213
|
+
sub a6, a5, a4
|
|
214
|
+
add a4, a4, a5
|
|
215
|
+
mulh a7, a6, s3
|
|
216
|
+
mul a5, a6, s2
|
|
217
|
+
mul a7, a7, t0
|
|
218
|
+
sub a5, a5, a7
|
|
219
|
+
sub a6, a4, a2
|
|
220
|
+
add a2, a2, a4
|
|
221
|
+
mulh a7, a6, s1
|
|
222
|
+
mul a4, a6, s0
|
|
223
|
+
mul a7, a7, t0
|
|
224
|
+
sub a4, a4, a7
|
|
225
|
+
sub a6, a5, a3
|
|
226
|
+
add a3, a3, a5
|
|
227
|
+
mulh a7, a6, s1
|
|
228
|
+
mul a5, a6, s0
|
|
229
|
+
mul a7, a7, t0
|
|
230
|
+
sub a5, a5, a7
|
|
231
|
+
sw a2, 0x0(t2)
|
|
232
|
+
sw a3, 0x40(t2)
|
|
233
|
+
sw a4, 0x80(t2)
|
|
234
|
+
sw a5, 0xc0(t2)
|
|
235
|
+
addi t2, t2, 0x4
|
|
236
|
+
bne t2, t4, .Lmld_intt_rv32im_p3_inner
|
|
237
|
+
addi t2, t2, 0xc0
|
|
238
|
+
bne t2, t3, .Lmld_intt_rv32im_p3_outer
|
|
239
|
+
addi a1, a1, -0x18
|
|
240
|
+
lw s0, 0x0(a1)
|
|
241
|
+
lw s1, 0x4(a1)
|
|
242
|
+
lw s2, 0x8(a1)
|
|
243
|
+
lw s3, 0xc(a1)
|
|
244
|
+
lw s4, 0x10(a1)
|
|
245
|
+
lw s5, 0x14(a1)
|
|
246
|
+
mv t2, a0
|
|
247
|
+
addi t4, a0, 0x100
|
|
248
|
+
|
|
249
|
+
.Lmld_intt_rv32im_p4_inner:
|
|
250
|
+
lw a2, 0x0(t2)
|
|
251
|
+
lw a3, 0x100(t2)
|
|
252
|
+
lw a4, 0x200(t2)
|
|
253
|
+
lw a5, 0x300(t2)
|
|
254
|
+
sub a6, a3, a2
|
|
255
|
+
add a2, a2, a3
|
|
256
|
+
mulh a7, a6, s5
|
|
257
|
+
mul a3, a6, s4
|
|
258
|
+
mul a7, a7, t0
|
|
259
|
+
sub a3, a3, a7
|
|
260
|
+
sub a6, a5, a4
|
|
261
|
+
add a4, a4, a5
|
|
262
|
+
mulh a7, a6, s3
|
|
263
|
+
mul a5, a6, s2
|
|
264
|
+
mul a7, a7, t0
|
|
265
|
+
sub a5, a5, a7
|
|
266
|
+
sub a6, a4, a2
|
|
267
|
+
add a2, a2, a4
|
|
268
|
+
mulh a7, a6, s1
|
|
269
|
+
mul a4, a6, s0
|
|
270
|
+
mul a7, a7, t0
|
|
271
|
+
sub a4, a4, a7
|
|
272
|
+
sub a6, a5, a3
|
|
273
|
+
add a3, a3, a5
|
|
274
|
+
mulh a7, a6, s1
|
|
275
|
+
mul a5, a6, s0
|
|
276
|
+
mul a7, a7, t0
|
|
277
|
+
sub a5, a5, a7
|
|
278
|
+
sw a2, 0x0(t2)
|
|
279
|
+
sw a3, 0x100(t2)
|
|
280
|
+
sw a4, 0x200(t2)
|
|
281
|
+
sw a5, 0x300(t2)
|
|
282
|
+
addi t2, t2, 0x4
|
|
283
|
+
bne t2, t4, .Lmld_intt_rv32im_p4_inner
|
|
284
|
+
lui s6, 0x4
|
|
285
|
+
addi s6, s6, -0x2
|
|
286
|
+
lui s7, 0x1004
|
|
287
|
+
addi s7, s7, -0x7f4
|
|
288
|
+
mv t2, a0
|
|
289
|
+
addi t5, a0, 0x400
|
|
290
|
+
|
|
291
|
+
.Lmld_intt_rv32im_scale:
|
|
292
|
+
lw a2, 0x0(t2)
|
|
293
|
+
mulh a6, a2, s7
|
|
294
|
+
addi a6, a6, 0x1
|
|
295
|
+
srai a6, a6, 0x1
|
|
296
|
+
mul a3, a2, s6
|
|
297
|
+
mul a6, a6, t0
|
|
298
|
+
sub a3, a3, a6
|
|
299
|
+
sw a3, 0x0(t2)
|
|
300
|
+
addi t2, t2, 0x4
|
|
301
|
+
bne t2, t5, .Lmld_intt_rv32im_scale
|
|
302
|
+
lw s0, 0x0(sp)
|
|
303
|
+
.cfi_restore s0
|
|
304
|
+
lw s1, 0x4(sp)
|
|
305
|
+
.cfi_restore s1
|
|
306
|
+
lw s2, 0x8(sp)
|
|
307
|
+
.cfi_restore s2
|
|
308
|
+
lw s3, 0xc(sp)
|
|
309
|
+
.cfi_restore s3
|
|
310
|
+
lw s4, 0x10(sp)
|
|
311
|
+
.cfi_restore s4
|
|
312
|
+
lw s5, 0x14(sp)
|
|
313
|
+
.cfi_restore s5
|
|
314
|
+
lw s6, 0x18(sp)
|
|
315
|
+
.cfi_restore s6
|
|
316
|
+
lw s7, 0x1c(sp)
|
|
317
|
+
.cfi_restore s7
|
|
318
|
+
addi sp, sp, 0x20
|
|
319
|
+
.cfi_adjust_cfa_offset -0x20
|
|
320
|
+
ret
|
|
321
|
+
.cfi_endproc
|
|
322
|
+
|
|
323
|
+
MLD_ASM_FN_SIZE(intt_rv32im_fastmul_asm)
|
|
324
|
+
|
|
325
|
+
.option pop
|
|
326
|
+
#endif /* MLD_SYS_RISCV32_M && MLD_ARITH_BACKEND_RV32IM && \
|
|
327
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED && MLD_RV32IM_NEED_FASTMUL */
|
|
328
|
+
|
|
329
|
+
#if defined(__ELF__)
|
|
330
|
+
.section .note.GNU-stack,"",%progbits
|
|
331
|
+
#endif
|
data/ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/rv32im/src/mldsa_intt_rv32im_slowmul_asm.S
ADDED
|
@@ -0,0 +1,381 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) The mldsa-native project authors
|
|
3
|
+
* SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/* References
|
|
7
|
+
* ==========
|
|
8
|
+
*
|
|
9
|
+
* - [NeonNTT_Autoformalised]
|
|
10
|
+
* Neon NTT - (Auto)formalised
|
|
11
|
+
* Hanno Becker
|
|
12
|
+
* https://eprint.iacr.org/2026/1223
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*
|
|
16
|
+
* RV32-IM ML-DSA inverse NTT, slow-multiplier variant.
|
|
17
|
+
*
|
|
18
|
+
* Thin wrapper: the kernel body is shared via mldsa_intt_rv32im_asm.i. Here it
|
|
19
|
+
* computes the Barrett low(t*q) reduction with a shift/add chain (exploiting
|
|
20
|
+
* q = 2^23 - 2^13 + 1), trading the multiply for cheap ALU ops -- preferred
|
|
21
|
+
* when the multiplier is slow. `native/rv32im/slowmul.h` selects this
|
|
22
|
+
* wrapper; the fast-multiplier variant lives in mldsa_intt_rv32im_asm.S.
|
|
23
|
+
* The coarse Barrett output bound used by the shared kernel is proved in
|
|
24
|
+
* @[NeonNTT_Autoformalised, Section 13.2].
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
/*yaml
|
|
28
|
+
Name: intt_rv32im_slowmul_asm
|
|
29
|
+
Description: RV32IM ML-DSA inverse NTT optimized for slow multipliers
|
|
30
|
+
Signature: void mld_intt_rv32im_slowmul_asm(int32_t r[256], const int32_t zetas[510])
|
|
31
|
+
ABI:
|
|
32
|
+
Architecture: riscv32
|
|
33
|
+
CallingConvention: ILP32
|
|
34
|
+
Features: [RV32M]
|
|
35
|
+
a0:
|
|
36
|
+
type: buffer
|
|
37
|
+
size_bytes: 1024
|
|
38
|
+
permissions: read/write
|
|
39
|
+
c_parameter: int32_t r[256]
|
|
40
|
+
description: Input/output polynomial (256 x int32_t)
|
|
41
|
+
a1:
|
|
42
|
+
type: buffer
|
|
43
|
+
size_bytes: 2040
|
|
44
|
+
permissions: read-only
|
|
45
|
+
c_parameter: const int32_t zetas[510]
|
|
46
|
+
description: Forward-NTT twiddle table reused in reverse
|
|
47
|
+
*/
|
|
48
|
+
|
|
49
|
+
#include "../../../common.h"
|
|
50
|
+
#if defined(MLD_SYS_RISCV32_M) && \
|
|
51
|
+
defined(MLD_ARITH_BACKEND_RV32IM) && \
|
|
52
|
+
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
53
|
+
defined(MLD_RV32IM_NEED_SLOWMUL)
|
|
54
|
+
/* Without linker relaxation, GNU as resolves the branches to .L
|
|
55
|
+
* labels and leaves no relocations in the kernel. It uses the
|
|
56
|
+
* setting in force at the end of the file, so keep this outside
|
|
57
|
+
* the push/pop below. */
|
|
58
|
+
.option norelax
|
|
59
|
+
/* Keep RV32IMC builds byte-identical to the verified RV32IM code. */
|
|
60
|
+
.option push
|
|
61
|
+
.option norvc
|
|
62
|
+
|
|
63
|
+
/*
|
|
64
|
+
* WARNING: This file is auto-derived from the mldsa-native source file
|
|
65
|
+
* dev/riscv32/src/mldsa_intt_rv32im_slowmul_asm.S using scripts/simpasm. Do not modify it directly.
|
|
66
|
+
*/
|
|
67
|
+
|
|
68
|
+
.text
|
|
69
|
+
.balign 4
|
|
70
|
+
.global MLD_ASM_NAMESPACE(intt_rv32im_slowmul_asm)
|
|
71
|
+
MLD_ASM_FN_SYMBOL(intt_rv32im_slowmul_asm)
|
|
72
|
+
|
|
73
|
+
.cfi_startproc
|
|
74
|
+
addi sp, sp, -0x20
|
|
75
|
+
.cfi_adjust_cfa_offset 0x20
|
|
76
|
+
sw s0, 0x0(sp)
|
|
77
|
+
.cfi_rel_offset s0, 0x0
|
|
78
|
+
sw s1, 0x4(sp)
|
|
79
|
+
.cfi_rel_offset s1, 0x4
|
|
80
|
+
sw s2, 0x8(sp)
|
|
81
|
+
.cfi_rel_offset s2, 0x8
|
|
82
|
+
sw s3, 0xc(sp)
|
|
83
|
+
.cfi_rel_offset s3, 0xc
|
|
84
|
+
sw s4, 0x10(sp)
|
|
85
|
+
.cfi_rel_offset s4, 0x10
|
|
86
|
+
sw s5, 0x14(sp)
|
|
87
|
+
.cfi_rel_offset s5, 0x14
|
|
88
|
+
sw s6, 0x18(sp)
|
|
89
|
+
.cfi_rel_offset s6, 0x18
|
|
90
|
+
sw s7, 0x1c(sp)
|
|
91
|
+
.cfi_rel_offset s7, 0x1c
|
|
92
|
+
addi a1, a1, 0x7f8
|
|
93
|
+
mv t2, a0
|
|
94
|
+
addi t3, a0, 0x400
|
|
95
|
+
|
|
96
|
+
.Lmld_intt_rv32im_p1_outer:
|
|
97
|
+
addi a1, a1, -0x18
|
|
98
|
+
lw s0, 0x0(a1)
|
|
99
|
+
lw s1, 0x4(a1)
|
|
100
|
+
lw s2, 0x8(a1)
|
|
101
|
+
lw s3, 0xc(a1)
|
|
102
|
+
lw s4, 0x10(a1)
|
|
103
|
+
lw s5, 0x14(a1)
|
|
104
|
+
lw a2, 0x0(t2)
|
|
105
|
+
lw a3, 0x4(t2)
|
|
106
|
+
lw a4, 0x8(t2)
|
|
107
|
+
lw a5, 0xc(t2)
|
|
108
|
+
sub a6, a3, a2
|
|
109
|
+
add a2, a2, a3
|
|
110
|
+
mulh a7, a6, s5
|
|
111
|
+
mul a3, a6, s4
|
|
112
|
+
sub a3, a3, a7
|
|
113
|
+
slli a7, a7, 0xd
|
|
114
|
+
add a3, a3, a7
|
|
115
|
+
slli a7, a7, 0xa
|
|
116
|
+
sub a3, a3, a7
|
|
117
|
+
sub a6, a5, a4
|
|
118
|
+
add a4, a4, a5
|
|
119
|
+
mulh a7, a6, s3
|
|
120
|
+
mul a5, a6, s2
|
|
121
|
+
sub a5, a5, a7
|
|
122
|
+
slli a7, a7, 0xd
|
|
123
|
+
add a5, a5, a7
|
|
124
|
+
slli a7, a7, 0xa
|
|
125
|
+
sub a5, a5, a7
|
|
126
|
+
sub a6, a4, a2
|
|
127
|
+
add a2, a2, a4
|
|
128
|
+
mulh a7, a6, s1
|
|
129
|
+
mul a4, a6, s0
|
|
130
|
+
sub a4, a4, a7
|
|
131
|
+
slli a7, a7, 0xd
|
|
132
|
+
add a4, a4, a7
|
|
133
|
+
slli a7, a7, 0xa
|
|
134
|
+
sub a4, a4, a7
|
|
135
|
+
sub a6, a5, a3
|
|
136
|
+
add a3, a3, a5
|
|
137
|
+
mulh a7, a6, s1
|
|
138
|
+
mul a5, a6, s0
|
|
139
|
+
sub a5, a5, a7
|
|
140
|
+
slli a7, a7, 0xd
|
|
141
|
+
add a5, a5, a7
|
|
142
|
+
slli a7, a7, 0xa
|
|
143
|
+
sub a5, a5, a7
|
|
144
|
+
sw a2, 0x0(t2)
|
|
145
|
+
sw a3, 0x4(t2)
|
|
146
|
+
sw a4, 0x8(t2)
|
|
147
|
+
sw a5, 0xc(t2)
|
|
148
|
+
addi t2, t2, 0x10
|
|
149
|
+
bne t2, t3, .Lmld_intt_rv32im_p1_outer
|
|
150
|
+
mv t2, a0
|
|
151
|
+
addi t3, a0, 0x400
|
|
152
|
+
|
|
153
|
+
.Lmld_intt_rv32im_p2_outer:
|
|
154
|
+
addi a1, a1, -0x18
|
|
155
|
+
lw s0, 0x0(a1)
|
|
156
|
+
lw s1, 0x4(a1)
|
|
157
|
+
lw s2, 0x8(a1)
|
|
158
|
+
lw s3, 0xc(a1)
|
|
159
|
+
lw s4, 0x10(a1)
|
|
160
|
+
lw s5, 0x14(a1)
|
|
161
|
+
addi t4, t2, 0x10
|
|
162
|
+
|
|
163
|
+
.Lmld_intt_rv32im_p2_inner:
|
|
164
|
+
lw a2, 0x0(t2)
|
|
165
|
+
lw a3, 0x10(t2)
|
|
166
|
+
lw a4, 0x20(t2)
|
|
167
|
+
lw a5, 0x30(t2)
|
|
168
|
+
sub a6, a3, a2
|
|
169
|
+
add a2, a2, a3
|
|
170
|
+
mulh a7, a6, s5
|
|
171
|
+
mul a3, a6, s4
|
|
172
|
+
sub a3, a3, a7
|
|
173
|
+
slli a7, a7, 0xd
|
|
174
|
+
add a3, a3, a7
|
|
175
|
+
slli a7, a7, 0xa
|
|
176
|
+
sub a3, a3, a7
|
|
177
|
+
sub a6, a5, a4
|
|
178
|
+
add a4, a4, a5
|
|
179
|
+
mulh a7, a6, s3
|
|
180
|
+
mul a5, a6, s2
|
|
181
|
+
sub a5, a5, a7
|
|
182
|
+
slli a7, a7, 0xd
|
|
183
|
+
add a5, a5, a7
|
|
184
|
+
slli a7, a7, 0xa
|
|
185
|
+
sub a5, a5, a7
|
|
186
|
+
sub a6, a4, a2
|
|
187
|
+
add a2, a2, a4
|
|
188
|
+
mulh a7, a6, s1
|
|
189
|
+
mul a4, a6, s0
|
|
190
|
+
sub a4, a4, a7
|
|
191
|
+
slli a7, a7, 0xd
|
|
192
|
+
add a4, a4, a7
|
|
193
|
+
slli a7, a7, 0xa
|
|
194
|
+
sub a4, a4, a7
|
|
195
|
+
sub a6, a5, a3
|
|
196
|
+
add a3, a3, a5
|
|
197
|
+
mulh a7, a6, s1
|
|
198
|
+
mul a5, a6, s0
|
|
199
|
+
sub a5, a5, a7
|
|
200
|
+
slli a7, a7, 0xd
|
|
201
|
+
add a5, a5, a7
|
|
202
|
+
slli a7, a7, 0xa
|
|
203
|
+
sub a5, a5, a7
|
|
204
|
+
sw a2, 0x0(t2)
|
|
205
|
+
sw a3, 0x10(t2)
|
|
206
|
+
sw a4, 0x20(t2)
|
|
207
|
+
sw a5, 0x30(t2)
|
|
208
|
+
addi t2, t2, 0x4
|
|
209
|
+
bne t2, t4, .Lmld_intt_rv32im_p2_inner
|
|
210
|
+
addi t2, t2, 0x30
|
|
211
|
+
bne t2, t3, .Lmld_intt_rv32im_p2_outer
|
|
212
|
+
mv t2, a0
|
|
213
|
+
addi t3, a0, 0x400
|
|
214
|
+
|
|
215
|
+
.Lmld_intt_rv32im_p3_outer:
|
|
216
|
+
addi a1, a1, -0x18
|
|
217
|
+
lw s0, 0x0(a1)
|
|
218
|
+
lw s1, 0x4(a1)
|
|
219
|
+
lw s2, 0x8(a1)
|
|
220
|
+
lw s3, 0xc(a1)
|
|
221
|
+
lw s4, 0x10(a1)
|
|
222
|
+
lw s5, 0x14(a1)
|
|
223
|
+
addi t4, t2, 0x40
|
|
224
|
+
|
|
225
|
+
.Lmld_intt_rv32im_p3_inner:
|
|
226
|
+
lw a2, 0x0(t2)
|
|
227
|
+
lw a3, 0x40(t2)
|
|
228
|
+
lw a4, 0x80(t2)
|
|
229
|
+
lw a5, 0xc0(t2)
|
|
230
|
+
sub a6, a3, a2
|
|
231
|
+
add a2, a2, a3
|
|
232
|
+
mulh a7, a6, s5
|
|
233
|
+
mul a3, a6, s4
|
|
234
|
+
sub a3, a3, a7
|
|
235
|
+
slli a7, a7, 0xd
|
|
236
|
+
add a3, a3, a7
|
|
237
|
+
slli a7, a7, 0xa
|
|
238
|
+
sub a3, a3, a7
|
|
239
|
+
sub a6, a5, a4
|
|
240
|
+
add a4, a4, a5
|
|
241
|
+
mulh a7, a6, s3
|
|
242
|
+
mul a5, a6, s2
|
|
243
|
+
sub a5, a5, a7
|
|
244
|
+
slli a7, a7, 0xd
|
|
245
|
+
add a5, a5, a7
|
|
246
|
+
slli a7, a7, 0xa
|
|
247
|
+
sub a5, a5, a7
|
|
248
|
+
sub a6, a4, a2
|
|
249
|
+
add a2, a2, a4
|
|
250
|
+
mulh a7, a6, s1
|
|
251
|
+
mul a4, a6, s0
|
|
252
|
+
sub a4, a4, a7
|
|
253
|
+
slli a7, a7, 0xd
|
|
254
|
+
add a4, a4, a7
|
|
255
|
+
slli a7, a7, 0xa
|
|
256
|
+
sub a4, a4, a7
|
|
257
|
+
sub a6, a5, a3
|
|
258
|
+
add a3, a3, a5
|
|
259
|
+
mulh a7, a6, s1
|
|
260
|
+
mul a5, a6, s0
|
|
261
|
+
sub a5, a5, a7
|
|
262
|
+
slli a7, a7, 0xd
|
|
263
|
+
add a5, a5, a7
|
|
264
|
+
slli a7, a7, 0xa
|
|
265
|
+
sub a5, a5, a7
|
|
266
|
+
sw a2, 0x0(t2)
|
|
267
|
+
sw a3, 0x40(t2)
|
|
268
|
+
sw a4, 0x80(t2)
|
|
269
|
+
sw a5, 0xc0(t2)
|
|
270
|
+
addi t2, t2, 0x4
|
|
271
|
+
bne t2, t4, .Lmld_intt_rv32im_p3_inner
|
|
272
|
+
addi t2, t2, 0xc0
|
|
273
|
+
bne t2, t3, .Lmld_intt_rv32im_p3_outer
|
|
274
|
+
addi a1, a1, -0x18
|
|
275
|
+
lw s0, 0x0(a1)
|
|
276
|
+
lw s1, 0x4(a1)
|
|
277
|
+
lw s2, 0x8(a1)
|
|
278
|
+
lw s3, 0xc(a1)
|
|
279
|
+
lw s4, 0x10(a1)
|
|
280
|
+
lw s5, 0x14(a1)
|
|
281
|
+
mv t2, a0
|
|
282
|
+
addi t4, a0, 0x100
|
|
283
|
+
|
|
284
|
+
.Lmld_intt_rv32im_p4_inner:
|
|
285
|
+
lw a2, 0x0(t2)
|
|
286
|
+
lw a3, 0x100(t2)
|
|
287
|
+
lw a4, 0x200(t2)
|
|
288
|
+
lw a5, 0x300(t2)
|
|
289
|
+
sub a6, a3, a2
|
|
290
|
+
add a2, a2, a3
|
|
291
|
+
mulh a7, a6, s5
|
|
292
|
+
mul a3, a6, s4
|
|
293
|
+
sub a3, a3, a7
|
|
294
|
+
slli a7, a7, 0xd
|
|
295
|
+
add a3, a3, a7
|
|
296
|
+
slli a7, a7, 0xa
|
|
297
|
+
sub a3, a3, a7
|
|
298
|
+
sub a6, a5, a4
|
|
299
|
+
add a4, a4, a5
|
|
300
|
+
mulh a7, a6, s3
|
|
301
|
+
mul a5, a6, s2
|
|
302
|
+
sub a5, a5, a7
|
|
303
|
+
slli a7, a7, 0xd
|
|
304
|
+
add a5, a5, a7
|
|
305
|
+
slli a7, a7, 0xa
|
|
306
|
+
sub a5, a5, a7
|
|
307
|
+
sub a6, a4, a2
|
|
308
|
+
add a2, a2, a4
|
|
309
|
+
mulh a7, a6, s1
|
|
310
|
+
mul a4, a6, s0
|
|
311
|
+
sub a4, a4, a7
|
|
312
|
+
slli a7, a7, 0xd
|
|
313
|
+
add a4, a4, a7
|
|
314
|
+
slli a7, a7, 0xa
|
|
315
|
+
sub a4, a4, a7
|
|
316
|
+
sub a6, a5, a3
|
|
317
|
+
add a3, a3, a5
|
|
318
|
+
mulh a7, a6, s1
|
|
319
|
+
mul a5, a6, s0
|
|
320
|
+
sub a5, a5, a7
|
|
321
|
+
slli a7, a7, 0xd
|
|
322
|
+
add a5, a5, a7
|
|
323
|
+
slli a7, a7, 0xa
|
|
324
|
+
sub a5, a5, a7
|
|
325
|
+
sw a2, 0x0(t2)
|
|
326
|
+
sw a3, 0x100(t2)
|
|
327
|
+
sw a4, 0x200(t2)
|
|
328
|
+
sw a5, 0x300(t2)
|
|
329
|
+
addi t2, t2, 0x4
|
|
330
|
+
bne t2, t4, .Lmld_intt_rv32im_p4_inner
|
|
331
|
+
lui s6, 0x4
|
|
332
|
+
addi s6, s6, -0x2
|
|
333
|
+
lui s7, 0x1004
|
|
334
|
+
addi s7, s7, -0x7f4
|
|
335
|
+
mv t2, a0
|
|
336
|
+
addi t5, a0, 0x400
|
|
337
|
+
|
|
338
|
+
.Lmld_intt_rv32im_scale:
|
|
339
|
+
lw a2, 0x0(t2)
|
|
340
|
+
mulh a6, a2, s7
|
|
341
|
+
addi a6, a6, 0x1
|
|
342
|
+
srai a6, a6, 0x1
|
|
343
|
+
mul a3, a2, s6
|
|
344
|
+
sub a3, a3, a6
|
|
345
|
+
slli a6, a6, 0xd
|
|
346
|
+
add a3, a3, a6
|
|
347
|
+
slli a6, a6, 0xa
|
|
348
|
+
sub a3, a3, a6
|
|
349
|
+
sw a3, 0x0(t2)
|
|
350
|
+
addi t2, t2, 0x4
|
|
351
|
+
bne t2, t5, .Lmld_intt_rv32im_scale
|
|
352
|
+
lw s0, 0x0(sp)
|
|
353
|
+
.cfi_restore s0
|
|
354
|
+
lw s1, 0x4(sp)
|
|
355
|
+
.cfi_restore s1
|
|
356
|
+
lw s2, 0x8(sp)
|
|
357
|
+
.cfi_restore s2
|
|
358
|
+
lw s3, 0xc(sp)
|
|
359
|
+
.cfi_restore s3
|
|
360
|
+
lw s4, 0x10(sp)
|
|
361
|
+
.cfi_restore s4
|
|
362
|
+
lw s5, 0x14(sp)
|
|
363
|
+
.cfi_restore s5
|
|
364
|
+
lw s6, 0x18(sp)
|
|
365
|
+
.cfi_restore s6
|
|
366
|
+
lw s7, 0x1c(sp)
|
|
367
|
+
.cfi_restore s7
|
|
368
|
+
addi sp, sp, 0x20
|
|
369
|
+
.cfi_adjust_cfa_offset -0x20
|
|
370
|
+
ret
|
|
371
|
+
.cfi_endproc
|
|
372
|
+
|
|
373
|
+
MLD_ASM_FN_SIZE(intt_rv32im_slowmul_asm)
|
|
374
|
+
|
|
375
|
+
.option pop
|
|
376
|
+
#endif /* MLD_SYS_RISCV32_M && MLD_ARITH_BACKEND_RV32IM && \
|
|
377
|
+
!MLD_CONFIG_MULTILEVEL_NO_SHARED && MLD_RV32IM_NEED_SLOWMUL */
|
|
378
|
+
|
|
379
|
+
#if defined(__ELF__)
|
|
380
|
+
.section .note.GNU-stack,"",%progbits
|
|
381
|
+
#endif
|