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
2020 select CRYPTO_ALGAPI
2121 select CRYPTO_LIB_DES
2222 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
2329 depends on PCI && PCI_MSI
2430 depends on ARM64 || (COMPILE_TEST && 64BIT)
2531 help
2632 Support for HiSilicon SEC Engine of version 2 in crypto subsystem.
2733 It provides AES, SM4, and 3DES algorithms with ECB
28- CBC, and XTS cipher mode.
34+ CBC, and XTS cipher mode, and AEAD algorithms .
2935
3036 To compile this as a module, choose M here: the module
3137 will be called hisi_sec2.
Original file line number Diff line number Diff line change 1313struct sec_alg_res {
1414 u8 * c_ivin ;
1515 dma_addr_t c_ivin_dma ;
16+ u8 * out_mac ;
17+ dma_addr_t out_mac_dma ;
1618};
1719
1820/* Cipher request of SEC private */
@@ -26,14 +28,21 @@ struct sec_cipher_req {
2628 bool encrypt ;
2729};
2830
31+ struct sec_aead_req {
32+ u8 * out_mac ;
33+ dma_addr_t out_mac_dma ;
34+ struct aead_request * aead_req ;
35+ };
36+
2937/* SEC request of Crypto */
3038struct sec_req {
3139 struct sec_sqe sec_sqe ;
3240 struct sec_ctx * ctx ;
3341 struct sec_qp_ctx * qp_ctx ;
3442
35- /* Cipher supported only at present */
3643 struct sec_cipher_req c_req ;
44+ struct sec_aead_req aead_req ;
45+
3746 int err_type ;
3847 int req_id ;
3948
@@ -60,6 +69,16 @@ struct sec_req_op {
6069 int (* process )(struct sec_ctx * ctx , struct sec_req * req );
6170};
6271
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+
6382/* SEC cipher context which cipher's relatives */
6483struct sec_cipher_ctx {
6584 u8 * c_key ;
@@ -85,6 +104,11 @@ struct sec_qp_ctx {
85104 atomic_t pending_reqs ;
86105};
87106
107+ enum sec_alg_type {
108+ SEC_SKCIPHER ,
109+ SEC_AEAD
110+ };
111+
88112/* SEC Crypto TFM context which defines queue and cipher .etc relatives */
89113struct sec_ctx {
90114 struct sec_qp_ctx * qp_ctx ;
@@ -102,7 +126,10 @@ struct sec_ctx {
102126
103127 /* Currrent cyclic index to select a queue for decipher */
104128 atomic_t dec_qcyclic ;
129+
130+ enum sec_alg_type alg_type ;
105131 struct sec_cipher_ctx c_ctx ;
132+ struct sec_auth_ctx a_ctx ;
106133};
107134
108135enum sec_endian {
You can’t perform that action at this time.
0 commit comments