MCUX CLNS MCUX Crypto Library Normal Secure |

Macros
Looping flow protection
MCUX CSSL &ndash; API » Flow Protection API

Support for flow protected loops. More...

## Macros

#define | MCUX_CSSL_FP_LOOP_DECL(id)
| Declaration of a flow protected loop. More...
#define | MCUX_CSSL_FP_LOOP_ITERATION(...)
| Perform a loop iteration. More...
#define | MCUX_CSSL_FP_LOOP_ITERATIONS(id, count)
| Expected number of loop iterations. More...

## Detailed Description

Support for flow protected loops.

Declaration
  MCUX_CSSL_FP_LOOP_DECL

Event
  MCUX_CSSL_FP_LOOP_ITERATION

Expectation
  MCUX_CSSL_FP_LOOP_ITERATIONS

## Macro Definition Documentation

## ◆ MCUX_CSSL_FP_LOOP_DECL

#define MCUX_CSSL_FP_LOOP_DECL | ( |  | id | ) |

Declaration of a flow protected loop.

To inform the flow protection mechanism about a loop that needs to be protected, a loop identifier needs to be declared. This identifier can then be used in the event and expectation macros. For example:

MCUX_CSSL_FP_LOOP_DECL(someLoopIdentifier);
for (uint32_t i = 0; i < 8; ++i)
{
MCUX_CSSL_FP_LOOP_ITERATION(someLoopIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
MCUX_CSSL_FP_LOOP_ITERATIONS(someLoopIdentifier, 8)
);

Event
  MCUX_CSSL_FP_LOOP_ITERATION

Expectation
  MCUX_CSSL_FP_LOOP_ITERATIONS

Parameters

  id | Identifier for the loop that is flow protected.

## ◆ MCUX_CSSL_FP_LOOP_ITERATION

#define MCUX_CSSL_FP_LOOP_ITERATION | ( |  | ... | ) |

Perform a loop iteration.

This loop iteration macro informs the flow mechanism that an iteration event is performed for the loop declared by MCUX_CSSL_FP_LOOP_DECL with the given `id`. For example:

MCUX_CSSL_FP_LOOP_DECL(someLoopIdentifier);
for (uint32_t i = 0; i < 8; ++i)
{
MCUX_CSSL_FP_LOOP_ITERATION(someLoopIdentifier);
}

Declaration
  MCUX_CSSL_FP_LOOP_DECL

Expectation
  MCUX_CSSL_FP_LOOP_ITERATIONS

Parameters

  ... | The following parameters need to be passed (comma separated):
  - id: Identifier for the loop that is flow protected.
  - expect: Zero or more (comma separated) declarations of expected code flow behavior related to this event.

## ◆ MCUX_CSSL_FP_LOOP_ITERATIONS

#define MCUX_CSSL_FP_LOOP_ITERATIONS | ( |  | id,
|  |  | count
| ) |  |

Expected number of loop iterations.

This expectation macro indicates to the flow protection mechanism that the loop declared by MCUX_CSSL_FP_LOOP_DECL with the given `id` has made `count` iterations. For example:

MCUX_CSSL_FP_LOOP_DECL(someLoopIdentifier);
for (uint32_t i = 0; i < 8; ++i)
{
MCUX_CSSL_FP_LOOP_ITERATION(someLoopIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
MCUX_CSSL_FP_LOOP_ITERATIONS(someLoopIdentifier, 8)
);

Declaration
  MCUX_CSSL_FP_LOOP_DECL

Event
  MCUX_CSSL_FP_LOOP_ITERATION

See also
  MCUX_CSSL_FP_FUNCTION_ENTRY
  MCUX_CSSL_FP_FUNCTION_EXIT
  MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK
  MCUX_CSSL_FP_EXPECT

Parameters

  id | Identifier of the flow protected loop.
  count | Number of expected iterations.