|
| 1 | +%undefine __cmake_in_source_build |
| 2 | +%undefine _disable_source_fetch |
| 3 | +%global _lto_cflags %{nil} |
| 4 | +%global debug_package %{nil} |
| 5 | +# Dependent Library Versions |
| 6 | +%global major 1 |
| 7 | +%global minor 4 |
| 8 | +%global rev 0 |
| 9 | +%global ipsec intel-ipsec-mb |
| 10 | +%global ipsecver %{major}.%{minor} |
| 11 | +%global ipsecfull %{ipsec}-%{ipsecver} |
| 12 | +%global fullversion %{major}.%{minor}.%{rev} |
| 13 | + |
| 14 | +%global ippcp_major 11 |
| 15 | +%global ippcp_minor 8 |
| 16 | +%global ippcp ipp-crypto |
| 17 | +%global ippcpver ippcp_2021.8 |
| 18 | +%global ippcpfull %{ippcp}-%{ippcpver} |
| 19 | +%global ippcpfullversion %{ippcp_major}.%{ippcp_minor} |
| 20 | + |
| 21 | +%global openssl openssl-3.0.10 |
| 22 | +%global qatdriver QAT20.L.1.0.50-00003 |
| 23 | + |
| 24 | +%global openssl_source %{_builddir}/%{openssl} |
| 25 | +%global openssl_install %{buildroot}/%{_prefix}/local/ssl |
| 26 | + |
| 27 | +Name: QAT_Engine |
| 28 | +Version: 1.4.0 |
| 29 | +Release: 1%{?dist} |
| 30 | +Summary: Intel QuickAssist Technology(QAT) OpenSSL Engine |
| 31 | +License: BSD-3-Clause AND OpenSSL |
| 32 | + |
| 33 | +Source0: https://github.com/intel/QAT_Engine/archive/refs/tags/v%{version}.tar.gz#/%{name}-%{version}.tar.gz |
| 34 | +Source1: https://github.com/openssl/openssl/releases/download/%{openssl}/%{openssl}.tar.gz#/%{openssl}.tar.gz |
| 35 | +Source2: https://downloadmirror.intel.com/783270/%{qatdriver}.tar.gz#/%{qatdriver}.tar.gz |
| 36 | +%if !0%{?suse_version} |
| 37 | +Source3: https://github.com/intel/ipp-crypto/archive/refs/tags/%{ippcpver}.tar.gz#/%{ippcp}-%{ippcpver}.tar.gz |
| 38 | +Source4: https://github.com/intel/intel-ipsec-mb/archive/refs/tags/v%{ipsecver}.tar.gz#/%{ipsecfull}.tar.gz |
| 39 | +%endif |
| 40 | + |
| 41 | +%description |
| 42 | +This package provides the Intel QuickAssist Technology OpenSSL Engine |
| 43 | +(an OpenSSL Plug-In Engine) which provides cryptographic acceleration |
| 44 | +for both hardware and optimized software using Intel QuickAssist Technology |
| 45 | +enabled Intel platforms. |
| 46 | + |
| 47 | +%prep |
| 48 | +%setup -b 0 |
| 49 | +%setup -b 1 |
| 50 | +%if !0%{?suse_version} |
| 51 | +%setup -b 3 |
| 52 | +%setup -b 4 |
| 53 | +%endif |
| 54 | +# Setup Source2 driver package manually |
| 55 | +mkdir -p %{_builddir}/%{qatdriver} |
| 56 | +tar -zxvf %{_sourcedir}/%{qatdriver}.tar.gz -C %{_builddir}/%{qatdriver} |
| 57 | +cp -rf %{_builddir}/%{name}-%{version}/fips/driver_install.sh %{_builddir} |
| 58 | + |
| 59 | +%build |
| 60 | +cd %{_builddir}/%{openssl} |
| 61 | +./config --prefix=%{_builddir}/openssl_install |
| 62 | +%make_build |
| 63 | +make install |
| 64 | +mkdir -p %{buildroot}/%{_prefix}/local/ssl/lib64 |
| 65 | +mkdir -p %{buildroot}/%{_prefix}/local/ssl/bin |
| 66 | +mkdir -p %{buildroot}/%{_prefix}/local/ssl/include |
| 67 | +mkdir -p %{buildroot}/%{_prefix}/local/lib |
| 68 | +mkdir -p %{buildroot}/%{_prefix}/lib |
| 69 | +cp -rf %{_builddir}/openssl_install/lib64/libcrypto.so.3 %{buildroot}/%{_prefix}/local/ssl/lib64 |
| 70 | +cp -rf %{_builddir}/openssl_install/lib64/libssl.so.3 %{buildroot}/%{_prefix}/local/ssl/lib64 |
| 71 | +cp -rf %{_builddir}/openssl_install/bin %{buildroot}/%{_prefix}/local/ssl/ |
| 72 | +cp -rf %{_builddir}/openssl_install/include %{buildroot}/%{_prefix}/local/ssl/ |
| 73 | +cd %{buildroot}/%{_prefix}/local/ssl/lib64 |
| 74 | +ln -sf libcrypto.so.3 libcrypto.so |
| 75 | +ln -sf libssl.so.3 libssl.so |
| 76 | + |
| 77 | +cd %{_builddir}/%{qatdriver} |
| 78 | +unset ICP_ROOT |
| 79 | +unset ICP_BUILD_OUTPUT |
| 80 | +./configure |
| 81 | +%make_build |
| 82 | + |
| 83 | +%if !0%{?suse_version} |
| 84 | +cd %{_builddir}/%{ippcpfull}/sources/ippcp/crypto_mb |
| 85 | +cmake . -B"build" -DOPENSSL_INCLUDE_DIR=%{openssl_install}/include -DOPENSSL_LIBRARIES=%{openssl_install} -DOPENSSL_ROOT_DIR=%{openssl_source} |
| 86 | +cd build |
| 87 | +%make_build |
| 88 | + |
| 89 | +install -d %{buildroot}/%{_includedir}/crypto_mb |
| 90 | +cp -rf %{_builddir}/%{ippcpfull}/sources/ippcp/crypto_mb/include/crypto_mb/*.h /%{buildroot}/%{_includedir}/crypto_mb/ |
| 91 | +install -d %{buildroot}/%{_libdir} |
| 92 | +cp %{_builddir}/%{ippcpfull}/sources/ippcp/crypto_mb/build/bin/libcrypto_mb.so.%{ippcpfullversion} %{buildroot}/%{_libdir} |
| 93 | +cd %{buildroot}/%{_libdir} |
| 94 | + |
| 95 | +ln -sf libcrypto_mb.so.%{ippcpfullversion} libcrypto_mb.so.%{ippcp_major} |
| 96 | +ln -sf libcrypto_mb.so.%{ippcpfullversion} libcrypto_mb.so |
| 97 | + |
| 98 | +cp -rf %{buildroot}/%{_libdir}/libcrypto_mb.so.%{ippcpfullversion} %{buildroot}/%{_prefix}/local/lib |
| 99 | +cp -rf %{buildroot}/%{_libdir}/libcrypto_mb.so.%{ippcp_major} %{buildroot}/%{_prefix}/local/lib |
| 100 | +cp -rf %{buildroot}/%{_libdir} libcrypto_mb.so %{buildroot}/%{_prefix}/local/lib |
| 101 | + |
| 102 | +cd %{_builddir}/%{ipsecfull} |
| 103 | +cd lib |
| 104 | +%make_build |
| 105 | + |
| 106 | +install -d %{buildroot}/%{_includedir} |
| 107 | +install -m 0644 %{_builddir}/%{ipsecfull}/lib/intel-ipsec-mb.h %{buildroot}/%{_includedir} |
| 108 | +cp %{buildroot}/%{_includedir}/intel-ipsec-mb.h /usr/include/ |
| 109 | +install -s -m 0755 %{_builddir}/%{ipsecfull}/lib/libIPSec_MB.so.%{fullversion} %{buildroot}/%{_libdir} |
| 110 | +cp -rf %{_builddir}/%{ipsecfull}/lib/libIPSec_MB.so.%{fullversion} %{buildroot}/%{_prefix}/lib |
| 111 | +cp -rf %{_builddir}/%{ipsecfull}/lib/libIPSec_MB.so %{buildroot}/%{_prefix}/lib |
| 112 | +cp -rf %{_builddir}/%{ipsecfull}/lib/libIPSec_MB.so.%{major} %{buildroot}/%{_prefix}/lib |
| 113 | + |
| 114 | +cd %{buildroot}/%{_libdir} |
| 115 | +ln -sf libIPSec_MB.so.%{fullversion} libIPSec_MB.so.%{major} |
| 116 | +ln -sf libIPSec_MB.so.%{fullversion} libIPSec_MB.so |
| 117 | +%endif |
| 118 | + |
| 119 | +cd %{_builddir}/%{name}-%{version} |
| 120 | +autoreconf -ivf |
| 121 | + |
| 122 | +%if !0%{?suse_version} |
| 123 | +# Enable QAT_HW & QAT_SW Co-existence acceleration |
| 124 | +./configure --with-openssl_install_dir=%{openssl_install} --with-qat_hw_dir=%{_builddir}/%{qatdriver} --enable-qat_sw |
| 125 | +%else |
| 126 | +# Enable QAT_HW acceleration for SUSE |
| 127 | +./configure --with-openssl_install_dir=%{openssl_install} --with-qat_hw_dir=%{_builddir}/%{qatdriver} |
| 128 | +%endif |
| 129 | +%make_build |
| 130 | + |
| 131 | +install -d %{buildroot}/%{_prefix}/local/ssl/lib64/engines-3 |
| 132 | +cp -rf %{_builddir}/%{name}-%{version}/.libs/qatengine.so %{buildroot}/%{_prefix}/local/ssl/lib64/engines-3 |
| 133 | + |
| 134 | +install -d %{buildroot}/%{_libdir}/build |
| 135 | +cp -rf %{_builddir}/%{name}-%{version}/qat_hw_config/4xxx/multi_process/4xxx_dev0.conf %{buildroot}/%{_libdir}/build |
| 136 | +cp -rf %{_builddir}/%{qatdriver}/build/libusdm_drv_s.so %{buildroot}/%{_libdir} |
| 137 | +cp -rf %{_builddir}/%{qatdriver}/build/libqat_s.so %{buildroot}/%{_libdir} |
| 138 | +cp -rf %{_builddir}/%{qatdriver}/build %{buildroot}/%{_libdir} |
| 139 | +cp %{_builddir}/%{name}-%{version}/fips/driver_install.sh %{buildroot}/%{_libdir} |
| 140 | + |
| 141 | +%post |
| 142 | + echo "RPM is getting installed" |
| 143 | +if (lspci | grep Co- >/dev/null ) |
| 144 | +then |
| 145 | + ./%{_libdir}/driver_install.sh |
| 146 | +fi |
| 147 | + |
| 148 | +%clean |
| 149 | +rm -rf %{buildroot} |
| 150 | + |
| 151 | +%files |
| 152 | +%exclude %{_prefix}/local/lib/lib64 |
| 153 | +%{_prefix}/local/ssl/lib64/engines-3/qatengine.so |
| 154 | +%{_prefix}/local/ssl/lib64 |
| 155 | +%{_prefix}/local/ssl/bin |
| 156 | +%{_prefix}/local/ssl/include |
| 157 | +%{_libdir}/libqat_s.so |
| 158 | +%{_libdir}/libusdm_drv_s.so |
| 159 | +%{_libdir}/build |
| 160 | +%{_libdir}/driver_install.sh |
| 161 | +%license LICENSE* |
| 162 | +%doc README.md docs* |
| 163 | + |
| 164 | +%if !0%{?suse_version} |
| 165 | +%{_libdir}/libcrypto_mb.so.%{ippcpfullversion} |
| 166 | +%{_libdir}/libcrypto_mb.so.%{ippcp_major} |
| 167 | +%{_libdir}/libcrypto_mb.so |
| 168 | + |
| 169 | +%{_libdir}/libIPSec_MB.so.%{fullversion} |
| 170 | +%{_libdir}/libIPSec_MB.so.%{major} |
| 171 | +%{_libdir}/libIPSec_MB.so |
| 172 | + |
| 173 | +%{_prefix}/lib/libIPSec_MB.so.%{fullversion} |
| 174 | +%{_prefix}/lib/libIPSec_MB.so.%{major} |
| 175 | +%{_prefix}/lib/libIPSec_MB.so |
| 176 | + |
| 177 | +%{_prefix}/local/lib/libcrypto_mb.so.%{ippcpfullversion} |
| 178 | +%{_prefix}/local/lib/libcrypto_mb.so.%{ippcp_major} |
| 179 | +%{_prefix}/local/lib/libcrypto_mb.so |
| 180 | + |
| 181 | +%{_includedir}/crypto_mb |
| 182 | +%{_includedir}/intel-ipsec-mb.h |
| 183 | +%endif |
0 commit comments