summaryrefslogtreecommitdiff
path: root/arch/s390/crypto/sha.h
diff options
context:
space:
mode:
authorJoerg Schmidbauer <jschmidb@de.ibm.com>2019-08-14 14:56:54 +0200
committerHeiko Carstens <heiko.carstens@de.ibm.com>2019-09-13 12:18:50 +0200
commit3c2eb6b76cabb7d90834798d6455f7f3431fc989 (patch)
tree92d5ec5f38d007b9f74bca75bfa4f3159e0f2fc0 /arch/s390/crypto/sha.h
parent724dc336b79ff965bd5773257642685cf33ed9af (diff)
s390/crypto: Support for SHA3 via CPACF (MSA6)
This patch introduces sha3 support for s390. - Rework the s390-specific SHA1 and SHA2 related code to provide the basis for SHA3. - Provide two new kernel modules sha3_256_s390 and sha3_512_s390 together with new kernel options. Signed-off-by: Joerg Schmidbauer <jschmidb@de.ibm.com> Reviewed-by: Ingo Franzki <ifranzki@linux.ibm.com> Reviewed-by: Harald Freudenberger <freude@linux.ibm.com> Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Diffstat (limited to 'arch/s390/crypto/sha.h')
-rw-r--r--arch/s390/crypto/sha.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/arch/s390/crypto/sha.h b/arch/s390/crypto/sha.h
index d6f8258b44df..ada2f98c27b7 100644
--- a/arch/s390/crypto/sha.h
+++ b/arch/s390/crypto/sha.h
@@ -12,15 +12,17 @@
#include <linux/crypto.h>
#include <crypto/sha.h>
+#include <crypto/sha3.h>
/* must be big enough for the largest SHA variant */
-#define SHA_MAX_STATE_SIZE (SHA512_DIGEST_SIZE / 4)
-#define SHA_MAX_BLOCK_SIZE SHA512_BLOCK_SIZE
+#define SHA3_STATE_SIZE 200
+#define CPACF_MAX_PARMBLOCK_SIZE SHA3_STATE_SIZE
+#define SHA_MAX_BLOCK_SIZE SHA3_224_BLOCK_SIZE
struct s390_sha_ctx {
- u64 count; /* message length in bytes */
- u32 state[SHA_MAX_STATE_SIZE];
- u8 buf[2 * SHA_MAX_BLOCK_SIZE];
+ u64 count; /* message length in bytes */
+ u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
+ u8 buf[SHA_MAX_BLOCK_SIZE];
int func; /* KIMD function to use */
};