File Index
Files and directories
Sign in
FILE

eip93-hash.h

File preview with syntax highlighting.

linux-6.19.14/drivers/crypto/inside-secure/eip93/eip93-hash.h C
 1/* SPDX-License-Identifier: GPL-2.0
 2 *
 3 * Copyright (C) 2019 - 2021
 4 *
 5 * Richard van Schagen <vschagen@icloud.com>
 6 * Christian Marangi <ansuelsmth@gmail.com
 7 */
 8#ifndef _EIP93_HASH_H_
 9#define _EIP93_HASH_H_
10
11#include <crypto/sha2.h>
12
13#include "eip93-main.h"
14#include "eip93-regs.h"
15
16struct eip93_hash_ctx {
17	struct eip93_device	*eip93;
18	u32			flags;
19
20	u8			ipad[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));
21	u8			opad[SHA256_DIGEST_SIZE] __aligned(sizeof(u32));
22};
23
24struct eip93_hash_reqctx {
25	/* Placement is important for DMA align */
26	struct {
27		struct sa_record	sa_record;
28		struct sa_record	sa_record_hmac;
29		struct sa_state		sa_state;
30	} __aligned(CRYPTO_DMA_ALIGN);
31
32	dma_addr_t		sa_record_base;
33	dma_addr_t		sa_record_hmac_base;
34	dma_addr_t		sa_state_base;
35
36	/* Don't enable HASH_FINALIZE when last block is sent */
37	bool			partial_hash;
38
39	/* Set to signal interrupt is for final packet */
40	bool			finalize;
41
42	/*
43	 * EIP93 requires data to be accumulated in block of 64 bytes
44	 * for intermediate hash calculation.
45	 */
46	u64			len;
47	u32			data_used;
48
49	u8			data[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));
50	dma_addr_t		data_dma;
51
52	struct list_head	blocks;
53};
54
55struct mkt_hash_block {
56	struct list_head	list;
57	u8			data[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));
58	dma_addr_t		data_dma;
59};
60
61struct eip93_hash_export_state {
62	u64			len;
63	u32			data_used;
64
65	u32			state_len[2];
66	u8			state_hash[SHA256_DIGEST_SIZE] __aligned(sizeof(u32));
67
68	u8			data[SHA256_BLOCK_SIZE] __aligned(sizeof(u32));
69};
70
71void eip93_hash_handle_result(struct crypto_async_request *async, int err);
72
73extern struct eip93_alg_template eip93_alg_md5;
74extern struct eip93_alg_template eip93_alg_sha1;
75extern struct eip93_alg_template eip93_alg_sha224;
76extern struct eip93_alg_template eip93_alg_sha256;
77extern struct eip93_alg_template eip93_alg_hmac_md5;
78extern struct eip93_alg_template eip93_alg_hmac_sha1;
79extern struct eip93_alg_template eip93_alg_hmac_sha224;
80extern struct eip93_alg_template eip93_alg_hmac_sha256;
81
82#endif /* _EIP93_HASH_H_ */
~/ Read-only file preview.