MCUX CLNS MCUX Crypto Library Normal Secure |

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

Support for flow protected branches. More...

## Macros
#define | MCUX_CSSL_FP_BRANCH_DECL(id)
| Declaration of a flow protected branch. More...
#define | MCUX_CSSL_FP_BRANCH_POSITIVE(...)
| Positive scenario for a branch is executed. More...
#define | MCUX_CSSL_FP_BRANCH_NEGATIVE(...)
| Negative scenario of a branch is executed. More...
#define | MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE(...)
| Expectation that positive branch has been taken. More...
#define | MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE(...)
| Expectation that negative branch has been taken. More...

## Detailed Description

Support for flow protected branches.

Declaration
  MCUX_CSSL_FP_BRANCH_DECL

Events
  MCUX_CSSL_FP_BRANCH_POSITIVE
  MCUX_CSSL_FP_BRANCH_NEGATIVE

Expectations
  MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE
  MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE

## Macro Definition Documentation

## ◆ MCUX_CSSL_FP_BRANCH_DECL

#define MCUX_CSSL_FP_BRANCH_DECL | ( |  | id | ) |

Declaration of a flow protected branch.

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

MCUX_CSSL_FP_BRANCH_DECL(someBranchIdentifier);
if (condition)
{
MCUX_CSSL_FP_BRANCH_POSITIVE(someBranchIdentifier);
}
else
{
MCUX_CSSL_FP_BRANCH_NEGATIVE(someBranchIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
MCUX_CSSL_FP_BRANCH_TAKEN(someBranchIdentifier,
MCUX_CSSL_FP_BRANCH_POSITIVE_SCENARIO, condition)
);

Events
  MCUX_CSSL_FP_BRANCH_POSITIVE
  MCUX_CSSL_FP_BRANCH_NEGATIVE

Expectations
  MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE
  MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE

Parameters

  id | Identifier for the branch that is flow protected.

## ◆ MCUX_CSSL_FP_BRANCH_POSITIVE

#define MCUX_CSSL_FP_BRANCH_POSITIVE | ( |  | ... | ) |

Positive scenario for a branch is executed.

This branch event macro informs the flow mechanism that the positive scenario of the branch is executed for the branch declared by MCUX_CSSL_FP_BRANCH_DECL with the given `id`. For example:

MCUX_CSSL_FP_BRANCH_DECL(someBranchIdentifier);
if (condition)
{
MCUX_CSSL_FP_BRANCH_POSITIVE(someBranchIdentifier);
}
else
{
MCUX_CSSL_FP_BRANCH_NEGATIVE(someBranchIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
MCUX_CSSL_FP_CONDITIONAL_IMPL(!condition,
MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE(someBranchIdentifier)
)
);

Declaration
  MCUX_CSSL_FP_BRANCH_DECL

Expectation
  MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE

Parameters

  ... | The following parameters need to be passed (comma separated): id: Identifier for the branch for which the positive scenario is executed. expect: Zero or more (comma separated) declarations of expected code flow behavior related to this event.

## ◆ MCUX_CSSL_FP_BRANCH_NEGATIVE

#define MCUX_CSSL_FP_BRANCH_NEGATIVE | ( |  | ... | ) |

Negative scenario of a branch is executed.

This branch event macro informs the flow mechanism that the positive scenario of the branch is executed for the branch declared by MCUX_CSSL_FP_BRANCH_DECL with the given `id`. For example:

MCUX_CSSL_FP_BRANCH_DECL(someBranchIdentifier);
if (condition)
{
MCUX_CSSL_FP_BRANCH_POSITIVE(someBranchIdentifier);
}
else
{
MCUX_CSSL_FP_BRANCH_NEGATIVE(someBranchIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
MCUX_CSSL_FP_CONDITIONAL_IMPL(!condition,
MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE(someBranchIdentifier)
)
);

Declaration
  MCUX_CSSL_FP_BRANCH_DECL

Expectation
  MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE

Parameters

  ... | The following parameters need to be passed (comma separated): id: Identifier for the branch for which the negative scenario is executed. expect: Zero or more (comma separated) declarations of expected code flow behavior related to this event.

## ◆ MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE

#define MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE | ( |  | ... | ) |

Expectation that positive branch has been taken.

This expectation macro indicates to the flow protection mechanism that the branch declared by MCUX_CSSL_FP_BRANCH_DECL with the given `id` has executed the positive scenario (under the given `condition`). For example:

MCUX_CSSL_FP_BRANCH_DECL(someBranchIdentifier);
if (condition)
{
MCUX_CSSL_FP_BRANCH_POSITIVE(someBranchIdentifier);
}
else
{
MCUX_CSSL_FP_BRANCH_NEGATIVE(someBranchIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
// Providing the condition as part of the branch expectation.
// Alternatively, the expectation can be placed in a conditional block.
MCUX_CSSL_FP_BRANCH_TAKEN_POSITIVE(someBranchIdentifier, condition)
);

Declaration
  MCUX_CSSL_FP_BRANCH_DECL

Event
  MCUX_CSSL_FP_BRANCH_POSITIVE

See also
  MCUX_CSSL_FP_FUNCTION_ENTRY
  MCUX_CSSL_FP_FUNCTION_EXIT
  MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK
  MCUX_CSSL_FP_EXPECT
  MCUX_CSSL_FP_CONDITIONAL

Parameters

  ... | The following parameters need to be passed (comma separated): id: Identifier of the flow protected branch. condition: Optional, condition under which this branch is taken.

## ◆ MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE

#define MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE | ( |  | ... | ) |

Expectation that negative branch has been taken.

This expectation macro indicates to the flow protection mechanism that the branch declared by MCUX_CSSL_FP_BRANCH_DECL with the given `id` has executed the negative scenario (under the given `condition`). For example:

MCUX_CSSL_FP_BRANCH_DECL(someBranchIdentifier);
if (condition)
{
MCUX_CSSL_FP_BRANCH_POSITIVE(someBranchIdentifier);
}
else
{
MCUX_CSSL_FP_BRANCH_NEGATIVE(someBranchIdentifier);
}
// ...
MCUX_CSSL_FP_FUNCTION_EXIT(someFunction, 0,
// Providing the branch expectation as part of a conditional block.
// Alternatively, the condition can be provided in the branch expectation.
MCUX_CSSL_FP_CONDITIONAL(!condition,
MCUX_CSSL_FP_BRANCH_TAKEN_NEGATIVE(someBranchIdentifier)
)
);

Declaration
  MCUX_CSSL_FP_BRANCH_DECL

Event
  MCUX_CSSL_FP_BRANCH_NEGATIVE

See also
  MCUX_CSSL_FP_FUNCTION_ENTRY
  MCUX_CSSL_FP_FUNCTION_EXIT
  MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK
  MCUX_CSSL_FP_EXPECT
  MCUX_CSSL_FP_CONDITIONAL

Parameters

  ... | The following parameters need to be passed (comma separated): id: Identifier of the flow protected branch. condition: Optional, condition under which this branch is taken.