lists.linaro.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
List overview
Download
Acc
September 2023
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
acc@lists.linaro.org
4 participants
6 discussions
Start a n
N
ew thread
[PATCH] uadk/cipher: cleaup judgement sequence
by Zhiqi Song
Modify the jugement sequence in aes_sm4_len_check(), prioritize the conditions that must be met. Signed-off-by: Zhiqi Song <songzhiqi1(a)huawei.com> --- drv/hisi_sec.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drv/hisi_sec.c b/drv/hisi_sec.c index 5eaa1a1..f8e5cfa 100644 --- a/drv/hisi_sec.c +++ b/drv/hisi_sec.c @@ -892,18 +892,18 @@ static void parse_cipher_bd2(struct hisi_qp *qp, struct hisi_sec_sqe *sqe, static int aes_sm4_len_check(struct wd_cipher_msg *msg) { - if ((msg->mode == WD_CIPHER_CBC_CS1 || + if (msg->alg == WD_CIPHER_AES && + msg->in_bytes <= AES_BLOCK_SIZE && + (msg->mode == WD_CIPHER_CBC_CS1 || msg->mode == WD_CIPHER_CBC_CS2 || - msg->mode == WD_CIPHER_CBC_CS3) && - msg->alg == WD_CIPHER_AES && - msg->in_bytes <= AES_BLOCK_SIZE) { + msg->mode == WD_CIPHER_CBC_CS3)) { WD_ERR("failed to check input bytes of AES_CBC_CS_X, size = %u\n", msg->in_bytes); return -WD_EINVAL; } - if ((msg->mode == WD_CIPHER_CBC || msg->mode == WD_CIPHER_ECB) && - msg->in_bytes & (AES_BLOCK_SIZE - 1)) { + if ((msg->in_bytes & (AES_BLOCK_SIZE - 1)) && + (msg->mode == WD_CIPHER_CBC || msg->mode == WD_CIPHER_ECB)) { WD_ERR("failed to check input bytes of AES or SM4, size = %u\n", msg->in_bytes); return -WD_EINVAL; -- 2.30.0
1 year, 3 months
1
0
0
0
[PATCH 0/8] Support cipher new features in uadk v1
by Zhiqi Song
Support AES-CBC CTS mode in uadk v1. Support user self-defined data in uadk v1. Sync and add test code for new features. Longfang Liu (5): uadk_tool: Optimize sec's sva benchmark code uadk_tool: Optimize sec's software benchmark code uadk_tool: Optimize sec's no-sva benchmark code uadk_tool: add latency test function for uadk_tools uadk_tool: Update test function for init2 Zhiqi Song (3): uadk/v1/cipher: support aes-cbc cts mode uadk_tool: support test case for aes cbc cts mode uadk/v1/cipher: support user self-defined data functions uadk_tool/benchmark/hpre_uadk_benchmark.c | 3 + uadk_tool/benchmark/hpre_wd_benchmark.c | 3 + uadk_tool/benchmark/sec_soft_benchmark.c | 794 +++++++++++------ uadk_tool/benchmark/sec_uadk_benchmark.c | 734 ++++++++++------ uadk_tool/benchmark/sec_wd_benchmark.c | 989 +++++++++++++--------- uadk_tool/benchmark/uadk_benchmark.c | 158 +++- uadk_tool/benchmark/uadk_benchmark.h | 35 +- uadk_tool/benchmark/zip_uadk_benchmark.c | 12 +- uadk_tool/benchmark/zip_wd_benchmark.c | 12 +- v1/drv/hisi_sec_udrv.c | 253 +++++- v1/drv/hisi_sec_udrv.h | 6 + v1/wd_cipher.c | 7 +- v1/wd_cipher.h | 4 + 13 files changed, 2037 insertions(+), 973 deletions(-) -- 2.33.0
1 year, 3 months
1
8
0
0
[PATCH 00/10] Some bugfix and cleanup of uadk_engine
by Zhiqi Song
Fixup async mode bug and remove redundant code. Zhiqi Song (10): uadk_engine: cleanup code style of async functions digest: fix the definition of async cb param cipher: fix the definition of async cb param dh: fix the definition of async cb param ecc: fix the definition of async cb param rsa: fix the definition of async cb param uadk_engine: remove redundant param of async ecc: fixup switching soft sm2 decrypt problem ecc: optimize sm2 sign check function digest: fix the address of async op src/uadk_async.c | 140 ++++++++++++++++++++++++---------------------- src/uadk_async.h | 5 +- src/uadk_cipher.c | 39 ++++++++----- src/uadk_dh.c | 100 +++++++++++++++++++++------------ src/uadk_digest.c | 50 +++++++++++------ src/uadk_pkey.c | 99 ++++++++++++++++++++------------ src/uadk_rsa.c | 82 +++++++++++++++++---------- src/uadk_sm2.c | 42 +++++++++++--- 8 files changed, 349 insertions(+), 208 deletions(-) -- 2.33.0
1 year, 3 months
1
10
0
0
[PATCH 1/6] uadk/v1:add sqe_fill_priv and sqe_parse_priv
by Yang Shen
From: wangyuan <wangyuan46(a)huawei.com> Description: This patch includes following changes: 1.in hisi_zip_udrv.c add sqe_fill/parse_priv for V3 api Signed-off-by: Yu'an Wang <wangyuan46(a)huawei.com> --- v1/drv/hisi_zip_udrv.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/v1/drv/hisi_zip_udrv.c b/v1/drv/hisi_zip_udrv.c index 1dec4d6..f820b7f 100644 --- a/v1/drv/hisi_zip_udrv.c +++ b/v1/drv/hisi_zip_udrv.c @@ -256,6 +256,7 @@ int qm_parse_zip_sqe(void *hw_msg, const struct qm_queue_info *info, __u16 i, __u16 usr) { struct wcrypto_comp_msg *recv_msg = info->req_cache[i]; + struct wcrypto_comp_tag *tag = (void *)(uintptr_t)recv_msg->udata; struct hisi_zip_sqe *sqe = hw_msg; __u16 ctx_st = sqe->ctx_dw0 & HZ_CTX_ST_MASK; __u16 lstblk = sqe->dw3 & HZ_LSTBLK_MASK; @@ -301,6 +302,9 @@ int qm_parse_zip_sqe(void *hw_msg, const struct qm_queue_info *info, MAX_CTX_RSV_SIZE); } + if (tag && info->sqe_parse_priv) + info->sqe_parse_priv(sqe, WCRYPTO_COMP, tag->priv); + qm_parse_zip_sqe_set_status(recv_msg, status, lstblk, ctx_st); return 1; @@ -580,6 +584,7 @@ int qm_fill_zip_sqe_v3(void *smsg, struct qm_queue_info *info, __u16 i) { struct hisi_zip_sqe_v3 *sqe = (struct hisi_zip_sqe_v3 *)info->sq_base + i; struct wcrypto_comp_msg *msg = smsg; + struct wcrypto_comp_tag *tag = (void *)(uintptr_t)msg->udata; struct wd_queue *q = info->q; __u8 flush_type; __u8 data_fmt; @@ -628,6 +633,9 @@ int qm_fill_zip_sqe_v3(void *smsg, struct qm_queue_info *info, __u16 i) ops[msg->alg_type].fill_sqe_hw_info(sqe, msg); sqe->tag_l = msg->tag; + if (tag && info->sqe_fill_priv) + info->sqe_fill_priv(sqe, WCRYPTO_COMP, tag->priv); + info->req_cache[i] = msg; return WD_SUCCESS; @@ -728,6 +736,9 @@ int qm_parse_zip_sqe_v3(void *hw_msg, const struct qm_queue_info *info, if (tag && tag->priv && !info->sqe_fill_priv) fill_priv_lz77_zstd(sqe, recv_msg); + if (tag && info->sqe_parse_priv) + info->sqe_parse_priv(sqe, WCRYPTO_COMP, tag->priv); + return 1; } -- 2.33.0
1 year, 3 months
1
0
0
0
[PATCH] add macro to mask dh,rsa,x448,x25519
by Hao Fang
From: Qimin Chen <chenqimin1(a)huawei.com> --- configure.ac | 28 ++++++++++++++++++---- src/Makefile.am | 47 +++++++++++++++++++++++++++++-------- src/uadk_engine_init.c | 29 +++++++++++++++++++++++ src/uadk_pkey.c | 40 ++++++++++++++++++++++++++++--- src/uadk_pkey.h | 7 ++++++ src/v1/utils/engine_check.c | 18 ++++++++++++++ src/v1/utils/engine_fork.c | 12 ++++++++++ 7 files changed, 164 insertions(+), 17 deletions(-) diff --git a/configure.ac b/configure.ac index 0fc14ed..7f52738 100644 --- a/configure.ac +++ b/configure.ac @@ -1,19 +1,39 @@ -AC_PREREQ([2.69]) -AC_INIT([uadk_engine], [1.2]) +AC_PREREQ([2.71]) +AC_INIT([uadk_engine],[1.2]) AM_INIT_AUTOMAKE([1.10 no-define]) AC_CONFIG_MACRO_DIR([m4]) AC_CONFIG_HEADERS([config.h]) AC_PROG_CC -AC_PROG_LIBTOOL -AM_PROG_LIBTOOL +LT_INIT +LT_INIT AC_ARG_ENABLE(kae, AS_HELP_STRING([--enable-kae],[Enable kae support])) AC_SUBST(enable_kae) AM_CONDITIONAL([WD_KAE], [test "$enable_kae" = "yes"]) +AC_ARG_ENABLE(rsa, + AS_HELP_STRING([--enable-rsa],[enable rsa support])) +AC_SUBST(enable_rsa) +AM_CONDITIONAL([DISABLE_RSA],[test "$enable_rsa" = "no"]) + +AC_ARG_ENABLE(dh, + AS_HELP_STRING([--enable-dh],[enable dh support])) +AC_SUBST(enable_dh) +AM_CONDITIONAL([DISABLE_DH],[test "$enable_dh"="no"]) + +AC_ARG_ENABLE(x448, + AS_HELP_STRING([--enable-x448],[enable x448 support])) +AC_SUBST(enable_x448) +AM_CONDITIONAL([DISABLE_X448],[test "$enable_x448" = "no"]) + +AC_ARG_ENABLE(x25519, + AS_HELP_STRING([--enable-x25519],[enable x25519 support])) +AC_SUBST(enable_x25519) +AM_CONDITIONAL([DISABLE_X25519],[test "$enable_x25519" = "no"]) + PKG_CHECK_MODULES(WD, libwd libwd_crypto, [with_wd=yes], [with_wd=no]) AM_CONDITIONAL(HAVE_WD, [test "$with_wd" != "no"]) diff --git a/src/Makefile.am b/src/Makefile.am index bfaeb78..227e359 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,6 +1,8 @@ VERSION = 1:2 ACLOCAL_AMFLAGS = -I m4 +uadk_engine_la_CFLAGS=$(WD_CFLAGS) $(libcrypto_CFLAGS) + if HAVE_CRYPTO lib_LTLIBRARIES=uadk_engine.la endif #HAVE_CRYPTO @@ -10,12 +12,32 @@ lib_LTLIBRARIES=uadk_provider.la endif #HAVE_CRYPTO3 uadk_engine_la_SOURCES=uadk_utils.c uadk_engine_init.c uadk_cipher.c \ - uadk_digest.c uadk_async.c uadk_rsa.c uadk_sm2.c \ - uadk_pkey.c uadk_dh.c uadk_ec.c uadk_ecx.c + uadk_digest.c uadk_async.c uadk_sm2.c \ + uadk_pkey.c uadk_ec.c +if DISABLE_RSA + uadk_engine_la_CFLAGS+=-DDISABLE_RSA +else + uadk_engine_la_SOURCES+=uadk_rsa.c +endif + +if DISABLE_DH + uadk_engine_la_CFLAGS+=-DDISABLE_DH +else + uadk_engine_la_SOURCES+=uadk_dh.c +endif + +if DISABLE_X448 + uadk_engine_la_CFLAGS+=-DDISABLE_X448 +endif + +if DISABLE_X25519 + uadk_engine_la_CFLAGS+=-DDISABLE_X25519 +endif + uadk_engine_la_LIBADD=-ldl $(WD_LIBS) -lpthread uadk_engine_la_LDFLAGS=-module -version-number $(VERSION) -uadk_engine_la_CFLAGS=$(WD_CFLAGS) $(libcrypto_CFLAGS) + uadk_engine_la_CFLAGS+=-DCRYPTO AUTOMAKE_OPTIONS = subdir-objects @@ -26,16 +48,9 @@ uadk_engine_la_SOURCES+=v1/alg/ciphers/sec_ciphers.c \ v1/alg/ciphers/sec_ciphers_soft.c \ v1/alg/ciphers/sec_ciphers_utils.c \ v1/alg/ciphers/sec_ciphers_wd.c \ - v1/alg/dh/hpre_dh.c \ - v1/alg/dh/hpre_dh_soft.c \ - v1/alg/dh/hpre_dh_wd.c \ v1/alg/digests/sec_digests.c \ v1/alg/digests/sec_digests_soft.c \ v1/alg/digests/sec_digests_wd.c \ - v1/alg/pkey/hpre_rsa.c \ - v1/alg/pkey/hpre_rsa_soft.c \ - v1/alg/pkey/hpre_rsa_utils.c \ - v1/alg/pkey/hpre_wd.c \ v1/wdmngr/wd_alg_queue.c \ v1/wdmngr/wd_queue_memory.c \ v1/utils/engine_check.c \ @@ -48,6 +63,18 @@ uadk_engine_la_SOURCES+=v1/alg/ciphers/sec_ciphers.c \ v1/async/async_event.c \ v1/async/async_poll.c \ v1/async/async_task_queue.c +if !DISABLE_DH + uadk_engine_la_SOURCES+=v1/alg/dh/hpre_dh.c \ + v1/alg/dh/hpre_dh_soft.c \ + v1/alg/dh/hpre_dh_wd.c +endif +if !DISABLE_RSA + uadk_engine_la_SOURCES+=v1/alg/pkey/hpre_rsa.c \ + v1/alg/pkey/hpre_rsa_soft.c \ + v1/alg/pkey/hpre_rsa_utils.c \ + v1/alg/pkey/hpre_wd.c +endif + endif #WD_KAE uadk_provider_la_SOURCES=uadk_prov_init.c uadk_prov_digest.c uadk_async.c uadk_utils.c diff --git a/src/uadk_engine_init.c b/src/uadk_engine_init.c index 0a9e3e6..0792c62 100644 --- a/src/uadk_engine_init.c +++ b/src/uadk_engine_init.c @@ -202,10 +202,16 @@ static int uadk_destroy(ENGINE *e) sec_ciphers_free_ciphers(); if (uadk_digest_nosva) sec_digests_free_methods(); + +#ifndef DISABLE_RSA if (uadk_rsa_nosva) hpre_destroy(); +#endif + +#ifndef DISABLE_DH if (uadk_dh_nosva) hpre_dh_destroy(); +#endif kae_debug_close_log(); #endif @@ -213,12 +219,19 @@ static int uadk_destroy(ENGINE *e) uadk_e_destroy_cipher(); if (uadk_digest) uadk_e_destroy_digest(); + +#ifndef DISABLE_RSA if (uadk_rsa) uadk_e_destroy_rsa(); +#endif + if (uadk_ecc) uadk_e_destroy_ecc(); + +#ifndef DISABLE_DH if (uadk_dh) uadk_e_destroy_dh(); +#endif pthread_mutex_lock(&uadk_engine_mutex); uadk_inited = 0; @@ -250,10 +263,17 @@ static int uadk_init(ENGINE *e) uadk_e_digest_lock_init(); if (uadk_cipher) uadk_e_cipher_lock_init(); + +#ifndef DISABLE_RSA if (uadk_rsa) uadk_e_rsa_lock_init(); +#endif + +#ifndef DISABLE_DH if (uadk_dh) uadk_e_dh_lock_init(); +#endif + if (uadk_ecc) uadk_e_ecc_lock_init(); @@ -300,6 +320,7 @@ static void bind_fn_kae_alg(ENGINE *e) uadk_digest_nosva = 1; } +#ifndef DISABLE_RSA dev_num = wd_get_nosva_dev_num("rsa"); if (dev_num > 0) { hpre_module_init(); @@ -308,7 +329,9 @@ static void bind_fn_kae_alg(ENGINE *e) else uadk_rsa_nosva = 1; } +#endif +#ifndef DISABLE_DH dev_num = wd_get_nosva_dev_num("dh"); if (dev_num > 0) { hpre_module_dh_init(); @@ -317,7 +340,9 @@ static void bind_fn_kae_alg(ENGINE *e) else uadk_dh_nosva = 1; } +#endif } + #endif static void bind_fn_uadk_alg(ENGINE *e) @@ -342,6 +367,7 @@ static void bind_fn_uadk_alg(ENGINE *e) free(dev); } +#ifndef DISABLE_RSA dev = wd_get_accel_dev("rsa"); if (dev) { if (!uadk_e_bind_rsa(e)) @@ -350,7 +376,9 @@ static void bind_fn_uadk_alg(ENGINE *e) uadk_rsa = 1; free(dev); } +#endif +#ifndef DISABLE_DH dev = wd_get_accel_dev("dh"); if (dev) { if (!uadk_e_bind_dh(e)) @@ -359,6 +387,7 @@ static void bind_fn_uadk_alg(ENGINE *e) uadk_dh = 1; free(dev); } +#endif /* find an ecc device, no difference for sm2/ecdsa/ecdh/x25519/x448 */ dev = wd_get_accel_dev("ecdsa"); diff --git a/src/uadk_pkey.c b/src/uadk_pkey.c index ba33b7d..a0601ac 100644 --- a/src/uadk_pkey.c +++ b/src/uadk_pkey.c @@ -31,13 +31,41 @@ static int g_ecc_support_state[ECC_TYPE]; +#if defined(DISABLE_X448) && defined(DISABLE_X25519) + static int pkey_nids[] = { EVP_PKEY_EC, - EVP_PKEY_SM2, - EVP_PKEY_X25519, - EVP_PKEY_X448 + EVP_PKEY_SM2 }; +#else + + #if defined(DISABLE_X448) + + static int pkey_nids[] = { + EVP_PKEY_EC, + EVP_PKEY_SM2, + EVP_PKEY_X25519 + }; + #elif defined(DISABLE_X25519) + + static int pkey_nids[] = { + EVP_PKEY_EC, + EVP_PKEY_SM2, + EVP_PKEY_X448 + }; + + #else + + static int pkey_nids[] = { + EVP_PKEY_EC, + EVP_PKEY_SM2, + EVP_PKEY_X25519, + EVP_PKEY_X448 + }; + + #endif +#endif struct ecc_sched { int sched_type; struct wd_sched wd_sched; @@ -599,6 +627,8 @@ static int get_pkey_meths(ENGINE *e, EVP_PKEY_METHOD **pmeth, } *pmeth = pkey_meth.ec; break; + +#ifndef DISABLE_X448 case EVP_PKEY_X448: ret = uadk_x448_create_pmeth(&pkey_meth); if (!ret) { @@ -607,6 +637,9 @@ static int get_pkey_meths(ENGINE *e, EVP_PKEY_METHOD **pmeth, } *pmeth = pkey_meth.x448; break; +#endif + +#ifndef DISABLE_X25519 case EVP_PKEY_X25519: ret = uadk_x25519_create_pmeth(&pkey_meth); if (!ret) { @@ -615,6 +648,7 @@ static int get_pkey_meths(ENGINE *e, EVP_PKEY_METHOD **pmeth, } *pmeth = pkey_meth.x25519; break; +#endif default: fprintf(stderr, "not find nid %d\n", nid); return 0; diff --git a/src/uadk_pkey.h b/src/uadk_pkey.h index b80e425..f0317cd 100644 --- a/src/uadk_pkey.h +++ b/src/uadk_pkey.h @@ -77,10 +77,17 @@ int uadk_sm2_create_pmeth(struct uadk_pkey_meth *pkey_meth); void uadk_sm2_delete_pmeth(struct uadk_pkey_meth *pkey_meth); int uadk_ec_create_pmeth(struct uadk_pkey_meth *pkey_meth); void uadk_ec_delete_meth(void); + +#ifndef DISABLE_X448 int uadk_x448_create_pmeth(struct uadk_pkey_meth *pkey_meth); void uadk_x448_delete_pmeth(struct uadk_pkey_meth *pkey_meth); +#endif + +#ifndef DISABLE_X25519 int uadk_x25519_create_pmeth(struct uadk_pkey_meth *pkey_meth); void uadk_x25519_delete_pmeth(struct uadk_pkey_meth *pkey_meth); +#endif + int uadk_bind_ec(ENGINE *e); int uadk_e_ecc_get_numa_id(void); int uadk_e_ecc_get_support_state(int alg_tag); diff --git a/src/v1/utils/engine_check.c b/src/v1/utils/engine_check.c index 949eeb8..90932b2 100644 --- a/src/v1/utils/engine_check.c +++ b/src/v1/utils/engine_check.c @@ -27,7 +27,11 @@ #include "../alg/ciphers/sec_ciphers_wd.h" #include "../alg/digests/sec_digests_wd.h" #include "../alg/pkey/hpre_wd.h" + +#ifndef DISABLE_DH #include "../alg/dh/hpre_dh_wd.h" +#endif + #include "engine_check.h" #include "engine_utils.h" #include "engine_log.h" @@ -81,8 +85,15 @@ static void *kae_checking_q_loop_fn(void *args) kae_queue_pool_check_and_release(wd_ciphers_get_qnode_pool(), wd_ciphers_free_engine_ctx); kae_queue_pool_check_and_release(wd_digests_get_qnode_pool(), wd_digests_free_engine_ctx); + +#ifndef DISABLE_RSA kae_queue_pool_check_and_release(wd_hpre_get_qnode_pool(), NULL); +#endif + +#ifndef DISABLE_DH kae_queue_pool_check_and_release(wd_hpre_dh_get_qnode_pool(), NULL); +#endif + } US_INFO("check thread exit normally."); @@ -96,8 +107,15 @@ static void kae_checking_q_thread_destroy(void) (void)wd_digests_uninit_qnode_pool(); (void)wd_ciphers_uninit_qnode_pool(); + +#ifndef DISABLE_DH (void)wd_hpre_dh_uninit_qnode_pool(); +#endif + +#ifndef DISABLE_RSA (void)wd_hpre_uninit_qnode_pool(); +#endif + } static void kae_check_thread_init(void) diff --git a/src/v1/utils/engine_fork.c b/src/v1/utils/engine_fork.c index 14f4e6e..3cab658 100644 --- a/src/v1/utils/engine_fork.c +++ b/src/v1/utils/engine_fork.c @@ -41,13 +41,25 @@ void engine_init_child_at_fork_handler_v1(void) g_sec_digests_qnode_pool->pool_use_num = 0; if (g_sec_ciphers_qnode_pool) g_sec_ciphers_qnode_pool->pool_use_num = 0; + +#ifndef DISABLE_RSA if (g_hpre_rsa_qnode_pool) g_hpre_rsa_qnode_pool->pool_use_num = 0; +#endif + +#ifndef DISABLE_DH if (g_hpre_dh_qnode_pool) g_hpre_dh_qnode_pool->pool_use_num = 0; +#endif +#ifndef DISABLE_RSA (void)hpre_module_init(); +#endif + +#ifndef DISABLE_DH (void)hpre_module_dh_init(); +#endif + (void)cipher_module_init(); (void)digest_module_init(); -- 2.36.1
1 year, 3 months
1
0
0
0
[PATCH] uadk: support loading alg lib from specified directories
by Weili Qian
From: Shangbin Liu <liushangbin(a)hisilicon.com> Solving the problem of traversing the entire library directory to load alg drv lib may result in unexpected results by specifying the loading directory 'uadk'. Signed-off-by: Shangbin Liu <liushangbin(a)hisilicon.com> --- Makefile.am | 7 +++++-- wd_util.c | 26 +++++++++++++------------- 2 files changed, 18 insertions(+), 15 deletions(-) diff --git a/Makefile.am b/Makefile.am index f04164f..11aa2a0 100644 --- a/Makefile.am +++ b/Makefile.am @@ -38,8 +38,11 @@ pkginclude_HEADERS = include/wd.h include/wd_cipher.h include/wd_aead.h \ nobase_pkginclude_HEADERS = v1/wd.h v1/wd_cipher.h v1/wd_aead.h v1/uacce.h v1/wd_dh.h \ v1/wd_digest.h v1/wd_rsa.h v1/wd_bmm.h -lib_LTLIBRARIES=libwd.la libwd_comp.la libwd_crypto.la libhisi_zip.la \ - libhisi_hpre.la libhisi_sec.la +lib_LTLIBRARIES=libwd.la libwd_comp.la libwd_crypto.la + +uadk_driversdir=$(libdir)/uadk +uadk_drivers_LTLIBRARIES=libhisi_sec.la libhisi_hpre.la libhisi_zip.la + libwd_la_SOURCES=wd.c wd_mempool.c wd.h wd_alg.c wd_alg.h \ v1/wd.c v1/wd.h v1/wd_adapter.c v1/wd_adapter.h \ diff --git a/wd_util.c b/wd_util.c index cb89709..2f6fcf7 100644 --- a/wd_util.c +++ b/wd_util.c @@ -28,7 +28,7 @@ #define US2S(us) ((us) >> 20) #define WD_INIT_RETRY_TIMEOUT 3 -#define DEF_DRV_LIB_FILE "libwd.so" +#define WD_DRV_LIB_DIR "uadk" struct msg_pool { /* message array allocated dynamically */ @@ -2151,7 +2151,7 @@ static void dladdr_empty(void) int wd_get_lib_file_path(char *lib_file, char *lib_path, bool is_dir) { char file_path[PATH_MAX] = {0}; - char path[PATH_MAX]; + char path[PATH_MAX] = {0}; Dl_info file_info; int len, rc, i; @@ -2173,16 +2173,17 @@ int wd_get_lib_file_path(char *lib_file, char *lib_path, bool is_dir) } if (is_dir) { - (void)snprintf(lib_path, PATH_MAX, "%s", file_path); - return 0; + len = snprintf(lib_path, PATH_MAX, "%s/%s", file_path, WD_DRV_LIB_DIR); + if (len < 0) + return -WD_EINVAL; + } else { + len = snprintf(lib_path, PATH_MAX, "%s/%s/%s", file_path, WD_DRV_LIB_DIR, lib_file); + if (len < 0) + return -WD_EINVAL; } - len = snprintf(lib_path, PATH_MAX, "%s/%s", file_path, lib_file); - if (len < 0) - return -WD_EINVAL; - if (realpath(lib_path, path) == NULL) { - WD_ERR("%s: no such file or directory!\n", path); + WD_ERR("invalid: %s: no such file or directory!\n", path); return -WD_EINVAL; } @@ -2205,11 +2206,10 @@ void *wd_dlopen_drv(const char *cust_lib_dir) if (ret) return NULL; } else { - (void)snprintf(lib_path, PATH_MAX, "%s/%s", cust_lib_dir, DEF_DRV_LIB_FILE); - ret = access(lib_path, F_OK); - if (ret) + if (realpath(cust_lib_dir, lib_path) == NULL) { + WD_ERR("invalid: %s: no such file or directory!\n", lib_path); return NULL; - + } strncpy(lib_dir_path, cust_lib_dir, PATH_MAX - 1); } -- 2.33.0
1 year, 3 months
1
0
0
0
← Newer
1
Older →
Jump to page:
1
Results per page:
10
25
50
100
200