forked from wolfSSL/wolfssl
Synchronous Quick Assist Support for Sniffer
1. Add configure option for sync IntelQA that uses the crypto callback API. 2. Refactor the IntelQA configure checks so they are usable by both the sync and async options. 3. Make a synchonous copy of the quickassist files. 4. Replace the printfs in the code with a logging macro. 5. Added padding to the AES_KEY structure for WOLF_CRYPTO_CB. 6. Tie in the crypto device to the sniffer. 7. When setting up the symmetric operation, add a build case for the sniffer to use malloc instead of realloc. Sniffer usually uses the middle of another buffer for the input data rather than the beginning of the buffer as it has the TCP/IP data to handle as well. 8. Add the raw key to the DES3 structure. 9. Copy the functions from qa_mem over to qa_sync.
This commit is contained in:
97
configure.ac
97
configure.ac
@ -3872,59 +3872,57 @@ AC_ARG_WITH([cavium-v],
|
||||
# Intel QuickAssist
|
||||
QAT_DIR=""
|
||||
BUILD_INTEL_QAT_VERSION=2
|
||||
|
||||
AC_ARG_WITH([intelqa],
|
||||
[ --with-intelqa=PATH PATH to Intel QuickAssist (QAT) driver dir ],
|
||||
[
|
||||
AC_MSG_CHECKING([for intelqa])
|
||||
CPPFLAGS="$CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"
|
||||
OLD_LIBS="$LIBS"
|
||||
[AS_HELP_STRING([--with-intelqa=PATH],[PATH to Intel QuickAssist (QAT) driver dir])],
|
||||
[ENABLED_INTEL_QA=yes; QAT_DIR=$withval],
|
||||
[ENABLED_INTEL_QA=no])
|
||||
|
||||
if test "x$withval" = "xyes" ; then
|
||||
AC_MSG_ERROR([need a PATH for --with-intelqa])
|
||||
fi
|
||||
if test "x$withval" != "xno" ; then
|
||||
QAT_DIR=$withval
|
||||
fi
|
||||
AC_ARG_WITH([intelqa-sync],
|
||||
[AS_HELP_STRING([--with-intelqa-sync=PATH],[PATH to Intel QuickAssist (QAT) driver dir (sync)])],
|
||||
[ENABLED_INTEL_QA_SYNC=yes; QAT_DIR=$withval],
|
||||
[ENABLED_INTEL_QA_SYNC=no])
|
||||
|
||||
CPPFLAGS="$CPPFLAGS -I$QAT_DIR/quickassist/include -I$QAT_DIR/quickassist/include/lac -I$QAT_DIR/quickassist/utilities/osal/include \
|
||||
-I$QAT_DIR/quickassist/utilities/osal/src/linux/user_space/include -I$QAT_DIR/quickassist/lookaside/access_layer/include \
|
||||
-I$QAT_DIR/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel \
|
||||
-I$QAT_DIR/quickassist/utilities/libusdm_drv"
|
||||
AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" && test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
|
||||
[AC_MSG_ERROR([Both Intel QA Async and Sync are selected, only select one.])])
|
||||
|
||||
LDFLAGS="$LDFLAGS -L$QAT_DIR/build"
|
||||
LIBS="$LIBS -lqat_s -lusdm_drv_s"
|
||||
AS_IF([test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
|
||||
[AC_MSG_CHECKING([for intelqa])
|
||||
AS_IF([test "x$ENABLED_INTEL_QA" = "xyes"],
|
||||
[AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"; intelqa_opt=""],
|
||||
[AM_CPPFLAGS="$AM_CPPFLAGS -DHAVE_INTEL_QA_SYNC -DQAT_USE_POLLING_THREAD -DO_CRYPTO -DUSER_SPACE"; intelqa_opt="-sync"])
|
||||
OLD_LIBS="$LIBS"
|
||||
OLD_CPPFLAGS="$CPPFLAGS"
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]], [[ Cpa16U count = 0; cpaCyGetNumInstances(&count); ]])],
|
||||
[ intelqa_linked=yes ],[ intelqa_linked=no ])
|
||||
if test "x$intelqa_linked" = "xno" ; then
|
||||
# Try old QAT driver libraries
|
||||
AS_IF([test "x$QAT_DIR" = "xyes"],[AC_MSG_ERROR([need a PATH for --with-intelqa$intelqa_opt])])
|
||||
|
||||
AM_CPPFLAGS="$AM_CPPFLAGS -I$QAT_DIR/quickassist/include -I$QAT_DIR/quickassist/include/lac -I$QAT_DIR/quickassist/utilities/osal/include \
|
||||
-I$QAT_DIR/quickassist/utilities/osal/src/linux/user_space/include -I$QAT_DIR/quickassist/lookaside/access_layer/include \
|
||||
-I$QAT_DIR/quickassist/lookaside/access_layer/src/common/include -I$srcdir/wolfssl -I$srcdir/wolfssl/wolfcrypt/port/intel \
|
||||
-I$QAT_DIR/quickassist/utilities/libusdm_drv"
|
||||
CPPFLAGS="$AM_CPPFLAGS"
|
||||
|
||||
LDFLAGS="$LDFLAGS -L$QAT_DIR/build"
|
||||
LIBS="$LIBS -lqat_s -lusdm_drv_s"
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
|
||||
|
||||
AS_IF([test "x$intelqa_linked" = "xno"],
|
||||
[# Try old QAT driver libraries
|
||||
LIBS="$OLD_LIBS -licp_qa_al_s"
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]],[[Cpa16U count = 0; cpaCyGetNumInstances(&count);]])],[intelqa_linked=yes],[intelqa_linked=no])
|
||||
AS_IF([test "x$intelqa_linked" = "xno"],
|
||||
[AC_MSG_ERROR([Intel QuickAssist not found. If it's already installed, specify its path using --with-intelqa$intelqa_opt=/dir/])],
|
||||
[BUILD_INTEL_QAT_VERSION=1])
|
||||
])
|
||||
|
||||
AC_LINK_IFELSE([AC_LANG_PROGRAM([[#include "cpa_cy_common.h"]], [[ Cpa16U count = 0; cpaCyGetNumInstances(&count); ]])],
|
||||
[ intelqa_linked=yes ],[ intelqa_linked=no ])
|
||||
if test "x$intelqa_linked" = "xno" ; then
|
||||
AC_MSG_ERROR([Intel QuickAssist not found.
|
||||
If it's already installed, specify its path using --with-intelqa=/dir/])
|
||||
else
|
||||
BUILD_INTEL_QAT_VERSION=1
|
||||
fi
|
||||
else
|
||||
AM_CFLAGS="$AM_CFLAGS -DHAVE_INTEL_QA -DDO_CRYPTO -DUSER_SPACE"
|
||||
fi
|
||||
AC_MSG_RESULT([yes])
|
||||
AC_MSG_RESULT([yes])
|
||||
|
||||
if test "x$BUILD_INTEL_QAT_VERSION" == "x1" ; then
|
||||
LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"
|
||||
else
|
||||
LIB_ADD="-losal -lrt $LIB_ADD"
|
||||
fi
|
||||
|
||||
ENABLED_INTEL_QA=yes
|
||||
],
|
||||
[
|
||||
ENABLED_INTEL_QA=no
|
||||
]
|
||||
)
|
||||
AS_IF([test "x$BUILD_INTEL_QAT_VERSION" == "x1"],
|
||||
[LIB_ADD="-ladf_proxy -losal -lrt $LIB_ADD"],
|
||||
[LIB_ADD="-losal -lrt $LIB_ADD"])
|
||||
CPPFLAGS="$OLD_CPPFLAGS"
|
||||
])
|
||||
|
||||
|
||||
# Single Precision maths implementation
|
||||
@ -4354,7 +4352,7 @@ fi
|
||||
# check for async if using Intel QuckAssist or Cavium
|
||||
if test "x$ENABLED_INTEL_QA" = "xyes" || test "x$ENABLED_CAVIUM" = "xyes" ; then
|
||||
if test "x$ENABLED_ASYNCCRYPT" = "xno" ; then
|
||||
AC_MSG_ERROR([Please enable enable asynchronous support using --enable-asynccrypt])
|
||||
AC_MSG_ERROR([Please enable asynchronous support using --enable-asynccrypt])
|
||||
fi
|
||||
fi
|
||||
|
||||
@ -4569,6 +4567,10 @@ AS_IF([test "x$ENABLED_OCSP" = "xyes" && \
|
||||
test "x$ENABLED_ECC" = "xno"],
|
||||
[AC_MSG_ERROR([please enable rsa or ecc if enabling ocsp.])])
|
||||
|
||||
# Sync Intel QA requires the crypto callback
|
||||
AS_IF([test "x$ENABLED_CRYPTOCB" = "xno" && test "x$ENABLED_INTEL_QA_SYNC" = "xyes"],
|
||||
[AC_MSG_ERROR([please enable the crypto callback support using --enable-cryptocb])])
|
||||
|
||||
# checks for pkcs7 needed enables
|
||||
AS_IF([test "x$ENABLED_PKCS7" = "xyes" && \
|
||||
test "x$ENABLED_RSA" = "xno" && \
|
||||
@ -4794,7 +4796,7 @@ if test "$ENABLED_DISTRO" = "no"
|
||||
then
|
||||
CFLAGS="$CFLAGS $USER_C_EXTRA_FLAGS"
|
||||
fi
|
||||
OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $CPPFLAGS $AM_CFLAGS"
|
||||
OPTION_FLAGS="$USER_CFLAGS $USER_C_EXTRA_FLAGS $CPPFLAGS $AM_CPPFLAGS $CFLAGS $AM_CFLAGS"
|
||||
|
||||
|
||||
# The following AM_CONDITIONAL statements set flags for use in the Makefiles.
|
||||
@ -4886,6 +4888,7 @@ AM_CONDITIONAL([BUILD_PKCS11],[test "x$ENABLED_PKCS11" = "xyes"])
|
||||
AM_CONDITIONAL([BUILD_CAVIUM],[test "x$ENABLED_CAVIUM" = "xyes"])
|
||||
AM_CONDITIONAL([BUILD_CAVIUM_V],[test "x$ENABLED_CAVIUM_V" = "xyes"])
|
||||
AM_CONDITIONAL([BUILD_INTEL_QA],[test "x$ENABLED_INTEL_QA" = "xyes"])
|
||||
AM_CONDITIONAL([BUILD_INTEL_QA_SYNC],[test "x$ENABLED_INTEL_QA_SYNC" = "xyes"])
|
||||
AM_CONDITIONAL([BUILD_SP],[test "x$ENABLED_SP" = "xyes"])
|
||||
AM_CONDITIONAL([BUILD_SP_C],[test "x$ENABLED_SP" = "xyes" && test "x$ENABLED_SP_ASM" = "xno" ])
|
||||
AM_CONDITIONAL([BUILD_SP_ARM64],[test "x$ENABLED_SP_ARM64_ASM" = "xyes" ])
|
||||
|
Reference in New Issue
Block a user