18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Cryptographic API.
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * s390 generic implementation of the SHA Secure Hash Algorithms.
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright IBM Corp. 2007
88c2ecf20Sopenharmony_ci * Author(s): Jan Glauber (jang@de.ibm.com)
98c2ecf20Sopenharmony_ci */
108c2ecf20Sopenharmony_ci#ifndef _CRYPTO_ARCH_S390_SHA_H
118c2ecf20Sopenharmony_ci#define _CRYPTO_ARCH_S390_SHA_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#include <linux/crypto.h>
148c2ecf20Sopenharmony_ci#include <crypto/sha.h>
158c2ecf20Sopenharmony_ci#include <crypto/sha3.h>
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci/* must be big enough for the largest SHA variant */
188c2ecf20Sopenharmony_ci#define SHA3_STATE_SIZE			200
198c2ecf20Sopenharmony_ci#define CPACF_MAX_PARMBLOCK_SIZE	SHA3_STATE_SIZE
208c2ecf20Sopenharmony_ci#define SHA_MAX_BLOCK_SIZE		SHA3_224_BLOCK_SIZE
218c2ecf20Sopenharmony_ci
228c2ecf20Sopenharmony_cistruct s390_sha_ctx {
238c2ecf20Sopenharmony_ci	u64 count;		/* message length in bytes */
248c2ecf20Sopenharmony_ci	u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
258c2ecf20Sopenharmony_ci	u8 buf[SHA_MAX_BLOCK_SIZE];
268c2ecf20Sopenharmony_ci	int func;		/* KIMD function to use */
278c2ecf20Sopenharmony_ci};
288c2ecf20Sopenharmony_ci
298c2ecf20Sopenharmony_cistruct shash_desc;
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ciint s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len);
328c2ecf20Sopenharmony_ciint s390_sha_final(struct shash_desc *desc, u8 *out);
338c2ecf20Sopenharmony_ci
348c2ecf20Sopenharmony_ci#endif
35