diff --git a/configure.ac b/configure.ac index d08c5a0c..4e9c4c46 100644 --- a/configure.ac +++ b/configure.ac @@ -1,4 +1,4 @@ -AC_INIT([libbbfdm], [0.1], [mohamed.kallel@pivasoftware.com]) +AC_INIT([libbbfdm], [1.0], [dev@iopsys.eu]) AC_CONFIG_MACRO_DIR([m4]) AM_INIT_AUTOMAKE([foreign subdir-objects]) @@ -14,8 +14,11 @@ AM_CONDITIONAL([BBF_TR104],[test "x$enable_tr104" = "xyes"]) AC_ARG_ENABLE(tr143, [AS_HELP_STRING([--enable-tr143], [enable tr143 diagnostics feature])], AC_DEFINE(BBF_TR143),) AM_CONDITIONAL([BBF_TR143],[test "x$enable_tr143" = "xyes"]) -AC_ARG_ENABLE(libssl, [AS_HELP_STRING([--enable-libssl], [enable libssl feature])], AC_DEFINE(LSSL),) -AM_CONDITIONAL([LSSL],[test "x$enable_libssl" = "xyes"]) +AC_ARG_ENABLE(libopenssl, [AS_HELP_STRING([--enable-libopenssl], [enable libopenssl feature])], AC_DEFINE(LOPENSSL),) +AM_CONDITIONAL([LOPENSSL],[test "x$enable_libopenssl" = "xyes"]) + +AC_ARG_ENABLE(libwolfssl, [AS_HELP_STRING([--enable-libwolfssl], [enable libwolfssl feature])], AC_DEFINE(LWOLFSSL),) +AM_CONDITIONAL([LWOLFSSL],[test "x$enable_libwolfssl" = "xyes"]) AC_ARG_ENABLE(vendor_extension, [AS_HELP_STRING([--enable-vendor-extension], [enable vendor extension])], AC_DEFINE(BBF_VENDOR_EXTENSION),) AM_CONDITIONAL([BBF_VENDOR_EXTENSION],[test "x$enable_vendor_extension" = "xyes"]) @@ -108,9 +111,16 @@ AC_SUBST([LIBCURL_LIBS]) LIBCRYPTO_LIBS='-lcrypto' AC_SUBST([LIBCRYPTO_LIBS]) -AM_COND_IF([LSSL], [ +AM_COND_IF([LWOLFSSL], [ LIBSSL_LIBS='-lwolfssl' AC_SUBST([LIBSSL_LIBS]) + AC_DEFINE(LSSL) +]) + +AM_COND_IF([LOPENSSL], [ + LIBSSL_LIBS='-lssl' + AC_SUBST([LIBSSL_LIBS]) + AC_DEFINE(LSSL) ]) # checks for header files diff --git a/dmdiagnostics.c b/dmdiagnostics.c index 9c47c398..2dd66558 100644 --- a/dmdiagnostics.c +++ b/dmdiagnostics.c @@ -9,8 +9,10 @@ * */ -#include -#include +#ifdef LWOLFSSL +#include +#endif +#include #include #include #include "dmentry.h" diff --git a/dmtree/tr181/security.c b/dmtree/tr181/security.c index 3f859313..4686e5cd 100644 --- a/dmtree/tr181/security.c +++ b/dmtree/tr181/security.c @@ -14,8 +14,13 @@ #define MAX_CERT 32 #ifdef LSSL -#include -#include +#include +#include +#include + +#ifdef LOPENSSL +#include +#endif static char certifcates_paths[MAX_CERT][256]; @@ -43,20 +48,18 @@ struct uci_section *dmsect, struct certificate_profile *certprofile) static char *get_certificate_sig_alg(int sig_nid) { switch(sig_nid) { - case CTC_SHA256wRSA: + case NID_sha256WithRSAEncryption: return "sha256WithRSAEncryption"; - case CTC_SHA384wRSA: + case NID_sha384WithRSAEncryption: return "sha384WithRSAEncryption"; - case CTC_SHA512wRSA: + case NID_sha512WithRSAEncryption: return "sha512WithRSAEncryption"; - case CTC_SHA224wRSA: + case NID_sha224WithRSAEncryption: return "sha224WithRSAEncryption"; - case CTC_MD5wRSA: + case NID_md5WithRSAEncryption: return "md5WithRSAEncryption"; - case CTC_SHAwRSA: + case NID_sha1WithRSAEncryption: return "sha1WithRSAEncryption"; - case CTC_MD2wRSA: - return "md2WithRSAEncryption"; default: return ""; } @@ -219,10 +222,15 @@ static int get_SecurityCertificate_NotBefore(char *refparam, struct dmctx *ctx, struct certificate_profile *cert_profile = (struct certificate_profile*)data; const ASN1_TIME *not_before = X509_get0_notBefore(cert_profile->openssl_cert); - ASN1_TIME_to_string((ASN1_TIME *)not_before, not_before_str, DATE_LEN); + *value = "0001-01-01T00:00:00Z"; +#ifdef LWOLFSSL + ASN1_TIME_to_string((ASN1_TIME *)not_before, not_before_str, DATE_LEN); if (!strptime(not_before_str, "%b %d %H:%M:%S %Y", &tm)) return -1; +#else + ASN1_TIME_to_tm(not_before, &tm); +#endif strftime(not_before_str, sizeof(not_before_str), "%Y-%m-%dT%H:%M:%SZ", &tm); *value = dmstrdup(not_before_str); @@ -236,10 +244,15 @@ static int get_SecurityCertificate_NotAfter(char *refparam, struct dmctx *ctx, v struct certificate_profile *cert_profile = (struct certificate_profile*)data; const ASN1_TIME *not_after = X509_get0_notAfter(cert_profile->openssl_cert); - ASN1_TIME_to_string((ASN1_TIME *)not_after, not_after_str, DATE_LEN); + *value = "0001-01-01T00:00:00Z"; +#ifdef LWOLFSSL + ASN1_TIME_to_string((ASN1_TIME *)not_after, not_after_str, DATE_LEN); if (!strptime(not_after_str, "%b %d %H:%M:%S %Y", &tm)) return -1; +#else + ASN1_TIME_to_tm((ASN1_TIME *)not_after, &tm); +#endif strftime(not_after_str, sizeof(not_after_str), "%Y-%m-%dT%H:%M:%SZ", &tm); *value = dmstrdup(not_after_str); diff --git a/gitlab-ci/shared.sh b/gitlab-ci/shared.sh index 7ab430e8..59d272b9 100755 --- a/gitlab-ci/shared.sh +++ b/gitlab-ci/shared.sh @@ -36,7 +36,7 @@ function exec_cmd_verbose() fi } -function install_libbbf() +function install_wolfssl() { CUR="${PWD}" @@ -55,6 +55,10 @@ function install_libbbf() exec_cmd make install cd ${CUR} +} + +function install_libbbf() +{ COV_CFLAGS='-fprofile-arcs -ftest-coverage' COV_LDFLAGS='--coverage' VENDOR_LIST='iopsys' @@ -70,8 +74,8 @@ function install_libbbf() fi exec_cmd autoreconf -i - exec_cmd ./configure --enable-tr181 --enable-tr104 --enable-tr143 --enable-libssl --enable-json-plugin --enable-shared-library --enable-vendor-extension BBF_VENDOR_LIST="$VENDOR_LIST" BBF_VENDOR_PREFIX="$VENDOR_PREFIX" - make CFLAGS="-D_GNU_SOURCE -Wall -Werror -DWC_NO_HARDEN" CFLAGS+="$COV_CFLAGS" LDFLAGS="$COV_LDFLAGS" >/dev/null 2>&1 + exec_cmd ./configure --enable-tr181 --enable-tr104 --enable-tr143 --enable-libopenssl --enable-json-plugin --enable-shared-library --enable-vendor-extension BBF_VENDOR_LIST="$VENDOR_LIST" BBF_VENDOR_PREFIX="$VENDOR_PREFIX" + make CFLAGS="-D_GNU_SOURCE -Wall -Werror" CFLAGS+="$COV_CFLAGS" LDFLAGS="$COV_LDFLAGS" >/dev/null 2>&1 echo "installing libbbf" exec_cmd make install