diff options
author | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-18 11:00:38 +0800 |
---|---|---|
committer | Herbert Xu <herbert@gondor.apana.org.au> | 2025-04-23 15:52:47 +0800 |
commit | 572b5c4682c77be19699ab38a2c477ec2b5a7226 (patch) | |
tree | 943a5ffbb4f0b4ec14719bae9203b77b5f33e693 /arch/s390/crypto/sha.h | |
parent | 2d0d18d801b6efbd034725338ed1b08ad5c74e40 (diff) |
crypto: s390/sha512 - Use API partial block handling
Use the Crypto API partial block handling.
Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au>
Diffstat (limited to 'arch/s390/crypto/sha.h')
-rw-r--r-- | arch/s390/crypto/sha.h | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/arch/s390/crypto/sha.h b/arch/s390/crypto/sha.h index d95437ebe1ca..0a3cc1739144 100644 --- a/arch/s390/crypto/sha.h +++ b/arch/s390/crypto/sha.h @@ -10,28 +10,32 @@ #ifndef _CRYPTO_ARCH_S390_SHA_H #define _CRYPTO_ARCH_S390_SHA_H +#include <crypto/sha2.h> #include <crypto/sha3.h> #include <linux/types.h> /* must be big enough for the largest SHA variant */ #define CPACF_MAX_PARMBLOCK_SIZE SHA3_STATE_SIZE #define SHA_MAX_BLOCK_SIZE SHA3_224_BLOCK_SIZE -#define S390_SHA_CTX_SIZE offsetof(struct s390_sha_ctx, buf) +#define S390_SHA_CTX_SIZE sizeof(struct s390_sha_ctx) struct s390_sha_ctx { u64 count; /* message length in bytes */ - u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)]; + union { + u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)]; + struct { + u64 state[SHA512_DIGEST_SIZE]; + u64 count_hi; + } sha512; + }; int func; /* KIMD function to use */ bool first_message_part; - u8 buf[SHA_MAX_BLOCK_SIZE]; }; struct shash_desc; -int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len); int s390_sha_update_blocks(struct shash_desc *desc, const u8 *data, unsigned int len); -int s390_sha_final(struct shash_desc *desc, u8 *out); int s390_sha_finup(struct shash_desc *desc, const u8 *src, unsigned int len, u8 *out); |