Use wd_env_set_ctx_nums to set ctx nums from environment information.
Signed-off-by: Wenkai Lin linwenkai6@hisilicon.com --- wd_cipher.c | 6 ++++++ wd_comp.c | 7 +++++++ wd_dh.c | 6 ++++++ wd_ecc.c | 6 ++++++ wd_rsa.c | 6 ++++++ 5 files changed, 31 insertions(+)
diff --git a/wd_cipher.c b/wd_cipher.c index eca9711..80d4be2 100644 --- a/wd_cipher.c +++ b/wd_cipher.c @@ -422,6 +422,12 @@ res_retry: goto out_dlopen; }
+ ret = wd_env_set_ctx_nums("WD_CIPHER_CTX_NUM", cipher_ctx_num, WD_CIPHER_DECRYPTION + 1); + if (ret) { + WD_ERR("fail to init cipher ctx nums from env!\n"); + goto out_driver; + } + ret = wd_ctx_param_init(&cipher_ctx_params, ctx_params, cipher_ctx_num, wd_cipher_setting.driver, WD_CIPHER_DECRYPTION + 1); diff --git a/wd_comp.c b/wd_comp.c index b7e0eb7..99553c5 100644 --- a/wd_comp.c +++ b/wd_comp.c @@ -243,6 +243,13 @@ res_retry: goto out_dlopen; }
+ + ret = wd_env_set_ctx_nums("WD_COMP_CTX_NUM", comp_ctx_num, WD_DIR_MAX); + if (ret) { + WD_ERR("fail to init comp ctx nums from env!\n"); + goto out_driver; + } + ret = wd_ctx_param_init(&comp_ctx_params, ctx_params, comp_ctx_num, wd_comp_setting.driver, WD_DIR_MAX); diff --git a/wd_dh.c b/wd_dh.c index d45ac89..bb8e76f 100644 --- a/wd_dh.c +++ b/wd_dh.c @@ -235,6 +235,12 @@ res_retry: goto out_dlopen; }
+ ret = wd_env_set_ctx_nums("WD_DH_CTX_NUM", dh_ctx_num, WD_DH_PHASE2); + if (ret) { + WD_ERR("fail to init dh ctx nums from env!\n"); + goto out_driver; + } + ret = wd_ctx_param_init(&dh_ctx_params, ctx_params, dh_ctx_num, wd_dh_setting.driver, WD_DH_PHASE2); diff --git a/wd_ecc.c b/wd_ecc.c index 57954e0..bef7982 100644 --- a/wd_ecc.c +++ b/wd_ecc.c @@ -291,6 +291,12 @@ res_retry: goto out_dlopen; }
+ ret = wd_env_set_ctx_nums("WD_ECC_CTX_NUM", ecc_ctx_num, WD_EC_OP_MAX); + if (ret) { + WD_ERR("fail to init ecc ctx nums from env!\n"); + goto out_driver; + } + ret = wd_ctx_param_init(&ecc_ctx_params, ctx_params, ecc_ctx_num, wd_ecc_setting.driver, WD_EC_OP_MAX); diff --git a/wd_rsa.c b/wd_rsa.c index 77fe5c0..9f5fb57 100644 --- a/wd_rsa.c +++ b/wd_rsa.c @@ -276,6 +276,12 @@ res_retry: goto out_dlopen; }
+ ret = wd_env_set_ctx_nums("WD_RSA_CTX_NUM", rsa_ctx_num, WD_RSA_GENKEY); + if (ret) { + WD_ERR("fail to init rsa ctx nums from env!\n"); + goto out_driver; + } + ret = wd_ctx_param_init(&rsa_ctx_params, ctx_params, rsa_ctx_num, wd_rsa_setting.driver, WD_RSA_GENKEY);