Skip to content
Open

Dev #179

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 24 additions & 4 deletions configure.ac
Original file line number Diff line number Diff line change
@@ -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"])

Expand Down
47 changes: 37 additions & 10 deletions src/Makefile.am
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand All @@ -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 \
Expand All @@ -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_async.c uadk_utils.c \
Expand Down
60 changes: 60 additions & 0 deletions src/Makefile.am.orig
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
VERSION = 1:2
ACLOCAL_AMFLAGS = -I m4

if HAVE_CRYPTO
lib_LTLIBRARIES=uadk_engine.la
endif #HAVE_CRYPTO

if HAVE_CRYPTO3
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_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

if WD_KAE
uadk_engine_la_CFLAGS += -DKAE
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 \
v1/utils/engine_config.c \
v1/utils/engine_fork.c \
v1/utils/engine_log.c \
v1/utils/engine_opensslerr.c \
v1/utils/engine_utils.c \
v1/async/async_callback.c \
v1/async/async_event.c \
v1/async/async_poll.c \
v1/async/async_task_queue.c
endif #WD_KAE

uadk_provider_la_SOURCES=uadk_prov_init.c uadk_async.c uadk_utils.c \
uadk_prov_digest.c uadk_prov_cipher.c \
uadk_prov_rsa.c

uadk_provider_la_LDFLAGS=-module -version-number $(VERSION)
uadk_provider_la_LIBADD=$(WD_LIBS) -lpthread
uadk_provider_la_CFLAGS=$(WD_CFLAGS) $(libcrypto_CFLAGS)
uadk_provider_la_CFLAGS+=-DOPENSSL_SUPPRESS_DEPRECATED
29 changes: 29 additions & 0 deletions src/uadk_engine_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -202,23 +202,36 @@ 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

if (uadk_cipher)
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

async_poll_task_free();

Expand Down Expand Up @@ -252,10 +265,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();

Expand Down Expand Up @@ -302,6 +322,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();
Expand All @@ -310,7 +331,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();
Expand All @@ -319,7 +342,9 @@ static void bind_fn_kae_alg(ENGINE *e)
else
uadk_dh_nosva = 1;
}
#endif
}

#endif

static void bind_fn_uadk_alg(ENGINE *e)
Expand All @@ -344,6 +369,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))
Expand All @@ -352,7 +378,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))
Expand All @@ -361,6 +389,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");
Expand Down
Loading