Modify the call form of callback function in async mode, matching the definition in uadk.
Signed-off-by: Zhiqi Song songzhiqi1@huawei.com --- src/uadk_cipher.c | 10 ++++++---- src/uadk_dh.c | 2 +- src/uadk_digest.c | 12 ++++++++---- src/uadk_pkey.c | 4 ++-- src/uadk_pkey.h | 2 +- src/uadk_rsa.c | 2 +- 6 files changed, 19 insertions(+), 13 deletions(-)
diff --git a/src/uadk_cipher.c b/src/uadk_cipher.c index daa456c..7ddb135 100644 --- a/src/uadk_cipher.c +++ b/src/uadk_cipher.c @@ -717,17 +717,17 @@ static int uadk_e_cipher_cleanup(EVP_CIPHER_CTX *ctx) return 1; }
-static void uadk_e_cipher_cb(struct wd_cipher_req *req, void *data) +static void *uadk_e_cipher_cb(struct wd_cipher_req *req, void *data) { struct uadk_e_cb_info *cb_param; struct async_op *op;
if (!req) - return; + return NULL;
cb_param = req->cb_param; if (!cb_param) - return; + return NULL;
op = cb_param->op; if (op && op->job && !op->done) { @@ -735,6 +735,8 @@ static void uadk_e_cipher_cb(struct wd_cipher_req *req, void *data) async_free_poll_task(op->idx, 1); async_wake_job(op->job); } + + return NULL; }
/* Increment counter (128-bit int) by c */ @@ -822,7 +824,7 @@ static int do_cipher_async(struct cipher_priv_ctx *priv, struct async_op *op)
cb_param.op = op; cb_param.priv = priv; - priv->req.cb = (void *)uadk_e_cipher_cb; + priv->req.cb = uadk_e_cipher_cb; priv->req.cb_param = &cb_param;
ret = async_get_free_task(&idx); diff --git a/src/uadk_dh.c b/src/uadk_dh.c index fc91609..acb5b8a 100644 --- a/src/uadk_dh.c +++ b/src/uadk_dh.c @@ -711,7 +711,7 @@ static int dh_do_crypto(struct uadk_dh_sess *dh_sess) } else { cb_param.op = &op; cb_param.priv = &dh_sess->req; - dh_sess->req.cb = (void *)uadk_e_dh_cb; + dh_sess->req.cb = uadk_e_dh_cb; dh_sess->req.cb_param = &cb_param; dh_sess->req.status = -1; ret = async_get_free_task(&idx); diff --git a/src/uadk_digest.c b/src/uadk_digest.c index 590a888..b75c408 100644 --- a/src/uadk_digest.c +++ b/src/uadk_digest.c @@ -674,23 +674,27 @@ soft_update: return digest_soft_update(priv, data, data_len); }
-static void async_cb(struct wd_digest_req *req, void *data) +static void *uadk_e_digest_cb(void *data) { + struct wd_digest_req *req = (struct wd_digest_req *)data; struct uadk_e_cb_info *cb_param; struct async_op *op;
if (!req) - return; + return NULL;
cb_param = req->cb_param; if (!cb_param) - return; + return NULL; + op = cb_param->op; if (op && op->job && !op->done) { op->done = 1; async_free_poll_task(op->idx, 1); async_wake_job(op->job); } + + return NULL; }
static int do_digest_sync(struct digest_priv_ctx *priv) @@ -721,7 +725,7 @@ static int do_digest_async(struct digest_priv_ctx *priv, struct async_op *op)
cb_param.op = op; cb_param.priv = priv; - priv->req.cb = (void *)async_cb; + priv->req.cb = uadk_e_digest_cb; priv->req.cb_param = &cb_param;
ret = async_get_free_task(&idx); diff --git a/src/uadk_pkey.c b/src/uadk_pkey.c index 35a2696..60e3238 100644 --- a/src/uadk_pkey.c +++ b/src/uadk_pkey.c @@ -76,7 +76,7 @@ static int ecc_poll_policy(handle_t h_sched_ctx, __u32 expect, __u32 *count) return 0; }
-void uadk_ecc_cb(void *req_t) +void uadk_e_ecc_cb(void *req_t) { struct wd_ecc_req *req_new = (struct wd_ecc_req *)req_t; struct uadk_e_cb_info *cb_param; @@ -296,7 +296,7 @@ int uadk_ecc_crypto(handle_t sess, struct wd_ecc_req *req, void *usr) cb_param.op = &op; cb_param.priv = req; req->cb_param = &cb_param; - req->cb = (void *)uadk_ecc_cb; + req->cb = uadk_e_ecc_cb; req->status = -1; ret = async_get_free_task(&idx); if (!ret) diff --git a/src/uadk_pkey.h b/src/uadk_pkey.h index b80e425..3168474 100644 --- a/src/uadk_pkey.h +++ b/src/uadk_pkey.h @@ -58,7 +58,7 @@ struct uadk_pkey_meth { bool uadk_is_all_zero(const unsigned char *data, size_t dlen); bool uadk_support_algorithm(const char *alg); int uadk_ecc_get_rand(char *out, size_t out_len, void *usr); -void uadk_ecc_cb(void *req_t); +void uadk_e_ecc_cb(void *req_t); void uadk_ecc_fill_req(struct wd_ecc_req *req, unsigned int op, void *in, void *out); int uadk_ecc_set_private_key(handle_t sess, const EC_KEY *eckey); diff --git a/src/uadk_rsa.c b/src/uadk_rsa.c index bc51e7d..d0780a7 100644 --- a/src/uadk_rsa.c +++ b/src/uadk_rsa.c @@ -1101,7 +1101,7 @@ static int rsa_do_crypto(struct uadk_rsa_sess *rsa_sess) } cb_param.op = &op; cb_param.priv = &(rsa_sess->req); - rsa_sess->req.cb = (void *)uadk_e_rsa_cb; + rsa_sess->req.cb = uadk_e_rsa_cb; rsa_sess->req.cb_param = &cb_param; rsa_sess->req.status = -1;