From 0bcb18fc0c90e6e1ad10a457de5765e7ff609be7 Mon Sep 17 00:00:00 2001 From: Junchong Pan Date: Wed, 2 Mar 2022 07:15:19 +0000 Subject: [PATCH 077/109] rsa: fix interface name and log msg wd_rsa_key_bits() is used to get key bits, changing its name to wd_rsa_get_key_bits() can make the semantics clearer. Signed-off-by: Junchong Pan Signed-off-by: Zhiqi Song --- include/wd_rsa.h | 2 +- test/hisi_hpre_test/test_hisi_hpre.c | 6 +++--- wd_rsa.c | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/wd_rsa.h b/include/wd_rsa.h index 081bc2a..0978b79 100644 --- a/include/wd_rsa.h +++ b/include/wd_rsa.h @@ -67,7 +67,7 @@ struct wd_rsa_sess_setup { }; bool wd_rsa_is_crt(handle_t sess); -__u32 wd_rsa_key_bits(handle_t sess); +__u32 wd_rsa_get_key_bits(handle_t sess); 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); int wd_rsa_set_pubkey_params(handle_t sess, struct wd_dtb *e, struct wd_dtb *n); diff --git a/test/hisi_hpre_test/test_hisi_hpre.c b/test/hisi_hpre_test/test_hisi_hpre.c index 924adb7..57d76fd 100644 --- a/test/hisi_hpre_test/test_hisi_hpre.c +++ b/test/hisi_hpre_test/test_hisi_hpre.c @@ -6793,7 +6793,7 @@ static int get_rsa_key_from_test_sample(handle_t sess, char *pubkey_file, memset(&wd_q, 0, sizeof(wd_q)); memset(&wd_p, 0, sizeof(wd_p)); - bits = wd_rsa_key_bits(sess); + bits = wd_rsa_get_key_bits(sess); if (bits == 1024) { e = rsa_e_1024; p = rsa_p_1024; @@ -7348,7 +7348,7 @@ int hpre_test_result_check(handle_t sess, struct wd_rsa_req *req, void *key) } wd_rsa_get_prikey(sess, &prikey); - keybits = wd_rsa_key_bits(sess); + keybits = wd_rsa_get_key_bits(sess); key_size = keybits >> 3; if (req->op_type == WD_RSA_GENKEY) { if (wd_rsa_is_crt(sess)) { @@ -7907,7 +7907,7 @@ static void _rsa_cb(void *req_t) struct test_hpre_pthread_dt *thread_info = tag->thread_info; wd_rsa_get_prikey(sess, &prikey); - keybits = wd_rsa_key_bits(sess); + keybits = wd_rsa_get_key_bits(sess); key_size = keybits >> 3; thread_info->recv_task_num++; diff --git a/wd_rsa.c b/wd_rsa.c index 2e61927..4c8fd71 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -599,7 +599,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_in memory fail!\n"); + WD_ERR("sess malloc kg_out memory fail!\n"); return NULL; } @@ -875,7 +875,7 @@ bool wd_rsa_is_crt(handle_t sess) return ((struct wd_rsa_sess *)sess)->setup.is_crt; } -__u32 wd_rsa_key_bits(handle_t sess) +__u32 wd_rsa_get_key_bits(handle_t sess) { if (!sess) { WD_ERR("get rsa key bits, sess NULL!\n"); -- 2.27.0