1. Delete some debug code. Debug code is not allowed in the
release version.
2. Fix a code style issue in sec drv exit.
Signed-off-by: Kai Ye <yekai13(a)huawei.com>
---
drv/hisi_sec.c | 67 ++++++--------------------------------------------
1 file changed, 7 insertions(+), 60 deletions(-)
diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c
index 16fcb5f..96a2e3c 100644
--- a/drv/hisi_sec.c
+++ b/drv/hisi_sec.c
@@ -486,20 +486,6 @@ static int g_hmac_a_alg[WD_DIGEST_TYPE_MAX] = {
int hisi_sec_init(struct wd_ctx_config_internal *config, void *priv);
void hisi_sec_exit(void *priv);
-#ifdef DEBUG
-static void sec_dump_bd(unsigned char *bd, unsigned int len)
-{
- unsigned int i;
-
- for (i = 0; i < len; i++) {
- WD_ERR("\\0x%02x", bd[i]);
- if ((i + 1) % WORD_BYTES == 0)
- WD_ERR("\n");
- }
- WD_ERR("\n");
-}
-#endif
-
/* increment counter (128-bit int) by software */
static void ctr_iv_inc(__u8 *counter, __u32 c)
{
@@ -1290,11 +1276,6 @@ static void parse_digest_bd2(struct hisi_sec_sqe *sqe,
recv_msg->data_fmt = hisi_sec_get_data_fmt_v2(sqe->sds_sa_type);
recv_msg->in = (__u8 *)(uintptr_t)sqe->type2.data_src_addr;
recv_msg->alg_type = WD_DIGEST;
-
-#ifdef DEBUG
- WD_ERR("Dump digest recv sqe-->!\n");
- sec_dump_bd((unsigned char *)sqe, SQE_BYTES_NUMS);
-#endif
}
static int digest_long_bd_check(struct wd_digest_msg *msg)
@@ -1389,11 +1370,6 @@ int hisi_sec_digest_send(handle_t ctx, struct wd_digest_msg *msg)
qm_fill_digest_long_bd(msg, &sqe);
-#ifdef DEBUG
- WD_ERR("Dump digest send sqe-->!\n");
- sec_dump_bd((unsigned char *)&sqe, SQE_BYTES_NUMS);
-#endif
-
sqe.type2.tag = msg->tag;
ret = hisi_qm_send(h_qp, &sqe, 1, &count);
if (ret < 0) {
@@ -1545,11 +1521,6 @@ int hisi_sec_digest_send_v3(handle_t ctx, struct wd_digest_msg *msg)
qm_fill_digest_long_bd3(msg, &sqe);
-#ifdef DEBUG
- WD_ERR("Dump digest send sqe-->!\n");
- sec_dump_bd((unsigned char *)&sqe, SQE_BYTES_NUMS);
-#endif
-
sqe.tag = (__u64)(uintptr_t)msg->tag;
ret = hisi_qm_send(h_qp, &sqe, 1, &count);
@@ -1590,11 +1561,6 @@ static void parse_digest_bd3(struct hisi_sec_sqe3 *sqe,
recv_msg->data_fmt = hisi_sec_get_data_fmt_v3(sqe->bd_param);
recv_msg->in = (__u8 *)(uintptr_t)sqe->data_src_addr;
recv_msg->alg_type = WD_DIGEST;
-
-#ifdef DEBUG
- WD_ERR("Dump digest recv sqe-->!\n");
- sec_dump_bd((unsigned char *)sqe, SQE_BYTES_NUMS);
-#endif
}
int hisi_sec_digest_recv_v3(handle_t ctx, struct wd_digest_msg *recv_msg)
@@ -1894,11 +1860,6 @@ int hisi_sec_aead_send(handle_t ctx, struct wd_aead_msg *msg)
fill_aead_bd2_addr(msg, &sqe);
-#ifdef DEBUG
- WD_ERR("Dump aead send sqe-->!\n");
- sec_dump_bd((unsigned char *)&sqe, SQE_BYTES_NUMS);
-#endif
-
sqe.type2.tag = (__u16)msg->tag;
ret = hisi_qm_send(h_qp, &sqe, 1, &count);
@@ -1948,11 +1909,6 @@ static void parse_aead_bd2(struct hisi_sec_sqe *sqe,
SEC_AUTH_LEN_MASK;
recv_msg->out_bytes = sqe->type2.clen_ivhlen +
sqe->type2.cipher_src_offset;
-
-#ifdef DEBUG
- WD_ERR("Dump aead recv sqe-->!\n");
- sec_dump_bd((unsigned char *)sqe, SQE_BYTES_NUMS);
-#endif
}
int hisi_sec_aead_recv(handle_t ctx, struct wd_aead_msg *recv_msg)
@@ -2163,11 +2119,6 @@ int hisi_sec_aead_send_v3(handle_t ctx, struct wd_aead_msg *msg)
fill_aead_bd3_addr(msg, &sqe);
-#ifdef DEBUG
- WD_ERR("Dump aead send sqe-->!\n");
- sec_dump_bd((unsigned char *)&sqe, SQE_BYTES_NUMS);
-#endif
-
sqe.tag = msg->tag;
ret = hisi_qm_send(h_qp, &sqe, 1, &count);
if (ret < 0) {
@@ -2216,11 +2167,6 @@ static void parse_aead_bd3(struct hisi_sec_sqe3 *sqe,
SEC_MAC_LEN_MASK;
recv_msg->out_bytes = sqe->c_len_ivin +
sqe->cipher_src_offset;
-
-#ifdef DEBUG
- WD_ERR("Dump aead recv sqe-->!\n");
- sec_dump_bd((unsigned char *)sqe, SQE_BYTES_NUMS);
-#endif
}
int hisi_sec_aead_recv_v3(handle_t ctx, struct wd_aead_msg *recv_msg)
@@ -2305,16 +2251,17 @@ out:
void hisi_sec_exit(void *priv)
{
- if (!priv) {
- WD_ERR("hisi sec exit input parameter is err!\n");
- return;
- }
-
struct hisi_sec_ctx *sec_ctx = priv;
- struct wd_ctx_config_internal *config = &sec_ctx->config;
+ struct wd_ctx_config_internal *config;
handle_t h_qp;
int i;
+ if (!sec_ctx) {
+ WD_ERR("hisi sec exit input parameter is err!\n");
+ return;
+ }
+
+ config = &sec_ctx->config;
for (i = 0; i < config->ctx_num; i++) {
h_qp = (handle_t)wd_ctx_get_priv(config->ctxs[i].ctx);
hisi_qm_free_qp(h_qp);
--
2.33.0