crypto: aesni - Macro-ify func save/restore
Macro-ify function save and restore. These will be used in new functions added for scatter/gather update operations. Signed-off-by: Dave Watson <davejwatson@fb.com> Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
This commit is contained in:
parent
e1fd316fba
commit
6c2c86b3e0
|
@ -171,6 +171,26 @@ ALL_F: .octa 0xffffffffffffffffffffffffffffffff
|
||||||
#define TKEYP T1
|
#define TKEYP T1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
.macro FUNC_SAVE
|
||||||
|
push %r12
|
||||||
|
push %r13
|
||||||
|
push %r14
|
||||||
|
mov %rsp, %r14
|
||||||
|
#
|
||||||
|
# states of %xmm registers %xmm6:%xmm15 not saved
|
||||||
|
# all %xmm registers are clobbered
|
||||||
|
#
|
||||||
|
sub $VARIABLE_OFFSET, %rsp
|
||||||
|
and $~63, %rsp
|
||||||
|
.endm
|
||||||
|
|
||||||
|
|
||||||
|
.macro FUNC_RESTORE
|
||||||
|
mov %r14, %rsp
|
||||||
|
pop %r14
|
||||||
|
pop %r13
|
||||||
|
pop %r12
|
||||||
|
.endm
|
||||||
|
|
||||||
#ifdef __x86_64__
|
#ifdef __x86_64__
|
||||||
/* GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0)
|
/* GHASH_MUL MACRO to implement: Data*HashKey mod (128,127,126,121,0)
|
||||||
|
@ -1131,16 +1151,7 @@ _esb_loop_\@:
|
||||||
*
|
*
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
ENTRY(aesni_gcm_dec)
|
ENTRY(aesni_gcm_dec)
|
||||||
push %r12
|
FUNC_SAVE
|
||||||
push %r13
|
|
||||||
push %r14
|
|
||||||
mov %rsp, %r14
|
|
||||||
/*
|
|
||||||
* states of %xmm registers %xmm6:%xmm15 not saved
|
|
||||||
* all %xmm registers are clobbered
|
|
||||||
*/
|
|
||||||
sub $VARIABLE_OFFSET, %rsp
|
|
||||||
and $~63, %rsp # align rsp to 64 bytes
|
|
||||||
mov %arg6, %r12
|
mov %arg6, %r12
|
||||||
movdqu (%r12), %xmm13 # %xmm13 = HashKey
|
movdqu (%r12), %xmm13 # %xmm13 = HashKey
|
||||||
movdqa SHUF_MASK(%rip), %xmm2
|
movdqa SHUF_MASK(%rip), %xmm2
|
||||||
|
@ -1310,10 +1321,7 @@ _T_1_decrypt:
|
||||||
_T_16_decrypt:
|
_T_16_decrypt:
|
||||||
movdqu %xmm0, (%r10)
|
movdqu %xmm0, (%r10)
|
||||||
_return_T_done_decrypt:
|
_return_T_done_decrypt:
|
||||||
mov %r14, %rsp
|
FUNC_RESTORE
|
||||||
pop %r14
|
|
||||||
pop %r13
|
|
||||||
pop %r12
|
|
||||||
ret
|
ret
|
||||||
ENDPROC(aesni_gcm_dec)
|
ENDPROC(aesni_gcm_dec)
|
||||||
|
|
||||||
|
@ -1394,22 +1402,12 @@ ENDPROC(aesni_gcm_dec)
|
||||||
* poly = x^128 + x^127 + x^126 + x^121 + 1
|
* poly = x^128 + x^127 + x^126 + x^121 + 1
|
||||||
***************************************************************************/
|
***************************************************************************/
|
||||||
ENTRY(aesni_gcm_enc)
|
ENTRY(aesni_gcm_enc)
|
||||||
push %r12
|
FUNC_SAVE
|
||||||
push %r13
|
|
||||||
push %r14
|
|
||||||
mov %rsp, %r14
|
|
||||||
#
|
|
||||||
# states of %xmm registers %xmm6:%xmm15 not saved
|
|
||||||
# all %xmm registers are clobbered
|
|
||||||
#
|
|
||||||
sub $VARIABLE_OFFSET, %rsp
|
|
||||||
and $~63, %rsp
|
|
||||||
mov %arg6, %r12
|
mov %arg6, %r12
|
||||||
movdqu (%r12), %xmm13
|
movdqu (%r12), %xmm13
|
||||||
movdqa SHUF_MASK(%rip), %xmm2
|
movdqa SHUF_MASK(%rip), %xmm2
|
||||||
PSHUFB_XMM %xmm2, %xmm13
|
PSHUFB_XMM %xmm2, %xmm13
|
||||||
|
|
||||||
|
|
||||||
# precompute HashKey<<1 mod poly from the HashKey (required for GHASH)
|
# precompute HashKey<<1 mod poly from the HashKey (required for GHASH)
|
||||||
|
|
||||||
movdqa %xmm13, %xmm2
|
movdqa %xmm13, %xmm2
|
||||||
|
@ -1577,10 +1575,7 @@ _T_1_encrypt:
|
||||||
_T_16_encrypt:
|
_T_16_encrypt:
|
||||||
movdqu %xmm0, (%r10)
|
movdqu %xmm0, (%r10)
|
||||||
_return_T_done_encrypt:
|
_return_T_done_encrypt:
|
||||||
mov %r14, %rsp
|
FUNC_RESTORE
|
||||||
pop %r14
|
|
||||||
pop %r13
|
|
||||||
pop %r12
|
|
||||||
ret
|
ret
|
||||||
ENDPROC(aesni_gcm_enc)
|
ENDPROC(aesni_gcm_enc)
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue