File tree Expand file tree Collapse file tree 4 files changed +620
-24
lines changed Expand file tree Collapse file tree 4 files changed +620
-24
lines changed Original file line number Diff line number Diff line change @@ -20,12 +20,18 @@ config CRYPTO_DEV_HISI_SEC2
20
20
select CRYPTO_ALGAPI
21
21
select CRYPTO_LIB_DES
22
22
select CRYPTO_DEV_HISI_QM
23
+ select CRYPTO_AEAD
24
+ select CRYPTO_AUTHENC
25
+ select CRYPTO_HMAC
26
+ select CRYPTO_SHA1
27
+ select CRYPTO_SHA256
28
+ select CRYPTO_SHA512
23
29
depends on PCI && PCI_MSI
24
30
depends on ARM64 || (COMPILE_TEST && 64BIT)
25
31
help
26
32
Support for HiSilicon SEC Engine of version 2 in crypto subsystem.
27
33
It provides AES, SM4, and 3DES algorithms with ECB
28
- CBC, and XTS cipher mode.
34
+ CBC, and XTS cipher mode, and AEAD algorithms .
29
35
30
36
To compile this as a module, choose M here: the module
31
37
will be called hisi_sec2.
Original file line number Diff line number Diff line change 13
13
struct sec_alg_res {
14
14
u8 * c_ivin ;
15
15
dma_addr_t c_ivin_dma ;
16
+ u8 * out_mac ;
17
+ dma_addr_t out_mac_dma ;
16
18
};
17
19
18
20
/* Cipher request of SEC private */
@@ -26,14 +28,21 @@ struct sec_cipher_req {
26
28
bool encrypt ;
27
29
};
28
30
31
+ struct sec_aead_req {
32
+ u8 * out_mac ;
33
+ dma_addr_t out_mac_dma ;
34
+ struct aead_request * aead_req ;
35
+ };
36
+
29
37
/* SEC request of Crypto */
30
38
struct sec_req {
31
39
struct sec_sqe sec_sqe ;
32
40
struct sec_ctx * ctx ;
33
41
struct sec_qp_ctx * qp_ctx ;
34
42
35
- /* Cipher supported only at present */
36
43
struct sec_cipher_req c_req ;
44
+ struct sec_aead_req aead_req ;
45
+
37
46
int err_type ;
38
47
int req_id ;
39
48
@@ -60,6 +69,16 @@ struct sec_req_op {
60
69
int (* process )(struct sec_ctx * ctx , struct sec_req * req );
61
70
};
62
71
72
+ /* SEC auth context */
73
+ struct sec_auth_ctx {
74
+ dma_addr_t a_key_dma ;
75
+ u8 * a_key ;
76
+ u8 a_key_len ;
77
+ u8 mac_len ;
78
+ u8 a_alg ;
79
+ struct crypto_shash * hash_tfm ;
80
+ };
81
+
63
82
/* SEC cipher context which cipher's relatives */
64
83
struct sec_cipher_ctx {
65
84
u8 * c_key ;
@@ -85,6 +104,11 @@ struct sec_qp_ctx {
85
104
atomic_t pending_reqs ;
86
105
};
87
106
107
+ enum sec_alg_type {
108
+ SEC_SKCIPHER ,
109
+ SEC_AEAD
110
+ };
111
+
88
112
/* SEC Crypto TFM context which defines queue and cipher .etc relatives */
89
113
struct sec_ctx {
90
114
struct sec_qp_ctx * qp_ctx ;
@@ -102,7 +126,10 @@ struct sec_ctx {
102
126
103
127
/* Currrent cyclic index to select a queue for decipher */
104
128
atomic_t dec_qcyclic ;
129
+
130
+ enum sec_alg_type alg_type ;
105
131
struct sec_cipher_ctx c_ctx ;
132
+ struct sec_auth_ctx a_ctx ;
106
133
};
107
134
108
135
enum sec_endian {
You can’t perform that action at this time.
0 commit comments