我要评分
获取效率
正确性
完整性
易理解

Installing KSL_ASN1

This section describes how to install KSL_ASN1 using an RPM package and verify KSL_ASN1 after the installation.

Procedure

  1. Optional: To prevent buffer overflow attacks, you are advised to enable address space layout randomization (ASLR) before installing KSL.

    ASLR randomizes the layout of linear areas such as the heap, stack, and shared library mapping to make it more difficult for attackers to predict target addresses and locate code. This technology can be applied to heaps, stacks, and memory mapping areas (mmap base addresses, shared libraries, and vDSO pages).

    echo 2 >/proc/sys/kernel/randomize_va_space
  2. Obtain the KSL_ASN1 software package by referring to Obtaining the Software Package and decompress it to obtain the binary RPM package.
  3. To use the KSL_ASN1 independent software package, run the following command:
    rpm -ivh boostkit-hiasn1-xxxx.aarch64.rpm

    After the installation, the system automatically adds the path to the lib folder, that is, /usr/local/ksl/lib, to the environment variable LD_LIBRARY_PATH.

    In the preceding command, xxxx indicates the version number.

Verification

  1. If the environment variables on the current terminal do not take effect, run the source command or log in to the terminal again for the environment variables to take effect.
    1
    source /etc/profile
    
  2. Check whether the environment variable LD_LIBRARY_PATH contains the KSL_ASN1 installation path /usr/local/ksl/lib.
    1
    env | grep LD_LIBRARY_PATH
    

    If the command output contains the installation path, the installation is successful.

    1
    LD_LIBRARY_PATH=/usr/local/ksl/lib:
    

    After the installation, the corresponding files are generated in the installation path (the default path is /usr/local/ksl). The include/hiasn1 folder contains the header files of KSL_ASN1, the lib folder contains the dynamic library files, and the bin folder contains the compilation tool of KSL_ASN1.

  3. To use KSL_ASN1, add the dynamic library path to the GCC compilation option to link the required dynamic library file. The compilation option is -I /usr/local/ksl/include -L /usr/local/ksl/lib -lhiasn1. After the compilation, run the ldd command to check whether the program dependency libraries are correctly linked.

    The KSL_ASN1 compilation tool hiasn1cli is stored in /usr/local/ksl/bin. You can use it to parse ASN.1 scripts and convert ASN.1 scripts into C intermediate files (containing multiple source files and header files).