Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
torvalds
GitHub Repository: torvalds/linux
Path: blob/master/arch/s390/crypto/sha.h
26451 views
1
/* SPDX-License-Identifier: GPL-2.0+ */
2
/*
3
* Cryptographic API.
4
*
5
* s390 generic implementation of the SHA Secure Hash Algorithms.
6
*
7
* Copyright IBM Corp. 2007
8
* Author(s): Jan Glauber ([email protected])
9
*/
10
#ifndef _CRYPTO_ARCH_S390_SHA_H
11
#define _CRYPTO_ARCH_S390_SHA_H
12
13
#include <crypto/sha2.h>
14
#include <crypto/sha3.h>
15
#include <linux/types.h>
16
17
/* must be big enough for the largest SHA variant */
18
#define CPACF_MAX_PARMBLOCK_SIZE SHA3_STATE_SIZE
19
#define SHA_MAX_BLOCK_SIZE SHA3_224_BLOCK_SIZE
20
#define S390_SHA_CTX_SIZE sizeof(struct s390_sha_ctx)
21
22
struct s390_sha_ctx {
23
u64 count; /* message length in bytes */
24
union {
25
u32 state[CPACF_MAX_PARMBLOCK_SIZE / sizeof(u32)];
26
struct {
27
u64 state[SHA512_DIGEST_SIZE / sizeof(u64)];
28
u64 count_hi;
29
} sha512;
30
struct {
31
__le64 state[SHA3_STATE_SIZE / sizeof(u64)];
32
} sha3;
33
};
34
int func; /* KIMD function to use */
35
bool first_message_part;
36
};
37
38
struct shash_desc;
39
40
int s390_sha_update_blocks(struct shash_desc *desc, const u8 *data,
41
unsigned int len);
42
int s390_sha_finup(struct shash_desc *desc, const u8 *src, unsigned int len,
43
u8 *out);
44
45
#endif
46
47