162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0+ */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Cryptographic API.
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * s390 generic implementation of the SHA Secure Hash Algorithms.
662306a36Sopenharmony_ci *
762306a36Sopenharmony_ci * Copyright IBM Corp. 2007
862306a36Sopenharmony_ci * Author(s): Jan Glauber (jang@de.ibm.com)
962306a36Sopenharmony_ci */
1062306a36Sopenharmony_ci#ifndef _CRYPTO_ARCH_S390_SHA_H
1162306a36Sopenharmony_ci#define _CRYPTO_ARCH_S390_SHA_H
1262306a36Sopenharmony_ci
1362306a36Sopenharmony_ci#include <linux/crypto.h>
1462306a36Sopenharmony_ci#include <crypto/sha1.h>
1562306a36Sopenharmony_ci#include <crypto/sha2.h>
1662306a36Sopenharmony_ci#include <crypto/sha3.h>
1762306a36Sopenharmony_ci
1862306a36Sopenharmony_ci/* must be big enough for the largest SHA variant */
1962306a36Sopenharmony_ci#define SHA3_STATE_SIZE			200
2062306a36Sopenharmony_ci#define CPACF_MAX_PARMBLOCK_SIZE	SHA3_STATE_SIZE
2162306a36Sopenharmony_ci#define SHA_MAX_BLOCK_SIZE		SHA3_224_BLOCK_SIZE
2262306a36Sopenharmony_ci
2362306a36Sopenharmony_cistruct s390_sha_ctx {
2462306a36Sopenharmony_ci	u64 count;		/* message length in bytes */
2562306a36Sopenharmony_ci	u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
2662306a36Sopenharmony_ci	u8 buf[SHA_MAX_BLOCK_SIZE];
2762306a36Sopenharmony_ci	int func;		/* KIMD function to use */
2862306a36Sopenharmony_ci};
2962306a36Sopenharmony_ci
3062306a36Sopenharmony_cistruct shash_desc;
3162306a36Sopenharmony_ci
3262306a36Sopenharmony_ciint s390_sha_update(struct shash_desc *desc, const u8 *data, unsigned int len);
3362306a36Sopenharmony_ciint s390_sha_final(struct shash_desc *desc, u8 *out);
3462306a36Sopenharmony_ci
3562306a36Sopenharmony_ci#endif
36