Skip to content

Commit

Permalink
avx2: [aes-gcm] new VAES AVX2 implementation (#530)
Browse files Browse the repository at this point in the history
* avx2: [aes-gcm] new VAES AVX2 implementation

Library aes-gcm:
- new macro added to generate AVX2 three operand instructions with memory as the second source
- created 16 block implementation with high level flow as follows
  - lead with aes-ctr (16 blocks)
  - repeat: aes-ctr on the next 16 blocks and GHASH on cipher text blocks from the previous step
  - end with GHASH on 16 blocks
- GHASH_N_BLOCKS macro created and functions added to compute GHASH over 1 to 16 blocks
- functions created for ENCRYPT_FINAL_PARTIAL_BLOCK macro invocations
- functions created to encrypt 1 to 16 blocks
- INITIAL_BLOCKS uses functions to encrypt N-initial number of blocks
- reduced number of arguments to GHASH_16_ENCRYPT_16_PARALLEL
- use internal GHASH function to reduce AAD in GCM_INIT

Test:
- stop aes-gcm scatter gather list test on the first failure
  • Loading branch information
tkanteck authored Sep 16, 2024
1 parent d9ccd74 commit f5edf68
Show file tree
Hide file tree
Showing 13 changed files with 3,860 additions and 4,377 deletions.
2 changes: 1 addition & 1 deletion lib/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ asm_avx_gcm_objs :=

asm_avx2_gcm_objs := \
ghash_by8_avx2.o aes_gcm_by8_avx2.o aes128_gcm_by8_avx2.o aes192_gcm_by8_avx2.o aes256_gcm_by8_avx2.o \
aes128_gcm_vaes_avx2.o aes192_gcm_vaes_avx2.o aes256_gcm_vaes_avx2.o
ghash_vaes_avx2.o aes_gcm_vaes_avx2.o aes128_gcm_vaes_avx2.o aes192_gcm_vaes_avx2.o aes256_gcm_vaes_avx2.o

asm_avx512_gcm_objs := \
aes128_gcm_api_vaes_avx512.o aes192_gcm_api_vaes_avx512.o aes256_gcm_api_vaes_avx512.o \
Expand Down
4 changes: 2 additions & 2 deletions lib/avx2_t2/aes128_gcm_vaes_avx2.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2023, Intel Corporation All rights reserved.
; Copyright(c) 2023-2024, Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -28,4 +28,4 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

%define GCM128_MODE 1
%include "include/gcm_vaes_avx2.inc"
%include "include/gcm_api_vaes_avx2.inc"
4 changes: 2 additions & 2 deletions lib/avx2_t2/aes192_gcm_vaes_avx2.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2023, Intel Corporation All rights reserved.
; Copyright(c) 2023-2024, Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -28,4 +28,4 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

%define GCM192_MODE 1
%include "include/gcm_vaes_avx2.inc"
%include "include/gcm_api_vaes_avx2.inc"
4 changes: 2 additions & 2 deletions lib/avx2_t2/aes256_gcm_vaes_avx2.asm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Copyright(c) 2023, Intel Corporation All rights reserved.
; Copyright(c) 2023-2024, Intel Corporation All rights reserved.
;
; Redistribution and use in source and binary forms, with or without
; modification, are permitted provided that the following conditions
Expand Down Expand Up @@ -28,4 +28,4 @@
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

%define GCM256_MODE 1
%include "include/gcm_vaes_avx2.inc"
%include "include/gcm_api_vaes_avx2.inc"
Loading

0 comments on commit f5edf68

Please sign in to comment.