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
|
@@ -37,6 +37,21 @@
|
|
|
37
37
|
#define MLK_SYS_AARCH64
|
|
38
38
|
#endif
|
|
39
39
|
|
|
40
|
+
/* Check if the AArch64 compilation target supports NEON (Advanced SIMD).
|
|
41
|
+
*
|
|
42
|
+
* Some compilers also define __ARM_NEON__, but __ARM_NEON is the most reliable
|
|
43
|
+
* signal. Specifically, clang on Apple appears to keep __ARM_NEON__ set even if
|
|
44
|
+
* -march=armv8-a+nosimd is set.
|
|
45
|
+
*
|
|
46
|
+
* gcc 4.8 -- the first gcc version introducing Neon support -- sets neither
|
|
47
|
+
* __ARM_NEON nor __ARM_NEON__; in fact, there is no preprocessor signal that
|
|
48
|
+
* Neon is enabled. If you use gcc 4.8, you should set __ARM_NEON manually.
|
|
49
|
+
* gcc 4.9 onwards do set __ARM_NEON.
|
|
50
|
+
*/
|
|
51
|
+
#if defined(MLK_SYS_AARCH64) && defined(__ARM_NEON)
|
|
52
|
+
#define MLK_SYS_AARCH64_NEON
|
|
53
|
+
#endif
|
|
54
|
+
|
|
40
55
|
/* Check if we're running on an AArch64 big endian system. */
|
|
41
56
|
#if defined(__AARCH64EB__)
|
|
42
57
|
#define MLK_SYS_AARCH64_EB
|
|
@@ -195,7 +210,7 @@
|
|
|
195
210
|
#endif
|
|
196
211
|
|
|
197
212
|
|
|
198
|
-
/* New X86_64 CPUs support
|
|
213
|
+
/* New X86_64 CPUs support control-flow protection using the CET instructions.
|
|
199
214
|
* When enabled (through -fcf-protection=), all compilation units (including
|
|
200
215
|
* empty ones) need to support CET for this to work.
|
|
201
216
|
* For assembly, this means that source files need to signal support for
|
|
@@ -273,9 +288,12 @@
|
|
|
273
288
|
typedef enum
|
|
274
289
|
{
|
|
275
290
|
/* x86_64 */
|
|
276
|
-
|
|
291
|
+
MLK_SYS_CAP_X86_64_AVX2,
|
|
277
292
|
/* AArch64 */
|
|
278
|
-
|
|
293
|
+
MLK_SYS_CAP_AARCH64_NEON,
|
|
294
|
+
MLK_SYS_CAP_AARCH64_SHA3,
|
|
295
|
+
/* Armv8.1-M */
|
|
296
|
+
MLK_SYS_CAP_ARMV81M_MVE
|
|
279
297
|
} mlk_sys_cap;
|
|
280
298
|
|
|
281
299
|
#if !defined(MLK_CONFIG_CUSTOM_CAPABILITY_FUNC)
|
|
@@ -419,17 +419,20 @@ __contract__(
|
|
|
419
419
|
#if !defined(MLK_CONFIG_CUSTOM_ZEROIZE)
|
|
420
420
|
#if defined(MLK_SYS_WINDOWS)
|
|
421
421
|
#include <windows.h>
|
|
422
|
+
#elif !defined(MLK_HAVE_INLINE_ASM)
|
|
423
|
+
#error No plausibly-secure implementation of mlk_zeroize available. Please provide your own using MLK_CONFIG_CUSTOM_ZEROIZE.
|
|
424
|
+
#endif
|
|
425
|
+
|
|
422
426
|
static MLK_INLINE void mlk_zeroize(void *ptr, size_t len)
|
|
423
427
|
__contract__(
|
|
428
|
+
requires(len <= UINT32_MAX)
|
|
424
429
|
requires(memory_no_alias(ptr, len))
|
|
425
|
-
assigns(memory_slice(ptr, len))
|
|
426
|
-
|
|
427
|
-
#include <string.h>
|
|
428
|
-
static MLK_INLINE void mlk_zeroize(void *ptr, size_t len)
|
|
429
|
-
__contract__(
|
|
430
|
-
requires(memory_no_alias(ptr, len))
|
|
431
|
-
assigns(memory_slice(ptr, len)))
|
|
430
|
+
assigns(memory_slice(ptr, len))
|
|
431
|
+
ensures(array_zeroized_u8((uint8_t *)ptr, len)))
|
|
432
432
|
{
|
|
433
|
+
#if defined(MLK_SYS_WINDOWS)
|
|
434
|
+
SecureZeroMemory(ptr, len);
|
|
435
|
+
#else
|
|
433
436
|
mlk_memset(ptr, 0, len);
|
|
434
437
|
/* This follows OpenSSL and seems sufficient to prevent the compiler
|
|
435
438
|
* from optimizing away the memset.
|
|
@@ -437,10 +440,8 @@ __contract__(
|
|
|
437
440
|
* If there was a reliable way to detect availability of memset_s(),
|
|
438
441
|
* that would be preferred. */
|
|
439
442
|
__asm__ volatile("" : : "r"(ptr) : "memory");
|
|
443
|
+
#endif /* !MLK_SYS_WINDOWS */
|
|
440
444
|
}
|
|
441
|
-
#else /* !MLK_SYS_WINDOWS && MLK_HAVE_INLINE_ASM */
|
|
442
|
-
#error No plausibly-secure implementation of mlk_zeroize available. Please provide your own using MLK_CONFIG_CUSTOM_ZEROIZE.
|
|
443
|
-
#endif /* !MLK_SYS_WINDOWS && !MLK_HAVE_INLINE_ASM */
|
|
444
445
|
#endif /* !MLK_CONFIG_CUSTOM_ZEROIZE */
|
|
445
446
|
|
|
446
447
|
#endif /* !MLK_VERIFY_H */
|
data/lib/pq_crypto/version.rb
CHANGED
data/script/vendor_libs.rb
CHANGED
|
@@ -13,17 +13,17 @@ MANIFEST_PATH = File.join(VENDOR_DIR, ".vendored")
|
|
|
13
13
|
PINS = {
|
|
14
14
|
mlkem: {
|
|
15
15
|
repo: "https://github.com/pq-code-package/mlkem-native.git",
|
|
16
|
-
ref: "
|
|
17
|
-
commit: "
|
|
18
|
-
tree_sha256: "
|
|
16
|
+
ref: "v2.0.0",
|
|
17
|
+
commit: "d1b2fe782888bdb761a50336012923180be7f502",
|
|
18
|
+
tree_sha256: "18bfa9ea4e2232bdf56f8ec374b62d10e50b99a30cb08aafc18d0b97e00cd06f",
|
|
19
19
|
target: "mlkem-native",
|
|
20
20
|
source_dir: "mlkem"
|
|
21
21
|
},
|
|
22
22
|
mldsa: {
|
|
23
23
|
repo: "https://github.com/pq-code-package/mldsa-native.git",
|
|
24
|
-
ref: "
|
|
25
|
-
commit: "
|
|
26
|
-
tree_sha256: "
|
|
24
|
+
ref: "v2.0.0",
|
|
25
|
+
commit: "834a90d5e846ffa1e1611bd24e160bb2e9b86d35",
|
|
26
|
+
tree_sha256: "25b3c3949d2ed37d1ad5d4722c8476d13deb2a0bb945f12444f463378d69375d",
|
|
27
27
|
target: "mldsa-native",
|
|
28
28
|
source_dir: "mldsa"
|
|
29
29
|
}
|
metadata
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: pq_crypto
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.6.
|
|
4
|
+
version: 0.6.6
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Roman Haydarov
|
|
8
|
-
autorequire:
|
|
9
8
|
bindir: exe
|
|
10
9
|
cert_chain: []
|
|
11
|
-
date:
|
|
10
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
|
12
11
|
dependencies:
|
|
13
12
|
- !ruby/object:Gem::Dependency
|
|
14
13
|
name: rake
|
|
@@ -83,6 +82,7 @@ files:
|
|
|
83
82
|
- ext/pqcrypto/vendor/mldsa-native/LICENSE
|
|
84
83
|
- ext/pqcrypto/vendor/mldsa-native/META.yml
|
|
85
84
|
- ext/pqcrypto/vendor/mldsa-native/README.md
|
|
85
|
+
- ext/pqcrypto/vendor/mldsa-native/RELEASE.md
|
|
86
86
|
- ext/pqcrypto/vendor/mldsa-native/SECURITY.md
|
|
87
87
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/README.md
|
|
88
88
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native.c
|
|
@@ -91,6 +91,7 @@ files:
|
|
|
91
91
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/mldsa_native_config.h
|
|
92
92
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/cbmc.h
|
|
93
93
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/common.h
|
|
94
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/context.h
|
|
94
95
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.c
|
|
95
96
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/ct.h
|
|
96
97
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/debug.c
|
|
@@ -120,9 +121,9 @@ files:
|
|
|
120
121
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/fips202_native_armv81m.h
|
|
121
122
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S
|
|
122
123
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c
|
|
124
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S
|
|
125
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S
|
|
123
126
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/keccakf1600_round_constants.c
|
|
124
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S
|
|
125
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S
|
|
126
127
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/auto.h
|
|
127
128
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h
|
|
128
129
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/fips202/native/x86_64/src/fips202_native_x86_64.h
|
|
@@ -131,24 +132,24 @@ files:
|
|
|
131
132
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/meta.h
|
|
132
133
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/aarch64_zetas.c
|
|
133
134
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/arith_native_aarch64.h
|
|
134
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
135
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
136
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
137
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
138
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
139
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
140
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
141
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
142
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
143
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
144
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
145
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
146
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
147
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/
|
|
135
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_intt_aarch64_asm.S
|
|
136
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_ntt_aarch64_asm.S
|
|
137
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_pointwise_montgomery_aarch64_asm.S
|
|
138
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_caddq_aarch64_asm.S
|
|
139
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_chknorm_aarch64_asm.S
|
|
140
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_32_aarch64_asm.S
|
|
141
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_decompose_88_aarch64_asm.S
|
|
142
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_32_aarch64_asm.S
|
|
143
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_poly_use_hint_88_aarch64_asm.S
|
|
144
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l4_aarch64_asm.S
|
|
145
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l5_aarch64_asm.S
|
|
146
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyvecl_pointwise_acc_montgomery_l7_aarch64_asm.S
|
|
147
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_17_aarch64_asm.S
|
|
148
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_polyz_unpack_19_aarch64_asm.S
|
|
149
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_aarch64_asm.S
|
|
150
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta2_aarch64_asm.S
|
|
151
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/mldsa_rej_uniform_eta4_aarch64_asm.S
|
|
148
152
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/polyz_unpack_table.c
|
|
149
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_aarch64_asm.S
|
|
150
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta2_aarch64_asm.S
|
|
151
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta4_aarch64_asm.S
|
|
152
153
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_eta_table.c
|
|
153
154
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/aarch64/src/rej_uniform_table.c
|
|
154
155
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/api.h
|
|
@@ -157,24 +158,24 @@ files:
|
|
|
157
158
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/arith_native_x86_64.h
|
|
158
159
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.c
|
|
159
160
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/consts.h
|
|
160
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
161
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
162
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
163
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
164
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
165
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
166
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
167
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
168
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
169
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
170
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
171
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
172
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
173
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
174
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
175
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
176
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
177
|
-
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/
|
|
161
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_intt_avx2_asm.S
|
|
162
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_ntt_avx2_asm.S
|
|
163
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_nttunpack_avx2_asm.S
|
|
164
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l4_avx2_asm.S
|
|
165
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l5_avx2_asm.S
|
|
166
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_acc_l7_avx2_asm.S
|
|
167
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_pointwise_avx2_asm.S
|
|
168
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_caddq_avx2_asm.S
|
|
169
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_chknorm_avx2_asm.S
|
|
170
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_32_avx2_asm.S
|
|
171
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_decompose_88_avx2_asm.S
|
|
172
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_32_avx2_asm.S
|
|
173
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_poly_use_hint_88_avx2_asm.S
|
|
174
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_17_avx2_asm.S
|
|
175
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_polyz_unpack_19_avx2_asm.S
|
|
176
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_avx2_asm.S
|
|
177
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta2_avx2_asm.S
|
|
178
|
+
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/mldsa_rej_uniform_eta4_avx2_asm.S
|
|
178
179
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/native/x86_64/src/rej_uniform_table.c
|
|
179
180
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.c
|
|
180
181
|
- ext/pqcrypto/vendor/mldsa-native/mldsa/src/packing.h
|
|
@@ -210,6 +211,7 @@ files:
|
|
|
210
211
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/common.h
|
|
211
212
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.c
|
|
212
213
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/compress.h
|
|
214
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/context.h
|
|
213
215
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.c
|
|
214
216
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/debug.h
|
|
215
217
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/fips202.c
|
|
@@ -237,9 +239,9 @@ files:
|
|
|
237
239
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/fips202_native_armv81m.h
|
|
238
240
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.S
|
|
239
241
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_mve.c
|
|
242
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_extract_bytes_mve.S
|
|
243
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccak_f1600_x4_state_xor_bytes_mve.S
|
|
240
244
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/keccakf1600_round_constants.c
|
|
241
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_extract_bytes_x4_mve.S
|
|
242
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/armv81m/src/state_xor_bytes_x4_mve.S
|
|
243
245
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/auto.h
|
|
244
246
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h
|
|
245
247
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/fips202/native/x86_64/src/fips202_native_x86_64.h
|
|
@@ -253,16 +255,16 @@ files:
|
|
|
253
255
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/meta.h
|
|
254
256
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/aarch64_zetas.c
|
|
255
257
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/arith_native_aarch64.h
|
|
256
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
257
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
258
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
259
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
260
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
261
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
262
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
263
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
264
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
265
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/
|
|
258
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_intt_aarch64_asm.S
|
|
259
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_ntt_aarch64_asm.S
|
|
260
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_mulcache_compute_aarch64_asm.S
|
|
261
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_reduce_aarch64_asm.S
|
|
262
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tobytes_aarch64_asm.S
|
|
263
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_poly_tomont_aarch64_asm.S
|
|
264
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_aarch64_asm.S
|
|
265
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_aarch64_asm.S
|
|
266
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_aarch64_asm.S
|
|
267
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/mlkem_rej_uniform_aarch64_asm.S
|
|
266
268
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/aarch64/src/rej_uniform_table.c
|
|
267
269
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/api.h
|
|
268
270
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/meta.h
|
|
@@ -271,10 +273,10 @@ files:
|
|
|
271
273
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/arith_native_ppc64le.h
|
|
272
274
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.c
|
|
273
275
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/consts.h
|
|
274
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/
|
|
275
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/
|
|
276
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/
|
|
277
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/
|
|
276
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_intt_ppc_asm.S
|
|
277
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_ntt_ppc_asm.S
|
|
278
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_poly_tomont_ppc_asm.S
|
|
279
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/ppc64le/src/mlkem_reduce_ppc_asm.S
|
|
278
280
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/README.md
|
|
279
281
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/meta.h
|
|
280
282
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/riscv64/src/arith_native_riscv64.h
|
|
@@ -291,27 +293,27 @@ files:
|
|
|
291
293
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/compress_consts.h
|
|
292
294
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.c
|
|
293
295
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/consts.h
|
|
294
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
295
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
296
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
297
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
298
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
299
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
300
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
301
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
302
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
303
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
304
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
305
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
306
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
307
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
308
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
309
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
310
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
311
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
312
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/
|
|
296
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_intt_avx2_asm.S
|
|
297
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntt_avx2_asm.S
|
|
298
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttfrombytes_avx2_asm.S
|
|
299
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_ntttobytes_avx2_asm.S
|
|
300
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_nttunpack_avx2_asm.S
|
|
301
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d10_avx2_asm.S
|
|
302
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d11_avx2_asm.S
|
|
303
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d4_avx2_asm.S
|
|
304
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_compress_d5_avx2_asm.S
|
|
305
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d10_avx2_asm.S
|
|
306
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d11_avx2_asm.S
|
|
307
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d4_avx2_asm.S
|
|
308
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_decompress_d5_avx2_asm.S
|
|
309
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_poly_mulcache_compute_avx2_asm.S
|
|
310
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.S
|
|
311
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.S
|
|
312
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.S
|
|
313
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_reduce_avx2_asm.S
|
|
314
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_rej_uniform_avx2_asm.S
|
|
315
|
+
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/mlkem_tomont_avx2_asm.S
|
|
313
316
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/rej_uniform_table.c
|
|
314
|
-
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/native/x86_64/src/tomont_avx2_asm.S
|
|
315
317
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/params.h
|
|
316
318
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.c
|
|
317
319
|
- ext/pqcrypto/vendor/mlkem-native/mlkem/src/poly.h
|
|
@@ -348,7 +350,6 @@ metadata:
|
|
|
348
350
|
homepage_uri: https://github.com/roman-haidarov/pq_crypto
|
|
349
351
|
source_code_uri: https://github.com/roman-haidarov/pq_crypto/tree/main
|
|
350
352
|
changelog_uri: https://github.com/roman-haidarov/pq_crypto/blob/main/CHANGELOG.md
|
|
351
|
-
post_install_message:
|
|
352
353
|
rdoc_options: []
|
|
353
354
|
require_paths:
|
|
354
355
|
- lib
|
|
@@ -363,8 +364,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
363
364
|
- !ruby/object:Gem::Version
|
|
364
365
|
version: '0'
|
|
365
366
|
requirements: []
|
|
366
|
-
rubygems_version: 3.
|
|
367
|
-
signing_key:
|
|
367
|
+
rubygems_version: 3.6.7
|
|
368
368
|
specification_version: 4
|
|
369
369
|
summary: Primitive-first post-quantum cryptography for Ruby
|
|
370
370
|
test_files: []
|
|
@@ -1,52 +0,0 @@
|
|
|
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
|
-
* - [REF_AVX2]
|
|
10
|
-
* CRYSTALS-Dilithium optimized AVX2 implementation
|
|
11
|
-
* Bai, Ducas, Kiltz, Lepoint, Lyubashevsky, Schwabe, Seiler, Stehlé
|
|
12
|
-
* https://github.com/pq-crystals/dilithium/tree/master/avx2
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
* This file is derived from the public domain
|
|
17
|
-
* AVX2 Dilithium implementation @[REF_AVX2].
|
|
18
|
-
*/
|
|
19
|
-
|
|
20
|
-
#include "../../../common.h"
|
|
21
|
-
|
|
22
|
-
#if defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
23
|
-
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED)
|
|
24
|
-
|
|
25
|
-
#include <immintrin.h>
|
|
26
|
-
#include "arith_native_x86_64.h"
|
|
27
|
-
|
|
28
|
-
int mld_poly_chknorm_avx2(const int32_t *a, int32_t B)
|
|
29
|
-
{
|
|
30
|
-
unsigned int i;
|
|
31
|
-
__m256i f, t;
|
|
32
|
-
const __m256i bound = _mm256_set1_epi32(B - 1);
|
|
33
|
-
|
|
34
|
-
t = _mm256_setzero_si256();
|
|
35
|
-
for (i = 0; i < MLDSA_N / 8; i++)
|
|
36
|
-
{
|
|
37
|
-
f = _mm256_load_si256((const __m256i *)&a[8 * i]);
|
|
38
|
-
f = _mm256_abs_epi32(f);
|
|
39
|
-
f = _mm256_cmpgt_epi32(f, bound);
|
|
40
|
-
t = _mm256_or_si256(t, f);
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return 1 - _mm256_testz_si256(t, t);
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
#else /* MLD_ARITH_BACKEND_X86_64_DEFAULT && !MLD_CONFIG_MULTILEVEL_NO_SHARED \
|
|
47
|
-
*/
|
|
48
|
-
|
|
49
|
-
MLD_EMPTY_CU(avx2_poly_chknorm)
|
|
50
|
-
|
|
51
|
-
#endif /* !(MLD_ARITH_BACKEND_X86_64_DEFAULT && \
|
|
52
|
-
!MLD_CONFIG_MULTILEVEL_NO_SHARED) */
|
|
@@ -1,157 +0,0 @@
|
|
|
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
|
-
* - [REF_AVX2]
|
|
10
|
-
* CRYSTALS-Dilithium optimized AVX2 implementation
|
|
11
|
-
* Bai, Ducas, Kiltz, Lepoint, Lyubashevsky, Schwabe, Seiler, Stehlé
|
|
12
|
-
* https://github.com/pq-crystals/dilithium/tree/master/avx2
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
/*
|
|
16
|
-
* This file is derived from the public domain
|
|
17
|
-
* AVX2 Dilithium implementation @[REF_AVX2].
|
|
18
|
-
*
|
|
19
|
-
* The algorithm for Decompose(r) (more specifically the handling for the
|
|
20
|
-
* wrap-around cases) are modified. See the "Reference" section in the comments
|
|
21
|
-
* below for a more detailed comparison.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
|
-
#include "../../../common.h"
|
|
25
|
-
|
|
26
|
-
#if defined(MLD_ARITH_BACKEND_X86_64_DEFAULT) && \
|
|
27
|
-
!defined(MLD_CONFIG_NO_SIGN_API) && \
|
|
28
|
-
!defined(MLD_CONFIG_MULTILEVEL_NO_SHARED) && \
|
|
29
|
-
(defined(MLD_CONFIG_MULTILEVEL_WITH_SHARED) || \
|
|
30
|
-
(MLD_CONFIG_PARAMETER_SET == 65 || MLD_CONFIG_PARAMETER_SET == 87))
|
|
31
|
-
|
|
32
|
-
#include <immintrin.h>
|
|
33
|
-
#include "arith_native_x86_64.h"
|
|
34
|
-
#include "consts.h"
|
|
35
|
-
|
|
36
|
-
/*
|
|
37
|
-
* Reference: The reference implementation has the input polynomial as a
|
|
38
|
-
* separate argument that may be aliased with either of the outputs.
|
|
39
|
-
* Removing the aliasing eases CBMC proofs.
|
|
40
|
-
*/
|
|
41
|
-
void mld_poly_decompose_32_avx2(int32_t *a1, int32_t *a0)
|
|
42
|
-
{
|
|
43
|
-
unsigned int i;
|
|
44
|
-
__m256i f, f0, f1, t;
|
|
45
|
-
const __m256i q_bound = _mm256_set1_epi32(31 * ((MLDSA_Q - 1) / 32));
|
|
46
|
-
/* check-magic: 1025 == floor(2**22 / 4092) */
|
|
47
|
-
const __m256i v = _mm256_set1_epi32(1025);
|
|
48
|
-
const __m256i alpha = _mm256_set1_epi32(2 * ((MLDSA_Q - 1) / 32));
|
|
49
|
-
const __m256i off = _mm256_set1_epi32(127);
|
|
50
|
-
const __m256i shift = _mm256_set1_epi32(512);
|
|
51
|
-
|
|
52
|
-
for (i = 0; i < MLDSA_N / 8; i++)
|
|
53
|
-
{
|
|
54
|
-
f = _mm256_load_si256((__m256i *)&a0[8 * i]);
|
|
55
|
-
|
|
56
|
-
/* check-magic: 4092 == intdiv(2 * intdiv(MLDSA_Q - 1, 32), 128) */
|
|
57
|
-
/*
|
|
58
|
-
* Compute f1 = round-(f / (2*GAMMA2)) as round-(f / (128B)) =
|
|
59
|
-
* round-(ceil(f / 128) / B) where B = 2*GAMMA2 / 128 = 4092. See
|
|
60
|
-
* mld_decompose() in mldsa/src/rounding.h for more details.
|
|
61
|
-
*
|
|
62
|
-
* range: 0 <= f <= Q-1 = 32*GAMMA2 = 16*128*B
|
|
63
|
-
*/
|
|
64
|
-
|
|
65
|
-
/* Compute f1' = ceil(f / 128) as floor((f + 127) / 2^7) */
|
|
66
|
-
f1 = _mm256_add_epi32(f, off);
|
|
67
|
-
f1 = _mm256_srli_epi32(f1, 7);
|
|
68
|
-
/*
|
|
69
|
-
* range: 0 <= f1' <= (Q-1)/128 = 16B
|
|
70
|
-
*
|
|
71
|
-
* Also, f1' <= (Q-1)/128 = 2^16 - 2^6 < 2^16 ensures that the odd-index
|
|
72
|
-
* 16-bit lanes are all 0, so no bits will be dropped in the input of the
|
|
73
|
-
* _mm256_mulhi_epu16() below.
|
|
74
|
-
*/
|
|
75
|
-
|
|
76
|
-
/*
|
|
77
|
-
* Compute f1 = round-(f1' / B) ≈ round(f1' * 1025 / 2^22). This is exact
|
|
78
|
-
* for 0 <= f1' < 2^16. See mld_decompose() in mldsa/src/rounding.h for the
|
|
79
|
-
* proof, and proofs/isabelle/compress for a formalization of the argument.
|
|
80
|
-
*
|
|
81
|
-
* round(f1' * 1025 / 2^22) is in turn computed in 2 steps as
|
|
82
|
-
* round(floor(f1' * 1025 / 2^16) / 2^6). The mulhi computes f1'' =
|
|
83
|
-
* floor(f1' * 1025 / 2^16). As for the next step f1 = round(f1'' / 2^6),
|
|
84
|
-
* because AVX2 doesn't have rounding right-shift (e.g. urshr in Neon), we
|
|
85
|
-
* simulate it using mulhrs with a power of 2, in this case mulhrs(f1'',
|
|
86
|
-
* 2^9) = round(f1'' * 2^9 / 2^15). (Note that the denominator is 2^15,
|
|
87
|
-
* not 2^16 as in mulhi.)
|
|
88
|
-
*/
|
|
89
|
-
f1 = _mm256_mulhi_epu16(f1, v);
|
|
90
|
-
/*
|
|
91
|
-
* range: 0 <= f1'' = floor(f1' * 1025 / 2^16)
|
|
92
|
-
* <= f1' * 1025 / 2^16
|
|
93
|
-
* < 2^16 * 1025 / 2^16 = 1025
|
|
94
|
-
*
|
|
95
|
-
* Because 0 <= f1'' < 2^15, the multiplication in mulhrs is unsigned, that
|
|
96
|
-
* is, no erroneous sign-extension occurs.
|
|
97
|
-
*/
|
|
98
|
-
f1 = _mm256_mulhrs_epi16(f1, shift);
|
|
99
|
-
/*
|
|
100
|
-
* range: 0 <= f1 = round-(f1' / B) <= round-(16B / B) = 16
|
|
101
|
-
*
|
|
102
|
-
* Note that the odd-index 16-bit lanes are still all 0 right now, so
|
|
103
|
-
* reinterpreting f1 as 8 lanes of int32_t (as done in the following) does
|
|
104
|
-
* not affect its value.
|
|
105
|
-
*/
|
|
106
|
-
|
|
107
|
-
/*
|
|
108
|
-
* If f1 = 16, i.e. f > 31*GAMMA2, proceed as if f' = f - Q was given
|
|
109
|
-
* instead. (For f = 31*GAMMA2 + 1 thus f' = -GAMMA2, we still round it to 0
|
|
110
|
-
* like other "wrapped around" cases.)
|
|
111
|
-
*
|
|
112
|
-
* Reference: They handle wrap-around in a somewhat convoluted way. Most
|
|
113
|
-
* notably, they compute remainder f0 with quotient f1 that's
|
|
114
|
-
* already wrapped around, so is off by q (instead of by 1) from
|
|
115
|
-
* what it should be ultimately. They detect the need for
|
|
116
|
-
* correction by checking if f0 is abnormally large.
|
|
117
|
-
*
|
|
118
|
-
* Our approach is closer to Algorithm 36 in the specification,
|
|
119
|
-
* in that we compute f0 normally and correct f1, f0 in the way
|
|
120
|
-
* they prescribed. The only real difference is that we check for
|
|
121
|
-
* wrap-around by examining f directly, instead of some other
|
|
122
|
-
* intermediates computed from it.
|
|
123
|
-
*/
|
|
124
|
-
|
|
125
|
-
/* Check for wrap-around */
|
|
126
|
-
t = _mm256_cmpgt_epi32(f, q_bound);
|
|
127
|
-
|
|
128
|
-
/* Compute remainder f0 */
|
|
129
|
-
f0 = _mm256_mullo_epi32(f1, alpha);
|
|
130
|
-
f0 = _mm256_sub_epi32(f, f0);
|
|
131
|
-
/*
|
|
132
|
-
* range: -GAMMA2 < f0 <= GAMMA2
|
|
133
|
-
*
|
|
134
|
-
* This holds since f1 = round-(f / (2*GAMMA2)) was computed exactly.
|
|
135
|
-
*/
|
|
136
|
-
|
|
137
|
-
/* If wrap-around is required, set f1 = 0 and f0 -= 1 */
|
|
138
|
-
f1 = _mm256_andnot_si256(t, f1);
|
|
139
|
-
f0 = _mm256_add_epi32(f0, t);
|
|
140
|
-
/* range: 0 <= f1 <= 15, -GAMMA2 <= f0 <= GAMMA2 */
|
|
141
|
-
|
|
142
|
-
_mm256_store_si256((__m256i *)&a1[8 * i], f1);
|
|
143
|
-
_mm256_store_si256((__m256i *)&a0[8 * i], f0);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
#else /* MLD_ARITH_BACKEND_X86_64_DEFAULT && !MLD_CONFIG_NO_SIGN_API && \
|
|
148
|
-
!MLD_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
149
|
-
(MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
150
|
-
|| MLD_CONFIG_PARAMETER_SET == 87) */
|
|
151
|
-
|
|
152
|
-
MLD_EMPTY_CU(avx2_poly_decompose_32)
|
|
153
|
-
|
|
154
|
-
#endif /* !(MLD_ARITH_BACKEND_X86_64_DEFAULT && !MLD_CONFIG_NO_SIGN_API && \
|
|
155
|
-
!MLD_CONFIG_MULTILEVEL_NO_SHARED && \
|
|
156
|
-
(MLD_CONFIG_MULTILEVEL_WITH_SHARED || MLD_CONFIG_PARAMETER_SET == 65 \
|
|
157
|
-
|| MLD_CONFIG_PARAMETER_SET == 87)) */
|