OSDN Git Service

crypto: aesni - Update aesni-intel_glue to use scatter/gather
authorDave Watson <davejwatson@fb.com>
Wed, 14 Feb 2018 17:40:58 +0000 (09:40 -0800)
committerHerbert Xu <herbert@gondor.apana.org.au>
Thu, 22 Feb 2018 14:16:52 +0000 (22:16 +0800)
commite845520707f85c539ce04bb73c6070e9441480be
treed4415b6ffbc10427f0fbfd3a9cf290b251eeea15
parentfb8986e6430a6b226917ec5370c2be06a72803eb
crypto: aesni - Update aesni-intel_glue to use scatter/gather

Add gcmaes_crypt_by_sg routine, that will do scatter/gather
by sg. Either src or dst may contain multiple buffers, so
iterate over both at the same time if they are different.
If the input is the same as the output, iterate only over one.

Currently both the AAD and TAG must be linear, so copy them out
with scatterlist_map_and_copy.  If first buffer contains the
entire AAD, we can optimize and not copy.   Since the AAD
can be any size, if copied it must be on the heap.  TAG can
be on the stack since it is always < 16 bytes.

Only the SSE routines are updated so far, so leave the previous
gcmaes_en/decrypt routines, and branch to the sg ones if the
keysize is inappropriate for avx, or we are SSE only.

Signed-off-by: Dave Watson <davejwatson@fb.com>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
arch/x86/crypto/aesni-intel_glue.c