hc
2024-12-19 9370bb92b2d16684ee45cf24e879c93c509162da
kernel/crypto/cryptd.c
....@@ -68,11 +68,12 @@
6868
6969 struct cryptd_skcipher_ctx {
7070 refcount_t refcnt;
71
- struct crypto_sync_skcipher *child;
71
+ struct crypto_skcipher *child;
7272 };
7373
7474 struct cryptd_skcipher_request_ctx {
7575 crypto_completion_t complete;
76
+ struct skcipher_request req;
7677 };
7778
7879 struct cryptd_hash_ctx {
....@@ -227,13 +228,13 @@
227228 const u8 *key, unsigned int keylen)
228229 {
229230 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(parent);
230
- struct crypto_sync_skcipher *child = ctx->child;
231
+ struct crypto_skcipher *child = ctx->child;
231232
232
- crypto_sync_skcipher_clear_flags(child, CRYPTO_TFM_REQ_MASK);
233
- crypto_sync_skcipher_set_flags(child,
234
- crypto_skcipher_get_flags(parent) &
235
- CRYPTO_TFM_REQ_MASK);
236
- return crypto_sync_skcipher_setkey(child, key, keylen);
233
+ crypto_skcipher_clear_flags(child, CRYPTO_TFM_REQ_MASK);
234
+ crypto_skcipher_set_flags(child,
235
+ crypto_skcipher_get_flags(parent) &
236
+ CRYPTO_TFM_REQ_MASK);
237
+ return crypto_skcipher_setkey(child, key, keylen);
237238 }
238239
239240 static void cryptd_skcipher_complete(struct skcipher_request *req, int err)
....@@ -258,13 +259,13 @@
258259 struct cryptd_skcipher_request_ctx *rctx = skcipher_request_ctx(req);
259260 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
260261 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm);
261
- struct crypto_sync_skcipher *child = ctx->child;
262
- SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, child);
262
+ struct skcipher_request *subreq = &rctx->req;
263
+ struct crypto_skcipher *child = ctx->child;
263264
264265 if (unlikely(err == -EINPROGRESS))
265266 goto out;
266267
267
- skcipher_request_set_sync_tfm(subreq, child);
268
+ skcipher_request_set_tfm(subreq, child);
268269 skcipher_request_set_callback(subreq, CRYPTO_TFM_REQ_MAY_SLEEP,
269270 NULL, NULL);
270271 skcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen,
....@@ -286,13 +287,13 @@
286287 struct cryptd_skcipher_request_ctx *rctx = skcipher_request_ctx(req);
287288 struct crypto_skcipher *tfm = crypto_skcipher_reqtfm(req);
288289 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm);
289
- struct crypto_sync_skcipher *child = ctx->child;
290
- SYNC_SKCIPHER_REQUEST_ON_STACK(subreq, child);
290
+ struct skcipher_request *subreq = &rctx->req;
291
+ struct crypto_skcipher *child = ctx->child;
291292
292293 if (unlikely(err == -EINPROGRESS))
293294 goto out;
294295
295
- skcipher_request_set_sync_tfm(subreq, child);
296
+ skcipher_request_set_tfm(subreq, child);
296297 skcipher_request_set_callback(subreq, CRYPTO_TFM_REQ_MAY_SLEEP,
297298 NULL, NULL);
298299 skcipher_request_set_crypt(subreq, req->src, req->dst, req->cryptlen,
....@@ -343,9 +344,10 @@
343344 if (IS_ERR(cipher))
344345 return PTR_ERR(cipher);
345346
346
- ctx->child = (struct crypto_sync_skcipher *)cipher;
347
+ ctx->child = cipher;
347348 crypto_skcipher_set_reqsize(
348
- tfm, sizeof(struct cryptd_skcipher_request_ctx));
349
+ tfm, sizeof(struct cryptd_skcipher_request_ctx) +
350
+ crypto_skcipher_reqsize(cipher));
349351 return 0;
350352 }
351353
....@@ -353,7 +355,7 @@
353355 {
354356 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(tfm);
355357
356
- crypto_free_sync_skcipher(ctx->child);
358
+ crypto_free_skcipher(ctx->child);
357359 }
358360
359361 static void cryptd_skcipher_free(struct skcipher_instance *inst)
....@@ -931,7 +933,7 @@
931933 {
932934 struct cryptd_skcipher_ctx *ctx = crypto_skcipher_ctx(&tfm->base);
933935
934
- return &ctx->child->base;
936
+ return ctx->child;
935937 }
936938 EXPORT_SYMBOL_GPL(cryptd_skcipher_child);
937939