linux/arch
Eric Biggers 669d2197fc UPSTREAM: crypto: blake2s - share the "shash" API boilerplate code
Add helper functions for shash implementations of BLAKE2s to
include/crypto/internal/blake2s.h, taking advantage of
__blake2s_update() and __blake2s_final() that were added by the previous
patch to share more code between the library and shash implementations.

crypto_blake2s_setkey() and crypto_blake2s_init() are usable as
shash_alg::setkey and shash_alg::init directly, while
crypto_blake2s_update() and crypto_blake2s_final() take an extra
'blake2s_compress_t' function pointer parameter.  This allows the
implementation of the compression function to be overridden, which is
the only part that optimized implementations really care about.

The new functions are inline functions (similar to those in sha1_base.h,
sha256_base.h, and sm3_base.h) because this avoids needing to add a new
module blake2s_helpers.ko, they aren't *too* long, and this avoids
indirect calls which are expensive these days.  Note that they can't go
in blake2s_generic.ko, as that would require selecting CRYPTO_BLAKE2S
from CRYPTO_BLAKE2S_X86, which would cause a recursive dependency.

Finally, use these new helper functions in the x86 implementation of
BLAKE2s.  (This part should be a separate patch, but unfortunately the
x86 implementation used the exact same function names like
"crypto_blake2s_update()", so it had to be updated at the same time.)

Signed-off-by: Eric Biggers <ebiggers@google.com>
Acked-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>

(cherry picked from commit 8c4a93a127)
Bug: 152722841
Bug: 178411248
Change-Id: I9d23b1897cee81fb1704b6eea14d3dc9b1c80fe0
Signed-off-by: Eric Biggers <ebiggers@google.com>
2021-02-23 08:06:19 +01:00
..
alpha UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
arc arch/arc: add copy_user_page() to <asm/page.h> to fix build error on ARC 2021-01-19 18:27:26 +01:00
arm Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
arm64 ANDROID: GKI: Build in VIRTIO_FS 2021-02-19 15:34:47 +00:00
c6x Revert "Revert "uaccess: add infrastructure for kernel builds with set_fs()"" 2020-10-28 15:08:39 +01:00
csky Merge 5.10.7 into android12-5.10 2021-01-13 10:29:42 +01:00
h8300 Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
hexagon local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
ia64 UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
m68k UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
microblaze local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
mips UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
nds32 local64.h: make <asm/local64.h> mandatory 2021-01-12 20:18:16 +01:00
nios2 sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
openrisc sched/idle: Fix arch_cpu_idle() vs tracing 2020-11-24 16:47:35 +01:00
parisc Merge 5.10.13 into android12-5.10 2021-02-05 10:38:34 +01:00
powerpc This is the 5.10.16 stable release 2021-02-13 14:19:38 +01:00
riscv Merge 5.10.17 into android12-5.10 2021-02-18 11:21:01 +01:00
s390 Merge 5.10.13 into android12-5.10 2021-02-05 10:38:34 +01:00
sh This is the 5.10.11 stable release 2021-01-27 12:12:33 +01:00
sparc UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
um This is the 5.10.15 stable release 2021-02-10 09:53:50 +01:00
x86 UPSTREAM: crypto: blake2s - share the "shash" API boilerplate code 2021-02-23 08:06:19 +01:00
xtensa UPSTREAM: arch: move SA_* definitions to generic headers 2021-01-22 10:05:52 -08:00
.gitignore
Kconfig UPSTREAM: mm: speedup mremap on 1GB or larger regions 2021-01-29 18:27:06 +00:00