KasperskyOS Community Edition 1.3

Math security model

Math security model object

The basic.psl file contains a declaration that creates a Math security model object named math. Consequently, inclusion of the basic.psl file into the solution security policy description will create a Math security model object by default.

A Math security model object does not have any parameters and cannot be covered by a security audit.

It is not necessary to create additional Math security model objects.

Math security model methods

The Math security model contains expressions that perform integer arithmetic operations, bitwise operations, and integer type casting operations. To call a part of these expressions, use the following arithmetic operators:

  • <Number> + <Number> – "addition". Returns values of the Number type.
  • <Number> - <Number> – "subtraction". Returns values of the Number type.
  • <Number> * <Number> – "multiplication". Returns values of the Number type.
  • <Number> | <Number> – "bitwise OR". Returns values of the Number type.
  • <Number> & <Number> – "bitwise AND". Returns values of the Number type.
  • ~ <Number> – "bitwise complement". Returns values of the Number type.

The other expressions are as follows:

  • neg (<Signed>) – "change number sign". Returns values of the Signed type.
  • abs (<Signed> ) – "get module of number". Returns values of the Signed type.
  • sum (<List<Number>>) – "add numbers from list". Returns values of the Number type. It returns 0 if an empty list of values ([]) is passed via the parameter.
  • product (<List<Number>>) – "multiple numbers from list". Returns values of the Number type. It returns 1 if an empty list of values ([]) is passed via the parameter.
  • uint64 (<Unsigned>) – "casting to type UInt64".
  • uint32 (<UInt8 | UInt16 | UInt32>) – "casting to type UInt32".
  • uint16 (<UInt8 | UInt16>) – "casting to type UInt16".
  • sint64 (<Signed | UInt8 | UInt16 | UInt32>) – "casting to type SInt64".
  • sint32 (<SInt8 | SInt16 | SInt32 | UInt8 | UInt16>) – "casting to type SInt32".
  • sint16 (<SInt8 | SInt16 | UInt8>) – "casting to type SInt16".
  • signedToUInt64 (<Signed>) – "casting to type UInt64". Negative numbers are converted to positive numbers by subtracting them from 2^64. For example, -1 is converted to 2^64-1.
  • signedToUInt32 (<SInt8 | SInt16 | SInt32>) – "casting to type UInt32". Negative numbers are converted to positive numbers by subtracting them from 2^32. For example, -3 is converted to 2^32-3.
  • signedToUInt16 (<SInt8 | SInt16>) – "casting to type UInt16". Negative numbers are converted to positive numbers by subtracting them from 2^16. For example, -5 is converted to 2^16-5.
  • signedToUInt8 (<SInt8>) – "casting to type UInt8". Negative numbers are converted to positive numbers by subtracting them from 2^8. For example, -7 is converted to 2^8-7.

To call these expressions, use the following construct:

math.<expression name> (<parameter>)