android_kernel_oneplus_msm8998/arch/arm64
Eric Biggers 0223de3a24 ANDROID: arm64/crypto: add ARMv8-CE optimized poly_hash algorithm
poly_hash is part of the HEH (Hash-Encrypt-Hash) encryption mode,
proposed in Internet Draft
https://tools.ietf.org/html/draft-cope-heh-01.  poly_hash is very
similar to GHASH; besides the swapping of the last two coefficients
which we opted to handle in the HEH template, poly_hash just uses a
different finite field representation.  As with GHASH, poly_hash becomes
much faster and more secure against timing attacks when implemented
using carryless multiplication instructions instead of tables.  This
patch adds an ARMv8-CE optimized version of poly_hash, based roughly on
the existing ARMv8-CE optimized version of GHASH.

Benchmark results are shown below, but note that the resistance to
timing attacks may be even more important than the performance gain.

poly_hash only:

    poly_hash-generic:
        1,000,000 setkey() takes 1185 ms
        hashing is 328 MB/s

    poly_hash-ce:
        1,000,000 setkey() takes 8 ms
        hashing is 1756 MB/s

heh(aes) with 4096-byte inputs (this is the ideal case, as the
improvement is less significant with smaller inputs):

    encryption with "heh_base(cmac(aes-ce),poly_hash-generic,ecb-aes-ce)": 118 MB/s
    decryption with "heh_base(cmac(aes-ce),poly_hash-generic,ecb-aes-ce)": 120 MB/s

    encryption with "heh_base(cmac(aes-ce),poly_hash-ce,ecb-aes-ce)": 291 MB/s
    decryption with "heh_base(cmac(aes-ce),poly_hash-ce,ecb-aes-ce)": 293 MB/s

Bug: 32508661
Signed-off-by: Eric Biggers <ebiggers@google.com>
Change-Id: I621ec0e1115df7e6f5cbd7e864a4a9d8d2e94cf2
2017-02-10 20:09:13 +00:00
..
boot ARM64: Ignore Image-dtb from git point of view 2016-05-24 14:42:55 -07:00
configs goldfish: enable CONFIG_INET_DIAG_DESTROY 2016-12-09 18:46:03 +00:00
crypto ANDROID: arm64/crypto: add ARMv8-CE optimized poly_hash algorithm 2017-02-10 20:09:13 +00:00
include UPSTREAM: arm64: Allow hw watchpoint of length 3,5,6 and 7 2017-02-03 17:43:54 +00:00
kernel UPSTREAM: arm64: Allow hw watchpoint of length 3,5,6 and 7 2017-02-03 17:43:54 +00:00
kvm BACKPORT: arm64: kvm: deal with kernel symbols outside of linear mapping 2016-09-22 13:38:22 -07:00
lib BACKPORT: arm64: Factor out PAN enabling/disabling into separate uaccess_* macros 2017-01-04 09:02:08 -08:00
mm UPSTREAM: arm64: Handle faults caused by inadvertent user access with PAN enabled 2017-01-04 10:56:21 -08:00
net arm64: bpf: add 'store immediate' instruction 2015-12-03 11:38:31 -05:00
xen UPSTREAM: arm64: xen: Enable user access before a privcmd hvc call 2017-01-04 10:56:22 -08:00
Kconfig UPSTREAM: arm64: Enable CONFIG_ARM64_SW_TTBR0_PAN 2017-01-04 10:56:22 -08:00
Kconfig.debug UPSTREAM: arm64: enable CONFIG_DEBUG_RODATA by default 2016-12-12 14:41:18 +00:00
Kconfig.platforms ARM: DT updates for v4.4 2015-11-10 15:06:26 -08:00
Makefile UPSTREAM: arm64: add support for building vmlinux as a relocatable PIE binary 2016-09-22 13:38:22 -07:00