From cebc80e528a9eb1cca675b2ea06f02b1760bafb3 Mon Sep 17 00:00:00 2001
From: Weili Qian <qianweili@huawei.com>
Date: Thu, 10 Mar 2022 20:29:46 +0800
Subject: [PATCH 098/109] rsa/dh/ecc: unify print format

Unify print format with following rules:
1.failed to do sth.
2.add prefix "invalid: " for check parameters printf
3.add "!" at the end.

Signed-off-by: Weili Qian <qianweili@huawei.com>
---
 wd_dh.c  |  44 +++++++++---------
 wd_ecc.c | 136 +++++++++++++++++++++++++++----------------------------
 wd_rsa.c | 118 +++++++++++++++++++++++------------------------
 3 files changed, 149 insertions(+), 149 deletions(-)

diff --git a/wd_dh.c b/wd_dh.c
index f5d70a2..c0d3e00 100644
--- a/wd_dh.c
+++ b/wd_dh.c
@@ -51,14 +51,14 @@ static void wd_dh_set_static_drv(void)
 {
 	wd_dh_setting.driver = wd_dh_get_driver();
 	if (!wd_dh_setting.driver)
-		WD_ERR("fail to get driver\n");
+		WD_ERR("failed to get dh driver!\n");
 }
 #else
 static void __attribute__((constructor)) wd_dh_open_driver(void)
 {
 	wd_dh_setting.dlhandle = dlopen("libhisi_hpre.so", RTLD_NOW);
 	if (!wd_dh_setting.dlhandle)
-		WD_ERR("Fail to open libhisi_hpre.so\n");
+		WD_ERR("failed to open libhisi_hpre.so!\n");
 }
 
 static void __attribute__((destructor)) wd_dh_close_driver(void)
@@ -71,7 +71,7 @@ static void __attribute__((destructor)) wd_dh_close_driver(void)
 void wd_dh_set_driver(struct wd_dh_driver *drv)
 {
 	if (!drv) {
-		WD_ERR("drv NULL\n");
+		WD_ERR("invalid: dh drv is NULL!\n");
 		return;
 	}
 
@@ -81,12 +81,12 @@ void wd_dh_set_driver(struct wd_dh_driver *drv)
 static int param_check(struct wd_ctx_config *config, struct wd_sched *sched)
 {
 	if (!config || !config->ctxs || !config->ctxs[0].ctx || !sched) {
-		WD_ERR("config or sched NULL\n");
+		WD_ERR("invalid: config or sched is NULL!\n");
 		return -WD_EINVAL;
 	}
 
 	if (!wd_is_sva(config->ctxs[0].ctx)) {
-		WD_ERR("no sva, do not dh init\n");
+		WD_ERR("invalid: the mode is non sva, please check system!\n");
 		return -WD_EINVAL;
 	}
 
@@ -103,13 +103,13 @@ int wd_dh_init(struct wd_ctx_config *config, struct wd_sched *sched)
 
 	ret = wd_init_ctx_config(&wd_dh_setting.config, config);
 	if (ret) {
-		WD_ERR("failed to wd initialize ctx config, ret = %d\n", ret);
+		WD_ERR("failed to initialize ctx config, ret = %d!\n", ret);
 		return ret;
 	}
 
 	ret = wd_init_sched(&wd_dh_setting.sched, sched);
 	if (ret) {
-		WD_ERR("failed to wd initialize sched, ret = %d\n", ret);
+		WD_ERR("failed to initialize sched, ret = %d!\n", ret);
 		goto out;
 	}
 
@@ -137,7 +137,7 @@ int wd_dh_init(struct wd_ctx_config *config, struct wd_sched *sched)
 	ret = wd_dh_setting.driver->init(&wd_dh_setting.config, priv,
 					 wd_dh_setting.driver->alg_name);
 	if (ret < 0) {
-		WD_ERR("failed to drv init, ret= %d\n", ret);
+		WD_ERR("failed to init dh driver, ret= %d!\n", ret);
 		goto out_init;
 	}
 
@@ -159,7 +159,7 @@ out:
 void wd_dh_uninit(void)
 {
 	if (!wd_dh_setting.priv) {
-		WD_ERR("repeat uninit dh\n");
+		WD_ERR("invalid: repeat uninit dh!\n");
 		return;
 	}
 
@@ -184,7 +184,7 @@ static int fill_dh_msg(struct wd_dh_msg *msg, struct wd_dh_req *req,
 	msg->key_bytes = sess->key_size;
 
 	if (unlikely(req->pri_bytes < sess->key_size)) {
-		WD_ERR("req pri bytes = %hu error!\n", req->pri_bytes);
+		WD_ERR("invalid: req pri bytes %hu is error!\n", req->pri_bytes);
 		return -WD_EINVAL;
 	}
 
@@ -195,12 +195,12 @@ static int fill_dh_msg(struct wd_dh_msg *msg, struct wd_dh_req *req,
 		msg->g = (__u8 *)req->pv;
 		msg->gbytes = req->pvbytes;
 	} else {
-		WD_ERR("op_type = %hhu error!\n", req->op_type);
+		WD_ERR("invalid: op_type %hhu is error!\n", req->op_type);
 		return -WD_EINVAL;
 	}
 
 	if (!msg->g) {
-		WD_ERR("request dh g is NULL!\n");
+		WD_ERR("invalid: request dh g is NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -268,7 +268,7 @@ int wd_do_dh_sync(handle_t sess, struct wd_dh_req *req)
 	int ret;
 
 	if (unlikely(!sess || !req)) {
-		WD_ERR("input param NULL!\n");
+		WD_ERR("invalid: input param NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -310,7 +310,7 @@ int wd_do_dh_async(handle_t sess, struct wd_dh_req *req)
 	__u32 idx;
 
 	if (unlikely(!req || !sess || !req->cb)) {
-		WD_ERR("input param NULL!\n");
+		WD_ERR("invalid: input param NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -363,7 +363,7 @@ int wd_dh_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 	int ret;
 
 	if (unlikely(!count)) {
-		WD_ERR("count is NULL!\n");
+		WD_ERR("invalid: count is NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -415,7 +415,7 @@ int wd_dh_poll(__u32 expt, __u32 *count)
 int wd_dh_get_mode(handle_t sess, __u8 *alg_mode)
 {
 	if (!sess || !alg_mode) {
-		WD_ERR("dh get mode: param NULL!\n");
+		WD_ERR("invalid: dh get mode, param NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -427,7 +427,7 @@ int wd_dh_get_mode(handle_t sess, __u8 *alg_mode)
 __u32 wd_dh_key_bits(handle_t sess)
 {
 	if (!sess) {
-		WD_ERR("get dh key bits, sess NULL!\n");
+		WD_ERR("invalid: get dh key bits, sess NULL!\n");
 		return 0;
 	}
 
@@ -439,7 +439,7 @@ int wd_dh_set_g(handle_t sess, struct wd_dtb *g)
 	struct wd_dh_sess *sess_t = (struct wd_dh_sess *)sess;
 
 	if (!sess_t || !g) {
-		WD_ERR("param NULL!\n");
+		WD_ERR("invalid: dh set g, param NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -460,7 +460,7 @@ int wd_dh_set_g(handle_t sess, struct wd_dtb *g)
 void wd_dh_get_g(handle_t sess, struct wd_dtb **g)
 {
 	if (!sess || !g) {
-		WD_ERR("param NULL!\n");
+		WD_ERR("invalid: dh get g, param NULL!\n");
 		return;
 	}
 
@@ -472,7 +472,7 @@ handle_t wd_dh_alloc_sess(struct wd_dh_sess_setup *setup)
 	struct wd_dh_sess *sess;
 
 	if (!setup) {
-		WD_ERR("alloc dh sess setup NULL!\n");
+		WD_ERR("invalid: alloc dh sess setup NULL!\n");
 		return (handle_t)0;
 	}
 
@@ -483,7 +483,7 @@ handle_t wd_dh_alloc_sess(struct wd_dh_sess_setup *setup)
 		setup->key_bits != 2048 &&
 		setup->key_bits != 3072 &&
 		setup->key_bits != 4096) {
-		WD_ERR("alloc dh sess key_bit %u err!\n", setup->key_bits);
+		WD_ERR("invalid: alloc dh sess key_bit %u is err!\n", setup->key_bits);
 		return (handle_t)0;
 	}
 
@@ -522,7 +522,7 @@ void wd_dh_free_sess(handle_t sess)
 	struct wd_dh_sess *sess_t = (struct wd_dh_sess *)sess;
 
 	if (!sess_t) {
-		WD_ERR("free rsa sess param NULL!\n");
+		WD_ERR("invalid: free dh sess param NULL!\n");
 		return;
 	}
 
diff --git a/wd_ecc.c b/wd_ecc.c
index d925bc3..af62b9a 100644
--- a/wd_ecc.c
+++ b/wd_ecc.c
@@ -105,14 +105,14 @@ static void wd_ecc_set_static_drv(void)
 {
 	wd_ecc_setting.driver = wd_ecc_get_driver();
 	if (!wd_ecc_setting.driver)
-		WD_ERR("fail to get driver\n");
+		WD_ERR("failed to get ecc driver!\n");
 }
 #else
 static void __attribute__((constructor)) wd_ecc_open_driver(void)
 {
 	wd_ecc_setting.dlhandle = dlopen("libhisi_hpre.so", RTLD_NOW);
 	if (!wd_ecc_setting.dlhandle)
-		WD_ERR("failed to open libhisi_hpre.so\n");
+		WD_ERR("failed to open libhisi_hpre.so!\n");
 }
 
 static void __attribute__((destructor)) wd_ecc_close_driver(void)
@@ -125,7 +125,7 @@ static void __attribute__((destructor)) wd_ecc_close_driver(void)
 void wd_ecc_set_driver(struct wd_ecc_driver *drv)
 {
 	if (!drv) {
-		WD_ERR("drv NULL\n");
+		WD_ERR("invalid: ecc drv is NULL!\n");
 		return;
 	}
 
@@ -135,12 +135,12 @@ void wd_ecc_set_driver(struct wd_ecc_driver *drv)
 static int init_param_check(struct wd_ctx_config *config, struct wd_sched *sched)
 {
 	if (!config || !config->ctxs || !config->ctxs[0].ctx || !sched) {
-		WD_ERR("config or sched NULL\n");
+		WD_ERR("invalid: config or sched is NULL!\n");
 		return -WD_EINVAL;
 	}
 
 	if (!wd_is_sva(config->ctxs[0].ctx)) {
-		WD_ERR("no sva, not do ecc init\n");
+		WD_ERR("invalid: the mode is non sva, please check system!\n");
 		return -WD_EINVAL;
 	}
 
@@ -191,7 +191,7 @@ int wd_ecc_init(struct wd_ctx_config *config, struct wd_sched *sched)
 	ret = wd_ecc_setting.driver->init(&wd_ecc_setting.config, priv,
 					  wd_ecc_setting.driver->alg_name);
 	if (ret < 0) {
-		WD_ERR("failed to drv init, ret = %d\n", ret);
+		WD_ERR("failed to init ecc driver, ret = %d!\n", ret);
 		goto out_init;
 	}
 
@@ -212,7 +212,7 @@ out:
 void wd_ecc_uninit(void)
 {
 	if (!wd_ecc_setting.priv) {
-		WD_ERR("repeat uninit ecc\n");
+		WD_ERR("invalid: repeat uninit ecc!\n");
 		return;
 	}
 
@@ -236,7 +236,7 @@ static int trans_to_binpad(char *dst, const char *src,
 	int j;
 
 	if (unlikely(!dst || !src || !b_size || !d_size || b_size < d_size)) {
-		WD_ERR("%s: trans to hpre bin params err!\n", p_name);
+		WD_ERR("invalid: %s trans to hpre bin params err!\n", p_name);
 		return -WD_EINVAL;
 	}
 
@@ -265,7 +265,7 @@ static __u32 get_key_bsz(__u32 ksz)
 	else if (ksz <= BITS_TO_BYTES(576))
 		size = BITS_TO_BYTES(576);
 	else
-		WD_ERR("failed to get key buffer size : key size = %u.\n", ksz);
+		WD_ERR("invalid: get key size %u is error!\n", ksz);
 
 	return size;
 }
@@ -386,7 +386,7 @@ static struct wd_ecc_pubkey *create_ecc_pubkey(struct wd_ecc_sess *sess)
 	hsz = get_key_bsz(sess->key_size);
 	pubkey = malloc(sizeof(struct wd_ecc_pubkey));
 	if (!pubkey) {
-		WD_ERR("failed to malloc!\n");
+		WD_ERR("failed to malloc pubkey!\n");
 		return NULL;
 	}
 
@@ -419,7 +419,7 @@ static struct wd_ecc_in *create_ecc_in(struct wd_ecc_sess *sess, __u32 num)
 	__u32 hsz, len;
 
 	if (!sess->key_size || sess->key_size > ECC_MAX_KEY_SIZE) {
-		WD_ERR("sess key size %u error!\n", sess->key_size);
+		WD_ERR("invalid: sess key size %u is error!\n", sess->key_size);
 		return NULL;
 	}
 
@@ -447,7 +447,7 @@ static struct wd_ecc_in *create_sm2_sign_in(struct wd_ecc_sess *sess,
 	__u64 len;
 
 	if (ksz != SM2_KEY_SIZE) {
-		WD_ERR("sess key size %u error!\n", ksz);
+		WD_ERR("invalid: sess key size %u is error!\n", ksz);
 		return NULL;
 	}
 
@@ -488,7 +488,7 @@ static struct wd_ecc_in *create_sm2_enc_in(struct wd_ecc_sess *sess,
 	__u64 len;
 
 	if (ksz != SM2_KEY_SIZE) {
-		WD_ERR("sess key size %u error!\n", sess->key_size);
+		WD_ERR("invalid: sess key size %u is error!\n", sess->key_size);
 		return NULL;
 	}
 
@@ -525,7 +525,7 @@ static void *create_sm2_ciphertext(struct wd_ecc_sess *sess, __u32 m_len,
 	void *start;
 
 	if (unlikely(ksz != SM2_KEY_SIZE)) {
-		WD_ERR("sess key size %u error!\n", ksz);
+		WD_ERR("invalid: sess key size %u is error!\n", ksz);
 		return NULL;
 	}
 
@@ -539,7 +539,7 @@ static void *create_sm2_ciphertext(struct wd_ecc_sess *sess, __u32 m_len,
 		(__u64)m_len + (__u64)h_byts;
 	start = malloc(*len);
 	if (unlikely(!start)) {
-		WD_ERR("failed to alloc, sz = %llu!\n", *len);
+		WD_ERR("failed to alloc start, sz = %llu!\n", *len);
 		return NULL;
 	}
 
@@ -579,7 +579,7 @@ static struct wd_ecc_out *create_ecc_out(struct wd_ecc_sess *sess, __u32 num)
 	__u32 hsz, len;
 
 	if (!sess->key_size || sess->key_size > ECC_MAX_KEY_SIZE) {
-		WD_ERR("sess key size %u error!\n", sess->key_size);
+		WD_ERR("invalid: sess key size %u is error!\n", sess->key_size);
 		return NULL;
 	}
 
@@ -678,12 +678,12 @@ static int set_param_single(struct wd_dtb *dst, const struct wd_dtb *src,
 			    const char *p_name)
 {
 	if (unlikely(!src || !src->data)) {
-		WD_ERR("%s: src or data NULL!\n", p_name);
+		WD_ERR("invalid: %s src or data NULL!\n", p_name);
 		return -WD_EINVAL;
 	}
 
 	if (!src->dsize || src->dsize > dst->dsize) {
-		WD_ERR("%s: src dsz = %u error, dst dsz = %u!\n",
+		WD_ERR("invalid: %s src dsz %u or dst dsz %u is error!\n",
 			p_name, src->dsize, dst->dsize);
 		return -WD_EINVAL;
 	}
@@ -698,7 +698,7 @@ static int set_param_single(struct wd_dtb *dst, const struct wd_dtb *src,
 int wd_ecc_get_key_bits(handle_t sess)
 {
 	if (!sess) {
-		WD_ERR("get ecc key bits, sess NULL!\n");
+		WD_ERR("invalid: get ecc key bits, sess NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -800,7 +800,7 @@ static int fill_param_by_id(struct wd_ecc_curve *c,
 	}
 
 	if (item->key_bits != key_bits) {
-		WD_ERR("curve %u and key bits %u not match!\n", id, key_bits);
+		WD_ERR("invalid: curve %u and key bits %u not match!\n", id, key_bits);
 		return -WD_EINVAL;
 	}
 
@@ -833,7 +833,7 @@ static int set_key_cv(struct wd_ecc_curve *dst,
 	int ret;
 
 	if (unlikely(!src)) {
-		WD_ERR("set key cv: praram NULL!\n");
+		WD_ERR("invalid: set key cv, praram NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -870,22 +870,22 @@ static int fill_user_curve_cfg(struct wd_ecc_curve *param,
 	if (setup->cv.type == WD_CV_CFG_ID) {
 		curve_id = setup->cv.cfg.id;
 		ret = fill_param_by_id(param, setup->key_bits, curve_id);
-		dbg("set curve id %u\n", curve_id);
+		dbg("set curve id %u!\n", curve_id);
 	} else if (setup->cv.type == WD_CV_CFG_PARAM) {
 		ret = set_key_cv(param, src_param);
 		if (ret) {
 			WD_ERR("failed to set key cv!\n");
 			return ret;
 		}
-		dbg("set curve by user param\n");
+		dbg("set curve by user param!\n");
 	} else {
-		WD_ERR("fill curve cfg:type %u error!\n", setup->cv.type);
+		WD_ERR("invalid: fill curve cfg type %u is error!\n", setup->cv.type);
 		return -WD_EINVAL;
 	}
 
 	if (!param->p.dsize ||
 	     param->p.dsize > BITS_TO_BYTES(setup->key_bits)) {
-		WD_ERR("fill curve cfg:dsize %u error!\n", param->p.dsize);
+		WD_ERR("invalid: fill curve cfg dsize %u is error!\n", param->p.dsize);
 		return -WD_EINVAL;
 	}
 
@@ -974,19 +974,19 @@ static bool is_alg_support(const char *alg)
 static int setup_param_check(struct wd_ecc_sess_setup *setup)
 {
 	if (unlikely(!setup || !setup->alg)) {
-		WD_ERR("input parameter error!\n");
+		WD_ERR("invalid: input parameter error!\n");
 		return -WD_EINVAL;
 	}
 
 	if (unlikely(!is_alg_support(setup->alg))) {
-		WD_ERR("algorithms %s not supported!\n", setup->alg);
+		WD_ERR("invalid: algorithms %s not supported!\n", setup->alg);
 		return -WD_EINVAL;
 	}
 
 	setup_curve_cfg(setup);
 
 	if (unlikely(!is_key_width_support(setup->key_bits))) {
-		WD_ERR("key_bits %u error!\n", setup->key_bits);
+		WD_ERR("invalid: key_bits %u is error!\n", setup->key_bits);
 		return -WD_EINVAL;
 	}
 
@@ -1035,7 +1035,7 @@ handle_t wd_ecc_alloc_sess(struct wd_ecc_sess_setup *setup)
 
 	ret = create_sess_key(setup, sess);
 	if (ret) {
-		WD_ERR("failed creat ecc sess keys!\n");
+		WD_ERR("failed to creat ecc sess keys!\n");
 		goto sess_err;
 	}
 
@@ -1061,7 +1061,7 @@ void wd_ecc_free_sess(handle_t sess)
 	struct wd_ecc_sess *sess_t = (struct wd_ecc_sess *)sess;
 
 	if (!sess_t) {
-		WD_ERR("free ecc sess parameter err!\n");
+		WD_ERR("invalid: free ecc sess parameter err!\n");
 		return;
 	}
 
@@ -1076,7 +1076,7 @@ struct wd_ecc_key *wd_ecc_get_key(handle_t sess)
 	struct wd_ecc_sess *sess_t = (struct wd_ecc_sess *)sess;
 
 	if (!sess_t) {
-		WD_ERR("get ecc key sess NULL!\n");
+		WD_ERR("invalid: get ecc key sess NULL!\n");
 		return NULL;
 	}
 
@@ -1091,14 +1091,14 @@ int wd_ecc_set_prikey(struct wd_ecc_key *ecc_key,
 	int ret;
 
 	if (!ecc_key || !prikey) {
-		WD_ERR("set ecc prikey parameter NULL!\n");
+		WD_ERR("invalid: set ecc prikey parameter NULL!\n");
 		return -WD_EINVAL;
 	}
 
 	ecc_prikey = ecc_key->prikey;
 	d = ecc_key->d;
 	if (!ecc_prikey || !d) {
-		WD_ERR("ecc_prikey or d NULL!\n");
+		WD_ERR("invalid: ecc_prikey or d NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1113,7 +1113,7 @@ int wd_ecc_get_prikey(struct wd_ecc_key *ecc_key,
 			   struct wd_dtb **prikey)
 {
 	if (!ecc_key || !prikey) {
-		WD_ERR("get ecc prikey parameter err!\n");
+		WD_ERR("invalid:  get ecc prikey parameter err!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1129,14 +1129,14 @@ int wd_ecc_set_pubkey(struct wd_ecc_key *ecc_key, struct wd_ecc_point *pubkey)
 	int ret;
 
 	if (!ecc_key || !pubkey) {
-		WD_ERR("set ecc pubkey parameter err!\n");
+		WD_ERR("invalid: set ecc pubkey parameter err!\n");
 		return -WD_EINVAL;
 	}
 
 	pub = ecc_key->pub;
 	ecc_pubkey = ecc_key->pubkey;
 	if (!ecc_pubkey || !pub) {
-		WD_ERR("ecc_pubkey or pub NULL!\n");
+		WD_ERR("invalid: ecc_pubkey or pub NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1161,7 +1161,7 @@ int wd_ecc_get_pubkey(struct wd_ecc_key *ecc_key,
 		      struct wd_ecc_point **pubkey)
 {
 	if (!ecc_key || !pubkey) {
-		WD_ERR("get ecc pubkey parameter err!\n");
+		WD_ERR("invalid: get ecc pubkey parameter err!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1174,7 +1174,7 @@ int wd_ecc_get_curve(struct wd_ecc_key *ecc_key,
 		     struct wd_ecc_curve **cv)
 {
 	if (!ecc_key || !cv) {
-		WD_ERR("get ecc pubkey parameter err!\n");
+		WD_ERR("invalid: get ecc pubkey parameter err!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1192,7 +1192,7 @@ void wd_ecc_get_prikey_params(struct wd_ecc_key *key,
 	struct wd_ecc_prikey *prk;
 
 	if (!key || !key->prikey) {
-		WD_ERR("input NULL in get ecc prikey param!\n");
+		WD_ERR("invalid: input NULL in get ecc prikey param!\n");
 		return;
 	}
 
@@ -1226,7 +1226,7 @@ void wd_ecc_get_pubkey_params(struct wd_ecc_key *key,
 	struct wd_ecc_pubkey *pbk;
 
 	if (!key || !key->pubkey) {
-		WD_ERR("input NULL in get ecc pubkey param!\n");
+		WD_ERR("invalid: input NULL in get ecc pubkey param!\n");
 		return;
 	}
 
@@ -1259,7 +1259,7 @@ struct wd_ecc_in *wd_ecxdh_new_in(handle_t sess, struct wd_ecc_point *in)
 	int ret;
 
 	if (!s || !in) {
-		WD_ERR("new ecc dh in parameter error!\n");
+		WD_ERR("invalid: new ecc dh in parameter error!\n");
 		return NULL;
 	}
 
@@ -1288,7 +1288,7 @@ struct wd_ecc_out *wd_ecxdh_new_out(handle_t sess)
 	struct wd_ecc_out *ecc_out;
 
 	if (!sess) {
-		WD_ERR("new ecc dh out sess NULL!\n");
+		WD_ERR("invalid: new ecc dh out sess NULL!\n");
 		return NULL;
 	}
 
@@ -1304,7 +1304,7 @@ void wd_ecxdh_get_out_params(struct wd_ecc_out *out, struct wd_ecc_point **key)
 	struct wd_ecc_dh_out *dh_out = (void *)out;
 
 	if (!dh_out) {
-		WD_ERR("input NULL in get ecdh out!\n");
+		WD_ERR("invalid: input NULL in get ecdh out!\n");
 		return;
 	}
 
@@ -1317,13 +1317,13 @@ void wd_ecc_del_in(handle_t sess, struct wd_ecc_in *in)
 	__u32 bsz;
 
 	if (!in) {
-		WD_ERR("del ecc in parameter error!\n");
+		WD_ERR("invalid: del ecc in parameter error!\n");
 		return;
 	}
 
 	bsz = in->size;
 	if (!bsz) {
-		WD_ERR("del ecc in: bsz 0!\n");
+		WD_ERR("invalid: del ecc in, bsz 0!\n");
 		return;
 	}
 
@@ -1336,13 +1336,13 @@ void wd_ecc_del_out(handle_t sess,  struct wd_ecc_out *out)
 	__u32 bsz;
 
 	if (!out) {
-		WD_ERR("del ecc out parameter error!\n");
+		WD_ERR("invalid: del ecc out parameter error!\n");
 		return;
 	}
 
 	bsz = out->size;
 	if (!bsz) {
-		WD_ERR("del ecc out: bsz 0!\n");
+		WD_ERR("invalid: del ecc out, bsz 0!\n");
 		return;
 	}
 
@@ -1374,7 +1374,7 @@ static int fill_ecc_msg(struct wd_ecc_msg *msg, struct wd_ecc_req *req,
 		key = &sess->key;
 		break;
 	default:
-		WD_ERR("ecc request op type = %u error!\n", req->op_type);
+		WD_ERR("invalid: ecc request op type %u is error!\n", req->op_type);
 		return -WD_EINVAL;
 	}
 	msg->key = key;
@@ -1390,7 +1390,7 @@ static int fill_ecc_msg(struct wd_ecc_msg *msg, struct wd_ecc_req *req,
 
 	if (!msg->req.src || (!req->dst && (req->op_type != WD_ECDSA_VERIFY &&
 		req->op_type != WD_SM2_VERIFY))) {
-		WD_ERR("req in/out NULL!\n");
+		WD_ERR("invalid: req in/out NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1468,7 +1468,7 @@ int wd_do_ecc_sync(handle_t h_sess, struct wd_ecc_req *req)
 	int ret;
 
 	if (unlikely(!h_sess || !req)) {
-		WD_ERR("input parameter NULL!\n");
+		WD_ERR("invalid: input parameter NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -1504,7 +1504,7 @@ static void get_sign_out_params(struct wd_ecc_out *out,
 	struct wd_ecc_sign_out *sout = (void *)out;
 
 	if (!sout) {
-		WD_ERR("input NULL in get ecc sign out!\n");
+		WD_ERR("invalid: input NULL in get ecc sign out!\n");
 		return;
 	}
 
@@ -1556,7 +1556,7 @@ static int generate_random(struct wd_ecc_sess *sess, struct wd_dtb *k)
 
 	ret = rand_t.cb(k->data, k->dsize, rand_t.usr);
 	if (ret)
-		WD_ERR("failed to rand cb: ret = %d!\n", ret);
+		WD_ERR("failed to do rand cb, ret = %d!\n", ret);
 
 	return ret;
 }
@@ -1580,7 +1580,7 @@ static int sm2_compute_za_hash(__u8 *za, __u32 *len, struct wd_dtb *id,
 
 	if (id && (!BYTES_TO_BITS(id->dsize) || !id->data ||
 		   BYTES_TO_BITS(id->dsize) > UINT16_MAX)) {
-		WD_ERR("id error: lens = %u!\n", id->dsize);
+		WD_ERR("invalid: id error, lens = %u!\n", id->dsize);
 		return -WD_EINVAL;
 	}
 
@@ -1633,7 +1633,7 @@ static int sm2_compute_digest(struct wd_ecc_sess *sess, struct wd_dtb *hash_msg,
 
 	hash_bytes = get_hash_bytes(hash->type);
 	if (unlikely(!hash_bytes || hash_bytes > SM2_KEY_SIZE)) {
-		WD_ERR("hash type = %hhu error!\n", hash->type);
+		WD_ERR("invalid: hash type %hhu is error!\n", hash->type);
 		return -WD_EINVAL;
 	}
 
@@ -1675,7 +1675,7 @@ static struct wd_ecc_in *new_sign_in(struct wd_ecc_sess *sess,
 	int ret;
 
 	if (!sess || !e) {
-		WD_ERR("failed to new ecc sign in: sess or e NULL!\n");
+		WD_ERR("invalid: new ecc sign in, sess or e NULL!\n");
 		return NULL;
 	}
 
@@ -1758,7 +1758,7 @@ static struct wd_ecc_in *create_sm2_verf_in(struct wd_ecc_sess *sess,
 	__u32 hsz;
 
 	if (sess->key_size != SM2_KEY_SIZE) {
-		WD_ERR("sess key size %u error!\n", sess->key_size);
+		WD_ERR("invalid: sess key size %u is error!\n", sess->key_size);
 		return NULL;
 	}
 
@@ -1820,7 +1820,7 @@ static struct wd_ecc_in *new_verf_in(handle_t sess,
 	int ret;
 
 	if (!sess_t || !r || !e || !s) {
-		WD_ERR("new ecc verf in parameter error!\n");
+		WD_ERR("invalid: new ecc verf in parameter error!\n");
 		return NULL;
 	}
 
@@ -1879,7 +1879,7 @@ static struct wd_ecc_out *wd_ecc_new_sign_out(struct wd_ecc_sess *sess)
 	struct wd_ecc_out *ecc_out;
 
 	if (!sess) {
-		WD_ERR("new ecc sout ctx NULL!\n");
+		WD_ERR("invalid: new ecc sout ctx NULL!\n");
 		return NULL;
 	}
 
@@ -1900,7 +1900,7 @@ struct wd_ecc_out *wd_sm2_new_kg_out(handle_t sess)
 	struct wd_ecc_out *ecc_out;
 
 	if (!sess) {
-		WD_ERR("new sm2 kg out sess NULL!\n");
+		WD_ERR("invalid: new sm2 kg out sess NULL!\n");
 		return NULL;
 	}
 
@@ -1919,7 +1919,7 @@ void wd_sm2_get_kg_out_params(struct wd_ecc_out *out,
 	struct wd_sm2_kg_out *kout = (void *)out;
 
 	if (!kout) {
-		WD_ERR("input NULL in get sm2 kg out!\n");
+		WD_ERR("invalid: input NULL in get sm2 kg out!\n");
 		return;
 	}
 
@@ -1940,7 +1940,7 @@ struct wd_ecc_in *wd_sm2_new_enc_in(handle_t sess,
 	int ret;
 
 	if (!sess_t || !plaintext) {
-		WD_ERR("new sm2 enc in parameter error!\n");
+		WD_ERR("invalid: new sm2 enc in parameter error!\n");
 		return NULL;
 	}
 
@@ -1991,7 +1991,7 @@ struct wd_ecc_in *wd_sm2_new_dec_in(handle_t sess,
 	int ret;
 
 	if (!sess_t || !c1 || !c2 || !c3) {
-		WD_ERR("new sm2 dec in parameter error!\n");
+		WD_ERR("invalid: new sm2 dec in parameter error!\n");
 		return NULL;
 	}
 
@@ -2035,7 +2035,7 @@ struct wd_ecc_out *wd_sm2_new_enc_out(handle_t sess, __u32 plaintext_len)
 	__u64 len = 0;
 
 	if (!sess_t) {
-		WD_ERR("new ecc sout sess NULL!\n");
+		WD_ERR("invalid: new ecc sout sess NULL!\n");
 		return NULL;
 	}
 
@@ -2090,7 +2090,7 @@ void wd_sm2_get_enc_out_params(struct wd_ecc_out *out,
 	struct wd_sm2_enc_out *eout = (void *)out;
 
 	if (!eout) {
-		WD_ERR("input NULL in get sm2 enc out!\n");
+		WD_ERR("invalid: input NULL in get sm2 enc out!\n");
 		return;
 	}
 
@@ -2110,7 +2110,7 @@ void wd_sm2_get_dec_out_params(struct wd_ecc_out *out,
 	struct wd_sm2_dec_out *dout = (void *)out;
 
 	if (!dout) {
-		WD_ERR("input NULL in get sm2 dec out!\n");
+		WD_ERR("invalid: input NULL in get sm2 dec out!\n");
 		return;
 	}
 
@@ -2156,7 +2156,7 @@ int wd_do_ecc_async(handle_t sess, struct wd_ecc_req *req)
 	int idx;
 
 	if (unlikely(!req || !sess || !req->cb)) {
-		WD_ERR("input parameter NULL!\n");
+		WD_ERR("invalid: input parameter NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -2207,7 +2207,7 @@ int wd_ecc_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 	int ret;
 
 	if (unlikely(!count)) {
-		WD_ERR("param count is NULL!");
+		WD_ERR("invalid: param count is NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -2234,7 +2234,7 @@ int wd_ecc_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 		msg = wd_find_msg_in_pool(&wd_ecc_setting.pool, idx,
 					  recv_msg.tag);
 		if (!msg) {
-			WD_ERR("get msg from pool is NULL!\n");
+			WD_ERR("failed to get msg from pool!\n");
 			return -WD_EINVAL;
 		}
 
diff --git a/wd_rsa.c b/wd_rsa.c
index 8fc405f..8371475 100644
--- a/wd_rsa.c
+++ b/wd_rsa.c
@@ -91,14 +91,14 @@ static void wd_rsa_set_static_drv(void)
 {
 	wd_rsa_setting.driver = wd_rsa_get_driver();
 	if (!wd_rsa_setting.driver)
-		WD_ERR("fail to get driver\n");
+		WD_ERR("failed to get rsa driver!\n");
 }
 #else
 static void __attribute__((constructor)) wd_rsa_open_driver(void)
 {
 	wd_rsa_setting.dlhandle = dlopen("libhisi_hpre.so", RTLD_NOW);
 	if (!wd_rsa_setting.dlhandle)
-		WD_ERR("Fail to open libhisi_hpre.so\n");
+		WD_ERR("failed to open libhisi_hpre.so!\n");
 }
 
 static void __attribute__((destructor)) wd_rsa_close_driver(void)
@@ -111,7 +111,7 @@ static void __attribute__((destructor)) wd_rsa_close_driver(void)
 void wd_rsa_set_driver(struct wd_rsa_driver *drv)
 {
 	if (!drv) {
-		WD_ERR("drv NULL\n");
+		WD_ERR("invalid: rsa drv is NULL!\n");
 		return;
 	}
 
@@ -121,12 +121,12 @@ void wd_rsa_set_driver(struct wd_rsa_driver *drv)
 static int param_check(struct wd_ctx_config *config, struct wd_sched *sched)
 {
 	if (!config || !config->ctxs[0].ctx || !sched) {
-		WD_ERR("config or sched NULL\n");
+		WD_ERR("invalid: config or sched NULL!\n");
 		return -WD_EINVAL;
 	}
 
 	if (!wd_is_sva(config->ctxs[0].ctx)) {
-		WD_ERR("no sva, do not rsa init\n");
+		WD_ERR("invalid: the mode is non sva, please check system!\n");
 		return -WD_EINVAL;
 	}
 
@@ -177,7 +177,7 @@ int wd_rsa_init(struct wd_ctx_config *config, struct wd_sched *sched)
 	ret = wd_rsa_setting.driver->init(&wd_rsa_setting.config, priv,
 					  wd_rsa_setting.driver->alg_name);
 	if (ret < 0) {
-		WD_ERR("failed to drv init, ret = %d\n", ret);
+		WD_ERR("failed to init rsa driver, ret = %d!\n", ret);
 		goto out_init;
 	}
 
@@ -198,7 +198,7 @@ out:
 void wd_rsa_uninit(void)
 {
 	if (!wd_rsa_setting.priv) {
-		WD_ERR("repeat uninit rsa\n");
+		WD_ERR("invalid: repeat uninit rsa!\n");
 		return;
 	}
 
@@ -240,24 +240,24 @@ static int fill_rsa_msg(struct wd_rsa_msg *msg, struct wd_rsa_req *req,
 		key = (__u8 *)req->src;
 		break;
 	default:
-		WD_ERR("rsa msguest op type err!\n");
+		WD_ERR("invalid: rsa msg req op type %u is err!\n", msg->req.op_type);
 		return -WD_EINVAL;
 	}
 
 	if (unlikely(!key)) {
-		WD_ERR("rsa msguest key null!\n");
+		WD_ERR("invalid: rsa msg key null!\n");
 		return -WD_EINVAL;
 	}
 
 	if (msg->req.op_type == WD_RSA_SIGN ||
 		msg->req.op_type == WD_RSA_VERIFY) {
 		if (unlikely(msg->req.src_bytes != sess->key_size)) {
-			WD_ERR("sign or verf src_bytes != key_size!\n");
+			WD_ERR("invalid: sign or verf src_bytes != key_size!\n");
 			return -WD_EINVAL;
 		}
 
 		if (unlikely(req->dst_bytes != sess->key_size)) {
-			WD_ERR("req dst bytes = %hu error!\n", req->dst_bytes);
+			WD_ERR("invalid: req dst bytes %hu is error!\n", req->dst_bytes);
 			return -WD_EINVAL;
 		}
 	}
@@ -329,7 +329,7 @@ int wd_do_rsa_sync(handle_t h_sess, struct wd_rsa_req *req)
 	int ret;
 
 	if (unlikely(!h_sess || !req)) {
-		WD_ERR("input param NULL!\n");
+		WD_ERR("invalid: input param NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -370,7 +370,7 @@ int wd_do_rsa_async(handle_t sess, struct wd_rsa_req *req)
 	__u32 idx;
 
 	if (unlikely(!req || !sess || !req->cb)) {
-		WD_ERR("input param NULL!\n");
+		WD_ERR("invalid: input param NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -417,7 +417,7 @@ int wd_rsa_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 	int ret;
 
 	if (unlikely(!count)) {
-		WD_ERR("param count is NULL!");
+		WD_ERR("invalid: param count is NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -443,7 +443,7 @@ int wd_rsa_poll_ctx(__u32 idx, __u32 expt, __u32 *count)
 		msg = wd_find_msg_in_pool(&wd_rsa_setting.pool, idx,
 					  recv_msg.tag);
 		if (!msg) {
-			WD_ERR("get msg from pool is NULL!\n");
+			WD_ERR("failed to get msg from pool!\n");
 			return -WD_EINVAL;
 		}
 
@@ -468,7 +468,7 @@ int wd_rsa_poll(__u32 expt, __u32 *count)
 int wd_rsa_kg_in_data(struct wd_rsa_kg_in *ki, char **data)
 {
 	if (!ki || !data) {
-		WD_ERR("param is NULL!\n");
+		WD_ERR("invalid: param is NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -479,7 +479,7 @@ int wd_rsa_kg_in_data(struct wd_rsa_kg_in *ki, char **data)
 int wd_rsa_kg_out_data(struct wd_rsa_kg_out *ko, char **data)
 {
 	if (!ko || !data) {
-		WD_ERR("param is NULL!\n");
+		WD_ERR("invalid: param is NULL!\n");
 		return -WD_EINVAL;
 	}
 
@@ -497,32 +497,32 @@ struct wd_rsa_kg_in *wd_rsa_new_kg_in(handle_t sess, struct wd_dtb *e,
 	int kg_in_size;
 
 	if (!c || !e || !p || !q) {
-		WD_ERR("sess malloc kg_in memory fail!\n");
+		WD_ERR("invalid: sess malloc kg_in memory params err!\n");
 		return NULL;
 	}
 
 	if (!c->key_size || c->key_size > RSA_MAX_KEY_SIZE) {
-		WD_ERR("key size err at create kg in!\n");
+		WD_ERR("invalid: key size err at create kg in!\n");
 		return NULL;
 	}
 
 	if (!e->dsize || e->dsize > c->key_size) {
-		WD_ERR("e para err at create kg in!\n");
+		WD_ERR("invalid: e para err at create kg in!\n");
 		return NULL;
 	}
 	if (!p->dsize || p->dsize > CRT_PARAM_SZ(c->key_size)) {
-		WD_ERR("p para err at create kg in!\n");
+		WD_ERR("invalid: p para err at create kg in!\n");
 		return NULL;
 	}
 	if (!q->dsize || q->dsize > CRT_PARAM_SZ(c->key_size)) {
-		WD_ERR("q para err at create kg in!\n");
+		WD_ERR("invalid: q para err at create kg in!\n");
 		return NULL;
 	}
 
 	kg_in_size = GEN_PARAMS_SZ(c->key_size);
 	kg_in = malloc(kg_in_size + sizeof(*kg_in));
 	if (!kg_in) {
-		WD_ERR("sess malloc kg_in memory fail!\n");
+		WD_ERR("failed to malloc kg_in memory!\n");
 		return NULL;
 	}
 	memset(kg_in, 0, kg_in_size + sizeof(*kg_in));
@@ -545,7 +545,7 @@ void wd_rsa_get_kg_in_params(struct wd_rsa_kg_in *kin, struct wd_dtb *e,
 			     struct wd_dtb *q, struct wd_dtb *p)
 {
 	if (!kin || !e || !q || !p) {
-		WD_ERR("para err at get input parameters key generate !\n");
+		WD_ERR("invalid: para err at get input parameters key generate!\n");
 		return;
 	}
 
@@ -563,7 +563,7 @@ void wd_rsa_get_kg_in_params(struct wd_rsa_kg_in *kin, struct wd_dtb *e,
 static void del_kg(void *k)
 {
 	if (!k) {
-		WD_ERR("del key generate params err!\n");
+		WD_ERR("invalid: del key generate params err!\n");
 		return;
 	}
 
@@ -583,13 +583,13 @@ struct wd_rsa_kg_out *wd_rsa_new_kg_out(handle_t sess)
 	__u32 kz;
 
 	if (!c) {
-		WD_ERR("sess null at new rsa key gen out!\n");
+		WD_ERR("invalid: sess null at new rsa key gen out!\n");
 		return NULL;
 	}
 
 	kz = c->key_size;
 	if (!kz || kz > RSA_MAX_KEY_SIZE) {
-		WD_ERR("new kg out key size error!\n");
+		WD_ERR("invalid: new kg out key size error!\n");
 		return NULL;
 	}
 
@@ -600,7 +600,7 @@ struct wd_rsa_kg_out *wd_rsa_new_kg_out(handle_t sess)
 
 	kg_out = malloc(kg_out_size + sizeof(*kg_out));
 	if (!kg_out) {
-		WD_ERR("sess malloc kg_out memory fail!\n");
+		WD_ERR("failed to malloc kg_out memory!\n");
 		return NULL;
 	}
 
@@ -621,7 +621,7 @@ struct wd_rsa_kg_out *wd_rsa_new_kg_out(handle_t sess)
 void wd_rsa_del_kg_out(handle_t sess, struct wd_rsa_kg_out *kout)
 {
 	if (!kout) {
-		WD_ERR("param null at del kg out!\n");
+		WD_ERR("invalid: param null at del kg out!\n");
 		return;
 	}
 
@@ -633,7 +633,7 @@ void wd_rsa_get_kg_out_params(struct wd_rsa_kg_out *kout, struct wd_dtb *d,
 					struct wd_dtb *n)
 {
 	if (!kout) {
-		WD_ERR("input null at get key gen params!\n");
+		WD_ERR("invalid: input null at get key gen params!\n");
 		return;
 	}
 
@@ -655,7 +655,7 @@ void wd_rsa_get_kg_out_crt_params(struct wd_rsa_kg_out *kout,
 					struct wd_dtb *dq, struct wd_dtb *dp)
 {
 	if (!kout || !qinv || !dq || !dp) {
-		WD_ERR("input null at get key gen crt para!\n");
+		WD_ERR("invalid: input null at get key gen crt para!\n");
 		return;
 	}
 
@@ -743,7 +743,7 @@ static int create_sess_key(struct wd_rsa_sess_setup *setup,
 			CRT_PARAMS_SZ(sess->key_size);
 		sess->prikey = malloc(len);
 		if (!sess->prikey) {
-			WD_ERR("alloc prikey2 fail!\n");
+			WD_ERR("failed to alloc sess prikey2!\n");
 			return -WD_ENOMEM;
 		}
 		pkey2 = &sess->prikey->pkey2;
@@ -754,7 +754,7 @@ static int create_sess_key(struct wd_rsa_sess_setup *setup,
 			GEN_PARAMS_SZ(sess->key_size);
 		sess->prikey = malloc(len);
 		if (!sess->prikey) {
-			WD_ERR("alloc prikey1 fail!\n");
+			WD_ERR("failed to alloc sess prikey1!\n");
 			return -WD_ENOMEM;
 		}
 		pkey1 = &sess->prikey->pkey1;
@@ -767,7 +767,7 @@ static int create_sess_key(struct wd_rsa_sess_setup *setup,
 	sess->pubkey = malloc(len);
 	if (!sess->pubkey) {
 		free(sess->prikey);
-		WD_ERR("alloc pubkey fail!\n");
+		WD_ERR("failed to alloc sess pubkey!\n");
 		return -WD_ENOMEM;
 	}
 
@@ -783,7 +783,7 @@ static void del_sess_key(struct wd_rsa_sess *sess)
 	struct wd_rsa_pubkey *pub = sess->pubkey;
 
 	if (!prk || !pub) {
-		WD_ERR("del sess key error: prk or pub NULL\n");
+		WD_ERR("invalid: del sess key error, prk or pub NULL!\n");
 		return;
 	}
 
@@ -808,7 +808,7 @@ handle_t wd_rsa_alloc_sess(struct wd_rsa_sess_setup *setup)
 	int ret;
 
 	if (!setup) {
-		WD_ERR("alloc rsa sess setup NULL!\n");
+		WD_ERR("invalid: alloc rsa sess setup NULL!\n");
 		return(handle_t)0;
 	}
 
@@ -816,7 +816,7 @@ handle_t wd_rsa_alloc_sess(struct wd_rsa_sess_setup *setup)
 		setup->key_bits != 2048 &&
 		setup->key_bits != 3072 &&
 		setup->key_bits != 4096) {
-		WD_ERR("alloc rsa sess key_bit %u err!\n", setup->key_bits);
+		WD_ERR("invalid: alloc rsa sess key_bit %u err!\n", setup->key_bits);
 		return (handle_t)0;
 	}
 
@@ -829,7 +829,7 @@ handle_t wd_rsa_alloc_sess(struct wd_rsa_sess_setup *setup)
 
 	ret = create_sess_key(setup, sess);
 	if (ret) {
-		WD_ERR("fail creating rsa sess keys!\n");
+		WD_ERR("failed to create rsa sess keys!\n");
 		goto sess_err;
 	}
 
@@ -855,7 +855,7 @@ void wd_rsa_free_sess(handle_t sess)
 	struct wd_rsa_sess *sess_t = (struct wd_rsa_sess *)sess;
 
 	if (!sess_t) {
-		WD_ERR("free rsa sess param err!\n");
+		WD_ERR("invalid: free rsa sess param err!\n");
 		return;
 	}
 
@@ -869,7 +869,7 @@ void wd_rsa_free_sess(handle_t sess)
 bool wd_rsa_is_crt(handle_t sess)
 {
 	if (!sess) {
-		WD_ERR("rsa is crt judge, sess NULL, return false!\n");
+		WD_ERR("invalid: rsa is crt judge, sess NULL, return false!\n");
 		return false;
 	}
 
@@ -879,7 +879,7 @@ bool wd_rsa_is_crt(handle_t sess)
 __u32 wd_rsa_get_key_bits(handle_t sess)
 {
 	if (!sess) {
-		WD_ERR("get rsa key bits, sess NULL!\n");
+		WD_ERR("invalid: get rsa key bits, sess NULL!\n");
 		return 0;
 	}
 
@@ -891,13 +891,13 @@ int wd_rsa_set_pubkey_params(handle_t sess, struct wd_dtb *e, struct wd_dtb *n)
 	struct wd_rsa_sess *c = (struct wd_rsa_sess *)sess;
 
 	if (!c || !c->pubkey || !c->pubkey->key_size) {
-		WD_ERR("sess NULL in set rsa public key!\n");
+		WD_ERR("invalid: sess NULL in set rsa public key!\n");
 		return -WD_EINVAL;
 	}
 
 	if (e) {
 		if (!e->dsize || !e->data || e->dsize > c->pubkey->key_size) {
-			WD_ERR("e err in set rsa public key!\n");
+			WD_ERR("invalid: e err in set rsa public key!\n");
 			return -WD_EINVAL;
 		}
 
@@ -908,7 +908,7 @@ int wd_rsa_set_pubkey_params(handle_t sess, struct wd_dtb *e, struct wd_dtb *n)
 
 	if (n) {
 		if (!n->dsize || !n->data || n->dsize > c->pubkey->key_size) {
-			WD_ERR("n err in set rsa public key!\n");
+			WD_ERR("invalid: n err in set rsa public key!\n");
 			return -WD_EINVAL;
 		}
 
@@ -924,7 +924,7 @@ void wd_rsa_get_pubkey_params(struct wd_rsa_pubkey *pbk, struct wd_dtb **e,
 					struct wd_dtb **n)
 {
 	if (!pbk) {
-		WD_ERR("input NULL in get rsa public key!\n");
+		WD_ERR("invalid: input NULL in get rsa public key!\n");
 		return;
 	}
 	if (e)
@@ -940,13 +940,13 @@ int wd_rsa_set_prikey_params(handle_t sess, struct wd_dtb *d, struct wd_dtb *n)
 	struct wd_rsa_sess *c = (struct wd_rsa_sess *)sess;
 
 	if (!c || wd_rsa_is_crt(sess) || !c->prikey) {
-		WD_ERR("sess err in set rsa private key1!\n");
+		WD_ERR("invalid: sess err in set rsa private key1!\n");
 		return -WD_EINVAL;
 	}
 	pkey1 = &c->prikey->pkey1;
 	if (d) {
 		if (!d->dsize || !d->data || d->dsize > pkey1->key_size) {
-			WD_ERR("d err in set rsa private key1!\n");
+			WD_ERR("invalid: d err in set rsa private key1!\n");
 			return -WD_EINVAL;
 		}
 
@@ -956,7 +956,7 @@ int wd_rsa_set_prikey_params(handle_t sess, struct wd_dtb *d, struct wd_dtb *n)
 	}
 	if (n) {
 		if (!n->dsize || !n->data || n->dsize > pkey1->key_size) {
-			WD_ERR("en err in set rsa private key1!\n");
+			WD_ERR("invalid: en err in set rsa private key1!\n");
 			return -WD_EINVAL;
 		}
 
@@ -974,7 +974,7 @@ void wd_rsa_get_prikey_params(struct wd_rsa_prikey *pvk, struct wd_dtb **d,
 	struct wd_rsa_prikey1 *pkey1;
 
 	if (!pvk) {
-		WD_ERR("pvk is NULL!\n");
+		WD_ERR("invalid: pvk is NULL!\n");
 		return;
 	}
 
@@ -1041,43 +1041,43 @@ int wd_rsa_set_crt_prikey_params(handle_t sess, struct wd_dtb *dq,
 	int ret = -WD_EINVAL;
 
 	if (!sess || !wd_rsa_is_crt(sess)) {
-		WD_ERR("sess err in set rsa crt private key2!\n");
+		WD_ERR("invalid: sess err in set rsa crt private key2!\n");
 		return ret;
 	}
 
 	if (!dq || !dp || !qinv || !q || !p) {
-		WD_ERR("para err in set rsa crt private key2!\n");
+		WD_ERR("invalid: para err in set rsa crt private key2!\n");
 		return ret;
 	}
 
 	pkey2 = &c->prikey->pkey2;
 	ret = rsa_prikey2_param_set(pkey2, dq, WD_CRT_PRIKEY_DQ);
 	if (ret) {
-		WD_ERR("dq err in set rsa private key2!\n");
+		WD_ERR("failed to set dq for rsa private key2!\n");
 		return ret;
 	}
 
 	ret = rsa_prikey2_param_set(pkey2, dp, WD_CRT_PRIKEY_DP);
 	if (ret) {
-		WD_ERR("dp err in set rsa private key2!\n");
+		WD_ERR("failed to set dp for rsa private key2!\n");
 		return ret;
 	}
 
 	ret = rsa_prikey2_param_set(pkey2, qinv, WD_CRT_PRIKEY_QINV);
 	if (ret) {
-		WD_ERR("qinv err in set rsa private key2!\n");
+		WD_ERR("failed to set qinv for rsa private key2!\n");
 		return ret;
 	}
 
 	ret = rsa_prikey2_param_set(pkey2, q, WD_CRT_PRIKEY_Q);
 	if (ret) {
-		WD_ERR("q err in set rsa private key2!\n");
+		WD_ERR("failed to set q for rsa private key2!\n");
 		return ret;
 	}
 
 	ret = rsa_prikey2_param_set(pkey2, p, WD_CRT_PRIKEY_P);
 	if (ret) {
-		WD_ERR("p err in set rsa private key2!\n");
+		WD_ERR("failed to set p for rsa private key2!\n");
 		return ret;
 	}
 
@@ -1092,7 +1092,7 @@ void wd_rsa_get_crt_prikey_params(struct wd_rsa_prikey *pvk,
 	struct wd_rsa_prikey2 *pkey2;
 
 	if (!pvk) {
-		WD_ERR("pvk is NULL!\n");
+		WD_ERR("invalid: pvk is NULL!\n");
 		return;
 	}
 
@@ -1113,7 +1113,7 @@ void wd_rsa_get_crt_prikey_params(struct wd_rsa_prikey *pvk,
 void wd_rsa_get_pubkey(handle_t sess, struct wd_rsa_pubkey **pubkey)
 {
 	if (!sess || !pubkey) {
-		WD_ERR("param is NULL!\n");
+		WD_ERR("invalid: param is NULL!\n");
 		return;
 	}
 
@@ -1123,7 +1123,7 @@ void wd_rsa_get_pubkey(handle_t sess, struct wd_rsa_pubkey **pubkey)
 void wd_rsa_get_prikey(handle_t sess, struct wd_rsa_prikey **prikey)
 {
 	if (!sess || !prikey) {
-		WD_ERR("param is NULL!\n");
+		WD_ERR("invalid: param is NULL!\n");
 		return;
 	}
 
-- 
2.27.0

