Skip to content

Commit 26beb2f

Browse files
Longfang LiuLiulongfang
Longfang Liu
authored andcommittedApr 9, 2024·
uadk: modify uadk static compile
After the UADK framework supports dynamic loading. Device drivers are all default used in the form of dynamic libraries. Static compilation requires static declaration and cannot declare unknown device drivers. Therefore, static compilation only supports HiSilicon device drivers. Signed-off-by: Longfang Liu <liulongfang@huawei.com> Signed-off-by: Qi Tao <taoqi10@huawei.com>
1 parent 3759e40 commit 26beb2f

13 files changed

+377
-147
lines changed
 

‎drv/hisi_comp.c

+8
Original file line numberDiff line numberDiff line change
@@ -1109,7 +1109,11 @@ static struct wd_alg_driver zip_alg_driver[] = {
11091109
GEN_ZIP_ALG_DRIVER("lz77_zstd"),
11101110
};
11111111

1112+
#ifdef WD_STATIC_DRV
1113+
void hisi_zip_probe(void)
1114+
#else
11121115
static void __attribute__((constructor)) hisi_zip_probe(void)
1116+
#endif
11131117
{
11141118
int alg_num = ARRAY_SIZE(zip_alg_driver);
11151119
int i, ret;
@@ -1124,7 +1128,11 @@ static void __attribute__((constructor)) hisi_zip_probe(void)
11241128
}
11251129
}
11261130

1131+
#ifdef WD_STATIC_DRV
1132+
void hisi_zip_remove(void)
1133+
#else
11271134
static void __attribute__((destructor)) hisi_zip_remove(void)
1135+
#endif
11281136
{
11291137
int alg_num = ARRAY_SIZE(zip_alg_driver);
11301138
int i;

‎drv/hisi_hpre.c

+9
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
/* SPDX-License-Identifier: Apache-2.0 */
23
/* Copyright 2020-2021 Huawei Technologies Co.,Ltd. All rights reserved. */
34

@@ -2547,7 +2548,11 @@ static struct wd_alg_driver hpre_dh_driver = {
25472548
.get_usage = hpre_get_usage,
25482549
};
25492550

2551+
#ifdef WD_STATIC_DRV
2552+
void hisi_hpre_probe(void)
2553+
#else
25502554
static void __attribute__((constructor)) hisi_hpre_probe(void)
2555+
#endif
25512556
{
25522557
__u32 alg_num = ARRAY_SIZE(hpre_ecc_driver);
25532558
__u32 i;
@@ -2569,7 +2574,11 @@ static void __attribute__((constructor)) hisi_hpre_probe(void)
25692574
}
25702575
}
25712576

2577+
#ifdef WD_STATIC_DRV
2578+
void hisi_hpre_remove(void)
2579+
#else
25722580
static void __attribute__((destructor)) hisi_hpre_remove(void)
2581+
#endif
25732582
{
25742583
__u32 alg_num = ARRAY_SIZE(hpre_ecc_driver);
25752584
__u32 i;

‎drv/hisi_sec.c

+8
Original file line numberDiff line numberDiff line change
@@ -3087,7 +3087,11 @@ static void hisi_sec_exit(struct wd_alg_driver *drv)
30873087
drv->priv = NULL;
30883088
}
30893089

3090+
#ifdef WD_STATIC_DRV
3091+
void hisi_sec2_probe(void)
3092+
#else
30903093
static void __attribute__((constructor)) hisi_sec2_probe(void)
3094+
#endif
30913095
{
30923096
int alg_num;
30933097
int i, ret;
@@ -3119,7 +3123,11 @@ static void __attribute__((constructor)) hisi_sec2_probe(void)
31193123
}
31203124
}
31213125

3126+
#ifdef WD_STATIC_DRV
3127+
void hisi_sec2_remove(void)
3128+
#else
31223129
static void __attribute__((destructor)) hisi_sec2_remove(void)
3130+
#endif
31233131
{
31243132
int alg_num;
31253133
int i;

‎include/wd_alg.h

+20-6
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ enum alg_dev_type {
6969
UADK_ALG_HW = 0x3
7070
};
7171

72-
/**
72+
/*
7373
* @drv_name: name of the current device driver
7474
* @alg_name: name of the algorithm supported by the driver
7575
* @priority: priority of the type of algorithm supported by the driver
@@ -133,7 +133,7 @@ inline int wd_alg_driver_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg
133133
return drv->recv(drv, ctx, msg);
134134
}
135135

136-
/**
136+
/*
137137
* wd_alg_driver_register() - Register a device driver.
138138
* @wd_alg_driver: a device driver that supports an algorithm.
139139
*
@@ -142,7 +142,7 @@ inline int wd_alg_driver_recv(struct wd_alg_driver *drv, handle_t ctx, void *msg
142142
int wd_alg_driver_register(struct wd_alg_driver *drv);
143143
void wd_alg_driver_unregister(struct wd_alg_driver *drv);
144144

145-
/**
145+
/*
146146
* @alg_name: name of the algorithm supported by the driver
147147
* @drv_name: name of the current device driver
148148
* @available: Indicates whether the current driver still has resources available
@@ -165,7 +165,7 @@ struct wd_alg_list {
165165
struct wd_alg_list *next;
166166
};
167167

168-
/**
168+
/*
169169
* wd_request_drv() - Apply for an algorithm driver.
170170
* @alg_name: task algorithm name.
171171
* @hw_mask: the flag of shield hardware device drivers.
@@ -175,7 +175,7 @@ struct wd_alg_list {
175175
struct wd_alg_driver *wd_request_drv(const char *alg_name, bool hw_mask);
176176
void wd_release_drv(struct wd_alg_driver *drv);
177177

178-
/**
178+
/*
179179
* wd_drv_alg_support() - Check the algorithms supported by the driver.
180180
* @alg_name: task algorithm name.
181181
* @drv: a device driver that supports an algorithm.
@@ -185,7 +185,7 @@ void wd_release_drv(struct wd_alg_driver *drv);
185185
bool wd_drv_alg_support(const char *alg_name,
186186
struct wd_alg_driver *drv);
187187

188-
/**
188+
/*
189189
* wd_enable_drv() - Re-enable use of the current device driver.
190190
* @drv: a device driver that supports an algorithm.
191191
*/
@@ -194,6 +194,20 @@ void wd_disable_drv(struct wd_alg_driver *drv);
194194

195195
struct wd_alg_list *wd_get_alg_head(void);
196196

197+
#ifdef WD_STATIC_DRV
198+
/*
199+
* duplicate drivers will be skipped when it register to alg_list
200+
*/
201+
void hisi_sec2_probe(void);
202+
void hisi_hpre_probe(void);
203+
void hisi_zip_probe(void);
204+
205+
void hisi_sec2_remove(void);
206+
void hisi_hpre_remove(void);
207+
void hisi_zip_remove(void);
208+
209+
#endif
210+
197211
#ifdef __cplusplus
198212
}
199213
#endif

‎include/wd_alg_common.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,12 @@ enum wd_ctx_mode {
5555
CTX_MODE_MAX,
5656
};
5757

58-
/**
58+
enum wd_init_type {
59+
WD_TYPE_V1,
60+
WD_TYPE_V2,
61+
};
62+
63+
/*
5964
* struct wd_ctx - Define one ctx and related type.
6065
* @ctx: The ctx itself.
6166
* @op_type: Define the operation type of this specific ctx.
@@ -69,7 +74,7 @@ struct wd_ctx {
6974
__u8 ctx_mode;
7075
};
7176

72-
/**
77+
/*
7378
* struct wd_cap_config - Capabilities.
7479
* @ctx_msg_num: number of asynchronous msg pools that the user wants to allocate.
7580
* Optional, user can set ctx_msg_num based on the number of requests
@@ -82,7 +87,7 @@ struct wd_cap_config {
8287
__u32 resv;
8388
};
8489

85-
/**
90+
/*
8691
* struct wd_ctx_config - Define a ctx set and its related attributes, which
8792
* will be used in the scope of current process.
8893
* @ctx_num: The ctx number in below ctx array.
@@ -98,7 +103,7 @@ struct wd_ctx_config {
98103
struct wd_cap_config *cap;
99104
};
100105

101-
/**
106+
/*
102107
* struct wd_ctx_nums - Define the ctx sets numbers.
103108
* @sync_ctx_num: The ctx numbers which are used for sync mode for each
104109
* ctx sets.
@@ -110,7 +115,7 @@ struct wd_ctx_nums {
110115
__u32 async_ctx_num;
111116
};
112117

113-
/**
118+
/*
114119
* struct wd_ctx_params - Define the ctx sets params which are used for init
115120
* algorithms.
116121
* @op_type_num: Used for index of ctx_set_num, the order is the same as
@@ -148,7 +153,7 @@ struct wd_ctx_config_internal {
148153
unsigned long *msg_cnt;
149154
};
150155

151-
/**
156+
/*
152157
* struct wd_comp_sched - Define a scheduler.
153158
* @name: Name of this scheduler.
154159
* @sched_policy: Method for scheduler to perform scheduling

‎wd_aead.c

+42-19
Original file line numberDiff line numberDiff line change
@@ -62,22 +62,48 @@ struct wd_aead_sess {
6262
struct wd_env_config wd_aead_env_config;
6363
static struct wd_init_attrs wd_aead_init_attrs;
6464

65-
static void wd_aead_close_driver(void)
65+
static void wd_aead_close_driver(int init_type)
6666
{
67+
#ifndef WD_STATIC_DRV
68+
if (init_type == WD_TYPE_V2) {
69+
wd_dlclose_drv(wd_aead_setting.dlh_list);
70+
return;
71+
}
72+
6773
if (wd_aead_setting.dlhandle) {
6874
wd_release_drv(wd_aead_setting.driver);
6975
dlclose(wd_aead_setting.dlhandle);
7076
wd_aead_setting.dlhandle = NULL;
7177
}
78+
#else
79+
wd_release_drv(wd_aead_setting.driver);
80+
hisi_sec2_remove();
81+
#endif
7282
}
7383

74-
static int wd_aead_open_driver(void)
84+
static int wd_aead_open_driver(int init_type)
7585
{
7686
struct wd_alg_driver *driver = NULL;
7787
const char *alg_name = "gcm(aes)";
88+
#ifndef WD_STATIC_DRV
7889
char lib_path[PATH_MAX];
7990
int ret;
8091

92+
if (init_type == WD_TYPE_V2) {
93+
/*
94+
* Driver lib file path could set by env param.
95+
* then open tham by wd_dlopen_drv()
96+
* use NULL means dynamic query path
97+
*/
98+
wd_aead_setting.dlh_list = wd_dlopen_drv(NULL);
99+
if (!wd_aead_setting.dlh_list) {
100+
WD_ERR("fail to open driver lib files.\n");
101+
return -WD_EINVAL;
102+
}
103+
104+
return WD_SUCCESS;
105+
}
106+
81107
ret = wd_get_lib_file_path("libhisi_sec.so", lib_path, false);
82108
if (ret)
83109
return ret;
@@ -87,17 +113,21 @@ static int wd_aead_open_driver(void)
87113
WD_ERR("failed to open libhisi_sec.so, %s\n", dlerror());
88114
return -WD_EINVAL;
89115
}
90-
116+
#else
117+
hisi_sec2_probe();
118+
if (init_type == WD_TYPE_V2)
119+
return WD_SUCCESS;
120+
#endif
91121
driver = wd_request_drv(alg_name, false);
92122
if (!driver) {
93-
wd_aead_close_driver();
123+
wd_aead_close_driver(WD_TYPE_V1);
94124
WD_ERR("failed to get %s driver support\n", alg_name);
95125
return -WD_EINVAL;
96126
}
97127

98128
wd_aead_setting.driver = driver;
99129

100-
return 0;
130+
return WD_SUCCESS;
101131
}
102132

103133
static int aes_key_len_check(__u32 length)
@@ -466,7 +496,7 @@ int wd_aead_init(struct wd_ctx_config *config, struct wd_sched *sched)
466496
if (ret)
467497
goto out_clear_init;
468498

469-
ret = wd_aead_open_driver();
499+
ret = wd_aead_open_driver(WD_TYPE_V1);
470500
if (ret)
471501
goto out_clear_init;
472502

@@ -479,7 +509,7 @@ int wd_aead_init(struct wd_ctx_config *config, struct wd_sched *sched)
479509
return 0;
480510

481511
out_close_driver:
482-
wd_aead_close_driver();
512+
wd_aead_close_driver(WD_TYPE_V1);
483513
out_clear_init:
484514
wd_alg_clear_init(&wd_aead_setting.status);
485515
return ret;
@@ -509,7 +539,7 @@ void wd_aead_uninit(void)
509539
if (ret)
510540
return;
511541

512-
wd_aead_close_driver();
542+
wd_aead_close_driver(WD_TYPE_V1);
513543
wd_alg_clear_init(&wd_aead_setting.status);
514544
}
515545

@@ -551,16 +581,9 @@ int wd_aead_init2_(char *alg, __u32 sched_type, int task_type,
551581
goto out_uninit;
552582
}
553583

554-
/*
555-
* Driver lib file path could set by env param.
556-
* then open them by wd_dlopen_drv()
557-
* use NULL means dynamic query path
558-
*/
559-
wd_aead_setting.dlh_list = wd_dlopen_drv(NULL);
560-
if (!wd_aead_setting.dlh_list) {
561-
WD_ERR("failed to open driver lib files.\n");
584+
state = wd_aead_open_driver(WD_TYPE_V2);
585+
if (state)
562586
goto out_uninit;
563-
}
564587

565588
while (ret != 0) {
566589
memset(&wd_aead_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -613,7 +636,7 @@ int wd_aead_init2_(char *alg, __u32 sched_type, int task_type,
613636
out_driver:
614637
wd_alg_drv_unbind(wd_aead_setting.driver);
615638
out_dlopen:
616-
wd_dlclose_drv(wd_aead_setting.dlh_list);
639+
wd_aead_close_driver(WD_TYPE_V2);
617640
out_uninit:
618641
wd_alg_clear_init(&wd_aead_setting.status);
619642
return ret;
@@ -629,7 +652,7 @@ void wd_aead_uninit2(void)
629652

630653
wd_alg_attrs_uninit(&wd_aead_init_attrs);
631654
wd_alg_drv_unbind(wd_aead_setting.driver);
632-
wd_dlclose_drv(wd_aead_setting.dlh_list);
655+
wd_aead_close_driver(WD_TYPE_V2);
633656
wd_aead_setting.dlh_list = NULL;
634657
wd_alg_clear_init(&wd_aead_setting.status);
635658
}

‎wd_alg.c

+24-1
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,26 @@ static bool wd_alg_driver_match(struct wd_alg_driver *drv,
164164
return true;
165165
}
166166

167+
static bool wd_alg_repeat_check(struct wd_alg_driver *drv)
168+
{
169+
struct wd_alg_list *npre = &alg_list_head;
170+
struct wd_alg_list *pnext = NULL;
171+
172+
pthread_mutex_lock(&mutex);
173+
pnext = npre->next;
174+
while (pnext) {
175+
if (wd_alg_driver_match(drv, pnext)) {
176+
pthread_mutex_unlock(&mutex);
177+
return true;
178+
}
179+
npre = pnext;
180+
pnext = pnext->next;
181+
}
182+
pthread_mutex_unlock(&mutex);
183+
184+
return false;
185+
}
186+
167187
int wd_alg_driver_register(struct wd_alg_driver *drv)
168188
{
169189
struct wd_alg_list *new_alg;
@@ -178,6 +198,9 @@ int wd_alg_driver_register(struct wd_alg_driver *drv)
178198
return -WD_EINVAL;
179199
}
180200

201+
if (wd_alg_repeat_check(drv))
202+
return 0;
203+
181204
new_alg = calloc(1, sizeof(struct wd_alg_list));
182205
if (!new_alg) {
183206
WD_ERR("failed to alloc alg driver memory!\n");
@@ -252,7 +275,7 @@ bool wd_drv_alg_support(const char *alg_name,
252275
struct wd_alg_list *head = &alg_list_head;
253276
struct wd_alg_list *pnext = head->next;
254277

255-
if (!alg_name)
278+
if (!alg_name || !drv)
256279
return false;
257280

258281
while (pnext) {

‎wd_cipher.c

+42-19
Original file line numberDiff line numberDiff line change
@@ -72,22 +72,48 @@ struct wd_cipher_sess {
7272
struct wd_env_config wd_cipher_env_config;
7373
static struct wd_init_attrs wd_cipher_init_attrs;
7474

75-
static void wd_cipher_close_driver(void)
75+
static void wd_cipher_close_driver(int init_type)
7676
{
77+
#ifndef WD_STATIC_DRV
78+
if (init_type == WD_TYPE_V2) {
79+
wd_dlclose_drv(wd_cipher_setting.dlh_list);
80+
return;
81+
}
82+
7783
if (wd_cipher_setting.dlhandle) {
7884
wd_release_drv(wd_cipher_setting.driver);
7985
dlclose(wd_cipher_setting.dlhandle);
8086
wd_cipher_setting.dlhandle = NULL;
8187
}
88+
#else
89+
wd_release_drv(wd_cipher_setting.driver);
90+
hisi_sec2_remove();
91+
#endif
8292
}
8393

84-
static int wd_cipher_open_driver(void)
94+
static int wd_cipher_open_driver(int init_type)
8595
{
8696
struct wd_alg_driver *driver = NULL;
8797
const char *alg_name = "cbc(aes)";
98+
#ifndef WD_STATIC_DRV
8899
char lib_path[PATH_MAX];
89100
int ret;
90101

102+
if (init_type == WD_TYPE_V2) {
103+
/*
104+
* Driver lib file path could set by env param.
105+
* then open tham by wd_dlopen_drv()
106+
* use NULL means dynamic query path
107+
*/
108+
wd_cipher_setting.dlh_list = wd_dlopen_drv(NULL);
109+
if (!wd_cipher_setting.dlh_list) {
110+
WD_ERR("fail to open driver lib files.\n");
111+
return -WD_EINVAL;
112+
}
113+
114+
return WD_SUCCESS;
115+
}
116+
91117
ret = wd_get_lib_file_path("libhisi_sec.so", lib_path, false);
92118
if (ret)
93119
return ret;
@@ -97,17 +123,21 @@ static int wd_cipher_open_driver(void)
97123
WD_ERR("failed to open libhisi_sec.so, %s\n", dlerror());
98124
return -WD_EINVAL;
99125
}
100-
126+
#else
127+
hisi_sec2_probe();
128+
if (init_type == WD_TYPE_V2)
129+
return WD_SUCCESS;
130+
#endif
101131
driver = wd_request_drv(alg_name, false);
102132
if (!driver) {
103-
wd_cipher_close_driver();
133+
wd_cipher_close_driver(WD_TYPE_V1);
104134
WD_ERR("failed to get %s driver support\n", alg_name);
105135
return -WD_EINVAL;
106136
}
107137

108138
wd_cipher_setting.driver = driver;
109139

110-
return 0;
140+
return WD_SUCCESS;
111141
}
112142

113143
static bool is_des_weak_key(const __u8 *key)
@@ -365,7 +395,7 @@ int wd_cipher_init(struct wd_ctx_config *config, struct wd_sched *sched)
365395
if (ret)
366396
goto out_clear_init;
367397

368-
ret = wd_cipher_open_driver();
398+
ret = wd_cipher_open_driver(WD_TYPE_V1);
369399
if (ret)
370400
goto out_clear_init;
371401

@@ -378,7 +408,7 @@ int wd_cipher_init(struct wd_ctx_config *config, struct wd_sched *sched)
378408
return 0;
379409

380410
out_close_driver:
381-
wd_cipher_close_driver();
411+
wd_cipher_close_driver(WD_TYPE_V1);
382412
out_clear_init:
383413
wd_alg_clear_init(&wd_cipher_setting.status);
384414
return ret;
@@ -392,7 +422,7 @@ void wd_cipher_uninit(void)
392422
if (ret)
393423
return;
394424

395-
wd_cipher_close_driver();
425+
wd_cipher_close_driver(WD_TYPE_V1);
396426
wd_alg_clear_init(&wd_cipher_setting.status);
397427
}
398428

@@ -421,16 +451,9 @@ int wd_cipher_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_p
421451
goto out_uninit;
422452
}
423453

424-
/*
425-
* Driver lib file path could set by env param.
426-
* then open tham by wd_dlopen_drv()
427-
* use NULL means dynamic query path
428-
*/
429-
wd_cipher_setting.dlh_list = wd_dlopen_drv(NULL);
430-
if (!wd_cipher_setting.dlh_list) {
431-
WD_ERR("fail to open driver lib files.\n");
454+
state = wd_cipher_open_driver(WD_TYPE_V2);
455+
if (state)
432456
goto out_uninit;
433-
}
434457

435458
while (ret != 0) {
436459
memset(&wd_cipher_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -484,7 +507,7 @@ int wd_cipher_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_p
484507
out_driver:
485508
wd_alg_drv_unbind(wd_cipher_setting.driver);
486509
out_dlopen:
487-
wd_dlclose_drv(wd_cipher_setting.dlh_list);
510+
wd_cipher_close_driver(WD_TYPE_V2);
488511
out_uninit:
489512
wd_alg_clear_init(&wd_cipher_setting.status);
490513
return ret;
@@ -500,7 +523,7 @@ void wd_cipher_uninit2(void)
500523

501524
wd_alg_attrs_uninit(&wd_cipher_init_attrs);
502525
wd_alg_drv_unbind(wd_cipher_setting.driver);
503-
wd_dlclose_drv(wd_cipher_setting.dlh_list);
526+
wd_cipher_close_driver(WD_TYPE_V2);
504527
wd_cipher_setting.dlh_list = NULL;
505528
wd_alg_clear_init(&wd_cipher_setting.status);
506529
}

‎wd_comp.c

+43-20
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,48 @@ struct wd_comp_setting {
5454
struct wd_env_config wd_comp_env_config;
5555
static struct wd_init_attrs wd_comp_init_attrs;
5656

57-
static void wd_comp_close_driver(void)
57+
static void wd_comp_close_driver(int init_type)
5858
{
59+
#ifndef WD_STATIC_DRV
60+
if (init_type == WD_TYPE_V2) {
61+
wd_dlclose_drv(wd_comp_setting.dlh_list);
62+
return;
63+
}
64+
5965
if (wd_comp_setting.dlhandle) {
6066
wd_release_drv(wd_comp_setting.driver);
6167
dlclose(wd_comp_setting.dlhandle);
6268
wd_comp_setting.dlhandle = NULL;
6369
}
70+
#else
71+
wd_release_drv(wd_comp_setting.driver);
72+
hisi_zip_remove();
73+
#endif
6474
}
6575

66-
static int wd_comp_open_driver(void)
76+
static int wd_comp_open_driver(int init_type)
6777
{
6878
struct wd_alg_driver *driver = NULL;
69-
char lib_path[PATH_MAX];
7079
const char *alg_name = "zlib";
80+
#ifndef WD_STATIC_DRV
81+
char lib_path[PATH_MAX];
7182
int ret;
7283

84+
if (init_type == WD_TYPE_V2) {
85+
/*
86+
* Driver lib file path could set by env param.
87+
* then open them by wd_dlopen_drv()
88+
* use NULL means dynamic query path
89+
*/
90+
wd_comp_setting.dlh_list = wd_dlopen_drv(NULL);
91+
if (!wd_comp_setting.dlh_list) {
92+
WD_ERR("fail to open driver lib files.\n");
93+
return -WD_EINVAL;
94+
}
95+
96+
return WD_SUCCESS;
97+
}
98+
7399
ret = wd_get_lib_file_path("libhisi_zip.so", lib_path, false);
74100
if (ret)
75101
return ret;
@@ -79,17 +105,21 @@ static int wd_comp_open_driver(void)
79105
WD_ERR("failed to open libhisi_zip.so, %s\n", dlerror());
80106
return -WD_EINVAL;
81107
}
82-
108+
#else
109+
hisi_zip_probe();
110+
if (init_type == WD_TYPE_V2)
111+
return WD_SUCCESS;
112+
#endif
83113
driver = wd_request_drv(alg_name, false);
84114
if (!driver) {
85-
wd_comp_close_driver();
115+
wd_comp_close_driver(WD_TYPE_V1);
86116
WD_ERR("failed to get %s driver support\n", alg_name);
87117
return -WD_EINVAL;
88118
}
89119

90120
wd_comp_setting.driver = driver;
91121

92-
return 0;
122+
return WD_SUCCESS;
93123
}
94124

95125
static void wd_comp_clear_status(void)
@@ -185,7 +215,7 @@ int wd_comp_init(struct wd_ctx_config *config, struct wd_sched *sched)
185215
if (ret)
186216
goto out_clear_init;
187217

188-
ret = wd_comp_open_driver();
218+
ret = wd_comp_open_driver(WD_TYPE_V1);
189219
if (ret)
190220
goto out_clear_init;
191221

@@ -198,7 +228,7 @@ int wd_comp_init(struct wd_ctx_config *config, struct wd_sched *sched)
198228
return 0;
199229

200230
out_clear_driver:
201-
wd_comp_close_driver();
231+
wd_comp_close_driver(WD_TYPE_V1);
202232
out_clear_init:
203233
wd_alg_clear_init(&wd_comp_setting.status);
204234
return ret;
@@ -212,7 +242,7 @@ void wd_comp_uninit(void)
212242
if (ret)
213243
return;
214244

215-
wd_comp_close_driver();
245+
wd_comp_close_driver(WD_TYPE_V1);
216246
wd_alg_clear_init(&wd_comp_setting.status);
217247
}
218248

@@ -241,16 +271,9 @@ int wd_comp_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_par
241271
goto out_uninit;
242272
}
243273

244-
/*
245-
* Driver lib file path could set by env param.
246-
* then open tham by wd_dlopen_drv()
247-
* use NULL means dynamic query path
248-
*/
249-
wd_comp_setting.dlh_list = wd_dlopen_drv(NULL);
250-
if (!wd_comp_setting.dlh_list) {
251-
WD_ERR("fail to open driver lib files.\n");
274+
state = wd_comp_open_driver(WD_TYPE_V2);
275+
if (state)
252276
goto out_uninit;
253-
}
254277

255278
while (ret != 0) {
256279
memset(&wd_comp_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -303,7 +326,7 @@ int wd_comp_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_par
303326
out_unbind_drv:
304327
wd_alg_drv_unbind(wd_comp_setting.driver);
305328
out_dlclose:
306-
wd_dlclose_drv(wd_comp_setting.dlh_list);
329+
wd_comp_close_driver(WD_TYPE_V2);
307330
out_uninit:
308331
wd_alg_clear_init(&wd_comp_setting.status);
309332
return ret;
@@ -319,7 +342,7 @@ void wd_comp_uninit2(void)
319342

320343
wd_alg_attrs_uninit(&wd_comp_init_attrs);
321344
wd_alg_drv_unbind(wd_comp_setting.driver);
322-
wd_dlclose_drv(wd_comp_setting.dlh_list);
345+
wd_comp_close_driver(WD_TYPE_V2);
323346
wd_comp_setting.dlh_list = NULL;
324347
wd_alg_clear_init(&wd_comp_setting.status);
325348
}

‎wd_dh.c

+42-19
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,49 @@ static struct wd_dh_setting {
4141
struct wd_env_config wd_dh_env_config;
4242
static struct wd_init_attrs wd_dh_init_attrs;
4343

44-
static void wd_dh_close_driver(void)
44+
static void wd_dh_close_driver(int init_type)
4545
{
46+
#ifndef WD_STATIC_DRV
47+
if (init_type == WD_TYPE_V2) {
48+
wd_dlclose_drv(wd_dh_setting.dlh_list);
49+
return;
50+
}
51+
4652
if (!wd_dh_setting.dlhandle)
4753
return;
4854

4955
wd_release_drv(wd_dh_setting.driver);
5056
dlclose(wd_dh_setting.dlhandle);
5157
wd_dh_setting.dlhandle = NULL;
58+
#else
59+
wd_release_drv(wd_dh_setting.driver);
60+
hisi_hpre_remove();
61+
#endif
5262
}
5363

54-
static int wd_dh_open_driver(void)
64+
static int wd_dh_open_driver(int init_type)
5565
{
5666
struct wd_alg_driver *driver = NULL;
57-
char lib_path[PATH_MAX];
5867
const char *alg_name = "dh";
68+
#ifndef WD_STATIC_DRV
69+
char lib_path[PATH_MAX];
5970
int ret;
6071

72+
if (init_type == WD_TYPE_V2) {
73+
/*
74+
* Driver lib file path could set by env param.
75+
* then open them by wd_dlopen_drv()
76+
* default dir in the /root/lib/xxx.so and then dlopen
77+
*/
78+
wd_dh_setting.dlh_list = wd_dlopen_drv(NULL);
79+
if (!wd_dh_setting.dlh_list) {
80+
WD_ERR("failed to open driver lib files.\n");
81+
return -WD_EINVAL;
82+
}
83+
84+
return WD_SUCCESS;
85+
}
86+
6187
ret = wd_get_lib_file_path("libhisi_hpre.so", lib_path, false);
6288
if (ret)
6389
return ret;
@@ -67,10 +93,14 @@ static int wd_dh_open_driver(void)
6793
WD_ERR("failed to open libhisi_hpre.so, %s!\n", dlerror());
6894
return -WD_EINVAL;
6995
}
70-
96+
#else
97+
hisi_hpre_probe();
98+
if (init_type == WD_TYPE_V2)
99+
return WD_SUCCESS;
100+
#endif
71101
driver = wd_request_drv(alg_name, false);
72102
if (!driver) {
73-
wd_dh_close_driver();
103+
wd_dh_close_driver(WD_TYPE_V1);
74104
WD_ERR("failed to get %s driver support\n", alg_name);
75105
return -WD_EINVAL;
76106
}
@@ -158,7 +188,7 @@ int wd_dh_init(struct wd_ctx_config *config, struct wd_sched *sched)
158188
if (ret)
159189
goto out_clear_init;
160190

161-
ret = wd_dh_open_driver();
191+
ret = wd_dh_open_driver(WD_TYPE_V1);
162192
if (ret)
163193
goto out_clear_init;
164194

@@ -171,7 +201,7 @@ int wd_dh_init(struct wd_ctx_config *config, struct wd_sched *sched)
171201
return WD_SUCCESS;
172202

173203
out_close_driver:
174-
wd_dh_close_driver();
204+
wd_dh_close_driver(WD_TYPE_V1);
175205
out_clear_init:
176206
wd_alg_clear_init(&wd_dh_setting.status);
177207
return ret;
@@ -185,7 +215,7 @@ void wd_dh_uninit(void)
185215
if (ret)
186216
return;
187217

188-
wd_dh_close_driver();
218+
wd_dh_close_driver(WD_TYPE_V1);
189219
wd_alg_clear_init(&wd_dh_setting.status);
190220
}
191221

@@ -212,16 +242,9 @@ int wd_dh_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_param
212242
goto out_clear_init;
213243
}
214244

215-
/*
216-
* Driver lib file path could set by env param.
217-
* than open tham by wd_dlopen_drv()
218-
* default dir in the /root/lib/xxx.so and then dlopen
219-
*/
220-
wd_dh_setting.dlh_list = wd_dlopen_drv(NULL);
221-
if (!wd_dh_setting.dlh_list) {
222-
WD_ERR("failed to open driver lib files!\n");
245+
state = wd_dh_open_driver(WD_TYPE_V2);
246+
if (state)
223247
goto out_clear_init;
224-
}
225248

226249
while (ret) {
227250
memset(&wd_dh_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -275,7 +298,7 @@ int wd_dh_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_param
275298
out_driver:
276299
wd_alg_drv_unbind(wd_dh_setting.driver);
277300
out_dlopen:
278-
wd_dlclose_drv(wd_dh_setting.dlh_list);
301+
wd_dh_close_driver(WD_TYPE_V2);
279302
out_clear_init:
280303
wd_alg_clear_init(&wd_dh_setting.status);
281304
return ret;
@@ -291,7 +314,7 @@ void wd_dh_uninit2(void)
291314

292315
wd_alg_attrs_uninit(&wd_dh_init_attrs);
293316
wd_alg_drv_unbind(wd_dh_setting.driver);
294-
wd_dlclose_drv(wd_dh_setting.dlh_list);
317+
wd_dh_close_driver(WD_TYPE_V2);
295318
wd_dh_setting.dlh_list = NULL;
296319
wd_alg_clear_init(&wd_dh_setting.status);
297320
}

‎wd_digest.c

+44-19
Original file line numberDiff line numberDiff line change
@@ -73,22 +73,48 @@ struct wd_digest_sess {
7373
struct wd_env_config wd_digest_env_config;
7474
static struct wd_init_attrs wd_digest_init_attrs;
7575

76-
static void wd_digest_close_driver(void)
76+
static void wd_digest_close_driver(int init_type)
7777
{
78+
#ifndef WD_STATIC_DRV
79+
if (init_type == WD_TYPE_V2) {
80+
wd_dlclose_drv(wd_digest_setting.dlh_list);
81+
return;
82+
}
83+
7884
if (wd_digest_setting.dlhandle) {
7985
wd_release_drv(wd_digest_setting.driver);
8086
dlclose(wd_digest_setting.dlhandle);
8187
wd_digest_setting.dlhandle = NULL;
8288
}
89+
#else
90+
wd_release_drv(wd_digest_setting.driver);
91+
hisi_sec2_remove();
92+
#endif
8393
}
8494

85-
static int wd_digest_open_driver(void)
95+
static int wd_digest_open_driver(int init_type)
8696
{
8797
struct wd_alg_driver *driver = NULL;
8898
const char *alg_name = "sm3";
99+
#ifndef WD_STATIC_DRV
89100
char lib_path[PATH_MAX];
90101
int ret;
91102

103+
if (init_type == WD_TYPE_V2) {
104+
/*
105+
* Driver lib file path could set by env param.
106+
* then open tham by wd_dlopen_drv()
107+
* use NULL means dynamic query path
108+
*/
109+
wd_digest_setting.dlh_list = wd_dlopen_drv(NULL);
110+
if (!wd_digest_setting.dlh_list) {
111+
WD_ERR("fail to open driver lib files.\n");
112+
return -WD_EINVAL;
113+
}
114+
115+
return WD_SUCCESS;
116+
}
117+
92118
ret = wd_get_lib_file_path("libhisi_sec.so", lib_path, false);
93119
if (ret)
94120
return ret;
@@ -98,17 +124,21 @@ static int wd_digest_open_driver(void)
98124
WD_ERR("failed to open libhisi_sec.so, %s\n", dlerror());
99125
return -WD_EINVAL;
100126
}
101-
127+
#else
128+
hisi_sec2_probe();
129+
if (init_type == WD_TYPE_V2)
130+
return WD_SUCCESS;
131+
#endif
102132
driver = wd_request_drv(alg_name, false);
103133
if (!driver) {
104-
wd_digest_close_driver();
134+
wd_digest_close_driver(WD_TYPE_V1);
105135
WD_ERR("failed to get %s driver support\n", alg_name);
106136
return -WD_EINVAL;
107137
}
108138

109139
wd_digest_setting.driver = driver;
110140

111-
return 0;
141+
return WD_SUCCESS;
112142
}
113143

114144
static int aes_key_len_check(__u32 length)
@@ -277,7 +307,7 @@ int wd_digest_init(struct wd_ctx_config *config, struct wd_sched *sched)
277307
if (ret)
278308
goto out_clear_init;
279309

280-
ret = wd_digest_open_driver();
310+
ret = wd_digest_open_driver(WD_TYPE_V1);
281311
if (ret)
282312
goto out_clear_init;
283313

@@ -290,7 +320,7 @@ int wd_digest_init(struct wd_ctx_config *config, struct wd_sched *sched)
290320
return 0;
291321

292322
out_close_driver:
293-
wd_digest_close_driver();
323+
wd_digest_close_driver(WD_TYPE_V1);
294324
out_clear_init:
295325
wd_alg_clear_init(&wd_digest_setting.status);
296326
return ret;
@@ -319,7 +349,7 @@ void wd_digest_uninit(void)
319349
if (ret)
320350
return;
321351

322-
wd_digest_close_driver();
352+
wd_digest_close_driver(WD_TYPE_V1);
323353
wd_alg_clear_init(&wd_digest_setting.status);
324354
}
325355

@@ -356,16 +386,11 @@ int wd_digest_init2_(char *alg, __u32 sched_type, int task_type,
356386
WD_ERR("invalid: digest:%s unsupported!\n", alg);
357387
goto out_uninit;
358388
}
359-
/*
360-
* Driver lib file path could set by env param.
361-
* then open them by wd_dlopen_drv()
362-
* use NULL means dynamic query path
363-
*/
364-
wd_digest_setting.dlh_list = wd_dlopen_drv(NULL);
365-
if (!wd_digest_setting.dlh_list) {
366-
WD_ERR("failed to open driver lib files.\n");
389+
390+
state = wd_digest_open_driver(WD_TYPE_V2);
391+
if (state)
367392
goto out_uninit;
368-
}
393+
369394

370395
while (ret != 0) {
371396
memset(&wd_digest_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -417,7 +442,7 @@ int wd_digest_init2_(char *alg, __u32 sched_type, int task_type,
417442
out_driver:
418443
wd_alg_drv_unbind(wd_digest_setting.driver);
419444
out_dlopen:
420-
wd_dlclose_drv(wd_digest_setting.dlh_list);
445+
wd_digest_close_driver(WD_TYPE_V2);
421446
out_uninit:
422447
wd_alg_clear_init(&wd_digest_setting.status);
423448
return ret;
@@ -433,7 +458,7 @@ void wd_digest_uninit2(void)
433458

434459
wd_alg_attrs_uninit(&wd_digest_init_attrs);
435460
wd_alg_drv_unbind(wd_digest_setting.driver);
436-
wd_dlclose_drv(wd_digest_setting.dlh_list);
461+
wd_digest_close_driver(WD_TYPE_V2);
437462
wd_digest_setting.dlh_list = NULL;
438463
wd_alg_clear_init(&wd_digest_setting.status);
439464
}

‎wd_ecc.c

+42-19
Original file line numberDiff line numberDiff line change
@@ -95,23 +95,49 @@ static const struct curve_param_desc curve_pram_list[] = {
9595
{ ECC_CURVE_G, offsetof(struct wd_ecc_prikey, g), offsetof(struct wd_ecc_pubkey, g) }
9696
};
9797

98-
static void wd_ecc_close_driver(void)
98+
static void wd_ecc_close_driver(int init_type)
9999
{
100+
#ifndef WD_STATIC_DRV
101+
if (init_type == WD_TYPE_V2) {
102+
wd_dlclose_drv(wd_ecc_setting.dlh_list);
103+
return;
104+
}
105+
100106
if (!wd_ecc_setting.dlhandle)
101107
return;
102108

103109
wd_release_drv(wd_ecc_setting.driver);
104110
dlclose(wd_ecc_setting.dlhandle);
105111
wd_ecc_setting.dlhandle = NULL;
112+
#else
113+
wd_release_drv(wd_ecc_setting.driver);
114+
hisi_hpre_remove();
115+
#endif
106116
}
107117

108-
static int wd_ecc_open_driver(void)
118+
static int wd_ecc_open_driver(int init_type)
109119
{
110120
struct wd_alg_driver *driver = NULL;
111-
char lib_path[PATH_MAX];
112121
const char *alg_name = "sm2";
122+
#ifndef WD_STATIC_DRV
123+
char lib_path[PATH_MAX];
113124
int ret;
114125

126+
if (init_type == WD_TYPE_V2) {
127+
/*
128+
* Driver lib file path could set by env param.
129+
* then open them by wd_dlopen_drv()
130+
* default dir in the /root/lib/xxx.so and then dlopen
131+
*/
132+
wd_ecc_setting.dlh_list = wd_dlopen_drv(NULL);
133+
if (!wd_ecc_setting.dlh_list) {
134+
WD_ERR("failed to open driver lib files.\n");
135+
return -WD_EINVAL;
136+
}
137+
138+
return WD_SUCCESS;
139+
}
140+
115141
ret = wd_get_lib_file_path("libhisi_hpre.so", lib_path, false);
116142
if (ret)
117143
return ret;
@@ -121,10 +147,14 @@ static int wd_ecc_open_driver(void)
121147
WD_ERR("failed to open libhisi_hpre.so, %s!\n", dlerror());
122148
return -WD_EINVAL;
123149
}
124-
150+
#else
151+
hisi_hpre_probe();
152+
if (init_type == WD_TYPE_V2)
153+
return WD_SUCCESS;
154+
#endif
125155
driver = wd_request_drv(alg_name, false);
126156
if (!driver) {
127-
wd_ecc_close_driver();
157+
wd_ecc_close_driver(WD_TYPE_V1);
128158
WD_ERR("failed to get %s driver support\n", alg_name);
129159
return -WD_EINVAL;
130160
}
@@ -221,7 +251,7 @@ int wd_ecc_init(struct wd_ctx_config *config, struct wd_sched *sched)
221251
if (ret)
222252
goto out_clear_init;
223253

224-
ret = wd_ecc_open_driver();
254+
ret = wd_ecc_open_driver(WD_TYPE_V1);
225255
if (ret)
226256
goto out_clear_init;
227257

@@ -234,7 +264,7 @@ int wd_ecc_init(struct wd_ctx_config *config, struct wd_sched *sched)
234264
return WD_SUCCESS;
235265

236266
out_close_driver:
237-
wd_ecc_close_driver();
267+
wd_ecc_close_driver(WD_TYPE_V1);
238268
out_clear_init:
239269
wd_alg_clear_init(&wd_ecc_setting.status);
240270
return ret;
@@ -248,7 +278,7 @@ void wd_ecc_uninit(void)
248278
if (ret)
249279
return;
250280

251-
wd_ecc_close_driver();
281+
wd_ecc_close_driver(WD_TYPE_V1);
252282
wd_alg_clear_init(&wd_ecc_setting.status);
253283
}
254284

@@ -277,16 +307,9 @@ int wd_ecc_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_para
277307
goto out_clear_init;
278308
}
279309

280-
/*
281-
* Driver lib file path could set by env param.
282-
* than open tham by wd_dlopen_drv()
283-
* default dir in the /root/lib/xxx.so and then dlopen
284-
*/
285-
wd_ecc_setting.dlh_list = wd_dlopen_drv(NULL);
286-
if (!wd_ecc_setting.dlh_list) {
287-
WD_ERR("failed to open driver lib files!\n");
310+
state = wd_ecc_open_driver(WD_TYPE_V2);
311+
if (state)
288312
goto out_clear_init;
289-
}
290313

291314
while (ret) {
292315
memset(&wd_ecc_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -340,7 +363,7 @@ int wd_ecc_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_para
340363
out_driver:
341364
wd_alg_drv_unbind(wd_ecc_setting.driver);
342365
out_dlopen:
343-
wd_dlclose_drv(wd_ecc_setting.dlh_list);
366+
wd_ecc_close_driver(WD_TYPE_V2);
344367
out_clear_init:
345368
wd_alg_clear_init(&wd_ecc_setting.status);
346369
return ret;
@@ -356,7 +379,7 @@ void wd_ecc_uninit2(void)
356379

357380
wd_alg_attrs_uninit(&wd_ecc_init_attrs);
358381
wd_alg_drv_unbind(wd_ecc_setting.driver);
359-
wd_dlclose_drv(wd_ecc_setting.dlh_list);
382+
wd_ecc_close_driver(WD_TYPE_V2);
360383
wd_ecc_setting.dlh_list = NULL;
361384
wd_alg_clear_init(&wd_ecc_setting.status);
362385
}

‎wd_rsa.c

+42-19
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,49 @@ static struct wd_rsa_setting {
8282
struct wd_env_config wd_rsa_env_config;
8383
static struct wd_init_attrs wd_rsa_init_attrs;
8484

85-
static void wd_rsa_close_driver(void)
85+
static void wd_rsa_close_driver(int init_type)
8686
{
87+
#ifndef WD_STATIC_DRV
88+
if (init_type == WD_TYPE_V2) {
89+
wd_dlclose_drv(wd_rsa_setting.dlh_list);
90+
return;
91+
}
92+
8793
if (!wd_rsa_setting.dlhandle)
8894
return;
8995

9096
wd_release_drv(wd_rsa_setting.driver);
9197
dlclose(wd_rsa_setting.dlhandle);
9298
wd_rsa_setting.dlhandle = NULL;
99+
#else
100+
wd_release_drv(wd_rsa_setting.driver);
101+
hisi_hpre_remove();
102+
#endif
93103
}
94104

95-
static int wd_rsa_open_driver(void)
105+
static int wd_rsa_open_driver(int init_type)
96106
{
97107
struct wd_alg_driver *driver = NULL;
98-
char lib_path[PATH_MAX];
99108
const char *alg_name = "rsa";
109+
#ifndef WD_STATIC_DRV
110+
char lib_path[PATH_MAX];
100111
int ret;
101112

113+
if (init_type == WD_TYPE_V2) {
114+
/*
115+
* Driver lib file path could set by env param.
116+
* then open them by wd_dlopen_drv()
117+
* default dir in the /root/lib/xxx.so and then dlopen
118+
*/
119+
wd_rsa_setting.dlh_list = wd_dlopen_drv(NULL);
120+
if (!wd_rsa_setting.dlh_list) {
121+
WD_ERR("failed to open driver lib files.\n");
122+
return -WD_EINVAL;
123+
}
124+
125+
return WD_SUCCESS;
126+
}
127+
102128
ret = wd_get_lib_file_path("libhisi_hpre.so", lib_path, false);
103129
if (ret)
104130
return ret;
@@ -108,10 +134,14 @@ static int wd_rsa_open_driver(void)
108134
WD_ERR("failed to open libhisi_hpre.so, %s!\n", dlerror());
109135
return -WD_EINVAL;
110136
}
111-
137+
#else
138+
hisi_hpre_probe();
139+
if (init_type == WD_TYPE_V2)
140+
return WD_SUCCESS;
141+
#endif
112142
driver = wd_request_drv(alg_name, false);
113143
if (!driver) {
114-
wd_rsa_close_driver();
144+
wd_rsa_close_driver(WD_TYPE_V1);
115145
WD_ERR("failed to get %s driver support!\n", alg_name);
116146
return -WD_EINVAL;
117147
}
@@ -198,7 +228,7 @@ int wd_rsa_init(struct wd_ctx_config *config, struct wd_sched *sched)
198228
if (ret)
199229
goto out_clear_init;
200230

201-
ret = wd_rsa_open_driver();
231+
ret = wd_rsa_open_driver(WD_TYPE_V1);
202232
if (ret)
203233
goto out_clear_init;
204234

@@ -211,7 +241,7 @@ int wd_rsa_init(struct wd_ctx_config *config, struct wd_sched *sched)
211241
return WD_SUCCESS;
212242

213243
out_close_driver:
214-
wd_rsa_close_driver();
244+
wd_rsa_close_driver(WD_TYPE_V1);
215245
out_clear_init:
216246
wd_alg_clear_init(&wd_rsa_setting.status);
217247
return ret;
@@ -225,7 +255,7 @@ void wd_rsa_uninit(void)
225255
if (ret)
226256
return;
227257

228-
wd_rsa_close_driver();
258+
wd_rsa_close_driver(WD_TYPE_V1);
229259
wd_alg_clear_init(&wd_rsa_setting.status);
230260
}
231261

@@ -252,16 +282,9 @@ int wd_rsa_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_para
252282
goto out_clear_init;
253283
}
254284

255-
/*
256-
* Driver lib file path could set by env param.
257-
* than open tham by wd_dlopen_drv()
258-
* default dir in the /root/lib/xxx.so and then dlopen
259-
*/
260-
wd_rsa_setting.dlh_list = wd_dlopen_drv(NULL);
261-
if (!wd_rsa_setting.dlh_list) {
262-
WD_ERR("failed to open driver lib files!\n");
285+
state = wd_rsa_open_driver(WD_TYPE_V2);
286+
if (state)
263287
goto out_clear_init;
264-
}
265288

266289
while (ret) {
267290
memset(&wd_rsa_setting.config, 0, sizeof(struct wd_ctx_config_internal));
@@ -315,7 +338,7 @@ int wd_rsa_init2_(char *alg, __u32 sched_type, int task_type, struct wd_ctx_para
315338
out_driver:
316339
wd_alg_drv_unbind(wd_rsa_setting.driver);
317340
out_dlopen:
318-
wd_dlclose_drv(wd_rsa_setting.dlh_list);
341+
wd_rsa_close_driver(WD_TYPE_V2);
319342
out_clear_init:
320343
wd_alg_clear_init(&wd_rsa_setting.status);
321344
return ret;
@@ -331,7 +354,7 @@ void wd_rsa_uninit2(void)
331354

332355
wd_alg_attrs_uninit(&wd_rsa_init_attrs);
333356
wd_alg_drv_unbind(wd_rsa_setting.driver);
334-
wd_dlclose_drv(wd_rsa_setting.dlh_list);
357+
wd_rsa_close_driver(WD_TYPE_V2);
335358
wd_rsa_setting.dlh_list = NULL;
336359
wd_alg_clear_init(&wd_rsa_setting.status);
337360
}

0 commit comments

Comments
 (0)
Please sign in to comment.