linux/include
Ard Biesheuvel fe1532c758 UPSTREAM: crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine
Reimplement the library routines to perform chacha20poly1305 en/decryption
on scatterlists, without [ab]using the [deprecated] blkcipher interface,
which is rather heavyweight and does things we don't really need.

Instead, we use the sg_miter API in a novel and clever way, to iterate
over the scatterlist in-place (i.e., source == destination, which is the
only way this library is expected to be used). That way, we don't have to
iterate over two scatterlists in parallel.

Another optimization is that, instead of relying on the blkcipher walker
to present the input in suitable chunks, we recognize that ChaCha is a
streamcipher, and so we can simply deal with partial blocks by keeping a
block of cipherstream on the stack and use crypto_xor() to mix it with
the in/output.

Finally, we omit the scatterwalk_and_copy() call if the last element of
the scatterlist covers the MAC as well (which is the common case),
avoiding the need to walk the scatterlist and kmap() the page twice.

Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
(cherry picked from commit d95312a3cc)
Bug: 152722841
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Change-Id: If538284520598f82365bc094c62adb5627abac2f
2020-10-24 22:42:44 +02:00
..
acpi x86: ACPI: fix CPU hotplug deadlock 2020-04-23 10:30:20 +02:00
asm-generic This is the 4.19.140 stable release 2020-08-19 08:43:22 +02:00
clocksource ANDROID: GKI: drivers: clksource: Add API to return cval 2020-04-02 23:32:47 +00:00
crypto UPSTREAM: crypto: lib/chacha20poly1305 - reimplement crypt_from_sg() routine 2020-10-24 22:42:44 +02:00
drm Revert "drm/dsi: Fix byte order of DCS set/get brightness" 2020-07-01 18:58:38 +00:00
dt-bindings dt-bindings: reset: meson8b: fix duplicate reset IDs 2020-01-23 08:21:26 +01:00
keys KEYS: Don't write out to userspace while holding key semaphore 2020-04-23 10:30:24 +02:00
kvm
linux This is the 4.19.151 stable release 2020-10-14 12:11:08 +02:00
math-emu
media ANDROID: media: increase video max frame number 2020-04-16 23:00:21 +00:00
memory
misc
net This is the 4.19.152 stable release 2020-10-17 10:26:40 +02:00
pcmcia
ras
rdma RDMA/core: Fix double destruction of uobject 2020-06-03 08:19:43 +02:00
scsi ANDROID: GKI: scsi: add Android ABI padding to some structures 2020-05-01 15:18:12 +02:00
soc irqchip/eznps: Fix build error for !ARC700 builds 2020-09-17 13:45:25 +02:00
sound This is the 4.19.135 stable release 2020-07-29 13:22:30 +02:00
target scsi: target: fix hang when multiple threads try to destroy the same iscsi session 2020-04-21 09:03:11 +02:00
trace This is the 4.19.149 stable release 2020-10-01 16:49:05 +02:00
uapi This is the 4.19.147 stable release 2020-09-24 12:48:04 +02:00
vdso UPSTREAM: vdso: Fix clocksource.h macro detection 2020-05-03 16:11:10 +00:00
video
xen