From bbf050d5f1eb525e881c7d581f913f2df27d2637 Mon Sep 17 00:00:00 2001 From: Zhangfei Gao Date: Tue, 13 Jun 2023 09:24:19 +0000 Subject: [PATCH 7/7] README: update openssl 3.0 Update build steps for openssl 3.0 Also update sanity_test.sh If ./configure --libdir=/usr/local/lib/ossl-modules/ $ ./test/sanity_test.sh If ./configure --prefix=/tmp/build $ ./test/sanity_test.sh /tmp/build/lib/uadk_provider.so Signed-off-by: Zhangfei Gao --- README.md | 34 ++++++++++++++++++++++++++------ test/sanity_test.sh | 48 +++++++++++++++++++++++++++++++++++++++------ 2 files changed, 70 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ac721e3..86676db 100644 --- a/README.md +++ b/README.md @@ -13,7 +13,7 @@ OpenSSL engine for uadk Prerequisites ============= * CPU: aarch64 -* OpenSSL: 1.1.1f +* OpenSSL: 1.1.1f or 3.0 * libnuma * zlib @@ -26,24 +26,26 @@ Build and install OpenSSL ``` git clone https://github.com/openssl/openssl.git cd openssl - git checkout -b OpenSSL_1_1_1f OpenSSL_1_1_1f + // For openssl1.1.1f + git checkout -b opensssl1.1 OpenSSL_1_1_1f + // for openssl 3.0 + git checkout -b openssl3.0 openssl-3.0.0 ./config make sudo make install openssl version ``` -Run pkg-config to ensure env is setup correctly +Setup env on-demand ----------------------------------------------- ``` $ export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/ $ pkg-config libcrypto --libs -L/usr/local/lib -lcrypto -``` -* export ``PKG_CONFIG_PATH`` is required on openEuler, - where /usr/local/lib is not set as the default pkgconfig search path. + $ export LD_LIBRARY_PATH=/usr/local/lib +``` Build and install UADK ---------------------- @@ -63,6 +65,7 @@ Build and install UADK Build and install UADK Engine ----------------------------- +For openssl 1.1 ``` git clone https://github.com/Linaro/uadk_engine.git cd uadk_engine @@ -74,6 +77,20 @@ Build and install UADK Engine Option --enable-kae can be chosen to enable KAE for non-sva version ``` +For openssl 3.0 +``` + git clone https://github.com/Linaro/uadk_engine.git + cd uadk_engine + autoreconf -i + // openEuler + ./configure --libdir=/usr/local/lib/engines-3/ + // ubuntu + ./configure --libdir=/usr/local/lib/ossl-modules/ + make + sudo make install + +``` + Testing ------- ``` @@ -109,9 +126,14 @@ Install libraries to the temp folder $ ./configure --prefix=/tmp/build $ make; make install + // For openssl 1.1 $ openssl engine -c /tmp/build/lib/uadk_engine.so $ ./test/sanity_test.sh /tmp/build/lib/uadk_engine.so + // For openssl 3.0 + $ openssl speed -provider /tmp/build/lib/uadk_provider.so -provider default -evp md5 + $ ./test/sanity_test.sh /tmp/build/lib/uadk_provider.so + ``` Environment variable of uadk engine diff --git a/test/sanity_test.sh b/test/sanity_test.sh index bdedc15..899d02c 100755 --- a/test/sanity_test.sh +++ b/test/sanity_test.sh @@ -2,14 +2,50 @@ sudo chmod 666 /dev/hisi_* -if [ ! -n "$1" ]; then - engine_id=uadk_engine -else - engine_id=$1 + +version=$(openssl version) +echo $version +if [[ $version =~ "3.0" ]]; then + echo "openssl 3.0" + if [ ! -n "$1" ]; then + engine_id=uadk_provider + else + engine_id=$1 + fi + + digest_algs=$(openssl list -provider $engine_id -digest-algorithms) +fi + +if [[ $digest_algs =~ "uadk_provider" ]]; then + echo "uadk_provider testing digest" + openssl speed -provider $engine_id -provider default -evp md5 + openssl speed -provider $engine_id -provider default -evp sm3 + openssl speed -provider $engine_id -provider default -evp sha1 + openssl speed -provider $engine_id -provider default -evp sha2-224 + openssl speed -provider $engine_id -provider default -evp sha2-256 + openssl speed -provider $engine_id -provider default -evp sha2-384 + openssl speed -provider $engine_id -provider default -evp sha2-512 + + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp md5 + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp sm3 + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp sha1 + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp sha2-224 + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp sha2-256 + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp sha2-384 + openssl speed -provider $engine_id -provider default -async_jobs 1 -evp sha2-512 fi -algs=$(openssl engine -c $engine_id) -echo $algs +if [[ $version =~ "1.1.1" ]]; then + echo "openssl 1.1.1" + if [ ! -n "$1" ]; then + engine_id=uadk_engine + else + engine_id=$1 + fi + + algs=$(openssl engine -c $engine_id) + echo $algs +fi #digest if [[ $algs =~ "MD5" ]]; then -- 2.25.1