KasperskyOS Community Edition 1.3
nk-psl-gen-c

The nk-psl-gen-c compiler generates the C-language source code of the Kaspersky Security Module based on the solution security policy description and the IDL, CDL, and EDL descriptions. This code is used by the makekss script.

The nk-psl-gen-c compiler can also generate the C-language source code of solution security policy tests based on solution security policy tests in PAL.

Syntax of the shell command for starting the nk-psl-gen-c compiler:

nk-psl-gen-c {-I|--include-dir} <SYSROOT_INCLUDE_DIR> [{-I|--include-dir} <DIR>]... [{-o|--output} <FILE>] [--out-tests <FILE>] [{-t|--tests} <ARG>] [{-a|--audit} <FILE>] [--enable-preprocessor] [--preprocessor-definition=<VAR_NAME>[=<VAR_VALUE>]]... [--preprocessor-dump-dir <DIR>] [-h|--help] [--version] <INPUT>

Parameters:

  • INPUT

    Path to the top-level file of the solution security policy description. This is normally the security.psl file.

  • {-I|--include-dir} <SYSROOT_INCLUDE_DIR>

    Path to the sysroot-*-kos/include directory from the KasperskyOS SDK.

  • {-I|--include-dir} <DIR>

    These parameters must be used to define the paths to directories containing IDL, CDL, and EDL files pertaining to the solution, and the paths to directories containing auxiliary files from the KasperskyOS SDK (common, toolchain/include).

  • {-o|--output} <FILE>

    Path to the file that will save the source code of the Kaspersky Security Module and (optionally) the source code of solution security policy tests. The path must include existing directories.

  • --out-tests <FILE>

    Path to the file that will save the source code of the solution security policy tests.

  • {-t|--tests} <ARG>

    Defines whether the source code of solution security policy tests must be generated. ARG can take the following values:

    • skip – source code of tests is not generated. This value is used by default if the {-t|--tests} <ARG> parameter is not specified.
    • generate – source code of tests is generated. If the source code of tests is generated, you are advised to use the --out-tests <FILE> parameter. Otherwise, the source code of tests will be saved in the same file containing the source code of the Kaspersky Security Module, which may lead to errors during the build.
  • {-a|--audit} <FILE>

    Path to the file that will save the C-language source code of the audit decoder.

  • --enable-preprocessor

    Enables the Ginger template engine.

  • --preprocessor-definition=<VAR_NAME>[=<VAR_VALUE>]

    These parameters must be used to define the variables that are utilized when expanding Ginger PSL templates. For example, --preprocessor-definition=foo=bar sets the foo variable to bar, and --preprocessor-definition=USE_DYNLD sets the USE_DYNLD variable to TRUE. The USE_DYNLD variable is set to TRUE because variables used when expanding Ginger PSL templates are set to TRUE by default.

  • --preprocessor-dump-dir <DIR>

    Path to the directory where PSL files received from Ginger PSL templates will be stored. These PSL files are needed only to verify what was obtained as a result of expanding Ginger PSL templates, and are not used to generate source code of the Kaspersky Security Module. (When source code of the security module is generated, Ginger PSL templates are expanded in memory irrespective of whether or not the --preprocessor-dump-dir <DIR> parameter is being used.) The names of PSL files are generated based on the absolute paths to Ginger PSL templates. For example, the PSL file named foo!bar!baz.psl corresponds to the Ginger PSL template located at the path /foo/bar/baz.psl.

  • -h|--help

    Prints the Help text.

  • --version

    Prints the version of the nk-psl-gen-c compiler.