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
|
@@ -46,14 +46,24 @@
|
|
|
46
46
|
|
|
47
47
|
#endif /* MLK_CHECK_APIS */
|
|
48
48
|
|
|
49
|
+
#if !defined(MLK_CONFIG_NO_KEYPAIR_API)
|
|
49
50
|
#define mlk_kem_keypair_derand \
|
|
50
51
|
MLK_NAMESPACE_K(keypair_derand) MLK_CONTEXT_PARAMETERS_3
|
|
52
|
+
#if !defined(MLK_CONFIG_NO_RANDOMIZED_API)
|
|
51
53
|
#define mlk_kem_keypair MLK_NAMESPACE_K(keypair) MLK_CONTEXT_PARAMETERS_2
|
|
54
|
+
#endif
|
|
55
|
+
#endif /* !MLK_CONFIG_NO_KEYPAIR_API */
|
|
56
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API)
|
|
52
57
|
#define mlk_kem_enc_derand MLK_NAMESPACE_K(enc_derand) MLK_CONTEXT_PARAMETERS_4
|
|
58
|
+
#if !defined(MLK_CONFIG_NO_RANDOMIZED_API)
|
|
53
59
|
#define mlk_kem_enc MLK_NAMESPACE_K(enc) MLK_CONTEXT_PARAMETERS_3
|
|
54
|
-
#
|
|
60
|
+
#endif
|
|
55
61
|
#define mlk_kem_check_pk MLK_NAMESPACE_K(check_pk) MLK_CONTEXT_PARAMETERS_1
|
|
62
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API */
|
|
63
|
+
#if !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
64
|
+
#define mlk_kem_dec MLK_NAMESPACE_K(dec) MLK_CONTEXT_PARAMETERS_3
|
|
56
65
|
#define mlk_kem_check_sk MLK_NAMESPACE_K(check_sk) MLK_CONTEXT_PARAMETERS_1
|
|
66
|
+
#endif
|
|
57
67
|
|
|
58
68
|
/**
|
|
59
69
|
* Implements modulus check mandated by FIPS 203, i.e., ensures that
|
|
@@ -70,19 +80,21 @@
|
|
|
70
80
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
71
81
|
*
|
|
72
82
|
* @retval 0 Success.
|
|
73
|
-
* @retval
|
|
83
|
+
* @retval MLK_ERR_INVALID_PK Modulus check failed.
|
|
74
84
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
75
85
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
76
86
|
*/
|
|
87
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API)
|
|
77
88
|
MLK_EXTERNAL_API
|
|
78
89
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
79
90
|
int mlk_kem_check_pk(const uint8_t pk[MLKEM_INDCCA_PUBLICKEYBYTES],
|
|
80
91
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
|
|
81
92
|
__contract__(
|
|
82
93
|
requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
|
|
83
|
-
ensures(return_value == 0 || return_value ==
|
|
94
|
+
ensures(return_value == 0 || return_value == MLK_ERR_INVALID_PK ||
|
|
84
95
|
return_value == MLK_ERR_OUT_OF_MEMORY)
|
|
85
96
|
);
|
|
97
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API */
|
|
86
98
|
|
|
87
99
|
|
|
88
100
|
/**
|
|
@@ -100,20 +112,23 @@ __contract__(
|
|
|
100
112
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
101
113
|
*
|
|
102
114
|
* @retval 0 Success.
|
|
103
|
-
* @retval
|
|
115
|
+
* @retval MLK_ERR_INVALID_SK Public key hash check failed.
|
|
104
116
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
105
117
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
106
118
|
*/
|
|
119
|
+
#if !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
107
120
|
MLK_EXTERNAL_API
|
|
108
121
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
109
122
|
int mlk_kem_check_sk(const uint8_t sk[MLKEM_INDCCA_SECRETKEYBYTES],
|
|
110
123
|
MLK_CONFIG_CONTEXT_PARAMETER_TYPE context)
|
|
111
124
|
__contract__(
|
|
112
125
|
requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
113
|
-
ensures(return_value == 0 || return_value ==
|
|
126
|
+
ensures(return_value == 0 || return_value == MLK_ERR_INVALID_SK ||
|
|
114
127
|
return_value == MLK_ERR_OUT_OF_MEMORY)
|
|
115
128
|
);
|
|
129
|
+
#endif /* !MLK_CONFIG_NO_DECAPS_API */
|
|
116
130
|
|
|
131
|
+
#if !defined(MLK_CONFIG_NO_KEYPAIR_API)
|
|
117
132
|
/**
|
|
118
133
|
* Generate a public/private keypair for the ML-KEM key encapsulation mechanism.
|
|
119
134
|
*
|
|
@@ -130,9 +145,11 @@ __contract__(
|
|
|
130
145
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
131
146
|
*
|
|
132
147
|
* @retval 0 Success.
|
|
133
|
-
* @retval
|
|
148
|
+
* @retval MLK_ERR_PCT_FAIL MLK_CONFIG_KEYGEN_PCT enabled and PCT failed.
|
|
134
149
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
135
150
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
151
|
+
* @retval MLK_ERR_RNG_FAIL MLK_CONFIG_KEYGEN_PCT enabled and random
|
|
152
|
+
* number generation failed within the PCT.
|
|
136
153
|
*/
|
|
137
154
|
MLK_EXTERNAL_API
|
|
138
155
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
@@ -146,11 +163,17 @@ __contract__(
|
|
|
146
163
|
requires(memory_no_alias(coins, 2 * MLKEM_SYMBYTES))
|
|
147
164
|
assigns(memory_slice(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
|
|
148
165
|
assigns(memory_slice(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
149
|
-
ensures(return_value == 0 || return_value ==
|
|
166
|
+
ensures(return_value == 0 || return_value == MLK_ERR_PCT_FAIL ||
|
|
150
167
|
return_value == MLK_ERR_OUT_OF_MEMORY ||
|
|
151
168
|
return_value == MLK_ERR_RNG_FAIL)
|
|
169
|
+
/* Output buffers on error, per API-CONVENTIONS.md */
|
|
170
|
+
ensures(return_value != 0 ==>
|
|
171
|
+
array_unchanged_or_zeroized_u8(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
|
|
172
|
+
ensures(return_value != 0 ==>
|
|
173
|
+
array_unchanged_or_zeroized_u8(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
152
174
|
);
|
|
153
175
|
|
|
176
|
+
#if !defined(MLK_CONFIG_NO_RANDOMIZED_API)
|
|
154
177
|
/**
|
|
155
178
|
* Generate a public/private keypair for the ML-KEM key encapsulation mechanism.
|
|
156
179
|
*
|
|
@@ -168,7 +191,7 @@ __contract__(
|
|
|
168
191
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
169
192
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
170
193
|
* @retval MLK_ERR_RNG_FAIL Random number generation failed.
|
|
171
|
-
* @retval
|
|
194
|
+
* @retval MLK_ERR_PCT_FAIL MLK_CONFIG_KEYGEN_PCT enabled and PCT failed.
|
|
172
195
|
*/
|
|
173
196
|
MLK_EXTERNAL_API
|
|
174
197
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
@@ -180,10 +203,17 @@ __contract__(
|
|
|
180
203
|
requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
181
204
|
assigns(memory_slice(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
|
|
182
205
|
assigns(memory_slice(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
183
|
-
ensures(return_value == 0 || return_value ==
|
|
206
|
+
ensures(return_value == 0 || return_value == MLK_ERR_PCT_FAIL ||
|
|
184
207
|
return_value == MLK_ERR_OUT_OF_MEMORY ||
|
|
185
208
|
return_value == MLK_ERR_RNG_FAIL)
|
|
209
|
+
/* Output buffers on error, per API-CONVENTIONS.md */
|
|
210
|
+
ensures(return_value != 0 ==>
|
|
211
|
+
array_unchanged_or_zeroized_u8(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
|
|
212
|
+
ensures(return_value != 0 ==>
|
|
213
|
+
array_unchanged_or_zeroized_u8(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
186
214
|
);
|
|
215
|
+
#endif /* !MLK_CONFIG_NO_RANDOMIZED_API */
|
|
216
|
+
#endif /* !MLK_CONFIG_NO_KEYPAIR_API */
|
|
187
217
|
|
|
188
218
|
/**
|
|
189
219
|
* Generate ciphertext and shared secret for a given public key.
|
|
@@ -203,11 +233,12 @@ __contract__(
|
|
|
203
233
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
204
234
|
*
|
|
205
235
|
* @retval 0 Success.
|
|
206
|
-
* @retval
|
|
236
|
+
* @retval MLK_ERR_INVALID_PK The 'modulus check' @[FIPS203, Section 7.2]
|
|
207
237
|
* for the public key failed.
|
|
208
238
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
209
239
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
210
240
|
*/
|
|
241
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API)
|
|
211
242
|
MLK_EXTERNAL_API
|
|
212
243
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
213
244
|
int mlk_kem_enc_derand(uint8_t ct[MLKEM_INDCCA_CIPHERTEXTBYTES],
|
|
@@ -222,10 +253,16 @@ __contract__(
|
|
|
222
253
|
requires(memory_no_alias(coins, MLKEM_SYMBYTES))
|
|
223
254
|
assigns(memory_slice(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
|
|
224
255
|
assigns(memory_slice(ss, MLKEM_SSBYTES))
|
|
225
|
-
ensures(return_value == 0 || return_value ==
|
|
256
|
+
ensures(return_value == 0 || return_value == MLK_ERR_INVALID_PK ||
|
|
226
257
|
return_value == MLK_ERR_OUT_OF_MEMORY)
|
|
258
|
+
/* Output buffers on error, per API-CONVENTIONS.md */
|
|
259
|
+
ensures(return_value != 0 ==>
|
|
260
|
+
array_unchanged_or_zeroized_u8(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
|
|
261
|
+
ensures(return_value != 0 ==>
|
|
262
|
+
array_unchanged_or_zeroized_u8(ss, MLKEM_SSBYTES))
|
|
227
263
|
);
|
|
228
264
|
|
|
265
|
+
#if !defined(MLK_CONFIG_NO_RANDOMIZED_API)
|
|
229
266
|
/**
|
|
230
267
|
* Generate ciphertext and shared secret for a given public key.
|
|
231
268
|
*
|
|
@@ -245,7 +282,7 @@ __contract__(
|
|
|
245
282
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
246
283
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
247
284
|
* @retval MLK_ERR_RNG_FAIL Random number generation failed.
|
|
248
|
-
* @retval
|
|
285
|
+
* @retval MLK_ERR_INVALID_PK The 'modulus check' @[FIPS203, Section 7.2]
|
|
249
286
|
* for the public key failed.
|
|
250
287
|
*/
|
|
251
288
|
MLK_EXTERNAL_API
|
|
@@ -260,10 +297,17 @@ __contract__(
|
|
|
260
297
|
requires(memory_no_alias(pk, MLKEM_INDCCA_PUBLICKEYBYTES))
|
|
261
298
|
assigns(memory_slice(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
|
|
262
299
|
assigns(memory_slice(ss, MLKEM_SSBYTES))
|
|
263
|
-
ensures(return_value == 0 || return_value ==
|
|
300
|
+
ensures(return_value == 0 || return_value == MLK_ERR_INVALID_PK ||
|
|
264
301
|
return_value == MLK_ERR_OUT_OF_MEMORY ||
|
|
265
302
|
return_value == MLK_ERR_RNG_FAIL)
|
|
303
|
+
/* Output buffers on error, per API-CONVENTIONS.md */
|
|
304
|
+
ensures(return_value != 0 ==>
|
|
305
|
+
array_unchanged_or_zeroized_u8(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
|
|
306
|
+
ensures(return_value != 0 ==>
|
|
307
|
+
array_unchanged_or_zeroized_u8(ss, MLKEM_SSBYTES))
|
|
266
308
|
);
|
|
309
|
+
#endif /* !MLK_CONFIG_NO_RANDOMIZED_API */
|
|
310
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API */
|
|
267
311
|
|
|
268
312
|
/**
|
|
269
313
|
* Generate shared secret for a given ciphertext and private key.
|
|
@@ -281,11 +325,12 @@ __contract__(
|
|
|
281
325
|
* MLK_CONFIG_CONTEXT_PARAMETER_TYPE.
|
|
282
326
|
*
|
|
283
327
|
* @retval 0 Success.
|
|
284
|
-
* @retval
|
|
328
|
+
* @retval MLK_ERR_INVALID_SK The 'hash check' @[FIPS203, Section 7.3]
|
|
285
329
|
* for the secret key failed.
|
|
286
330
|
* @retval MLK_ERR_OUT_OF_MEMORY MLK_CONFIG_CUSTOM_ALLOC_FREE was used and
|
|
287
331
|
* MLK_CUSTOM_ALLOC returned NULL.
|
|
288
332
|
*/
|
|
333
|
+
#if !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
289
334
|
MLK_EXTERNAL_API
|
|
290
335
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
291
336
|
int mlk_kem_dec(uint8_t ss[MLKEM_SSBYTES],
|
|
@@ -297,8 +342,12 @@ __contract__(
|
|
|
297
342
|
requires(memory_no_alias(ct, MLKEM_INDCCA_CIPHERTEXTBYTES))
|
|
298
343
|
requires(memory_no_alias(sk, MLKEM_INDCCA_SECRETKEYBYTES))
|
|
299
344
|
assigns(memory_slice(ss, MLKEM_SSBYTES))
|
|
300
|
-
ensures(return_value == 0 || return_value ==
|
|
345
|
+
ensures(return_value == 0 || return_value == MLK_ERR_INVALID_SK ||
|
|
301
346
|
return_value == MLK_ERR_OUT_OF_MEMORY)
|
|
347
|
+
/* Output buffers on error, per API-CONVENTIONS.md */
|
|
348
|
+
ensures(return_value != 0 ==>
|
|
349
|
+
array_unchanged_or_zeroized_u8(ss, MLKEM_SSBYTES))
|
|
302
350
|
);
|
|
351
|
+
#endif /* !MLK_CONFIG_NO_DECAPS_API */
|
|
303
352
|
|
|
304
353
|
#endif /* !MLK_KEM_H */
|
|
@@ -28,37 +28,61 @@
|
|
|
28
28
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
29
29
|
static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N])
|
|
30
30
|
{
|
|
31
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
32
|
+
{
|
|
33
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
34
|
+
}
|
|
31
35
|
mlk_ntt_aarch64_asm(data, mlk_aarch64_ntt_zetas_layer12345,
|
|
32
36
|
mlk_aarch64_ntt_zetas_layer67);
|
|
33
37
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
34
38
|
}
|
|
35
39
|
|
|
40
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API) || !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
36
41
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
37
42
|
static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N])
|
|
38
43
|
{
|
|
44
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
45
|
+
{
|
|
46
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
47
|
+
}
|
|
39
48
|
mlk_intt_aarch64_asm(data, mlk_aarch64_invntt_zetas_layer12345,
|
|
40
49
|
mlk_aarch64_invntt_zetas_layer67);
|
|
41
50
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
42
51
|
}
|
|
52
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API */
|
|
43
53
|
|
|
44
54
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
45
55
|
static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N])
|
|
46
56
|
{
|
|
57
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
58
|
+
{
|
|
59
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
60
|
+
}
|
|
47
61
|
mlk_poly_reduce_aarch64_asm(data);
|
|
48
62
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
49
63
|
}
|
|
50
64
|
|
|
65
|
+
#if !defined(MLK_CONFIG_NO_KEYPAIR_API)
|
|
51
66
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
52
67
|
static MLK_INLINE int mlk_poly_tomont_native(int16_t data[MLKEM_N])
|
|
53
68
|
{
|
|
69
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
70
|
+
{
|
|
71
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
72
|
+
}
|
|
54
73
|
mlk_poly_tomont_aarch64_asm(data);
|
|
55
74
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
56
75
|
}
|
|
76
|
+
#endif /* !MLK_CONFIG_NO_KEYPAIR_API */
|
|
57
77
|
|
|
58
78
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
59
79
|
static MLK_INLINE int mlk_poly_mulcache_compute_native(int16_t x[MLKEM_N / 2],
|
|
60
80
|
const int16_t y[MLKEM_N])
|
|
61
81
|
{
|
|
82
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
83
|
+
{
|
|
84
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
85
|
+
}
|
|
62
86
|
mlk_poly_mulcache_compute_aarch64_asm(
|
|
63
87
|
x, y, mlk_aarch64_zetas_mulcache_native,
|
|
64
88
|
mlk_aarch64_zetas_mulcache_twisted_native);
|
|
@@ -71,6 +95,10 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k2_native(
|
|
|
71
95
|
int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N],
|
|
72
96
|
const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)])
|
|
73
97
|
{
|
|
98
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
99
|
+
{
|
|
100
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
101
|
+
}
|
|
74
102
|
mlk_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm(r, a, b, b_cache);
|
|
75
103
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
76
104
|
}
|
|
@@ -82,6 +110,10 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k3_native(
|
|
|
82
110
|
int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N],
|
|
83
111
|
const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)])
|
|
84
112
|
{
|
|
113
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
114
|
+
{
|
|
115
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
116
|
+
}
|
|
85
117
|
mlk_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm(r, a, b, b_cache);
|
|
86
118
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
87
119
|
}
|
|
@@ -93,26 +125,36 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k4_native(
|
|
|
93
125
|
int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N],
|
|
94
126
|
const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)])
|
|
95
127
|
{
|
|
128
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
129
|
+
{
|
|
130
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
131
|
+
}
|
|
96
132
|
mlk_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm(r, a, b, b_cache);
|
|
97
133
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
98
134
|
}
|
|
99
135
|
#endif /* MLK_CONFIG_MULTILEVEL_WITH_SHARED || MLKEM_K == 4 */
|
|
100
136
|
|
|
137
|
+
#if !defined(MLK_CONFIG_NO_KEYPAIR_API) || !defined(MLK_CONFIG_NO_ENCAPS_API)
|
|
101
138
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
102
139
|
static MLK_INLINE int mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES],
|
|
103
140
|
const int16_t a[MLKEM_N])
|
|
104
141
|
{
|
|
142
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON))
|
|
143
|
+
{
|
|
144
|
+
return MLK_NATIVE_FUNC_FALLBACK;
|
|
145
|
+
}
|
|
105
146
|
mlk_poly_tobytes_aarch64_asm(r, a);
|
|
106
147
|
return MLK_NATIVE_FUNC_SUCCESS;
|
|
107
148
|
}
|
|
149
|
+
#endif /* !MLK_CONFIG_NO_KEYPAIR_API || !MLK_CONFIG_NO_ENCAPS_API */
|
|
108
150
|
|
|
109
151
|
MLK_MUST_CHECK_RETURN_VALUE
|
|
110
152
|
static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len,
|
|
111
153
|
const uint8_t *buf,
|
|
112
154
|
unsigned buflen)
|
|
113
155
|
{
|
|
114
|
-
if (len != MLKEM_N ||
|
|
115
|
-
buflen % 24 != 0)
|
|
156
|
+
if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_NEON) || len != MLKEM_N ||
|
|
157
|
+
buflen % 24 != 0)
|
|
116
158
|
{
|
|
117
159
|
return MLK_NATIVE_FUNC_FALLBACK;
|
|
118
160
|
}
|
|
@@ -79,6 +79,7 @@ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const int16_t
|
|
|
79
79
|
10129, 10129, -3878, -3878, -11566, -11566,
|
|
80
80
|
};
|
|
81
81
|
|
|
82
|
+
#if !defined(MLK_CONFIG_NO_ENCAPS_API) || !defined(MLK_CONFIG_NO_DECAPS_API)
|
|
82
83
|
MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const int16_t
|
|
83
84
|
mlk_aarch64_invntt_zetas_layer12345[80] = {
|
|
84
85
|
1583, 15582, -821, -8081, 1355, 13338, 0, 0, -569,
|
|
@@ -138,6 +139,7 @@ MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const int16_t
|
|
|
138
139
|
1041, -1637, -1637, -583, -583, -17, -17, 10247, 10247,
|
|
139
140
|
-16113, -16113, -5739, -5739, -167, -167,
|
|
140
141
|
};
|
|
142
|
+
#endif /* !MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API */
|
|
141
143
|
|
|
142
144
|
MLK_ALIGN MLK_INTERNAL_DATA_DEFINITION const int16_t
|
|
143
145
|
mlk_aarch64_zetas_mulcache_native[128] = {
|
|
@@ -38,7 +38,7 @@ MLK_INTERNAL_DATA_DECLARATION const uint8_t mlk_rej_uniform_table[4096];
|
|
|
38
38
|
void mlk_ntt_aarch64_asm(int16_t p[256], const int16_t twiddles12345[80],
|
|
39
39
|
const int16_t twiddles56[384])
|
|
40
40
|
/* This must be kept in sync with the HOL-Light specification
|
|
41
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
41
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_ntt_aarch64_asm.ml */
|
|
42
42
|
__contract__(
|
|
43
43
|
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
44
44
|
requires(array_abs_bound(p, 0, MLKEM_N, 8192))
|
|
@@ -54,7 +54,7 @@ __contract__(
|
|
|
54
54
|
void mlk_intt_aarch64_asm(int16_t p[256], const int16_t twiddles12345[80],
|
|
55
55
|
const int16_t twiddles56[384])
|
|
56
56
|
/* This must be kept in sync with the HOL-Light specification
|
|
57
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
57
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_intt_aarch64_asm.ml */
|
|
58
58
|
__contract__(
|
|
59
59
|
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
60
60
|
requires(twiddles12345 == mlk_aarch64_invntt_zetas_layer12345)
|
|
@@ -68,7 +68,7 @@ __contract__(
|
|
|
68
68
|
#define mlk_poly_reduce_aarch64_asm MLK_NAMESPACE(poly_reduce_aarch64_asm)
|
|
69
69
|
void mlk_poly_reduce_aarch64_asm(int16_t p[256])
|
|
70
70
|
/* This must be kept in sync with the HOL-Light specification
|
|
71
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
71
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_poly_reduce_aarch64_asm.ml */
|
|
72
72
|
__contract__(
|
|
73
73
|
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
74
74
|
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
@@ -78,7 +78,7 @@ __contract__(
|
|
|
78
78
|
#define mlk_poly_tomont_aarch64_asm MLK_NAMESPACE(poly_tomont_aarch64_asm)
|
|
79
79
|
void mlk_poly_tomont_aarch64_asm(int16_t p[256])
|
|
80
80
|
/* This must be kept in sync with the HOL-Light specification
|
|
81
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
81
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_poly_tomont_aarch64_asm.ml */
|
|
82
82
|
__contract__(
|
|
83
83
|
requires(memory_no_alias(p, sizeof(int16_t) * MLKEM_N))
|
|
84
84
|
assigns(memory_slice(p, sizeof(int16_t) * MLKEM_N))
|
|
@@ -92,7 +92,8 @@ void mlk_poly_mulcache_compute_aarch64_asm(int16_t cache[128],
|
|
|
92
92
|
const int16_t zetas[128],
|
|
93
93
|
const int16_t zetas_twisted[128])
|
|
94
94
|
/* This must be kept in sync with the HOL-Light specification
|
|
95
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
95
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_poly_mulcache_compute_aarch64_asm.ml
|
|
96
|
+
*/
|
|
96
97
|
__contract__(
|
|
97
98
|
requires(memory_no_alias(cache, sizeof(int16_t) * (MLKEM_N / 2)))
|
|
98
99
|
requires(memory_no_alias(mlk_poly, sizeof(int16_t) * MLKEM_N))
|
|
@@ -105,7 +106,7 @@ __contract__(
|
|
|
105
106
|
#define mlk_poly_tobytes_aarch64_asm MLK_NAMESPACE(poly_tobytes_aarch64_asm)
|
|
106
107
|
void mlk_poly_tobytes_aarch64_asm(uint8_t r[384], const int16_t a[256])
|
|
107
108
|
/* This must be kept in sync with the HOL-Light specification
|
|
108
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
109
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_poly_tobytes_aarch64_asm.ml */
|
|
109
110
|
__contract__(
|
|
110
111
|
requires(memory_no_alias(r, MLKEM_POLYBYTES))
|
|
111
112
|
requires(memory_no_alias(a, sizeof(int16_t) * MLKEM_N))
|
|
@@ -119,7 +120,7 @@ void mlk_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm(
|
|
|
119
120
|
int16_t r[256], const int16_t a[512], const int16_t b[512],
|
|
120
121
|
const int16_t b_cache[256])
|
|
121
122
|
/* This must be kept in sync with the HOL-Light specification in
|
|
122
|
-
* proofs/hol_light/aarch64/proofs/
|
|
123
|
+
* proofs/hol_light/aarch64/proofs/mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.ml.
|
|
123
124
|
*/
|
|
124
125
|
__contract__(
|
|
125
126
|
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
@@ -136,7 +137,7 @@ void mlk_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm(
|
|
|
136
137
|
int16_t r[256], const int16_t a[768], const int16_t b[768],
|
|
137
138
|
const int16_t b_cache[384])
|
|
138
139
|
/* This must be kept in sync with the HOL-Light specification in
|
|
139
|
-
* proofs/hol_light/aarch64/proofs/
|
|
140
|
+
* proofs/hol_light/aarch64/proofs/mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.ml.
|
|
140
141
|
*/
|
|
141
142
|
__contract__(
|
|
142
143
|
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
@@ -153,7 +154,7 @@ void mlk_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm(
|
|
|
153
154
|
int16_t r[256], const int16_t a[1024], const int16_t b[1024],
|
|
154
155
|
const int16_t b_cache[512])
|
|
155
156
|
/* This must be kept in sync with the HOL-Light specification in
|
|
156
|
-
* proofs/hol_light/aarch64/proofs/
|
|
157
|
+
* proofs/hol_light/aarch64/proofs/mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.ml.
|
|
157
158
|
*/
|
|
158
159
|
__contract__(
|
|
159
160
|
requires(memory_no_alias(r, sizeof(int16_t) * MLKEM_N))
|
|
@@ -169,7 +170,7 @@ MLK_MUST_CHECK_RETURN_VALUE
|
|
|
169
170
|
uint64_t mlk_rej_uniform_aarch64_asm(int16_t r[256], const uint8_t *buf,
|
|
170
171
|
unsigned buflen, const uint8_t table[4096])
|
|
171
172
|
/* This must be kept in sync with the HOL-Light specification
|
|
172
|
-
* in proofs/hol_light/aarch64/proofs/
|
|
173
|
+
* in proofs/hol_light/aarch64/proofs/mlkem_rej_uniform_aarch64_asm.ml. */
|
|
173
174
|
__contract__(
|
|
174
175
|
requires(buflen % 24 == 0)
|
|
175
176
|
requires(memory_no_alias(buf, buflen))
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
Description: AArch64 ML-KEM inverse NTT following @[NeonNTT] and @[SLOTHY_Paper]
|
|
25
25
|
Signature: void mlk_intt_aarch64_asm(int16_t p[256], const int16_t twiddles12345[80], const int16_t twiddles56[384])
|
|
26
26
|
ABI:
|
|
27
|
+
Architecture: aarch64
|
|
28
|
+
CallingConvention: AAPCS64
|
|
29
|
+
Features: [NEON]
|
|
27
30
|
x0:
|
|
28
31
|
type: buffer
|
|
29
32
|
size_bytes: 512
|
|
@@ -48,11 +51,14 @@
|
|
|
48
51
|
*/
|
|
49
52
|
|
|
50
53
|
#include "../../../common.h"
|
|
51
|
-
#if defined(MLK_ARITH_BACKEND_AARCH64) &&
|
|
54
|
+
#if defined(MLK_ARITH_BACKEND_AARCH64) && \
|
|
55
|
+
!defined(MLK_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
56
|
+
(!defined(MLK_CONFIG_NO_ENCAPS_API) || \
|
|
57
|
+
!defined(MLK_CONFIG_NO_DECAPS_API))
|
|
52
58
|
|
|
53
59
|
/*
|
|
54
60
|
* WARNING: This file is auto-derived from the mlkem-native source file
|
|
55
|
-
* dev/aarch64_opt/src/
|
|
61
|
+
* dev/aarch64_opt/src/mlkem_intt_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
|
|
56
62
|
*/
|
|
57
63
|
|
|
58
64
|
.text
|
|
@@ -200,7 +206,7 @@ MLK_ASM_FN_SYMBOL(intt_aarch64_asm)
|
|
|
200
206
|
mls v24.8h, v19.8h, v7.h[0]
|
|
201
207
|
sub x4, x4, #0x2
|
|
202
208
|
|
|
203
|
-
|
|
209
|
+
Lmlk_intt_layer4567_start:
|
|
204
210
|
add v16.8h, v21.8h, v10.8h
|
|
205
211
|
mul v18.8h, v6.8h, v15.8h
|
|
206
212
|
sub v19.8h, v20.8h, v25.8h
|
|
@@ -293,8 +299,8 @@ Lintt_layer4567_start:
|
|
|
293
299
|
sqrdmulh v31.8h, v8.8h, v11.h[5]
|
|
294
300
|
sub v14.8h, v21.8h, v10.8h
|
|
295
301
|
stur q0, [x3, #-0x30]
|
|
296
|
-
|
|
297
|
-
cbnz x4,
|
|
302
|
+
sub x4, x4, #0x1
|
|
303
|
+
cbnz x4, Lmlk_intt_layer4567_start
|
|
298
304
|
mul v15.8h, v6.8h, v15.8h
|
|
299
305
|
sub v22.8h, v20.8h, v25.8h
|
|
300
306
|
add v4.8h, v21.8h, v10.8h
|
|
@@ -442,7 +448,7 @@ Lintt_layer4567_start:
|
|
|
442
448
|
sqrdmulh v10.8h, v10.8h, v0.h[1]
|
|
443
449
|
sub x4, x4, #0x2
|
|
444
450
|
|
|
445
|
-
|
|
451
|
+
Lmlk_intt_layer123_start:
|
|
446
452
|
sub v12.8h, v3.8h, v30.8h
|
|
447
453
|
mul v11.8h, v21.8h, v1.h[0]
|
|
448
454
|
add v28.8h, v4.8h, v8.8h
|
|
@@ -519,8 +525,8 @@ Lintt_layer123_start:
|
|
|
519
525
|
sqrdmulh v9.8h, v13.8h, v0.h[1]
|
|
520
526
|
str q17, [x0, #0x130]
|
|
521
527
|
mul v17.8h, v19.8h, v0.h[0]
|
|
522
|
-
|
|
523
|
-
cbnz x4,
|
|
528
|
+
sub x4, x4, #0x1
|
|
529
|
+
cbnz x4, Lmlk_intt_layer123_start
|
|
524
530
|
mls v23.8h, v10.8h, v7.h[0]
|
|
525
531
|
ldr q11, [x0, #0x190]
|
|
526
532
|
str q18, [x0, #0x100]
|
|
@@ -621,7 +627,8 @@ Lintt_layer123_start:
|
|
|
621
627
|
|
|
622
628
|
MLK_ASM_FN_SIZE(intt_aarch64_asm)
|
|
623
629
|
|
|
624
|
-
#endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED
|
|
630
|
+
#endif /* MLK_ARITH_BACKEND_AARCH64 && !MLK_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
631
|
+
(!MLK_CONFIG_NO_ENCAPS_API || !MLK_CONFIG_NO_DECAPS_API) */
|
|
625
632
|
|
|
626
633
|
#if defined(__ELF__)
|
|
627
634
|
.section .note.GNU-stack,"",%progbits
|
|
@@ -24,6 +24,9 @@
|
|
|
24
24
|
Description: AArch64 ML-KEM forward NTT following @[NeonNTT] and @[SLOTHY_Paper]
|
|
25
25
|
Signature: void mlk_ntt_aarch64_asm(int16_t p[256], const int16_t twiddles12345[80], const int16_t twiddles56[384])
|
|
26
26
|
ABI:
|
|
27
|
+
Architecture: aarch64
|
|
28
|
+
CallingConvention: AAPCS64
|
|
29
|
+
Features: [NEON]
|
|
27
30
|
x0:
|
|
28
31
|
type: buffer
|
|
29
32
|
size_bytes: 512
|
|
@@ -52,7 +55,7 @@
|
|
|
52
55
|
|
|
53
56
|
/*
|
|
54
57
|
* WARNING: This file is auto-derived from the mlkem-native source file
|
|
55
|
-
* dev/aarch64_opt/src/
|
|
58
|
+
* dev/aarch64_opt/src/mlkem_ntt_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
|
|
56
59
|
*/
|
|
57
60
|
|
|
58
61
|
.text
|
|
@@ -144,7 +147,7 @@ MLK_ASM_FN_SYMBOL(ntt_aarch64_asm)
|
|
|
144
147
|
mul v4.8h, v5.8h, v1.h[0]
|
|
145
148
|
sub x4, x4, #0x2
|
|
146
149
|
|
|
147
|
-
|
|
150
|
+
Lmlk_ntt_layer123_start:
|
|
148
151
|
mls v23.8h, v15.8h, v7.h[0]
|
|
149
152
|
ldr q6, [x0, #0x190]
|
|
150
153
|
ldr q15, [x0, #0x90]
|
|
@@ -221,8 +224,8 @@ Lntt_layer123_start:
|
|
|
221
224
|
add v28.8h, v13.8h, v23.8h
|
|
222
225
|
sub v13.8h, v13.8h, v23.8h
|
|
223
226
|
mul v23.8h, v20.8h, v0.h[2]
|
|
224
|
-
|
|
225
|
-
cbnz x4,
|
|
227
|
+
sub x4, x4, #0x1
|
|
228
|
+
cbnz x4, Lmlk_ntt_layer123_start
|
|
226
229
|
sqrdmulh v3.8h, v5.8h, v1.h[1]
|
|
227
230
|
mls v23.8h, v15.8h, v7.h[0]
|
|
228
231
|
ldr q5, [x0, #0x190]
|
|
@@ -396,7 +399,7 @@ Lntt_layer123_start:
|
|
|
396
399
|
mls v23.8h, v16.8h, v7.h[0]
|
|
397
400
|
sub x4, x4, #0x2
|
|
398
401
|
|
|
399
|
-
|
|
402
|
+
Lmlk_ntt_layer4567_start:
|
|
400
403
|
ldr q19, [x2, #0x50]
|
|
401
404
|
sub v31.8h, v30.8h, v23.8h
|
|
402
405
|
mls v0.8h, v29.8h, v7.h[0]
|
|
@@ -468,8 +471,8 @@ Lntt_layer4567_start:
|
|
|
468
471
|
sub v30.8h, v21.8h, v17.8h
|
|
469
472
|
mul v0.8h, v16.8h, v1.8h
|
|
470
473
|
trn1 v28.4s, v6.4s, v12.4s
|
|
471
|
-
|
|
472
|
-
cbnz x4,
|
|
474
|
+
sub x4, x4, #0x1
|
|
475
|
+
cbnz x4, Lmlk_ntt_layer4567_start
|
|
473
476
|
add v22.8h, v11.8h, v8.8h
|
|
474
477
|
mul v27.8h, v27.8h, v4.h[2]
|
|
475
478
|
trn2 v17.4s, v6.4s, v12.4s
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
Description: Compute multiplication cache for polynomial
|
|
9
9
|
Signature: void mlk_poly_mulcache_compute_aarch64_asm(int16_t cache[128], const int16_t mlk_poly[256], const int16_t zetas[128], const int16_t zetas_twisted[128])
|
|
10
10
|
ABI:
|
|
11
|
+
Architecture: aarch64
|
|
12
|
+
CallingConvention: AAPCS64
|
|
13
|
+
Features: [NEON]
|
|
11
14
|
x0:
|
|
12
15
|
type: buffer
|
|
13
16
|
size_bytes: 256
|
|
@@ -41,7 +44,7 @@
|
|
|
41
44
|
|
|
42
45
|
/*
|
|
43
46
|
* WARNING: This file is auto-derived from the mlkem-native source file
|
|
44
|
-
* dev/aarch64_opt/src/
|
|
47
|
+
* dev/aarch64_opt/src/mlkem_poly_mulcache_compute_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
|
|
45
48
|
*/
|
|
46
49
|
|
|
47
50
|
.text
|
|
@@ -79,7 +82,7 @@ MLK_ASM_FN_SYMBOL(poly_mulcache_compute_aarch64_asm)
|
|
|
79
82
|
lsr x4, x4, #1
|
|
80
83
|
sub x4, x4, #0x2
|
|
81
84
|
|
|
82
|
-
|
|
85
|
+
Lmlk_poly_mulcache_compute_loop_start:
|
|
83
86
|
str q5, [x0], #0x10
|
|
84
87
|
sqrdmulh v22.8h, v29.8h, v17.8h
|
|
85
88
|
ldr q28, [x2], #0x10
|
|
@@ -99,7 +102,7 @@ Lpoly_mulcache_compute_loop_start:
|
|
|
99
102
|
str q26, [x0], #0x10
|
|
100
103
|
mul v26.8h, v23.8h, v18.8h
|
|
101
104
|
subs x4, x4, #0x1
|
|
102
|
-
cbnz x4,
|
|
105
|
+
cbnz x4, Lmlk_poly_mulcache_compute_loop_start
|
|
103
106
|
mls v26.8h, v4.8h, v6.h[0]
|
|
104
107
|
str q5, [x0], #0x10
|
|
105
108
|
ldr q5, [x2], #0x10
|
|
@@ -8,6 +8,9 @@
|
|
|
8
8
|
Description: Barrett reduction of polynomial coefficients
|
|
9
9
|
Signature: void mlk_poly_reduce_aarch64_asm(int16_t p[256])
|
|
10
10
|
ABI:
|
|
11
|
+
Architecture: aarch64
|
|
12
|
+
CallingConvention: AAPCS64
|
|
13
|
+
Features: [NEON]
|
|
11
14
|
x0:
|
|
12
15
|
type: buffer
|
|
13
16
|
size_bytes: 512
|
|
@@ -23,7 +26,7 @@
|
|
|
23
26
|
|
|
24
27
|
/*
|
|
25
28
|
* WARNING: This file is auto-derived from the mlkem-native source file
|
|
26
|
-
* dev/aarch64_opt/src/
|
|
29
|
+
* dev/aarch64_opt/src/mlkem_poly_reduce_aarch64_asm.S using scripts/simpasm. Do not modify it directly.
|
|
27
30
|
*/
|
|
28
31
|
|
|
29
32
|
.text
|
|
@@ -64,7 +67,7 @@ MLK_ASM_FN_SYMBOL(poly_reduce_aarch64_asm)
|
|
|
64
67
|
and v31.16b, v3.16b, v31.16b
|
|
65
68
|
sub x1, x1, #0x2
|
|
66
69
|
|
|
67
|
-
|
|
70
|
+
Lmlk_poly_reduce_loop_start:
|
|
68
71
|
add v21.8h, v18.8h, v21.8h
|
|
69
72
|
ldur q18, [x0, #-0x20]
|
|
70
73
|
add v25.8h, v0.8h, v31.8h
|
|
@@ -98,7 +101,7 @@ Lpoly_reduce_loop_start:
|
|
|
98
101
|
and v31.16b, v3.16b, v20.16b
|
|
99
102
|
sqdmulh v2.8h, v26.8h, v4.h[0]
|
|
100
103
|
subs x1, x1, #0x1
|
|
101
|
-
cbnz x1,
|
|
104
|
+
cbnz x1, Lmlk_poly_reduce_loop_start
|
|
102
105
|
add v28.8h, v0.8h, v31.8h
|
|
103
106
|
ldur q29, [x0, #-0x10]
|
|
104
107
|
add v21.8h, v18.8h, v21.8h
|