Skip to content

Commit

Permalink
test: [xvalid] vary pattern generation for safe check option
Browse files Browse the repository at this point in the history
- remove stack frame clear operation from AES-GCM AVX2 type 2
- add small comment about register usage in AES-GCM AVX512 type 2
  • Loading branch information
tkanteck committed Oct 4, 2024
1 parent e88784e commit 1600330
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 6 deletions.
1 change: 0 additions & 1 deletion lib/include/gcm_vaes_avx2.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions lib/include/gcm_vaes_avx512.inc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
20 changes: 17 additions & 3 deletions test/xvalid-app/ipsec_xvalid.c
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down

0 comments on commit 1600330

Please sign in to comment.