Commit 564cabc0 authored by Herbert Xu's avatar Herbert Xu

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: 3d5b1ecd ("crypto: rsa - RSA padding algorithm")
Signed-off-by: default avatarHerbert Xu <herbert@gondor.apana.org.au>
parent 6909823d
...@@ -214,16 +214,14 @@ static void pkcs1pad_encrypt_sign_complete_cb( ...@@ -214,16 +214,14 @@ static void pkcs1pad_encrypt_sign_complete_cb(
struct crypto_async_request *child_async_req, int err) struct crypto_async_request *child_async_req, int err)
{ {
struct akcipher_request *req = child_async_req->data; struct akcipher_request *req = child_async_req->data;
struct crypto_async_request async_req;
if (err == -EINPROGRESS) if (err == -EINPROGRESS)
return; goto out;
err = pkcs1pad_encrypt_sign_complete(req, err);
async_req.data = req->base.data; out:
async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req)); akcipher_request_complete(req, err);
async_req.flags = child_async_req->flags;
req->base.complete(&async_req,
pkcs1pad_encrypt_sign_complete(req, err));
} }
static int pkcs1pad_encrypt(struct akcipher_request *req) static int pkcs1pad_encrypt(struct akcipher_request *req)
...@@ -332,15 +330,14 @@ static void pkcs1pad_decrypt_complete_cb( ...@@ -332,15 +330,14 @@ static void pkcs1pad_decrypt_complete_cb(
struct crypto_async_request *child_async_req, int err) struct crypto_async_request *child_async_req, int err)
{ {
struct akcipher_request *req = child_async_req->data; struct akcipher_request *req = child_async_req->data;
struct crypto_async_request async_req;
if (err == -EINPROGRESS) if (err == -EINPROGRESS)
return; goto out;
err = pkcs1pad_decrypt_complete(req, err);
async_req.data = req->base.data; out:
async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req)); akcipher_request_complete(req, err);
async_req.flags = child_async_req->flags;
req->base.complete(&async_req, pkcs1pad_decrypt_complete(req, err));
} }
static int pkcs1pad_decrypt(struct akcipher_request *req) static int pkcs1pad_decrypt(struct akcipher_request *req)
...@@ -513,15 +510,14 @@ static void pkcs1pad_verify_complete_cb( ...@@ -513,15 +510,14 @@ static void pkcs1pad_verify_complete_cb(
struct crypto_async_request *child_async_req, int err) struct crypto_async_request *child_async_req, int err)
{ {
struct akcipher_request *req = child_async_req->data; struct akcipher_request *req = child_async_req->data;
struct crypto_async_request async_req;
if (err == -EINPROGRESS) if (err == -EINPROGRESS)
return; goto out;
async_req.data = req->base.data; err = pkcs1pad_verify_complete(req, err);
async_req.tfm = crypto_akcipher_tfm(crypto_akcipher_reqtfm(req));
async_req.flags = child_async_req->flags; out:
req->base.complete(&async_req, pkcs1pad_verify_complete(req, err)); akcipher_request_complete(req, err);
} }
/* /*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment