diff --git a/dev/fips202/aarch64/x1_v84a.h b/dev/fips202/aarch64/x1_v84a.h index 87c0a81155..94a87fa3e6 100644 --- a/dev/fips202/aarch64/x1_v84a.h +++ b/dev/fips202/aarch64/x1_v84a.h @@ -21,7 +21,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x1_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/dev/fips202/aarch64/x2_v84a.h b/dev/fips202/aarch64/x2_v84a.h index f0adab5180..a8f9e74558 100644 --- a/dev/fips202/aarch64/x2_v84a.h +++ b/dev/fips202/aarch64/x2_v84a.h @@ -21,7 +21,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x4_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/dev/fips202/aarch64/x4_v8a_v84a_scalar.h b/dev/fips202/aarch64/x4_v8a_v84a_scalar.h index 47a68379d7..358b0a30d2 100644 --- a/dev/fips202/aarch64/x4_v8a_v84a_scalar.h +++ b/dev/fips202/aarch64/x4_v8a_v84a_scalar.h @@ -21,7 +21,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x4_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/dev/fips202/x86_64/keccak_f1600_x4_avx2.h b/dev/fips202/x86_64/keccak_f1600_x4_avx2.h index 30a63e31cb..4601629284 100644 --- a/dev/fips202/x86_64/keccak_f1600_x4_avx2.h +++ b/dev/fips202/x86_64/keccak_f1600_x4_avx2.h @@ -19,7 +19,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x4_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/dev/x86_64/meta.h b/dev/x86_64/meta.h index fdbbfcea28..c750f10809 100644 --- a/dev/x86_64/meta.h +++ b/dev/x86_64/meta.h @@ -37,7 +37,7 @@ static MLK_INLINE void mlk_poly_permute_bitrev_to_custom(int16_t data[MLKEM_N]) { - if (mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { mlk_nttunpack_avx2_asm(data); } @@ -48,7 +48,7 @@ static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len, const uint8_t *buf, unsigned buflen) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2) || len != MLKEM_N || + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2) || len != MLKEM_N || buflen % 12 != 0) { return MLK_NATIVE_FUNC_FALLBACK; @@ -59,7 +59,7 @@ static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len, MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -71,7 +71,7 @@ static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N]) MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -83,7 +83,7 @@ static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N]) MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -95,7 +95,7 @@ static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N]) MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_tomont_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -108,7 +108,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_mulcache_compute_native(int16_t x[MLKEM_N / 2], const int16_t y[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -123,7 +123,7 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k2_native( int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N], const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -139,7 +139,7 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k3_native( int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N], const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -155,7 +155,7 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k4_native( int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N], const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -169,7 +169,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -182,7 +182,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_frombytes_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYBYTES]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -196,7 +196,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d4_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -209,7 +209,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d10_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -222,7 +222,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d4_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -235,7 +235,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d10_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D10]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -250,7 +250,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d5_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -263,7 +263,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d11_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -276,7 +276,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d5_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -289,7 +289,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d11_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D11]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/integration/aws-lc/post_import.patch b/integration/aws-lc/post_import.patch new file mode 100644 index 0000000000..ee11797548 --- /dev/null +++ b/integration/aws-lc/post_import.patch @@ -0,0 +1,14 @@ +# Copyright (c) The mlkem-native project authors +# SPDX-License-Identifier: Apache-2.0 OR ISC OR MIT +diff --git a/crypto/fipsmodule/ml_kem/mlkem_native_config.h b/crypto/fipsmodule/ml_kem/mlkem_native_config.h +--- a/crypto/fipsmodule/ml_kem/mlkem_native_config.h ++++ b/crypto/fipsmodule/ml_kem/mlkem_native_config.h +@@ -36,7 +36,7 @@ + static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap) + { + #if defined(MLK_SYS_X86_64) +- if (cap == MLK_SYS_CAP_AVX2) ++ if (cap == MLK_SYS_CAP_X86_64_AVX2) + { + return CRYPTO_is_AVX2_capable(); + } diff --git a/mlkem/src/fips202/native/aarch64/x1_v84a.h b/mlkem/src/fips202/native/aarch64/x1_v84a.h index c7d374a9a0..eb8a64fe84 100644 --- a/mlkem/src/fips202/native/aarch64/x1_v84a.h +++ b/mlkem/src/fips202/native/aarch64/x1_v84a.h @@ -21,7 +21,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x1_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/mlkem/src/fips202/native/aarch64/x2_v84a.h b/mlkem/src/fips202/native/aarch64/x2_v84a.h index 3dabec4834..14343853e7 100644 --- a/mlkem/src/fips202/native/aarch64/x2_v84a.h +++ b/mlkem/src/fips202/native/aarch64/x2_v84a.h @@ -21,7 +21,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x4_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h b/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h index c215198c11..9c0b35dc0c 100644 --- a/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h +++ b/mlkem/src/fips202/native/aarch64/x4_v8a_v84a_scalar.h @@ -21,7 +21,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x4_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h b/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h index 1c37f31ac3..aa975b0f35 100644 --- a/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h +++ b/mlkem/src/fips202/native/x86_64/keccak_f1600_x4_avx2.h @@ -19,7 +19,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_keccak_f1600_x4_native(uint64_t *state) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/mlkem/src/native/x86_64/meta.h b/mlkem/src/native/x86_64/meta.h index e59849ef76..e6573261ee 100644 --- a/mlkem/src/native/x86_64/meta.h +++ b/mlkem/src/native/x86_64/meta.h @@ -37,7 +37,7 @@ static MLK_INLINE void mlk_poly_permute_bitrev_to_custom(int16_t data[MLKEM_N]) { - if (mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { mlk_nttunpack_avx2_asm(data); } @@ -48,7 +48,7 @@ static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len, const uint8_t *buf, unsigned buflen) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2) || len != MLKEM_N || + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2) || len != MLKEM_N || buflen % 12 != 0) { return MLK_NATIVE_FUNC_FALLBACK; @@ -59,7 +59,7 @@ static MLK_INLINE int mlk_rej_uniform_native(int16_t *r, unsigned len, MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -71,7 +71,7 @@ static MLK_INLINE int mlk_ntt_native(int16_t data[MLKEM_N]) MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -83,7 +83,7 @@ static MLK_INLINE int mlk_intt_native(int16_t data[MLKEM_N]) MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -95,7 +95,7 @@ static MLK_INLINE int mlk_poly_reduce_native(int16_t data[MLKEM_N]) MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_tomont_native(int16_t data[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -108,7 +108,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_mulcache_compute_native(int16_t x[MLKEM_N / 2], const int16_t y[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -123,7 +123,7 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k2_native( int16_t r[MLKEM_N], const int16_t a[2 * MLKEM_N], const int16_t b[2 * MLKEM_N], const int16_t b_cache[2 * (MLKEM_N / 2)]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -139,7 +139,7 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k3_native( int16_t r[MLKEM_N], const int16_t a[3 * MLKEM_N], const int16_t b[3 * MLKEM_N], const int16_t b_cache[3 * (MLKEM_N / 2)]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -155,7 +155,7 @@ static MLK_INLINE int mlk_polyvec_basemul_acc_montgomery_cached_k4_native( int16_t r[MLKEM_N], const int16_t a[4 * MLKEM_N], const int16_t b[4 * MLKEM_N], const int16_t b_cache[4 * (MLKEM_N / 2)]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -169,7 +169,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_tobytes_native(uint8_t r[MLKEM_POLYBYTES], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -182,7 +182,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_frombytes_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYBYTES]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -196,7 +196,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d4_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D4], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -209,7 +209,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d10_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D10], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -222,7 +222,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d4_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D4]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -235,7 +235,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d10_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D10]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -250,7 +250,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d5_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D5], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -263,7 +263,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_compress_d11_native( uint8_t r[MLKEM_POLYCOMPRESSEDBYTES_D11], const int16_t a[MLKEM_N]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -276,7 +276,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d5_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D5]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } @@ -289,7 +289,7 @@ MLK_MUST_CHECK_RETURN_VALUE static MLK_INLINE int mlk_poly_decompress_d11_native( int16_t r[MLKEM_N], const uint8_t a[MLKEM_POLYCOMPRESSEDBYTES_D11]) { - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { return MLK_NATIVE_FUNC_FALLBACK; } diff --git a/mlkem/src/sys.h b/mlkem/src/sys.h index 1c48d81476..58fd7031cc 100644 --- a/mlkem/src/sys.h +++ b/mlkem/src/sys.h @@ -273,11 +273,11 @@ typedef enum { /* x86_64 */ - MLK_SYS_CAP_AVX2, + MLK_SYS_CAP_X86_64_AVX2, /* AArch64 */ - MLK_SYS_CAP_SHA3, + MLK_SYS_CAP_AARCH64_SHA3, /* Armv8.1-M */ - MLK_SYS_CAP_MVE + MLK_SYS_CAP_ARMV81M_MVE } mlk_sys_cap; #if !defined(MLK_CONFIG_CUSTOM_CAPABILITY_FUNC) diff --git a/scripts/autogen b/scripts/autogen index d2ebfadc6f..5cd34eb96c 100755 --- a/scripts/autogen +++ b/scripts/autogen @@ -2909,10 +2909,9 @@ def check_macro_typos_in_file(filename, macro_check): def get_syscaps(): return [ - "MLK_SYS_CAP_AVX2", - "MLK_SYS_CAP_SHA3", - "MLK_SYS_CAP_MVE", - "MLK_SYS_CAP_DUMMY", + "MLK_SYS_CAP_X86_64_AVX2", + "MLK_SYS_CAP_AARCH64_SHA3", + "MLK_SYS_CAP_ARMV81M_MVE", ] @@ -2963,8 +2962,8 @@ def check_macro_typos(): if rest.startswith("\\") or m in ["MLK_XXX", "MLK_SOURCE_XXX"]: return True - # AWS-LC importer patch - if is_autogen or filename == "integration/awslc/awslc.patch": + # AWS-LC post-import patch + if is_autogen or filename == "integration/aws-lc/post_import.patch": return True if is_autogen or filename == "mlkem/src/common.h": @@ -4604,7 +4603,7 @@ ABI_CAPS = { "AVX2": { "asm_subdir": "x86_64", "guard": "__AVX2__", - "syscap": "MLK_SYS_CAP_AVX2", + "syscap": "MLK_SYS_CAP_X86_64_AVX2", "description": "AVX2", "cflags": ["-mavx2", "-mbmi2"], "aux_files": [], @@ -4612,7 +4611,7 @@ ABI_CAPS = { "SHA3": { "asm_subdir": "aarch64", "guard": "__ARM_FEATURE_SHA3", - "syscap": "MLK_SYS_CAP_SHA3", + "syscap": "MLK_SYS_CAP_AARCH64_SHA3", "description": "Armv8.4-A SHA3 (eor3, rax1, xar, bcax)", "cflags": ["-march=armv8.4-a+sha3"], "aux_files": [], @@ -4620,7 +4619,7 @@ ABI_CAPS = { "MVE": { "asm_subdir": "armv81m", "guard": "__ARM_FEATURE_MVE", - "syscap": "MLK_SYS_CAP_MVE", + "syscap": "MLK_SYS_CAP_ARMV81M_MVE", "description": "Armv8.1-M MVE", "cflags": ["-march=armv8.1-m.main+mve", "-mthumb"], "aux_files": [ @@ -5360,8 +5359,8 @@ def _main(): ("Generate monolithic source files", gen_monolithic), ("Generate undefs", gen_undefs), ("Generate test configs", gen_test_configs), - ("Check macro typos", check_macro_typos), ("Generate ABI checker tests", gen_abicheck), + ("Check macro typos", check_macro_typos), ("Generate preprocessor comments", gen_preprocessor_comments), # Formatting should be the last step ("Format files", lambda: format_files(args.dry_run)), diff --git a/test/abicheck/aarch64/checks/check_keccak_f1600_x1_v84a_aarch64_asm.c b/test/abicheck/aarch64/checks/check_keccak_f1600_x1_v84a_aarch64_asm.c index 2c6372733c..3108173185 100644 --- a/test/abicheck/aarch64/checks/check_keccak_f1600_x1_v84a_aarch64_asm.c +++ b/test/abicheck/aarch64/checks/check_keccak_f1600_x1_v84a_aarch64_asm.c @@ -31,7 +31,7 @@ int check_keccak_f1600_x1_v84a_aarch64_asm(void) MLK_ALIGN uint8_t buf_x0[200]; /* Keccak state (25 x uint64_t) */ MLK_ALIGN uint8_t buf_x1[192]; /* Round constants (24 x uint64_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { fprintf(stderr, "ABI check keccak_f1600_x1_v84a_aarch64_asm: host lacks Armv8.4-A " diff --git a/test/abicheck/aarch64/checks/check_keccak_f1600_x2_v84a_aarch64_asm.c b/test/abicheck/aarch64/checks/check_keccak_f1600_x2_v84a_aarch64_asm.c index ab3a97363a..8db59b018a 100644 --- a/test/abicheck/aarch64/checks/check_keccak_f1600_x2_v84a_aarch64_asm.c +++ b/test/abicheck/aarch64/checks/check_keccak_f1600_x2_v84a_aarch64_asm.c @@ -32,7 +32,7 @@ int check_keccak_f1600_x2_v84a_aarch64_asm(void) buf_x0[400]; /* Two sequential Keccak states (state0[25], state1[25]) */ MLK_ALIGN uint8_t buf_x1[192]; /* Round constants (24 x uint64_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { fprintf(stderr, "ABI check keccak_f1600_x2_v84a_aarch64_asm: host lacks Armv8.4-A " diff --git a/test/abicheck/aarch64/checks/check_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.c b/test/abicheck/aarch64/checks/check_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.c index 9d8c31d5cc..2e592ae36b 100644 --- a/test/abicheck/aarch64/checks/check_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.c +++ b/test/abicheck/aarch64/checks/check_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm.c @@ -32,7 +32,7 @@ int check_keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm(void) state1[25], state2[25], state3[25]) */ MLK_ALIGN uint8_t buf_x1[192]; /* Round constants (24 x uint64_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_SHA3)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_AARCH64_SHA3)) { fprintf(stderr, "ABI check keccak_f1600_x4_v8a_v84a_scalar_hybrid_aarch64_asm: " diff --git a/test/abicheck/armv81m/checks/check_keccak_f1600_x4_mve_asm.c b/test/abicheck/armv81m/checks/check_keccak_f1600_x4_mve_asm.c index ccc6a9f9e6..3f84d6186a 100644 --- a/test/abicheck/armv81m/checks/check_keccak_f1600_x4_mve_asm.c +++ b/test/abicheck/armv81m/checks/check_keccak_f1600_x4_mve_asm.c @@ -34,7 +34,7 @@ int check_keccak_f1600_x4_mve_asm(void) MLK_ALIGN uint8_t buf_r2[192]; /* Keccak round constants in bit-interleaved form (24 pairs of 32-bit words) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_MVE)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_ARMV81M_MVE)) { fprintf(stderr, "ABI check keccak_f1600_x4_mve_asm: host lacks Armv8.1-M MVE, " diff --git a/test/abicheck/x86_64/checks/check_invntt_avx2_asm.c b/test/abicheck/x86_64/checks/check_invntt_avx2_asm.c index 3a7a52f80b..a7c6a0ffbf 100644 --- a/test/abicheck/x86_64/checks/check_invntt_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_invntt_avx2_asm.c @@ -32,7 +32,7 @@ int check_invntt_avx2_asm(void) MLK_ALIGN uint8_t buf_rdi[512]; /* Input/output polynomial (256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[1248]; /* Precomputed constants (624 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check invntt_avx2_asm: host lacks AVX2, skipping\n"); return MLK_ABICHECK_SKIPPED; diff --git a/test/abicheck/x86_64/checks/check_keccak_f1600_x4_avx2_asm.c b/test/abicheck/x86_64/checks/check_keccak_f1600_x4_avx2_asm.c index b529d951cc..33aa051e6d 100644 --- a/test/abicheck/x86_64/checks/check_keccak_f1600_x4_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_keccak_f1600_x4_avx2_asm.c @@ -37,7 +37,7 @@ int check_keccak_f1600_x4_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[32]; /* Rotation constant rho8 (4 x uint64_t) */ MLK_ALIGN uint8_t buf_rsi[192]; /* Round constants (24 x uint64_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check keccak_f1600_x4_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_ntt_avx2_asm.c b/test/abicheck/x86_64/checks/check_ntt_avx2_asm.c index 7c0e1ec819..b2185c6019 100644 --- a/test/abicheck/x86_64/checks/check_ntt_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_ntt_avx2_asm.c @@ -32,7 +32,7 @@ int check_ntt_avx2_asm(void) MLK_ALIGN uint8_t buf_rdi[512]; /* Input/output polynomial (256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[1248]; /* Precomputed constants (624 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check ntt_avx2_asm: host lacks AVX2, skipping\n"); return MLK_ABICHECK_SKIPPED; diff --git a/test/abicheck/x86_64/checks/check_nttfrombytes_avx2_asm.c b/test/abicheck/x86_64/checks/check_nttfrombytes_avx2_asm.c index 8adfa96815..90b9c29563 100644 --- a/test/abicheck/x86_64/checks/check_nttfrombytes_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_nttfrombytes_avx2_asm.c @@ -32,7 +32,7 @@ int check_nttfrombytes_avx2_asm(void) MLK_ALIGN uint8_t buf_rdi[512]; /* Output polynomial (256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[384]; /* Input byte array (MLKEM_POLYBYTES = 384) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check nttfrombytes_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_ntttobytes_avx2_asm.c b/test/abicheck/x86_64/checks/check_ntttobytes_avx2_asm.c index 3d3de38115..36ad2af817 100644 --- a/test/abicheck/x86_64/checks/check_ntttobytes_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_ntttobytes_avx2_asm.c @@ -33,7 +33,7 @@ int check_ntttobytes_avx2_asm(void) buf_rdi[384]; /* Output byte array (MLKEM_POLYBYTES = 384) */ MLK_ALIGN uint8_t buf_rsi[512]; /* Input polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check ntttobytes_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_nttunpack_avx2_asm.c b/test/abicheck/x86_64/checks/check_nttunpack_avx2_asm.c index 96d7a62fd6..eaee811376 100644 --- a/test/abicheck/x86_64/checks/check_nttunpack_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_nttunpack_avx2_asm.c @@ -31,7 +31,7 @@ int check_nttunpack_avx2_asm(void) int violations; MLK_ALIGN uint8_t buf_rdi[512]; /* Input/output polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check nttunpack_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_poly_compress_d10_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_compress_d10_avx2_asm.c index 455b7a2b68..a30c040d04 100644 --- a/test/abicheck/x86_64/checks/check_poly_compress_d10_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_compress_d10_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_compress_d10_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[32]; /* Precomputed compression constants */ MLK_ALIGN uint8_t buf_rsi[512]; /* Input polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf( stderr, diff --git a/test/abicheck/x86_64/checks/check_poly_compress_d11_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_compress_d11_avx2_asm.c index 702d204dde..8fc598be22 100644 --- a/test/abicheck/x86_64/checks/check_poly_compress_d11_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_compress_d11_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_compress_d11_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[64]; /* Precomputed compression constants */ MLK_ALIGN uint8_t buf_rsi[512]; /* Input polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf( stderr, diff --git a/test/abicheck/x86_64/checks/check_poly_compress_d4_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_compress_d4_avx2_asm.c index a5e71ffa07..5d819961be 100644 --- a/test/abicheck/x86_64/checks/check_poly_compress_d4_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_compress_d4_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_compress_d4_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[32]; /* Precomputed compression constants */ MLK_ALIGN uint8_t buf_rsi[512]; /* Input polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check poly_compress_d4_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_poly_compress_d5_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_compress_d5_avx2_asm.c index db3117c6cc..e64c7966c2 100644 --- a/test/abicheck/x86_64/checks/check_poly_compress_d5_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_compress_d5_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_compress_d5_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[32]; /* Precomputed compression constants */ MLK_ALIGN uint8_t buf_rsi[512]; /* Input polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check poly_compress_d5_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_poly_decompress_d10_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_decompress_d10_avx2_asm.c index a1ee4d9652..c878ae7319 100644 --- a/test/abicheck/x86_64/checks/check_poly_decompress_d10_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_decompress_d10_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_decompress_d10_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[32]; /* Precomputed decompression constants */ MLK_ALIGN uint8_t buf_rsi[320]; /* Input compressed polynomial */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf( stderr, diff --git a/test/abicheck/x86_64/checks/check_poly_decompress_d11_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_decompress_d11_avx2_asm.c index 89fab6768c..573a11b47e 100644 --- a/test/abicheck/x86_64/checks/check_poly_decompress_d11_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_decompress_d11_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_decompress_d11_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[128]; /* Precomputed decompression constants */ MLK_ALIGN uint8_t buf_rsi[352]; /* Input compressed polynomial */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf( stderr, diff --git a/test/abicheck/x86_64/checks/check_poly_decompress_d4_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_decompress_d4_avx2_asm.c index d414efd90e..a27768ccf5 100644 --- a/test/abicheck/x86_64/checks/check_poly_decompress_d4_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_decompress_d4_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_decompress_d4_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[32]; /* Precomputed decompression constants */ MLK_ALIGN uint8_t buf_rsi[128]; /* Input compressed polynomial */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf( stderr, diff --git a/test/abicheck/x86_64/checks/check_poly_decompress_d5_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_decompress_d5_avx2_asm.c index 2ce87bdd04..bdc2d6e806 100644 --- a/test/abicheck/x86_64/checks/check_poly_decompress_d5_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_decompress_d5_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_decompress_d5_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[96]; /* Precomputed decompression constants */ MLK_ALIGN uint8_t buf_rsi[160]; /* Input compressed polynomial */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf( stderr, diff --git a/test/abicheck/x86_64/checks/check_poly_mulcache_compute_avx2_asm.c b/test/abicheck/x86_64/checks/check_poly_mulcache_compute_avx2_asm.c index db9539c521..1bacb3b763 100644 --- a/test/abicheck/x86_64/checks/check_poly_mulcache_compute_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_poly_mulcache_compute_avx2_asm.c @@ -34,7 +34,7 @@ int check_poly_mulcache_compute_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[1248]; /* Precomputed constants (624 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[512]; /* Input polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check poly_mulcache_compute_avx2_asm: host lacks AVX2, " diff --git a/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.c b/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.c index a61cc18edc..9e31b942c7 100644 --- a/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm.c @@ -35,7 +35,7 @@ int check_polyvec_basemul_acc_montgomery_cached_k2_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[1024]; /* Input polyvec b (2 x 256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[1024]; /* Input polyvec a (2 x 256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check polyvec_basemul_acc_montgomery_cached_k2_avx2_asm: host " diff --git a/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.c b/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.c index 958df27d90..e1add85cbb 100644 --- a/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm.c @@ -35,7 +35,7 @@ int check_polyvec_basemul_acc_montgomery_cached_k3_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[1536]; /* Input polyvec b (3 x 256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[1536]; /* Input polyvec a (3 x 256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check polyvec_basemul_acc_montgomery_cached_k3_avx2_asm: host " diff --git a/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.c b/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.c index 43ad32d4af..7cdabca54c 100644 --- a/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm.c @@ -35,7 +35,7 @@ int check_polyvec_basemul_acc_montgomery_cached_k4_avx2_asm(void) MLK_ALIGN uint8_t buf_rdx[2048]; /* Input polyvec b (4 x 256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[2048]; /* Input polyvec a (4 x 256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check polyvec_basemul_acc_montgomery_cached_k4_avx2_asm: host " diff --git a/test/abicheck/x86_64/checks/check_reduce_avx2_asm.c b/test/abicheck/x86_64/checks/check_reduce_avx2_asm.c index ecc4e0b481..9e1ed6bb67 100644 --- a/test/abicheck/x86_64/checks/check_reduce_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_reduce_avx2_asm.c @@ -31,7 +31,7 @@ int check_reduce_avx2_asm(void) int violations; MLK_ALIGN uint8_t buf_rdi[512]; /* Input/output polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check reduce_avx2_asm: host lacks AVX2, skipping\n"); return MLK_ABICHECK_SKIPPED; diff --git a/test/abicheck/x86_64/checks/check_rej_uniform_avx2_asm.c b/test/abicheck/x86_64/checks/check_rej_uniform_avx2_asm.c index c740b7e21f..8f2089c212 100644 --- a/test/abicheck/x86_64/checks/check_rej_uniform_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_rej_uniform_avx2_asm.c @@ -34,7 +34,7 @@ int check_rej_uniform_avx2_asm(void) MLK_ALIGN uint8_t buf_rdi[512]; /* Output buffer (256 x int16_t) */ MLK_ALIGN uint8_t buf_rsi[504]; /* Input buffer */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check rej_uniform_avx2_asm: host lacks AVX2, skipping\n"); diff --git a/test/abicheck/x86_64/checks/check_tomont_avx2_asm.c b/test/abicheck/x86_64/checks/check_tomont_avx2_asm.c index 8803c982c6..38db3122a2 100644 --- a/test/abicheck/x86_64/checks/check_tomont_avx2_asm.c +++ b/test/abicheck/x86_64/checks/check_tomont_avx2_asm.c @@ -31,7 +31,7 @@ int check_tomont_avx2_asm(void) int violations; MLK_ALIGN uint8_t buf_rdi[512]; /* Input/output polynomial (256 x int16_t) */ - if (!mlk_sys_check_capability(MLK_SYS_CAP_AVX2)) + if (!mlk_sys_check_capability(MLK_SYS_CAP_X86_64_AVX2)) { fprintf(stderr, "ABI check tomont_avx2_asm: host lacks AVX2, skipping\n"); return MLK_ABICHECK_SKIPPED; diff --git a/test/configs/configs.yml b/test/configs/configs.yml index 8ad847f82c..58a9a70831 100644 --- a/test/configs/configs.yml +++ b/test/configs/configs.yml @@ -214,7 +214,7 @@ configs: static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap) { - if (cap == MLK_SYS_CAP_AVX2) + if (cap == MLK_SYS_CAP_X86_64_AVX2) { uint32_t eax, ebx, ecx, edx; @@ -261,7 +261,7 @@ configs: static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap) { - if (cap == MLK_SYS_CAP_SHA3) + if (cap == MLK_SYS_CAP_AARCH64_SHA3) { uint64_t id_aa64pfr1_el1; diff --git a/test/configs/custom_native_capability_config_CPUID_AVX2.h b/test/configs/custom_native_capability_config_CPUID_AVX2.h index afde1e7d81..e42bf78e70 100644 --- a/test/configs/custom_native_capability_config_CPUID_AVX2.h +++ b/test/configs/custom_native_capability_config_CPUID_AVX2.h @@ -419,7 +419,7 @@ static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap) { - if (cap == MLK_SYS_CAP_AVX2) + if (cap == MLK_SYS_CAP_X86_64_AVX2) { uint32_t eax, ebx, ecx, edx; diff --git a/test/configs/custom_native_capability_config_ID_AA64PFR1_EL1.h b/test/configs/custom_native_capability_config_ID_AA64PFR1_EL1.h index 72ce101048..370b78065a 100644 --- a/test/configs/custom_native_capability_config_ID_AA64PFR1_EL1.h +++ b/test/configs/custom_native_capability_config_ID_AA64PFR1_EL1.h @@ -418,7 +418,7 @@ static MLK_INLINE int mlk_sys_check_capability(mlk_sys_cap cap) { - if (cap == MLK_SYS_CAP_SHA3) + if (cap == MLK_SYS_CAP_AARCH64_SHA3) { uint64_t id_aa64pfr1_el1;