Skip to content

Commit

Permalink
Add testapp tests and spec file for QAT_SW
Browse files Browse the repository at this point in the history
- Testapp tests and script that validates qat_engine Functionally.
- qategnine-sw.spec file that builds qatengine
  for QAT_SW with crypto_mb and ipsec_mb dependancies.
- Update README and version to v0.6.8

Signed-off-by: Yogaraj Alamenda <yogarajx.alamenda@intel.com>
  • Loading branch information
bairemon authored and Yogaraj-Alamenda committed Sep 17, 2021
1 parent 3db1d7b commit 639d94d
Show file tree
Hide file tree
Showing 25 changed files with 9,362 additions and 17 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ tags
TAGS
cscope.out
/.dir-locals.el
testapp.log

# Top level and qat_contig_mem excludes
*.mod*
Expand All @@ -34,8 +35,11 @@ qat_contig_mem_test
*.exe
*.lib
*.la
testapp

# Autotools generated files
test/.deps
test/.dirstamp
/.deps
/.libs
/m4
Expand Down
14 changes: 8 additions & 6 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,26 @@ qatengine_la_LDFLAGS = -module -no-undefined -avoid-version \

mostlyclean-generic:
-rm -f *.obj lib tags core .pure .nfs* \
*.old *.bak fluff *.so *.sl *.dll
*.old *.bak fluff *.so *.sl *.dll test/*.obj testapp

if QAT_ERR_FILES_BUILD
MAKE = make err-files && make
endif

err-files:
if QAT_OPENSSL_110
rm -rf e_qat_err* && perl -I$(with_openssl_dir) $(with_openssl_dir)/util/mkerr.pl -conf e_qat.ec \
rm -rf e_qat_err* && perl -I$(with_openssl_dir) \
$(with_openssl_dir)/util/mkerr.pl -conf e_qat.ec \
-rebuild -reindex -nostatic -write *.c

else
if QAT_OPENSSL_3
perl -I$(with_openssl_dir) $(with_openssl_dir)/util/mkerr.pl -conf qat_prov.ec \
-rebuild -reindex *.c
else
rm -f e_qat_err.c e_qat.txt && perl -I$(with_openssl_dir) $(with_openssl_dir)/util/mkerr.pl -conf e_qat.ec \
-rebuild -reindex *.c

rm -f e_qat_err.c e_qat.txt && perl -I$(with_openssl_dir) \
$(with_openssl_dir)/util/mkerr.pl -conf e_qat.ec \
-rebuild -reindex *.c
endif
endif

include test.am
18 changes: 18 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -528,6 +528,24 @@ qat_sw (Intel(R) Multi-Buffer Crypto for IPsec)
./openssl speed -engine qatengine -elapsed -evp aes-256-gcm
```
</details>
<details>
<summary>Testing the Intel&reg; QuickAssist Technology OpenSSL* Engine using testapp utility</summary>

## Testing the Intel&reg; QuickAssist Technology OpenSSL* Engine using testapp utility</summary>

```text
cd /path/to/qat_engine
make test
./testapp.sh QAT_HW (For testing algorithms supported by QAT_HW)
./testapp.sh QAT_SW (For testing algorithms supported by QAT_SW)
```
The `testapp.sh` script will run the corresponding functional tests supported
by QAT_HW and QAT_SW. Please note that the QAT Engine should be built with
that support for the tests.

Additional information for testapp tests available with the help option
`./testapp -help`
</details>

## Troubleshooting
Troubleshooting information is available [here](docs/troubleshooting.md).
Expand Down
16 changes: 10 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@
# Process this file with autoconf to produce a configure script.

AC_PREREQ([2.68])
AC_INIT([qatengine], [0.6.6], [])
AC_INIT([qatengine], [0.6.8], [])
AC_CONFIG_SRCDIR([config.h.in])
AC_CONFIG_HEADERS([config.h])
AC_CONFIG_AUX_DIR([.])
AM_INIT_AUTOMAKE([foreign])
AM_INIT_AUTOMAKE([foreign subdir-objects])

#Libtool for generating shared library
LT_INIT
Expand Down Expand Up @@ -222,7 +222,7 @@ AC_SUBST(enable_qat_auto_engine_init_on_fork)
AC_CHECK_FILE(${qat_hw_dir_prefix}/include/qat/icp_sal_versions.h,
[with_icp_sal_versions_h=yes],
[with_icp_sal_versions_h=no])
if test "x$with_icp_sal_versions_h" = "xyes"
if test "x$with_icp_sal_versions_h" = "xyes" -a "x$enable_qat_sw" = "x"
then
if test `grep "define SAL_INFO2_DRIVER_SW_VERSION_TYPE \"in-tree\"" ${qat_hw_dir_prefix}/include/qat/icp_sal_versions.h | wc -l` = "1"
then
Expand Down Expand Up @@ -250,10 +250,11 @@ then
AC_MSG_NOTICE([Build QAT engine against OpenSSL 3.0])
AC_SUBST([cflags_openssl_3], ["-DQAT_OPENSSL_3 -DOPENSSL_SUPPRESS_DEPRECATED"])
libdir="\$(with_openssl_install_dir)/lib/engines-3"
AC_SUBST([openssl_version], ["3"])
else
AC_MSG_NOTICE([Build QAT engine against OpenSSL 1.1.x])
libdir="\$(with_openssl_install_dir)/lib/engines-1.1"
if test "`grep "define OPENSSL_VERSION_NUMBER 0x10100" $with_openssl_install_dir/include/openssl/opensslv.h | wc -l`" = "1"
if test "`grep "define OPENSSL_VERSION_NUMBER 0x101000" $with_openssl_install_dir/include/openssl/opensslv.h | wc -l`" = "1"
then
if test "x$with_openssl_dir" = "x"
then
Expand All @@ -263,6 +264,7 @@ then
fi
fi
AC_SUBST([includes_openssl], ["-I\$(with_openssl_install_dir)/include"])
AC_SUBST([OPENSSL_LIB], ["-Wl,-rpath,\$(with_openssl_install_dir)/lib -L\$(with_openssl_install_dir)/lib -lcrypto"])
else
AC_PATH_TOOL(PKGCONFIG, pkg-config)
AS_IF([test "x$PKGCONFIG" = "x"], [AC_MSG_ERROR(pkg-config not found.)], )
Expand All @@ -280,6 +282,7 @@ else
fi
AC_MSG_NOTICE([Install engine in the system OpenSSL enginesdir Path])
AC_SUBST([includes_openssl], ["-I`pkg-config --variable=includedir libcrypto`"])
AC_SUBST([OPENSSL_LIB], ["-lcrypto"])
AC_SUBST([libdir])
fi
AM_CONDITIONAL([QAT_OPENSSL_110], [test "x$cflags_openssl_110" != "x"])
Expand Down Expand Up @@ -331,9 +334,10 @@ then
AC_SUBST([includes_qat_sw], ["-I/usr/local/include -I/usr/include"])
if test "x$ac_cv_lib_crypto_mb_mbx_getversion" = "xyes"
then
with_qat_sw_install_dir="/usr/local"
AC_CHECK_FILE(/usr/local/lib/libcrypto_mb.so,
[AC_SUBST([QAT_SW_CRYPTO_MB_LIB], ["-Wl,-rpath,/usr/local/lib -L/usr/loca/lib -lcrypto_mb"])],
[AC_SUBST([QAT_SW_CRYPTO_MB_LIB], ["-lcrypto_mb"])])
AC_SUBST([cflags_qat_sw], ["-DQAT_SW"])
AC_SUBST([QAT_SW_CRYPTO_MB_LIB], ["-Wl,-rpath,\$(with_qat_sw_install_dir)/lib -L\$(with_qat_sw_install_dir)/lib -lcrypto_mb"])
fi
if test "x$ac_cv_lib_IPSec_MB_imb_get_version" = "xyes"
then
Expand Down
4 changes: 2 additions & 2 deletions docs/software_requirements.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ This release was validated on the following:
* Operating system: Ubuntu 20.04.2 LTS
* Kernel: 5.4.0-62-generic
* Intel&reg; Crypto Multi-buffer library from the [ipp-crypto][1] release
version **IPP Crypto 2020 Update 3**
* Intel&reg; Multi-Buffer crypto for IPsec Library release version **v0.55**
version **IPP Crypto 2021.3**
* Intel&reg; Multi-Buffer crypto for IPsec Library release version **v1.0**
* OpenSSL\* 1.1.1k

[1]:https://github.com/intel/ipp-crypto
Expand Down
4 changes: 2 additions & 2 deletions e_qat.c
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,10 @@
const char *engine_qat_id = STR(QAT_ENGINE_ID);
#ifdef QAT_HW
const char *engine_qat_name =
"Reference implementation of QAT crypto engine(qat_hw) v0.6.7";
"Reference implementation of QAT crypto engine(qat_hw) v0.6.8";
#else
const char *engine_qat_name =
"Reference implementation of QAT crypto engine(qat_sw) v0.6.7";
"Reference implementation of QAT crypto engine(qat_sw) v0.6.8";
#endif
unsigned int engine_inited = 0;

Expand Down
6 changes: 6 additions & 0 deletions qat_utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ void qat_hex_dump(const char *func, const char *var, const unsigned char p[],
# define WARN(...)
# endif

# define INFO(fmt_str, ...) \
do { \
fprintf(stderr,fmt_str, ##__VA_ARGS__); \
fflush(stderr); \
} while (0)

# ifdef QAT_DEBUG
# define DUMP_DH_GEN_PHASE1(instance_handle, opData, pPV) \
do { \
Expand Down
53 changes: 53 additions & 0 deletions qatengine-sw.spec
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
# SPDX-License-Identifier: MIT

%global githubname QAT_Engine
%global enginesdir %(pkg-config --variable=enginesdir libcrypto)

Name: qatengine-sw
Version: 0.6.8
Release: 1%{?dist}
Summary: Intel QuickAssist Technology (QAT) OpenSSL Engine
# Most of the source code is BSD, with the following exceptions:
# - e_qat.txt, e_qat_err.c, and e_qat_err.h are OpenSSL
# - qat/config/* are (BSD or GPLv2), but are not used during compilation
# - qat_contig_mem/* are GPLv2, but are not used during compilation
License: BSD and OpenSSL
URL: https://github.com/intel/%{githubname}
Source0: https://github.com/intel/%{githubname}/archive/v%{version}/%{name}-%{version}.tar.gz

BuildRequires: gcc make pkg-config
BuildRequires: autoconf automake libtool
BuildRequires: openssl-devel >= 1.1.1
BuildRequires: intel-ipsec-mb-devel >= 0.55.0
BuildRequires: intel-ipp-crypto-mb-devel >= 1.0.1
# https://bugzilla.redhat.com/show_bug.cgi?id=1909065
ExcludeArch: %{arm} aarch64 %{power64} s390x i686

%description
This package provides the Intel QuickAssist Technology OpenSSL Engine
(an OpenSSL Plug-In Engine) which provides cryptographic acceleration
for optimized software using Intel QuickAssist Technology
enabled Intel platforms.

%prep
%autosetup -n %{githubname}-%{version}

%build
autoreconf -ivf

%configure --enable-qat_sw

%make_build

%install
%make_install

%files
%license LICENSE*
%doc README.md docs*
%{enginesdir}/qatengine.so
%exclude %{enginesdir}/qatengine.la

%changelog
* Mon Aug 23 2021 Bernard Iremonger <bernard.iremonger@intel.com> 0.6.8-1
- Initial version of rpm package
5 changes: 4 additions & 1 deletion qatengine.spec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
%global enginesdir %(pkg-config --variable=enginesdir libcrypto)

Name: qatengine
Version: 0.6.7
Version: 0.6.8
Release: 1%{?dist}
Summary: Intel QuickAssist Technology (QAT) OpenSSL Engine
# Most of the source code is BSD, with the following exceptions:
Expand Down Expand Up @@ -46,6 +46,9 @@ autoreconf -ivf
%exclude %{enginesdir}/qatengine.la

%changelog
* Mon Aug 23 2021 Bernard Iremonger <bernard.iremonger@intel.com> - 0.6.8-1
- Update to qatengine v0.6.8

* Thu Jul 20 2021 Yogaraj Alamenda <yogarajx.alamenda@intel.com> - 0.6.7-1
- Update to qatengine v0.6.7

Expand Down
73 changes: 73 additions & 0 deletions test.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
################################################################
# BSD LICENSE
#
# Copyright(c) 2021 Intel Corporation. All rights reserved.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in
# the documentation and/or other materials provided with the
# distribution.
# * Neither the name of Intel Corporation nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
################################################################


EXTRA_PROGRAMS = testapp

QAT_TEST_SRC = test/main.c \
test/tests.c \
test/tests_ecdh.c \
test/tests_ecdsa.c \
test/tests_rsa.c \
test/tests_aes128_gcm.c \
test/tests_aes256_gcm.c

if QAT_HW
QAT_HW_TEST_SRC = test/tests_aes_cbc_hmac_sha.c \
test/tests_dsa.c \
test/tests_dh.c \
test/tests_prf.c
endif

if !QAT_OPENSSL_110
if QAT_SW
OPENSSL_111_TEST_SRC = test/tests_ecx.c
else
OPENSSL_111_TEST_SRC = test/tests_hkdf.c \
test/tests_ecx.c
endif
endif

testapp_SOURCES = ${QAT_TEST_SRC} \
${QAT_HW_TEST_SRC} \
${OPENSSL_111_TEST_SRC}

testapp_CFLAGS = $(includes_qat_hw) $(includes_openssl) \
$(cflags_openssl_3) $(cflags_qat_hw) \
$(cflags_qat_sw) $(cflags_qat_sw_ipsec) \
$(enable_qat_debug) $(enable_qat_warnings)

testapp_LDADD = -ldl -lrt -lpthread $(OPENSSL_LIB)

test: testapp

0 comments on commit 639d94d

Please sign in to comment.