Skip to content

Commit

Permalink
crypto: api - Use data directly in completion function
Browse files Browse the repository at this point in the history
This patch does the final flag day conversion of all completion
functions which are now all contained in the Crypto API.

Signed-off-by: Herbert Xu <[email protected]>
  • Loading branch information
herbertx committed Feb 13, 2023
1 parent 234650b commit 255e48e
Show file tree
Hide file tree
Showing 23 changed files with 133 additions and 152 deletions.
5 changes: 2 additions & 3 deletions crypto/adiantum.c
Original file line number Diff line number Diff line change
Expand Up @@ -308,10 +308,9 @@ static int adiantum_finish(struct skcipher_request *req)
return 0;
}

static void adiantum_streamcipher_done(struct crypto_async_request *areq,
int err)
static void adiantum_streamcipher_done(void *data, int err)
{
struct skcipher_request *req = areq->data;
struct skcipher_request *req = data;

if (!err)
err = adiantum_finish(req);
Expand Down
6 changes: 3 additions & 3 deletions crypto/af_alg.c
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ EXPORT_SYMBOL_GPL(af_alg_free_resources);

/**
* af_alg_async_cb - AIO callback handler
* @_req: async request info
* @data: async request completion data
* @err: if non-zero, error result to be returned via ki_complete();
* otherwise return the AIO output length via ki_complete().
*
Expand All @@ -1196,9 +1196,9 @@ EXPORT_SYMBOL_GPL(af_alg_free_resources);
* The number of bytes to be generated with the AIO operation must be set
* in areq->outlen before the AIO callback handler is invoked.
*/
void af_alg_async_cb(struct crypto_async_request *_req, int err)
void af_alg_async_cb(void *data, int err)
{
struct af_alg_async_req *areq = _req->data;
struct af_alg_async_req *areq = data;
struct sock *sk = areq->sk;
struct kiocb *iocb = areq->iocb;
unsigned int resultlen;
Expand Down
12 changes: 6 additions & 6 deletions crypto/ahash.c
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ static void ahash_restore_req(struct ahash_request *req, int err)
kfree_sensitive(subreq);
}

static void ahash_op_unaligned_done(struct crypto_async_request *req, int err)
static void ahash_op_unaligned_done(void *data, int err)
{
struct ahash_request *areq = req->data;
struct ahash_request *areq = data;

if (err == -EINPROGRESS)
goto out;
Expand Down Expand Up @@ -348,9 +348,9 @@ int crypto_ahash_digest(struct ahash_request *req)
}
EXPORT_SYMBOL_GPL(crypto_ahash_digest);

static void ahash_def_finup_done2(struct crypto_async_request *req, int err)
static void ahash_def_finup_done2(void *data, int err)
{
struct ahash_request *areq = req->data;
struct ahash_request *areq = data;

if (err == -EINPROGRESS)
return;
Expand Down Expand Up @@ -378,9 +378,9 @@ static int ahash_def_finup_finish1(struct ahash_request *req, int err)
return err;
}

static void ahash_def_finup_done1(struct crypto_async_request *req, int err)
static void ahash_def_finup_done1(void *data, int err)
{
struct ahash_request *areq = req->data;
struct ahash_request *areq = data;
struct ahash_request *subreq;

if (err == -EINPROGRESS)
Expand Down
4 changes: 2 additions & 2 deletions crypto/api.c
Original file line number Diff line number Diff line change
Expand Up @@ -643,9 +643,9 @@ int crypto_has_alg(const char *name, u32 type, u32 mask)
}
EXPORT_SYMBOL_GPL(crypto_has_alg);

void crypto_req_done(struct crypto_async_request *req, int err)
void crypto_req_done(void *data, int err)
{
struct crypto_wait *wait = req->data;
struct crypto_wait *wait = data;

if (err == -EINPROGRESS)
return;
Expand Down
14 changes: 6 additions & 8 deletions crypto/authenc.c
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,9 @@ static int crypto_authenc_setkey(struct crypto_aead *authenc, const u8 *key,
return err;
}

static void authenc_geniv_ahash_done(struct crypto_async_request *areq, int err)
static void authenc_geniv_ahash_done(void *data, int err)
{
struct aead_request *req = areq->data;
struct aead_request *req = data;
struct crypto_aead *authenc = crypto_aead_reqtfm(req);
struct aead_instance *inst = aead_alg_instance(authenc);
struct authenc_instance_ctx *ictx = aead_instance_ctx(inst);
Expand Down Expand Up @@ -160,10 +160,9 @@ static int crypto_authenc_genicv(struct aead_request *req, unsigned int flags)
return 0;
}

static void crypto_authenc_encrypt_done(struct crypto_async_request *req,
int err)
static void crypto_authenc_encrypt_done(void *data, int err)
{
struct aead_request *areq = req->data;
struct aead_request *areq = data;

if (err)
goto out;
Expand Down Expand Up @@ -261,10 +260,9 @@ static int crypto_authenc_decrypt_tail(struct aead_request *req,
return crypto_skcipher_decrypt(skreq);
}

static void authenc_verify_ahash_done(struct crypto_async_request *areq,
int err)
static void authenc_verify_ahash_done(void *data, int err)
{
struct aead_request *req = areq->data;
struct aead_request *req = data;

if (err)
goto out;
Expand Down
15 changes: 6 additions & 9 deletions crypto/authencesn.c
Original file line number Diff line number Diff line change
Expand Up @@ -107,10 +107,9 @@ static int crypto_authenc_esn_genicv_tail(struct aead_request *req,
return 0;
}

static void authenc_esn_geniv_ahash_done(struct crypto_async_request *areq,
int err)
static void authenc_esn_geniv_ahash_done(void *data, int err)
{
struct aead_request *req = areq->data;
struct aead_request *req = data;

err = err ?: crypto_authenc_esn_genicv_tail(req, 0);
aead_request_complete(req, err);
Expand Down Expand Up @@ -153,10 +152,9 @@ static int crypto_authenc_esn_genicv(struct aead_request *req,
}


static void crypto_authenc_esn_encrypt_done(struct crypto_async_request *req,
int err)
static void crypto_authenc_esn_encrypt_done(void *data, int err)
{
struct aead_request *areq = req->data;
struct aead_request *areq = data;

if (!err)
err = crypto_authenc_esn_genicv(areq, 0);
Expand Down Expand Up @@ -258,10 +256,9 @@ static int crypto_authenc_esn_decrypt_tail(struct aead_request *req,
return crypto_skcipher_decrypt(skreq);
}

static void authenc_esn_verify_ahash_done(struct crypto_async_request *areq,
int err)
static void authenc_esn_verify_ahash_done(void *data, int err)
{
struct aead_request *req = areq->data;
struct aead_request *req = data;

err = err ?: crypto_authenc_esn_decrypt_tail(req, 0);
authenc_esn_request_complete(req, err);
Expand Down
9 changes: 4 additions & 5 deletions crypto/ccm.c
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,9 @@ static int crypto_ccm_auth(struct aead_request *req, struct scatterlist *plain,
return err;
}

static void crypto_ccm_encrypt_done(struct crypto_async_request *areq, int err)
static void crypto_ccm_encrypt_done(void *data, int err)
{
struct aead_request *req = areq->data;
struct aead_request *req = data;
struct crypto_aead *aead = crypto_aead_reqtfm(req);
struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req);
u8 *odata = pctx->odata;
Expand Down Expand Up @@ -320,10 +320,9 @@ static int crypto_ccm_encrypt(struct aead_request *req)
return err;
}

static void crypto_ccm_decrypt_done(struct crypto_async_request *areq,
int err)
static void crypto_ccm_decrypt_done(void *data, int err)
{
struct aead_request *req = areq->data;
struct aead_request *req = data;
struct crypto_ccm_req_priv_ctx *pctx = crypto_ccm_reqctx(req);
struct crypto_aead *aead = crypto_aead_reqtfm(req);
unsigned int authsize = crypto_aead_authsize(aead);
Expand Down
40 changes: 20 additions & 20 deletions crypto/chacha20poly1305.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,9 @@ static int poly_copy_tag(struct aead_request *req)
return 0;
}

static void chacha_decrypt_done(struct crypto_async_request *areq, int err)
static void chacha_decrypt_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_verify_tag);
async_done_continue(data, err, poly_verify_tag);
}

static int chacha_decrypt(struct aead_request *req)
Expand Down Expand Up @@ -161,9 +161,9 @@ static int poly_tail_continue(struct aead_request *req)
return chacha_decrypt(req);
}

static void poly_tail_done(struct crypto_async_request *areq, int err)
static void poly_tail_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_tail_continue);
async_done_continue(data, err, poly_tail_continue);
}

static int poly_tail(struct aead_request *req)
Expand Down Expand Up @@ -191,9 +191,9 @@ static int poly_tail(struct aead_request *req)
return poly_tail_continue(req);
}

static void poly_cipherpad_done(struct crypto_async_request *areq, int err)
static void poly_cipherpad_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_tail);
async_done_continue(data, err, poly_tail);
}

static int poly_cipherpad(struct aead_request *req)
Expand All @@ -220,9 +220,9 @@ static int poly_cipherpad(struct aead_request *req)
return poly_tail(req);
}

static void poly_cipher_done(struct crypto_async_request *areq, int err)
static void poly_cipher_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_cipherpad);
async_done_continue(data, err, poly_cipherpad);
}

static int poly_cipher(struct aead_request *req)
Expand Down Expand Up @@ -250,9 +250,9 @@ static int poly_cipher(struct aead_request *req)
return poly_cipherpad(req);
}

static void poly_adpad_done(struct crypto_async_request *areq, int err)
static void poly_adpad_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_cipher);
async_done_continue(data, err, poly_cipher);
}

static int poly_adpad(struct aead_request *req)
Expand All @@ -279,9 +279,9 @@ static int poly_adpad(struct aead_request *req)
return poly_cipher(req);
}

static void poly_ad_done(struct crypto_async_request *areq, int err)
static void poly_ad_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_adpad);
async_done_continue(data, err, poly_adpad);
}

static int poly_ad(struct aead_request *req)
Expand All @@ -303,9 +303,9 @@ static int poly_ad(struct aead_request *req)
return poly_adpad(req);
}

static void poly_setkey_done(struct crypto_async_request *areq, int err)
static void poly_setkey_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_ad);
async_done_continue(data, err, poly_ad);
}

static int poly_setkey(struct aead_request *req)
Expand All @@ -329,9 +329,9 @@ static int poly_setkey(struct aead_request *req)
return poly_ad(req);
}

static void poly_init_done(struct crypto_async_request *areq, int err)
static void poly_init_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_setkey);
async_done_continue(data, err, poly_setkey);
}

static int poly_init(struct aead_request *req)
Expand All @@ -352,9 +352,9 @@ static int poly_init(struct aead_request *req)
return poly_setkey(req);
}

static void poly_genkey_done(struct crypto_async_request *areq, int err)
static void poly_genkey_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_init);
async_done_continue(data, err, poly_init);
}

static int poly_genkey(struct aead_request *req)
Expand Down Expand Up @@ -391,9 +391,9 @@ static int poly_genkey(struct aead_request *req)
return poly_init(req);
}

static void chacha_encrypt_done(struct crypto_async_request *areq, int err)
static void chacha_encrypt_done(void *data, int err)
{
async_done_continue(areq->data, err, poly_genkey);
async_done_continue(data, err, poly_genkey);
}

static int chacha_encrypt(struct aead_request *req)
Expand Down
Loading

0 comments on commit 255e48e

Please sign in to comment.