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

Installing KSL

This section describes how to install KSL using an RPM package and verify KSL 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 software package by referring to Obtaining the Software Package and decompress it to obtain the binary RPM package.
  3. Install KSL as the root user.
    1
    rpm -ivh boostkit-ksl-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. 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 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 folder contains the header files of the sub-libraries, the lib folder contains the dynamic library files of KSL, and the bin folder contains the compilation tool of KSL_ASN1.

  3. Add the path of the dynamic library to the GCC compilation option to link the required dynamic library file. After compilation, run the ldd command to check that the dependency library of the program is correctly linked.

    The HTL and KSL_ASN1 sub-libraries can be used together. To do so, you need to enable each sub-library separately.

    • To use HTL, add -I /usr/local/ksl/include -L /usr/local/ksl/lib -lhtl during compilation.
    • To use KSL_ASN1, add -I /usr/local/ksl/include -L /usr/local/ksl/lib -lhiasn1 during compilation.

      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).