Installation Using RPM Packages
KAE 1.0 RPM software packages include hisi_hpre, hisi_sec2, hisi_rde, hisi_zip, libkaezip, libkae, UACCE, and libwd. UACCE and libwd are required, and the others are optional. To upgrade KAE, uninstall the old version and then install the new version.
Prerequisites
- The RPM tool is available.
- The OpenSSL version is 1.1.1x (run the openssl version command to query). If not, install OpenSSL based on Installing OpenSSL/Tongsuo.
- Set the OpenSSL environment variable OPENSSL_ENGINES to the directory where the KAE dynamic library is stored so that OpenSSL can detect KAE.
1export OPENSSL_ENGINES=/usr/local/lib/engines-1.1
Procedure
In KAE 1.0, the hisi_hpre, hisi_sec2, hisi_rde, and hisi_zip driver software packages depend on the UACCE software package, and the libkae and libkaezip engine software packages depend on the libwd software package.
- If only the RSA and DH algorithms need to be accelerated, you are advised to install only the UACCE, hisi_hpre, libwd, and libkae software packages.
- If only AES, MD5, SM3, and SM4 need to be accelerated, you are advised to install only the UACCE, hisi_sec2, libwd, and libkae software packages.
- If only the zlib library compression algorithm needs to be accelerated, install only the UACCE, hisi_zip, libwd, and libkaezip packages.
- Use SSH to remotely log in to the Linux CLI as the root user.
- Download the RPM packages suitable for your OS version by referring to Obtaining Software Packages and copy the obtained KAE 1.0 RPM software packages to a custom path.
- Install the accelerator driver software packages.
- Method 1: If OpenSSL has been installed using the preceding default method, run the rpm -ivh *.rpm command to install all KAE RPM software packages.
1rpm -ivh *.rpm
If the following information is displayed, the installation is successful:1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
Preparing... ################################# [100%] checking installed modules Updating / installing... 1:uacce-1.0.1-1.centos7.6 ################################# [ 14%] modules installed 2:libwd-1.0.1-1.centos7.6 ################################# [ 29%] 3:libkae-1.0.1-1.centos7.6 ################################# [ 43%] checking installed modules 4:hisi_hpre-1.0.1-1.centos7.6 ################################# [ 57%] modules installed checking installed modules 5:hisi_rde-1.0.1-1.centos7.6 ################################# [ 71%] modules installed checking installed modules 6:hisi_sec2-1.0.1-1.centos7.6 ################################# [ 86%] modules installed checking installed modules
- Method 2: Install the RPM packages in sequence. See the following example to install the uacce-1.0.1 software package.
1rpm -ivh uacce-1.0.1-1.centos7.6.aarch64.rpm
If the following information is displayed, the installation is successful:1 2 3 4 5
Preparing... ################################# [100%] checking installed modules Updating / installing... 1:uacce-1.0.1-1.centos7.6 ################################# [100%] modules installed
Install the hisi_hpre, hisi_sec2, hisi_rde and hisi_zip driver software packages and the libwd and libkae engine software packages in sequence. Replace the RPM package name in the command with the actual one. When installing the libkae engine software package, use --prefix to specify the OpenSSL engine path. The command and command output are as follows:
1rpm -ivh libkae-1.0.1-1.centos7.6.aarch64.rpm --prefix=/usr/local/openssl/lib/engines-1.1
--prefix=/usr/local/openssl/lib/engines-1.1 indicates that the OpenSSL installation path is /usr/local/openssl.
- Method 1: If OpenSSL has been installed using the preceding default method, run the rpm -ivh *.rpm command to install all KAE RPM software packages.
- Check whether the RPM packages are installed in the system.
- Check whether UACCE is installed.
1rpm -ql uacce
Command output:1 2
/lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/hisi_qm.ko /lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/uacce.ko
- Check whether hisi_sec2, hisi_hpre, and hisi_rde are installed.
1rpm -ql hisi_sec2 hisi_hpre hisi_rde hisi_zip
Command output:1 2 3 4 5 6 7 8
/lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/hisi_sec2.ko /etc/modproe.d/hisi_sec2.conf /lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/hisi_hpre.ko /etc/modproe.d/hisi_hpre.conf /lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/hisi_rde.ko /etc/modproe.d/hisi_rde.conf /lib/modules/4.14.0-115.el7a.0.1.aarch64/extra/hisi_zip.ko /etc/modproe.d/hisi_zip.conf
- Check whether the corresponding modules are generated in the installation directory.
1ls -al /lib/modules/`uname -r`/extra
Command output:1 2 3 4 5 6 7 8 9
total 3672 drwxr-xr-x. 2 root root 118 Nov 17 21:56 . drwxr-xr-x. 7 root root 4096 Nov 17 21:56 .. -rw-r--r--. 1 root root 681104 Nov 12 17:32 hisi_hpre.ko -rw-r--r--. 1 root root 618888 Nov 12 17:32 hisi_qm.ko -rw-r--r--. 1 root root 844728 Nov 12 17:32 hisi_rde.ko -rw-r--r--. 1 root root 729304 Nov 12 17:32 hisi_sec2.ko -rw-r--r--. 1 root root 396784 Nov 12 17:32 hisi_zip.ko -rw-r--r--. 1 root root 467160 Nov 12 17:32 uacce.ko
- Check whether the corresponding configuration files are generated in /etc/modprobe.d/.
1ls -al /etc/modprobe.d/
Command output:1 2 3 4 5 6 7 8 9
total 36 drwxr-xr-x. 2 root root 140 Nov 17 21:56 . drwxr-xr-x. 127 root root 8192 Nov 17 22:14 .. -rw-r--r--. 1 root root 166 Oct 30 2018 firewalld-sysctls.conf -rw-r--r--. 1 root root 44 Nov 17 21:56 hisi_hpre.conf -rw-r--r--. 1 root root 43 Nov 17 21:56 hisi_rde.conf -rw-r--r--. 1 root root 61 Nov 17 21:56 hisi_sec2.conf -rw-r--r--. 1 root root 43 Nov 17 21:56 hisi_zip.conf -rw-r--r--. 1 root root 674 Jul 4 2018 tuned.conf
- Check whether UACCE is installed.
- Optional: If a SUSE OS is used, set allow_unsupported_modules in the /etc/modprobe.d/10-unsupported-modules.conf file to 1 before loading external drivers.
- Load the accelerator drivers to the kernel.
- Method 1: Restart the system.
- Method 2: Manually load the drivers in sequence in the CLI and check whether the loading is successful.
- Query UACCE driver modules that have been loaded to the kernel.
1lsmod | grep uacce
If no command output is displayed, perform 6.b to 6.f to load the corresponding modules to the kernel.
- Load the UACCE driver.
1modprobe uacce - Load the hisi_sec2 driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_sec2.conf.
1modprobe hisi_sec2 - Load the hisi_hpre driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_hpre.conf.
1modprobe hisi_hpre - Load the hisi_rde driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_rde.conf.
1modprobe hisi_rde - Load the hisi_zip driver to the kernel based on the configuration file in /etc/modprobe.d/hisi_zip.conf.
1modprobe hisi_zip - Query UACCE driver modules that have been loaded to the kernel again.
1lsmod | grep uacce
If the following information is displayed, the loading is successful:1uacce 36864 3 hisi_sec2,hisi_qm,hisi_hpre,hisi_rde,hisi_zip
- Query UACCE driver modules that have been loaded to the kernel.
Verifying the Installation
- Check KAE RPM software packages.
1rpm -qa uacce hisi_sec2 hisi_hpre hisi_rde hisi_zip
If the following information is displayed, the installation is successful:1 2 3 4 5
hisi_rde-1.0.1-1.centos7.6.aarch64 hisi_sec2-1.0.1-1.centos7.6.aarch64 uacce-1.0.1-1.centos7.6.aarch64 hisi_hpre-1.0.1-1.centos7.6.aarch64 hisi_zip-1.0.1-1.centos7.6.aarch64
- Check the accelerator devices in the virtual file system.
1ls -al /sys/class/uacce/
Command output:1 2 3 4 5 6 7 8 9
total 0 lrwxrwxrwx. 1 root root 0 Nov 14 03:45 hisi_hpre-2 -> ../../devices/pci0000:78/0000:78:00.0/0000:79:00.0/uacce/hisi_hpre-2 lrwxrwxrwx. 1 root root 0 Nov 14 03:45 hisi_hpre-3 -> ../../devices/pci0000:b8/0000:b8:00.0/0000:b9:00.0/uacce/hisi_hpre-3 lrwxrwxrwx. 1 root root 0 Nov 17 22:09 hisi_rde-4 -> ../../devices/pci0000:78/0000:78:01.0/uacce/hisi_rde-4 lrwxrwxrwx. 1 root root 0 Nov 17 22:09 hisi_rde-5 -> ../../devices/pci0000:b8/0000:b8:01.0/uacce/hisi_rde-5 lrwxrwxrwx. 1 root root 0 Nov 14 08:39 hisi_sec-0 -> ../../devices/pci0000:74/0000:74:01.0/0000:76:00.0/uacce/hisi_sec-0 lrwxrwxrwx. 1 root root 0 Nov 14 08:39 hisi_sec-1 -> ../../devices/pci0000:b4/0000:b4:01.0/0000:b6:00.0/uacce/hisi_sec-1 lrwxrwxrwx. 1 root root 0 Nov 17 22:09 hisi_zip-6 -> ../../devices/pci0000:74/0000:74:00.0/0000:75:00.0/uacce/hisi_zip-6 lrwxrwxrwx. 1 root root 0 Nov 17 22:09 hisi_zip-7 -> ../../devices/pci0000:b4/0000:b4:00.0/0000:b5:00.0/uacce/hisi_zip-7
- Check whether KAEOpensslEngine takes effect.
The RSA performance is used as an example. For details about the verification procedure, see Testing the RSA Algorithm Performance in Synchronous Mode. The command output shows that the RSA performance is significantly improved after KAE is specified.
In addition, during the execution of the RSA performance verification command, you can view the hardware queue resource usage of the hisi_hpre device on a new terminal. Similarly, you can view the hardware queue resource usage of the hisi_sec2 device when verifying the SM3/SM4 algorithm performance.
1cat /sys/class/uacce/hisi_hpre-*/attrs/available_instancesYou can also run the following command to refresh the hardware queue consumption of hisi_hpre every 0.1 second:1watch -n 0.1 cat /sys/class/uacce/hisi_hpre-*/attrs/available_instances
If the value changes from 256 to 255, the RSA algorithm consumes a hardware queue of the HPRE accelerator, indicating that KAEOpensslEngine has taken effect.
- Check whether the accelerator engines of the zlib library take effect.Run the ldd command to check whether the zlib library is linked to libwd and libkaezip.
1ldd /usr/local/kaezip/lib/libz.so.1.2.11If the following information is displayed, the zlib library has been installed. You can also run the ldd command to check whether libwd and libkaezip are used.1 2 3 4 5
linux-vdso.so.1 => (0x0000ffff80280000) libc.so.6 => /lib64/libc.so.6 (0x0000ffff80080000) libwd.so.1 => /lib64/libwd.so.1 (0x0000ffff80040000) /lib/ld-linux-aarch64.so.1 (0x0000ffff80290000) libkaezip.so => /usr/local/kaezip/lib/libkaezip.so (0x0000ffff80830000)