mirror of
https://dev.iopsys.eu/bbf/bbfdm.git
synced 2025-12-10 07:44:39 +01:00
Config option to select ssl utility library
This commit is contained in:
parent
e3fe55623b
commit
8675f66168
4 changed files with 50 additions and 21 deletions
18
configure.ac
18
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
|
||||
|
|
|
|||
|
|
@ -9,8 +9,10 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#include <wolfssl/options.h>
|
||||
#include <wolfssl/openssl/sha.h>
|
||||
#ifdef LWOLFSSL
|
||||
#include <options.h>
|
||||
#endif
|
||||
#include <openssl/sha.h>
|
||||
#include <curl/curl.h>
|
||||
#include <libtrace.h>
|
||||
#include "dmentry.h"
|
||||
|
|
|
|||
|
|
@ -14,8 +14,13 @@
|
|||
#define MAX_CERT 32
|
||||
|
||||
#ifdef LSSL
|
||||
#include <wolfssl/openssl/x509.h>
|
||||
#include <wolfssl/openssl/pem.h>
|
||||
#include <openssl/x509.h>
|
||||
#include <openssl/pem.h>
|
||||
#include <openssl/evp.h>
|
||||
|
||||
#ifdef LOPENSSL
|
||||
#include <openssl/obj_mac.h>
|
||||
#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);
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue