summaryrefslogtreecommitdiffstats
path: root/arch/s390/crypto/chacha-s390.h
diff options
context:
space:
mode:
authorPatrick Steuer <patrick.steuer@de.ibm.com>2021-11-04 15:58:51 +0100
committerHeiko Carstens <hca@linux.ibm.com>2021-12-06 14:42:24 +0100
commitb087dfab4d3902681550fd1f5ff9c3e942059478 (patch)
treeacc95523edb8e6eac15e296eaf9ecb5b5ac889b5 /arch/s390/crypto/chacha-s390.h
parent0fcfb00b28c0b7884635dacf38e46d60bf3d4eb1 (diff)
downloadlinux-stable-b087dfab4d3902681550fd1f5ff9c3e942059478.tar.gz
linux-stable-b087dfab4d3902681550fd1f5ff9c3e942059478.tar.bz2
linux-stable-b087dfab4d3902681550fd1f5ff9c3e942059478.zip
s390/crypto: add SIMD implementation for ChaCha20
Add an implementation of the ChaCha20 stream cipher (see e.g. RFC 7539) that makes use of z13's vector instruction set extension. The original implementation is by Andy Polyakov which is adapted for kernel use. Four to six blocks are processed in parallel resulting in a performance gain for inputs >= 256 bytes. chacha20-generic 1 operation in 622 cycles (256 bytes) 1 operation in 2346 cycles (1024 bytes) chacha20-s390 1 operation in 218 cycles (256 bytes) 1 operation in 647 cycles (1024 bytes) Cc: Andy Polyakov <appro@openssl.org> Reviewed-by: Harald Freudenberger <freude@de.ibm.com> Signed-off-by: Patrick Steuer <patrick.steuer@de.ibm.com> Signed-off-by: Heiko Carstens <hca@linux.ibm.com>
Diffstat (limited to 'arch/s390/crypto/chacha-s390.h')
-rw-r--r--arch/s390/crypto/chacha-s390.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/s390/crypto/chacha-s390.h b/arch/s390/crypto/chacha-s390.h
new file mode 100644
index 000000000000..733744ce30f5
--- /dev/null
+++ b/arch/s390/crypto/chacha-s390.h
@@ -0,0 +1,14 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * s390 ChaCha stream cipher.
+ *
+ * Copyright IBM Corp. 2021
+ */
+
+#ifndef _CHACHA_S390_H
+#define _CHACHA_S390_H
+
+void chacha20_vx(u8 *out, const u8 *inp, size_t len, const u32 *key,
+ const u32 *counter);
+
+#endif /* _CHACHA_S390_H */