MCUX CLNS
MCUX Crypto Library Normal Secure
 
Loading...
Searching...
No Matches

Support for flow protected functions. More...

Macros

#define MCUX_CSSL_FP_FUNCTION_ID(id)
 Generator for function identifiers.
 
#define MCUX_CSSL_FP_FUNCTION_ID_ENTRY_MASK
 Mask to be used to derive entry part from a function identifier.
 
#define MCUX_CSSL_FP_FUNCTION_ID_ENTRY_PART(id)
 Part of the function identifier to be used at function entry.
 
#define MCUX_CSSL_FP_FUNCTION_ID_EXIT_PART(id)
 Part of the function identifier to be used at function exit.
 
#define MCUX_CSSL_FP_FUNCTION_DECL_IMPL(...)
 Declaration implementation of a flow protected function.
 
#define MCUX_CSSL_FP_FUNCTION_VALUE(id)
 Macro to get the value for a given function.
 
#define MCUX_CSSL_FP_FUNCTION_DEF_IMPL(...)
 Definition implementation of a flow protected function.
 
#define MCUX_CSSL_FP_RESULT_OFFSET
 Offset of the result in the return value.
 
#define MCUX_CSSL_FP_RESULT_MASK
 Bitmask of the result in the return value.
 
#define MCUX_CSSL_FP_RESULT_VALUE(result)
 Encode a result value for a protected return value.
 
#define MCUX_CSSL_FP_RESULT_IMPL2(type, return)
 Extract the result value from a protected return value.
 
#define MCUX_CSSL_FP_RESULT_IMPL1(return)
 Extract the result value from a protected return value.
 
#define MCUX_CSSL_FP_RESULT_IMPL(...)
 Extract the result value from a protected return value.
 
#define MCUX_CSSL_FP_PROTECTION_OFFSET
 Offset of the protection token in the return value.
 
#define MCUX_CSSL_FP_PROTECTION_MASK
 Bitmask of the protection token in the return value.
 
#define MCUX_CSSL_FP_PROTECTION_TOKEN_VALUE(token)
 Encode a protection token for a protected return value.
 
#define MCUX_CSSL_FP_PROTECTION_TOKEN_IMPL(return)
 Extract the protection token value from a protected return value.
 
#define MCUX_CSSL_FP_COUNTER_COMPRESSED()
 Compressed version of the secure counter that can be used as a protection token.
 
#define MCUX_CSSL_FP_FUNCTION_CALLED_IMPL(id)
 Expectation implementation of a called function.
 
#define MCUX_CSSL_FP_FUNCTION_ENTERED_IMPL(id)
 Expectation implementation of an entered (but not exited) function.
 
#define MCUX_CSSL_FP_PROTECTED_TYPE_IMPL(resultType)
 Based on a given base type, builds a return type with flow protection.
 
#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPLn(function, ...)
 Flow protection handler implementation for the function entry point.
 
#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL1(function)
 Flow protection handler implementation for the function entry point.
 
#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL(...)
 Flow protection handler implementation for the function entry point.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn(id, result, ...)
 Flow protection handler implementation for the function exit point.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL1(id)
 Flow protection handler implementation for the function exit point.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL2(id, result)
 Flow protection handler implementation for the function exit point.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL(...)
 Flow protection handler implementation for the function exit point.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPLn(id, pass, fail, ...)
 Flow protection handler implementation for the function exit point which includes an actual check of the code flow.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL3(id, pass, fail)
 Flow protection handler implementation for the function exit point which includes an actual check of the code flow.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL(...)
 Flow protection handler implementation for the function exit point which includes an actual check of the code flow.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL1(id)
 Flow protection handler for the exit point of functions with the return type void.
 
#define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL(...)
 Flow protection handler for the exit point of functions with the return type void.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL3(type, result, call)
 Event implementation of a flow protected function call.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL2(result, call)
 Event implementation of a flow protected function call.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL(...)
 Event implementation of a flow protected function call.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_IMPL(call)
 Event implementation of a flow protected void function call.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_PROTECTED_IMPL(result, token, call)
 Implementation of a flow protected function call meant to be used from within an unprotected function.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_PROTECTED_IMPL(token, call)
 Implementation of a flow protected void function call meant to be used from within an unprotected function.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL(result, token, call)
 Implementation of a flow protected function call meant to be used from within an unprotected function, that must be terminated by MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL()
 Implementation of the end of a section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN_IMPL(token, call)
 Implementation of a flow protected void function call meant to be used from within an unprotected function, that must be terminated by MCUX_CSSL_FP_FUNCTION_CALL_VOID_END_IMPL.
 
#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_END_IMPL()
 Implementation of the end of a section started by MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN_IMPL.
 

Detailed Description

Support for flow protected functions.

Declaration
MCUX_CSSL_FP_FUNCTION_DECL_IMPL
Event
MCUX_CSSL_FP_FUNCTION_CALL_IMPL
Expectation
MCUX_CSSL_FP_FUNCTION_CALLED_IMPL

Macro Definition Documentation

◆ MCUX_CSSL_FP_FUNCTION_ID

#define MCUX_CSSL_FP_FUNCTION_ID (   id)

Generator for function identifiers.

Parameters
idIdentifier for the flow protected function.

◆ MCUX_CSSL_FP_FUNCTION_ID_ENTRY_MASK

#define MCUX_CSSL_FP_FUNCTION_ID_ENTRY_MASK

Mask to be used to derive entry part from a function identifier.

◆ MCUX_CSSL_FP_FUNCTION_ID_ENTRY_PART

#define MCUX_CSSL_FP_FUNCTION_ID_ENTRY_PART (   id)

Part of the function identifier to be used at function entry.

Parameters
idIdentifier for the flow protected function.

◆ MCUX_CSSL_FP_FUNCTION_ID_EXIT_PART

#define MCUX_CSSL_FP_FUNCTION_ID_EXIT_PART (   id)

Part of the function identifier to be used at function exit.

Parameters
idIdentifier for the flow protected function.

◆ MCUX_CSSL_FP_FUNCTION_DECL_IMPL

#define MCUX_CSSL_FP_FUNCTION_DECL_IMPL (   ...)

Declaration implementation of a flow protected function.

Event
MCUX_CSSL_FP_FUNCTION_CALL_IMPL
Expectation
MCUX_CSSL_FP_FUNCTION_CALLED_IMPL
Parameters
idIdentifier for the function that is flow protected.
ptrTypeOptional, pointer type matching this function.

◆ MCUX_CSSL_FP_FUNCTION_VALUE

#define MCUX_CSSL_FP_FUNCTION_VALUE (   id)

Macro to get the value for a given function.

Parameters
idIdentifier for the function that is flow protected.
Returns
The counter value for the given function id.

◆ MCUX_CSSL_FP_FUNCTION_DEF_IMPL

#define MCUX_CSSL_FP_FUNCTION_DEF_IMPL (   ...)

Definition implementation of a flow protected function.

Not used in the current implementation.

Parameters
idIdentifier for the function that is flow protected.
ptrTypeOptional, pointer type matching this function.

◆ MCUX_CSSL_FP_RESULT_OFFSET

#define MCUX_CSSL_FP_RESULT_OFFSET

Offset of the result in the return value.

◆ MCUX_CSSL_FP_RESULT_MASK

#define MCUX_CSSL_FP_RESULT_MASK

Bitmask of the result in the return value.

◆ MCUX_CSSL_FP_RESULT_VALUE

#define MCUX_CSSL_FP_RESULT_VALUE (   result)

Encode a result value for a protected return value.

Parameters
resultThe result that needs to be encoded.

◆ MCUX_CSSL_FP_RESULT_IMPL2

#define MCUX_CSSL_FP_RESULT_IMPL2 (   type,
  return 
)

Extract the result value from a protected return value.

Parameters
typeType of the result.
returnThe protected return value which contains the result.

◆ MCUX_CSSL_FP_RESULT_IMPL1

#define MCUX_CSSL_FP_RESULT_IMPL1 (   return)

Extract the result value from a protected return value.

Parameters
returnThe protected return value which contains the result.

◆ MCUX_CSSL_FP_RESULT_IMPL

#define MCUX_CSSL_FP_RESULT_IMPL (   ...)

Extract the result value from a protected return value.

Parameters
typeOptional, type of the result.
returnThe protected return value which contains the result.

◆ MCUX_CSSL_FP_PROTECTION_OFFSET

#define MCUX_CSSL_FP_PROTECTION_OFFSET

Offset of the protection token in the return value.

◆ MCUX_CSSL_FP_PROTECTION_MASK

#define MCUX_CSSL_FP_PROTECTION_MASK

Bitmask of the protection token in the return value.

◆ MCUX_CSSL_FP_PROTECTION_TOKEN_VALUE

#define MCUX_CSSL_FP_PROTECTION_TOKEN_VALUE (   token)

Encode a protection token for a protected return value.

Note that this macro is only used with a local security counter, e.g. for configuration CSSL_SC_USE_SW_LOCAL

Parameters
tokenThe protection token that needs to be encoded.

◆ MCUX_CSSL_FP_PROTECTION_TOKEN_IMPL

#define MCUX_CSSL_FP_PROTECTION_TOKEN_IMPL (   return)

Extract the protection token value from a protected return value.

Note that this macro is only used with a local security counter, e.g. for configuration CSSL_SC_USE_SW_LOCAL

Parameters
returnThe protected return value which contains the protection token.

◆ MCUX_CSSL_FP_COUNTER_COMPRESSED

#define MCUX_CSSL_FP_COUNTER_COMPRESSED ( )

Compressed version of the secure counter that can be used as a protection token.

◆ MCUX_CSSL_FP_FUNCTION_CALLED_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALLED_IMPL (   id)

Expectation implementation of a called function.

Declaration
MCUX_CSSL_FP_FUNCTION_DECL_IMPL
Event
MCUX_CSSL_FP_FUNCTION_CALL_IMPL
See also
MCUX_CSSL_FP_FUNCTION_VALUE
Parameters
idIdentifier of the function that is expected to be called.
Returns
Counter value for the given function.

◆ MCUX_CSSL_FP_FUNCTION_ENTERED_IMPL

#define MCUX_CSSL_FP_FUNCTION_ENTERED_IMPL (   id)

Expectation implementation of an entered (but not exited) function.

Declaration
MCUX_CSSL_FP_FUNCTION_DECL_IMPL
Event
MCUX_CSSL_FP_FUNCTION_CALL_IMPL
See also
MCUX_CSSL_FP_FUNCTION_VALUE
Parameters
idIdentifier of the function that is expected to be entered.
Returns
Counter value for the given function.

◆ MCUX_CSSL_FP_PROTECTED_TYPE_IMPL

#define MCUX_CSSL_FP_PROTECTED_TYPE_IMPL (   resultType)

Based on a given base type, builds a return type with flow protection.

See also
MCUX_CSSL_FP_FUNCTION_DEF_IMPL
Parameters
resultTypeThe type to be converted into a protected type.

◆ MCUX_CSSL_FP_FUNCTION_ENTRY_IMPLn

#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPLn (   function,
  ... 
)

Flow protection handler implementation for the function entry point.

Initialize the counter with the entry part of the function identifier, and include expectations in the initialization value.

See also
MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL
Parameters
idIdentifier of the function that has just been entered.
expectOne or more (comma separated) declarations of expected code flow behavior.

◆ MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL1

#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL1 (   function)

Flow protection handler implementation for the function entry point.

Initialize the counter with the entry part of the function identifier, without any potential expectations.

See also
MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL
Parameters
idIdentifier of the function that has just been entered.

◆ MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL

#define MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL (   ...)

Flow protection handler implementation for the function entry point.

Initialize the counter with entry part of the function identifier, and include potential expectations in the initialization value.

Implemented as an overloaded macro to simplify the use of the API.

See also
MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL1
MCUX_CSSL_FP_FUNCTION_ENTRY_IMPLn
Parameters
idIdentifier of the function that has just been entered.
expectZero or more (comma separated) declarations of expected code flow behavior.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn

#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn (   id,
  result,
  ... 
)

Flow protection handler implementation for the function exit point.

Adjust the counter with the exit part of the function identifier, and include potential expectations in the adjustment value. Return the counter value together with the result via the function return value.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_IMPL
Parameters
idIdentifier of the function from which we will exit.
resultResult that should be encoded in the return value.
expectOne or more (comma separated) declarations of expected code flow behavior.
Returns
A value in which both result and a flow protection token are encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_IMPL1

#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL1 (   id)

Flow protection handler implementation for the function exit point.

Adjust the counter with the exit part of the function identifier, without any potential expectations in the adjustment value. Return the counter value via the function return value.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_IMPL
Parameters
idIdentifier of the function from which we will exit.
Returns
A value in which a flow protection token is encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_IMPL2

#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL2 (   id,
  result 
)

Flow protection handler implementation for the function exit point.

Adjust the counter with the exit part of the function identifier, without any potential expectations in the adjustment value. Return the counter value together with the result via the function return value.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_IMPL
Parameters
idIdentifier of the function from which we will exit.
resultResult that should be encoded in the return value.
Returns
A value in which both result and a flow protection token are encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_IMPL

#define MCUX_CSSL_FP_FUNCTION_EXIT_IMPL (   ...)

Flow protection handler implementation for the function exit point.

Adjust the counter with the exit part of the function identifier, and include potential expectations in the adjustment value. Return the counter value together with the result via the function return value.

Implemented as an overloaded macro to simplify the use of the API.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_IMPL1
MCUX_CSSL_FP_FUNCTION_EXIT_IMPL2
MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn
Parameters
idIdentifier of the function from which we will exit.
resultResult that should be encoded in the return value.
expectZero or more (comma separated) declarations of expected code flow behavior.
Returns
A value in which both result and a flow protection token are encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPLn

#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPLn (   id,
  pass,
  fail,
  ... 
)

Flow protection handler implementation for the function exit point which includes an actual check of the code flow.

Adjust the counter with the exit part of the function identifier, and include potential expectations in the adjustment value. Check whether the counter matches the expected value, and choose the result from pass and fail and return it together with the counter value via the function return value.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL3
MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPLn
Parameters
idIdentifier of the function from which we will exit.
passResult that should be encoded in the return value if the flow protection check passed.
failResult that should be encoded in the return value if the flow protection check failed.
expectOne or more (comma separated) declarations of expected code flow behavior.
Returns
A value in which both the result (either pass or fail) and a flow protection token are encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL3

#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL3 (   id,
  pass,
  fail 
)

Flow protection handler implementation for the function exit point which includes an actual check of the code flow.

Adjust the counter with the exit part of the function identifier. Check whether the counter matches the expected value, and choose the result from pass and fail and return it together with the counter value via the function return value.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL
Parameters
idIdentifier of the function from which we will exit.
passResult that should be encoded in the return value if the flow protection check passed.
failResult that should be encoded in the return value if the flow protection check failed.
Returns
A value in which both the result (either pass or fail) and a flow protection token are encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL

#define MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL (   ...)

Flow protection handler implementation for the function exit point which includes an actual check of the code flow.

Adjust the counter with the exit part of the function identifier, and include potential expectations in the adjustment value. Check whether the counter matches the expected value, and choose the result from pass and fail and return it together with the counter value via the function return value.

Implemented as an overloaded macro to simplify the use of the API.

See also
MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPL3
MCUX_CSSL_FP_FUNCTION_EXIT_WITH_CHECK_IMPLn
Parameters
idIdentifier of the function from which we will exit.
passResult that should be encoded in the return value if the flow protection check passed.
failResult that should be encoded in the return value if the flow protection check failed.
expectZero or more (comma separated) declarations of expected code flow behavior.
Returns
A value in which both the result (either pass or fail) and a flow protection token are encoded.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL1

#define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL1 (   id)

Flow protection handler for the exit point of functions with the return type void.

Parameters
idIdentifier of the function from which we will exit.
Returns
A protected return value of type void.

◆ MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL

#define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL (   ...)

Flow protection handler for the exit point of functions with the return type void.

Parameters
idIdentifier of the function from which we will exit.
expectZero or more (comma separated) declarations of expected code flow behavior.
Returns
A protected return value of type void.

◆ MCUX_CSSL_FP_FUNCTION_CALL_IMPL3

#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL3 (   type,
  result,
  call 
)

Event implementation of a flow protected function call.

Parameters
typeType of the result variable.
resultFresh variable name to store the result of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_IMPL2

#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL2 (   result,
  call 
)

Event implementation of a flow protected function call.

Parameters
resultFresh variable name to store the result of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL (   ...)

Event implementation of a flow protected function call.

Declaration
MCUX_CSSL_FP_FUNCTION_DECL_IMPL
Expectation
MCUX_CSSL_FP_FUNCTION_CALLED_IMPL
Parameters
typeOptional, type of the result variable.
resultFresh variable name to store the result of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_VOID_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_IMPL (   call)

Event implementation of a flow protected void function call.

Declaration
MCUX_CSSL_FP_FUNCTION_DECL_IMPL
Expectation
MCUX_CSSL_FP_FUNCTION_CALLED_IMPL
Parameters
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_PROTECTED_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_PROTECTED_IMPL (   result,
  token,
  call 
)

Implementation of a flow protected function call meant to be used from within an unprotected function.

Parameters
resultFresh variable name to store the result of call.
tokenFresh variable name to store the protection token of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_VOID_PROTECTED_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_PROTECTED_IMPL (   token,
  call 
)

Implementation of a flow protected void function call meant to be used from within an unprotected function.

Parameters
tokenFresh variable name to store the protection token of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL (   result,
  token,
  call 
)

Implementation of a flow protected function call meant to be used from within an unprotected function, that must be terminated by MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL.

Parameters
resultFresh variable name to store the result of call.
tokenFresh variable name to store the protection token of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL ( )

Implementation of the end of a section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL.

◆ MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN_IMPL (   token,
  call 
)

Implementation of a flow protected void function call meant to be used from within an unprotected function, that must be terminated by MCUX_CSSL_FP_FUNCTION_CALL_VOID_END_IMPL.

Parameters
tokenFresh variable name to store the protection token of call.
callThe (protected) function call that must be performed.

◆ MCUX_CSSL_FP_FUNCTION_CALL_VOID_END_IMPL

#define MCUX_CSSL_FP_FUNCTION_CALL_VOID_END_IMPL ( )

Implementation of the end of a section started by MCUX_CSSL_FP_FUNCTION_CALL_VOID_BEGIN_IMPL.