Skip to content

Commit 564cabc

Browse files
committed
crypto: rsa-pkcs1pad - Use akcipher_request_complete
Use the akcipher_request_complete helper instead of calling the completion function directly. In fact the previous code was buggy in that EINPROGRESS was never passed back to the original caller. Fixes: 3d5b1ec ("crypto: rsa - RSA padding algorithm") Signed-off-by: Herbert Xu <[email protected]>
1 parent 6909823 commit 564cabc

File tree

1 file changed

+15
-19
lines changed

1 file changed

+15
-19
lines changed

crypto/rsa-pkcs1pad.c

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -214,16 +214,14 @@ static void pkcs1pad_encrypt_sign_complete_cb(
214214
struct crypto_async_request *child_async_req, int err)
215215
{
216216
struct akcipher_request *req = child_async_req->data;
217-
struct crypto_async_request async_req;
218217

219218
if (err == -EINPROGRESS)
220-
return;
219+
goto out;
220+
221+
err = pkcs1pad_encrypt_sign_complete(req, err);
221222

222-
async_req.data = req->base.data;
223-
async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req));
224-
async_req.flags = child_async_req->flags;
225-
req->base.complete(&async_req,
226-
pkcs1pad_encrypt_sign_complete(req, err));
223+
out:
224+
akcipher_request_complete(req, err);
227225
}
228226

229227
static int pkcs1pad_encrypt(struct akcipher_request *req)
@@ -332,15 +330,14 @@ static void pkcs1pad_decrypt_complete_cb(
332330
struct crypto_async_request *child_async_req, int err)
333331
{
334332
struct akcipher_request *req = child_async_req->data;
335-
struct crypto_async_request async_req;
336333

337334
if (err == -EINPROGRESS)
338-
return;
335+
goto out;
336+
337+
err = pkcs1pad_decrypt_complete(req, err);
339338

340-
async_req.data = req->base.data;
341-
async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req));
342-
async_req.flags = child_async_req->flags;
343-
req->base.complete(&async_req, pkcs1pad_decrypt_complete(req, err));
339+
out:
340+
akcipher_request_complete(req, err);
344341
}
345342

346343
static int pkcs1pad_decrypt(struct akcipher_request *req)
@@ -513,15 +510,14 @@ static void pkcs1pad_verify_complete_cb(
513510
struct crypto_async_request *child_async_req, int err)
514511
{
515512
struct akcipher_request *req = child_async_req->data;
516-
struct crypto_async_request async_req;
517513

518514
if (err == -EINPROGRESS)
519-
return;
515+
goto out;
520516

521-
async_req.data = req->base.data;
522-
async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req));
523-
async_req.flags = child_async_req->flags;
524-
req->base.complete(&async_req, pkcs1pad_verify_complete(req, err));
517+
err = pkcs1pad_verify_complete(req, err);
518+
519+
out:
520+
akcipher_request_complete(req, err);
525521
}
526522

527523
/*

0 commit comments

Comments
 (0)