Rate This Document
Findability
Accuracy
Completeness
Readability

Installation Using RPM Packages (KAE 2.0)

KAE 2.0 RPM software packages include kae-driver, kae-openssl, and kae-zip. To use encryption and decryption algorithms, you need to install kae-driver and kae-openssl. You can install other software packages as required to use corresponding modules and algorithms.

  • Currently, the RPM package of KAE 2.0 is built on a specified tag. It is dedicated to specific OSs and does not offer the latest features of KAE 2.0.
  • You are advised to install KAE 2.0 using the source code. To install KAE 2.0 using an RPM package on other OSs, perform the following steps to build an RPM package:
    1. Download the KAE 2.0 source package from https://gitee.com/kunpengcompute/KAE/tree/kae2/ or by running git clone https://gitee.com/kunpengcompute/KAE.git -b kae2.
    2. Run the yum install -y make kernel-devel libtool numactl-devel openssl-devel chrpath lz4-devel command to install dependencies.
    3. Run the sh build.sh rpmpack command in the KAE source code directory to build an RPM package.

Prerequisites

  • You have downloaded the RPM packages matching the OS. For KAE 2.0, download RPM packages of version v2.x.x from https://gitee.com/kunpengcompute/KAE/releases.
  • 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.
  • Run the yum install -y make kernel-devel libtool numactl-devel openssl-devel chrpath command to install dependencies.
  • Set the OpenSSL environment variable OPENSSL_ENGINES to the directory where the KAE dynamic library is stored so that OpenSSL can find KAE.
    1
    export OPENSSL_ENGINES=/usr/local/lib/engines-1.1
    

Procedure

  1. Use SSH to remotely log in to the Linux CLI as the root user.
  2. Copy the KAE 2.0 RPM software packages to a custom directory.
  3. Install the accelerator driver RPM package kae-driver.
    1
    rpm -ivh kae-driver-2.0.1-1.aarch64.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
    18
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Preprocessing before installing the driver
    checking installed modules
    uacce modules start to install
    checking installed modules
    hisi_sec2 modules start to install
    checking installed modules
    hisi_hpre modules start to install
    checking installed modules
    hisi_zip modules start to install
    Updating / installing...
       1:kae-driver-2.0.1-1               ################################# [100%]
    installing driver...
    uacce modules installed
    hisi_sec2 modules installed
    hisi_hpre modules installed
    hisi_zip modules installed
    
  4. Install the engine library RPM package kae-openssl.
    1
    rpm -ivh kae-openssl-2.0.1-1.aarch64.rpm
    
    If the following information is displayed, the installation is successful:
    1
    2
    3
    4
    5
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:kae-openssl-2.0.1-1              ################################# [100%]
    installing openssl engine...
    
  5. Check whether related software has been installed in the system.
    1. Check whether the drivers are installed.
      • Check whether the accelerator engine file system exists in /sys/class/uacce.
        1
        ll /sys/class/uacce/
        
        If the following information is displayed, the drivers have been installed:
        1
        2
        3
        4
        5
        6
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_hpre-2 -> ../../devices/pci0000:78/0000:78:00.0/0000:79:00.0/uacce/hisi_hpre-2
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_hpre-3 -> ../../devices/pci0000:b8/0000:b8:00.0/0000:b9:00.0/uacce/hisi_hpre-3
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_sec2-0 -> ../../devices/pci0000:74/0000:74:01.0/0000:76:00.0/uacce/hisi_sec2-0
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_sec2-1 -> ../../devices/pci0000:b4/0000:b4:01.0/0000:b6:00.0/uacce/hisi_sec2-1
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_zip-4 -> ../../devices/pci0000:74/0000:74:00.0/0000:75:00.0/uacce/hisi_zip-4
        lrwxrwxrwx. 1 root root 0 Aug 22 17:14 hisi_zip-5 -> ../../devices/pci0000:b4/0000:b4:00.0/0000:b5:00.0/uacce/hisi_zip-5
        
      • Use lsmod to check whether the drivers are successfully installed.
        1
        lsmod | grep uacce
        
        If the following information is displayed, the drivers have been installed:
        1
        uacce                  32768  3 hisi_sec2,hisi_qm,hisi_zip
        
    2. Check whether the UADK framework is installed.
      1
      ll /usr/local/lib/libwd*
      
      The installation is successful if the following information is displayed:
       1
       2
       3
       4
       5
       6
       7
       8
       9
      10
      11
      12
      -rwxr-xr-x. 1 root root     961 Aug 22 17:23 /usr/local/lib/libwd_comp.la
      lrwxrwxrwx. 1 root root      19 Aug 22 17:23 /usr/local/lib/libwd_comp.so -> libwd_comp.so.2.5.0
      lrwxrwxrwx. 1 root root      19 Aug 22 17:23 /usr/local/lib/libwd_comp.so.2 -> libwd_comp.so.2.5.0
      -rwxr-xr-x. 1 root root  377872 Aug 22 17:23 /usr/local/lib/libwd_comp.so.2.5.0
      -rwxr-xr-x. 1 root root     973 Aug 22 17:23 /usr/local/lib/libwd_crypto.la
      lrwxrwxrwx. 1 root root      21 Aug 22 17:23 /usr/local/lib/libwd_crypto.so -> libwd_crypto.so.2.5.0
      lrwxrwxrwx. 1 root root      21 Aug 22 17:23 /usr/local/lib/libwd_crypto.so.2 -> libwd_crypto.so.2.5.0
      -rwxr-xr-x. 1 root root  715616 Aug 22 17:23 /usr/local/lib/libwd_crypto.so.2.5.0
      -rwxr-xr-x. 1 root root     907 Aug 22 17:23 /usr/local/lib/libwd.la
      lrwxrwxrwx. 1 root root      14 Aug 22 17:23 /usr/local/lib/libwd.so -> libwd.so.2.5.0
      lrwxrwxrwx. 1 root root      14 Aug 22 17:23 /usr/local/lib/libwd.so.2 -> libwd.so.2.5.0
      -rwxr-xr-x. 1 root root 1342080 Aug 22 17:23 /usr/local/lib/libwd.so.2.5.0
      
    3. Check whether KAE is successfully installed.
      1
       ll /usr/local/lib/engines-1.1
      

      The installation is successful if the following information is displayed:

      1
      2
      3
      4
      5
      6
      total 5644
      -rw-r--r--. 1 root root 3846524 Aug 22 17:28 kae.a
      -rwxr-xr-x. 1 root root     995 Aug 22 17:28 kae.la
      lrwxrwxrwx. 1 root root      12 Aug 22 17:28 kae.so -> kae.so.2.0.0
      lrwxrwxrwx. 1 root root      12 Aug 22 17:28 kae.so.2 -> kae.so.2.0.0
      -rwxr-xr-x. 1 root root 1967736 Aug 22 17:28 kae.so.2.0.0
      

Verifying the Installation

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.

1
cat /sys/class/uacce/hisi_hpre-*/available_instances
You can also run the following command to refresh the hardware queue consumption of hisi_sec2 every 0.1 second:
1
watch -n 0.1 cat /sys/class/uacce/hisi_hpre-*/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.