hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/crypto/rockchip/rk3288_crypto.h
....@@ -5,9 +5,11 @@
55 #include <crypto/aes.h>
66 #include <crypto/internal/des.h>
77 #include <crypto/algapi.h>
8
+#include <linux/dma-mapping.h>
89 #include <linux/interrupt.h>
910 #include <linux/delay.h>
1011 #include <linux/scatterlist.h>
12
+#include <crypto/engine.h>
1113 #include <crypto/internal/hash.h>
1214 #include <crypto/internal/skcipher.h>
1315
....@@ -192,45 +194,15 @@
192194 struct reset_control *rst;
193195 void __iomem *reg;
194196 int irq;
195
- struct crypto_queue queue;
196
- struct tasklet_struct queue_task;
197
- struct tasklet_struct done_task;
198
- struct crypto_async_request *async_req;
199
- int err;
200
- /* device lock */
201
- spinlock_t lock;
202197
203
- /* the public variable */
204
- struct scatterlist *sg_src;
205
- struct scatterlist *sg_dst;
206
- struct scatterlist sg_tmp;
207
- struct scatterlist *first;
208
- unsigned int left_bytes;
209
- void *addr_vir;
210
- int aligned;
211
- int align_size;
212
- size_t src_nents;
213
- size_t dst_nents;
214
- unsigned int total;
215
- unsigned int count;
216
- dma_addr_t addr_in;
217
- dma_addr_t addr_out;
218
- bool busy;
219
- int (*start)(struct rk_crypto_info *dev);
220
- int (*update)(struct rk_crypto_info *dev);
221
- void (*complete)(struct crypto_async_request *base, int err);
222
- int (*enable_clk)(struct rk_crypto_info *dev);
223
- void (*disable_clk)(struct rk_crypto_info *dev);
224
- int (*load_data)(struct rk_crypto_info *dev,
225
- struct scatterlist *sg_src,
226
- struct scatterlist *sg_dst);
227
- void (*unload_data)(struct rk_crypto_info *dev);
228
- int (*enqueue)(struct rk_crypto_info *dev,
229
- struct crypto_async_request *async_req);
198
+ struct crypto_engine *engine;
199
+ struct completion complete;
200
+ int status;
230201 };
231202
232203 /* the private variable of hash */
233204 struct rk_ahash_ctx {
205
+ struct crypto_engine_ctx enginectx;
234206 struct rk_crypto_info *dev;
235207 /* for fallback */
236208 struct crypto_ahash *fallback_tfm;
....@@ -240,14 +212,23 @@
240212 struct rk_ahash_rctx {
241213 struct ahash_request fallback_req;
242214 u32 mode;
215
+ int nrsg;
243216 };
244217
245218 /* the private variable of cipher */
246219 struct rk_cipher_ctx {
220
+ struct crypto_engine_ctx enginectx;
247221 struct rk_crypto_info *dev;
248222 unsigned int keylen;
249
- u32 mode;
223
+ u8 key[AES_MAX_KEY_SIZE];
250224 u8 iv[AES_BLOCK_SIZE];
225
+ struct crypto_skcipher *fallback_tfm;
226
+};
227
+
228
+struct rk_cipher_rctx {
229
+ u8 backup_iv[AES_BLOCK_SIZE];
230
+ u32 mode;
231
+ struct skcipher_request fallback_req; // keep at the end
251232 };
252233
253234 enum alg_type {