Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0+ */
0002 /*
0003  * Cryptographic API.
0004  *
0005  * s390 generic implementation of the SHA Secure Hash Algorithms.
0006  *
0007  * Copyright IBM Corp. 2007
0008  * Author(s): Jan Glauber (jang@de.ibm.com)
0009  */
0010 #ifndef _CRYPTO_ARCH_S390_SHA_H
0011 #define _CRYPTO_ARCH_S390_SHA_H
0012 
0013 #include <linux/crypto.h>
0014 #include <crypto/sha1.h>
0015 #include <crypto/sha2.h>
0016 #include <crypto/sha3.h>
0017 
0018 /* must be big enough for the largest SHA variant */
0019 #define SHA3_STATE_SIZE         200
0020 #define CPACF_MAX_PARMBLOCK_SIZE    SHA3_STATE_SIZE
0021 #define SHA_MAX_BLOCK_SIZE      SHA3_224_BLOCK_SIZE
0022 
0023 struct s390_sha_ctx {
0024     u64 count;      /* message length in bytes */
0025     u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
0026     u8 buf[SHA_MAX_BLOCK_SIZE];
0027     int func;       /* KIMD function to use */
0028 };
0029 
0030 struct shash_desc;
0031 
0032 int s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len);
0033 int s390_sha_final(struct shash_desc *desc, u8 *out);
0034 
0035 #endif