Support for flow protected functions. More...
Macros | |
#define | MCUX_CSSL_FP_FUNCTION_ID(id) |
Generator for function identifiers. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ID_ENTRY_MASK |
Mask to be used to derive entry part from a function identifier. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ID_ENTRY_PART(id) |
Part of the function identifier to be used at function entry. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ID_EXIT_PART(id) |
Part of the function identifier to be used at function exit. More... | |
#define | MCUX_CSSL_FP_FUNCTION_DECL_IMPL(...) |
Declaration implementation of a flow protected function. More... | |
#define | MCUX_CSSL_FP_FUNCTION_VALUE(id) |
Macro to get the value for a given function. More... | |
#define | MCUX_CSSL_FP_FUNCTION_DEF_IMPL(...) |
Definition implementation of a flow protected function. More... | |
#define | MCUX_CSSL_FP_RESULT_OFFSET |
Offset of the result in the return value. More... | |
#define | MCUX_CSSL_FP_RESULT_MASK |
Bitmask of the result in the return value. More... | |
#define | MCUX_CSSL_FP_RESULT_VALUE(result) |
Encode a result value for a protected return value. More... | |
#define | MCUX_CSSL_FP_RESULT_IMPL(return) |
Extract the result value from a protected return value. More... | |
#define | MCUX_CSSL_FP_PROTECTION_OFFSET |
Offset of the protection token in the return value. More... | |
#define | MCUX_CSSL_FP_PROTECTION_MASK |
Bitmask of the protection token in the return value. More... | |
#define | MCUX_CSSL_FP_PROTECTION_TOKEN_VALUE(token) |
Encode a protection token for a protected return value. More... | |
#define | MCUX_CSSL_FP_PROTECTION_TOKEN_IMPL(return) |
Extract the protection token value from a protected return value. More... | |
#define | MCUX_CSSL_FP_COUNTER_COMPRESSED() |
Compressed version of the secure counter that can be used as a protection token. More... | |
#define | MCUX_CSSL_FP_FUNCTION_CALLED_IMPL(id) |
Expectation implementation of a called function. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ENTERED_IMPL(id) |
Expectation implementation of an entered (but not exited) function. More... | |
#define | MCUX_CSSL_FP_PROTECTED_TYPE_IMPL(resultType) |
Based on a given base type, builds a return type with flow protection. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ENTRY_IMPLn(function, ...) |
Flow protection handler implementation for the function entry point. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL1(function) |
Flow protection handler implementation for the function entry point. More... | |
#define | MCUX_CSSL_FP_FUNCTION_ENTRY_IMPL(...) |
Flow protection handler implementation for the function entry point. More... | |
#define | MCUX_CSSL_FP_FUNCTION_EXIT_IMPLn(id, result, ...) |
Flow protection handler implementation for the function exit point. More... | |
#define | MCUX_CSSL_FP_FUNCTION_EXIT_IMPL1(id) |
Flow protection handler implementation for the function exit point. More... | |
#define | MCUX_CSSL_FP_FUNCTION_EXIT_IMPL2(id, result) |
Flow protection handler implementation for the function exit point. More... | |
#define | MCUX_CSSL_FP_FUNCTION_EXIT_IMPL(...) |
Flow protection handler implementation for the function exit point. More... | |
#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. More... | |
#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. More... | |
#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. More... | |
#define | MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL1(id) |
Flow protection handler for the exit point of functions with the return type void . More... | |
#define | MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL(...) |
Flow protection handler for the exit point of functions with the return type void . More... | |
#define | MCUX_CSSL_FP_FUNCTION_CALL_IMPL(result, call) |
Event implementation of a flow protected function call. More... | |
#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. More... | |
#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. More... | |
#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. More... | |
#define | MCUX_CSSL_FP_FUNCTION_CALL_END_IMPL() |
Implementation of the end of a section started by MCUX_CSSL_FP_FUNCTION_CALL_BEGIN_IMPL. More... | |
#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. More... | |
#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. More... | |
Support for flow protected functions.
#define MCUX_CSSL_FP_FUNCTION_ID | ( | id | ) |
Generator for function identifiers.
id | Identifier for the flow protected function. |
#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.
id | Identifier for the flow protected function. |
#define MCUX_CSSL_FP_FUNCTION_ID_EXIT_PART | ( | id | ) |
Part of the function identifier to be used at function exit.
id | Identifier for the flow protected function. |
#define MCUX_CSSL_FP_FUNCTION_DECL_IMPL | ( | ... | ) |
Declaration implementation of a flow protected function.
id | Identifier for the function that is flow protected. |
ptrType | Optional, pointer type matching this function. |
#define MCUX_CSSL_FP_FUNCTION_VALUE | ( | id | ) |
Macro to get the value for a given function.
id | Identifier for the function that is flow protected. |
id
. #define MCUX_CSSL_FP_FUNCTION_DEF_IMPL | ( | ... | ) |
Definition implementation of a flow protected function.
Not used in the current implementation.
id | Identifier for the function that is flow protected. |
ptrType | Optional, pointer type matching this 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.
result | The result that needs to be encoded. |
#define MCUX_CSSL_FP_RESULT_IMPL | ( | return | ) |
Extract the result value from a protected return
value.
return | The protected return value which contains the result. |
#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.
Note that this macro is only used with a local security counter, e.g. for configuration CSSL_SC_USE_SW_LOCAL
token | The protection token that needs to be encoded. |
#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
return | The protected return value which contains the protection token. |
#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.
id | Identifier of the function that is expected to be called. |
#define MCUX_CSSL_FP_FUNCTION_ENTERED_IMPL | ( | id | ) |
Expectation implementation of an entered (but not exited) function.
id | Identifier of the function that is expected to be entered. |
#define MCUX_CSSL_FP_PROTECTED_TYPE_IMPL | ( | resultType | ) |
Based on a given base type, builds a return type with flow protection.
resultType | The type to be converted into a protected type. |
#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.
id | Identifier of the function that has just been entered. |
expect | One or more (comma separated) declarations of expected code flow behavior. |
#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.
id | Identifier of the function that has just been entered. |
#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.
id | Identifier of the function that has just been entered. |
expect | Zero or more (comma separated) declarations of expected code flow behavior. |
#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.
id | Identifier of the function from which we will exit. |
result | Result that should be encoded in the return value. |
expect | One or more (comma separated) declarations of expected code flow behavior. |
result
and a flow protection token are encoded. #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.
id | Identifier of the function from which we will exit. |
#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.
id | Identifier of the function from which we will exit. |
result | Result that should be encoded in the return value. |
result
and a flow protection token are encoded. #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.
id | Identifier of the function from which we will exit. |
result | Result that should be encoded in the return value. |
expect | Zero or more (comma separated) declarations of expected code flow behavior. |
result
and a flow protection token are encoded. #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.
id | Identifier of the function from which we will exit. |
pass | Result that should be encoded in the return value if the flow protection check passed. |
fail | Result that should be encoded in the return value if the flow protection check failed. |
expect | One or more (comma separated) declarations of expected code flow behavior. |
pass
or fail
) and a flow protection token are encoded. #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.
id | Identifier of the function from which we will exit. |
pass | Result that should be encoded in the return value if the flow protection check passed. |
fail | Result that should be encoded in the return value if the flow protection check failed. |
pass
or fail
) and a flow protection token are encoded. #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.
id | Identifier of the function from which we will exit. |
pass | Result that should be encoded in the return value if the flow protection check passed. |
fail | Result that should be encoded in the return value if the flow protection check failed. |
expect | Zero or more (comma separated) declarations of expected code flow behavior. |
pass
or fail
) and a flow protection token are encoded. #define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL1 | ( | id | ) |
Flow protection handler for the exit point of functions with the return type void
.
id | Identifier of the function from which we will exit. |
#define MCUX_CSSL_FP_FUNCTION_EXIT_VOID_IMPL | ( | ... | ) |
Flow protection handler for the exit point of functions with the return type void
.
id | Identifier of the function from which we will exit. |
expect | Zero or more (comma separated) declarations of expected code flow behavior. |
#define MCUX_CSSL_FP_FUNCTION_CALL_IMPL | ( | result, | |
call | |||
) |
Event implementation of a flow protected function call.
result | Fresh variable name to store the result of call . |
call | The (protected) function call that must be performed. |
#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.
result | Fresh variable name to store the result of call . |
token | Fresh variable name to store the protection token of call . |
call | The (protected) function call that must be performed. |
#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.
token | Fresh variable name to store the protection token of call . |
call | The (protected) function call that must be performed. |
#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.
result | Fresh variable name to store the result of call . |
token | Fresh variable name to store the protection token of call . |
call | The (protected) function call that must be performed. |
#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.
token | Fresh variable name to store the protection token of call . |
call | The (protected) function call that must be performed. |
#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.