From 1600330074413bb37052879c94e4b4324618e995 Mon Sep 17 00:00:00 2001 From: Tomasz Kantecki Date: Thu, 3 Oct 2024 14:52:11 +0100 Subject: [PATCH] test: [xvalid] vary pattern generation for safe check option - remove stack frame clear operation from AES-GCM AVX2 type 2 - add small comment about register usage in AES-GCM AVX512 type 2 --- lib/include/gcm_vaes_avx2.inc | 1 - lib/include/gcm_vaes_avx512.inc | 4 ++-- test/xvalid-app/ipsec_xvalid.c | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 6 deletions(-) diff --git a/lib/include/gcm_vaes_avx2.inc b/lib/include/gcm_vaes_avx2.inc index 27a3f93a..51b7e9c5 100644 --- a/lib/include/gcm_vaes_avx2.inc +++ b/lib/include/gcm_vaes_avx2.inc @@ -1630,7 +1630,6 @@ align 32 %endif %%_small_initial_compute_hash: - vmovdqa [rsp + TMP1], xmm14 ;; overwrite TMP1 with current hash value; in some rare cases, TMP1 may contain fragment of a round key ;; Final hash is now in T3 (xmm14 really) vmovdqa xmm9, [rsp + TMP3] ;; keep last counter block into xmm9 %endmacro ; INITIAL_BLOCKS_PARTIAL diff --git a/lib/include/gcm_vaes_avx512.inc b/lib/include/gcm_vaes_avx512.inc index de394b4d..515ffd65 100644 --- a/lib/include/gcm_vaes_avx512.inc +++ b/lib/include/gcm_vaes_avx512.inc @@ -3202,8 +3202,8 @@ align 32 %define %%ZTMP5 zmm7 %define %%ZTMP6 zmm8 %define %%ZTMP7 zmm9 -%define %%ZTMP8 zmm10 -%define %%ZTMP9 zmm11 +%define %%ZTMP8 zmm10 ; used by ghash() +%define %%ZTMP9 zmm11 ; used by ghash() %define %%ZTMP10 zmm12 %define %%ZTMP11 zmm13 %define %%ZTMP12 zmm14 diff --git a/test/xvalid-app/ipsec_xvalid.c b/test/xvalid-app/ipsec_xvalid.c index f2eaa042..b6d02004 100644 --- a/test/xvalid-app/ipsec_xvalid.c +++ b/test/xvalid-app/ipsec_xvalid.c @@ -707,9 +707,23 @@ get_pattern_seed(void) static void generate_patterns(void) { - pattern_auth_key = get_pattern_seed(); - pattern_cipher_key = get_pattern_seed(); - pattern_plain_text = get_pattern_seed(); + static int var_patterns = 0; + + /* change order of generating patterns */ + if (var_patterns == 0) { + pattern_auth_key = get_pattern_seed(); + pattern_cipher_key = get_pattern_seed(); + pattern_plain_text = get_pattern_seed(); + } else if (var_patterns == 1) { + pattern_cipher_key = get_pattern_seed(); + pattern_auth_key = get_pattern_seed(); + pattern_plain_text = get_pattern_seed(); + } else { + pattern_plain_text = get_pattern_seed(); + pattern_auth_key = get_pattern_seed(); + pattern_cipher_key = get_pattern_seed(); + } + var_patterns = (var_patterns + 1) % 3; nosimd_memset(&pattern8_auth_key, pattern_auth_key, sizeof(pattern8_auth_key)); nosimd_memset(&pattern8_cipher_key, pattern_cipher_key, sizeof(pattern8_cipher_key));