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 theNumber
type. - <
Number
>-
<Number
> – "subtraction". Returns values of theNumber
type. - <
Number
>*
<Number
> – "multiplication". Returns values of theNumber
type. - <
Number
>|
<Number
> – "bitwise OR". Returns values of theNumber
type. - <
Number
>&
<Number
> – "bitwise AND". Returns values of theNumber
type. ~
<Number
> – "bitwise complement". Returns values of theNumber
type.
The other expressions are as follows:
neg (
<Signed
>)
– "change number sign". Returns values of theSigned
type.abs (
<Signed
>)
– "get module of number". Returns values of theSigned
type.sum (
<List<Number>
>)
– "add numbers from list". Returns values of theNumber
type. It returns0
if an empty list of values ([]
) is passed via the parameter.product (
<List<Number>
>)
– "multiple numbers from list". Returns values of theNumber
type. It returns1
if an empty list of values ([]
) is passed via the parameter.uint64 (
<Unsigned
>)
– "casting to typeUInt64
".uint32 (
<UInt8 | UInt16 | UInt32
>)
– "casting to typeUInt32
".uint16 (
<UInt8 | UInt16
>)
– "casting to typeUInt16
".sint64 (
<Signed | UInt8 | UInt16 | UInt32
>)
– "casting to typeSInt64
".sint32 (
<SInt8 | SInt16 | SInt32 | UInt8 | UInt16
>)
– "casting to typeSInt32
".sint16 (
<SInt8 | SInt16 | UInt8
>)
– "casting to typeSInt16
".signedToUInt64 (
<Signed
>)
– "casting to typeUInt64
". 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 typeUInt32
". 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 typeUInt16
". 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 typeUInt8
". 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: