1.Remove duplicate NULL pointer checks in rsa; 2.Remove wd_rsa_setting.dlh_list check in dh/ecc/rsa, since wd_alg_try_init() returns true, wd_<alg>_setting.dlh_list must be NULL, the branch does not enter.
Signed-off-by: Weili Qian qianweili@huawei.com --- wd_dh.c | 7 ------- wd_ecc.c | 7 ------- wd_rsa.c | 13 +++---------- 3 files changed, 3 insertions(+), 24 deletions(-)
diff --git a/wd_dh.c b/wd_dh.c index df5d90e..4a14737 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -60,13 +60,6 @@ static int wd_dh_open_driver(void) const char *alg_name = "dh"; int ret;
- /* - * Compatible with the normal acquisition of device - * drivers in the init interface. - */ - if (wd_dh_setting.dlh_list) - return 0; - ret = wd_get_lib_file_path("libhisi_hpre.so", lib_path, false); if (ret) return ret; diff --git a/wd_ecc.c b/wd_ecc.c index e401a46..1e042f0 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -116,13 +116,6 @@ static int wd_ecc_open_driver(void) const char *alg_name = "sm2"; int ret;
- /* - * Compatible with the normal acquisition of device - * drivers in the init interface - */ - if (wd_ecc_setting.dlh_list) - return 0; - ret = wd_get_lib_file_path("libhisi_hpre.so", lib_path, false); if (ret) return ret; diff --git a/wd_rsa.c b/wd_rsa.c index ba2e088..d34820d 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -101,13 +101,6 @@ static int wd_rsa_open_driver(void) const char *alg_name = "rsa"; int ret;
- /* - * Compatible with the normal acquisition of device - * drivers in the init interface. - */ - if (wd_rsa_setting.dlh_list) - return 0; - ret = wd_get_lib_file_path("libhisi_hpre.so", lib_path, false); if (ret) return ret; @@ -764,19 +757,19 @@ void wd_rsa_get_kg_out_crt_params(struct wd_rsa_kg_out *kout, return; }
- if (qinv && kout->qinv) { + if (kout->qinv) { qinv->bsize = CRT_PARAM_SZ(kout->key_size); qinv->dsize = kout->qinvbytes; qinv->data = (void *)kout->qinv; }
- if (dq && kout->dq) { + if (kout->dq) { dq->bsize = CRT_PARAM_SZ(kout->key_size); dq->dsize = kout->dqbytes; dq->data = (void *)kout->dq; }
- if (dp && kout->dp) { + if (kout->dp) { dp->bsize = CRT_PARAM_SZ(kout->key_size); dp->dsize = kout->dpbytes; dp->data = (void *)kout->dp;