• Ard Biesheuvel's avatar
    crypto: sha3-generic - rewrite KECCAK transform to help the compiler optimize · 83dee2ce
    Ard Biesheuvel authored
    The way the KECCAK transform is currently coded involves many references
    into the state array using indexes that are calculated at runtime using
    simple but non-trivial arithmetic. This forces the compiler to treat the
    state matrix as an array in memory rather than keep it in registers,
    which results in poor performance.
    
    So instead, let's rephrase the algorithm using fixed array indexes only.
    This helps the compiler keep the state matrix in registers, resulting
    in the following speedup (SHA3-256 performance in cycles per byte):
    
                                                before   after   speedup
      Intel Core i7 @ 2.0 GHz (2.9 turbo)        100.6    35.7     2.8x
      Cortex-A57 @ 2.0 GHz (64-bit mode)         101.6    12.7     8.0x
      Cortex-A53 @ 1.0 GHz                       224.4    15.8    14.2x
      Cortex-A57 @ 2.0 GHz (32-bit mode)         201.8    63.0     3.2x
    Signed-off-by: 's avatarArd Biesheuvel <ard.biesheuvel@linaro.org>
    Signed-off-by: 's avatarHerbert Xu <herbert@gondor.apana.org.au>
    83dee2ce
Name
Last commit
Last update
Documentation Loading commit data...
arch Loading commit data...
block Loading commit data...
certs Loading commit data...
crypto Loading commit data...
drivers Loading commit data...
firmware Loading commit data...
fs Loading commit data...
include Loading commit data...
init Loading commit data...
ipc Loading commit data...
kernel Loading commit data...
lib Loading commit data...
mm Loading commit data...
net Loading commit data...
samples Loading commit data...
scripts Loading commit data...
security Loading commit data...
sound Loading commit data...
tools Loading commit data...
usr Loading commit data...
virt Loading commit data...
.cocciconfig Loading commit data...
.get_maintainer.ignore Loading commit data...
.gitattributes Loading commit data...
.gitignore Loading commit data...
.mailmap Loading commit data...
COPYING Loading commit data...
CREDITS Loading commit data...
Kbuild Loading commit data...
Kconfig Loading commit data...
MAINTAINERS Loading commit data...
Makefile Loading commit data...
README Loading commit data...