SE RT Services Utilities library
IFX SE FIH library API

General Description

IFX SE FIH library functions.

Data Structures

struct  ifx_se_fih_uint
 All ints are replaced with two int - the normal one and a backup which is XORed with the mask. More...
 
struct  ifx_se_fih_ptr_t
 Special pointer FIH type definition for SE RT Services transport. More...
 

Macros

#define ifx_se_fih_uint_eq(x, y)
 Standard equality for ifx_se_fih_uint values. More...
 
#define ifx_se_fih_uint_not_eq(x, y)
 Standard non-equality for ifx_se_fih_uint values. More...
 
#define ifx_se_fih_uint_gt(x, y)
 Standard greater than comparison for ifx_se_fih_uint values. More...
 
#define ifx_se_fih_uint_ge(x, y)
 Standard greater than or equal comparison for ifx_se_fih_uint values. More...
 
#define ifx_se_fih_uint_lt(x, y)
 Standard less than comparison for ifx_se_fih_uint values. More...
 
#define ifx_se_fih_uint_le(x, y)
 Standard less than or equal comparison for ifx_se_fih_uint values. More...
 

Typedefs

typedef ifx_se_fih_uint ifx_se_fih_t
 Special generic FIH type definition for SE RT Services transport.
 
typedef ifx_se_fih_uint ifx_se_alg_fih_t
 Special algorithm FIH type definition for SE RT Services transport.
 

Functions

bool ifx_se_fih_delay (void)
 Perform delay between FIH operations. More...
 
__STATIC_FORCEINLINE bool ifx_se_fih_uint_validate (ifx_se_fih_uint x)
 Validate ifx_se_fih_uint for tampering. More...
 
__STATIC_FORCEINLINE uint32_t ifx_se_fih_uint_decode (ifx_se_fih_uint x)
 Convert a ifx_se_fih_uint to an unsigned int. More...
 
__STATIC_FORCEINLINE ifx_se_fih_uint ifx_se_fih_uint_encode (uint32_t x)
 Convert an unsigned int to a ifx_se_fih_uint. More...
 
IFX_SE_NOINLINE bool ifx_se_fih_check_eq_mask (ifx_se_fih_uint *a, ifx_se_fih_uint *b)
 Compares masks for two FIH variables. More...
 
IFX_SE_NOINLINE bool ifx_se_fih_check_not_eq_mask (ifx_se_fih_uint *a, ifx_se_fih_uint *b)
 Compares masks for two FIH variables. More...
 
IFX_SE_NOINLINE bool ifx_se_fih_check_gt_mask (ifx_se_fih_uint *a, ifx_se_fih_uint *b)
 Compares masks for two FIH variables. More...
 
IFX_SE_NOINLINE bool ifx_se_fih_check_ge_mask (ifx_se_fih_uint *a, ifx_se_fih_uint *b)
 Compares masks for two FIH variables. More...
 
IFX_SE_NOINLINE bool ifx_se_fih_check_lt_mask (ifx_se_fih_uint *a, ifx_se_fih_uint *b)
 Compares masks for two FIH variables. More...
 
IFX_SE_NOINLINE bool ifx_se_fih_check_le_mask (ifx_se_fih_uint *a, ifx_se_fih_uint *b)
 Compares masks for two FIH variables. More...
 
__STATIC_FORCEINLINE ifx_se_fih_uint ifx_se_fih_uint_or (ifx_se_fih_uint x, ifx_se_fih_uint y)
 Standard logical OR for ifx_se_fih_uint values. More...
 
__STATIC_FORCEINLINE ifx_se_fih_uint ifx_se_fih_uint_and (ifx_se_fih_uint x, ifx_se_fih_uint y)
 Standard logical AND for ifx_se_fih_uint values. More...
 
__STATIC_FORCEINLINE bool ifx_se_fih_ptr_validate (ifx_se_fih_ptr_t x)
 Validate ifx_se_fih_ptr_t for tampering. More...
 
__STATIC_FORCEINLINE ifx_se_fih_ptr_t ifx_se_fih_ptr_encode (const void *x)
 Convert pointer address to a ifx_se_fih_ptr_t. More...
 
__STATIC_FORCEINLINE void * ifx_se_fih_ptr_decode (ifx_se_fih_ptr_t x)
 Convert a ifx_se_fih_ptr_t to pointer address. More...
 

Data Structure Documentation

◆ ifx_se_fih_uint

struct ifx_se_fih_uint
Data Fields
volatile uint32_t val
volatile uint32_t msk

◆ ifx_se_fih_ptr_t

struct ifx_se_fih_ptr_t
Data Fields
volatile uint32_t val
volatile uint32_t msk

Macro Definition Documentation

◆ ifx_se_fih_uint_eq

#define ifx_se_fih_uint_eq (   x,
 
)
Value:
( ((x).val == (y).val) && \
((y).val == IFX_SE_FIH_VAL_MASK((x).msk)) && \
ifx_se_fih_delay() && \
ifx_se_fih_uint_validate(x) && \
ifx_se_fih_check_eq_mask(&(x), &(y)) \
)
bool ifx_se_fih_delay(void)
Perform delay between FIH operations.
Definition: ifx_se_fih.c:40

Standard equality for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be compared.
y2nd ifx_se_fih_uint value to be compared.
Returns
TRUE if x == y, FALSE other otherwise.
Note
This implementation of ifx_se_fih_uint_eq() macro causes two "MISRA C-2012 Rule 13.5" - "persistent side effects" violations in "if" per each ifx_se_fih_uint_eq() in the calling code. The violations should be suppressed in the MISRA checker configuration and marked as non-critical. This explanation is also applicable for other FIH macros like ifx_se_fih_uint_not_eq(), ifx_se_fih_uint_gt(), etc.

◆ ifx_se_fih_uint_not_eq

#define ifx_se_fih_uint_not_eq (   x,
 
)
Value:
( ((x).val != (y).val) && \
((y).val != IFX_SE_FIH_VAL_MASK((x).msk)) && \
ifx_se_fih_delay() && \
ifx_se_fih_uint_validate(x) && \
ifx_se_fih_check_not_eq_mask(&(x), &(y)) \
)

Standard non-equality for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be compared.
y2nd ifx_se_fih_uint value to be compared.
Returns
TRUE if x != y, FALSE otherwise.

◆ ifx_se_fih_uint_gt

#define ifx_se_fih_uint_gt (   x,
 
)
Value:
( ((x).val > (y).val) && \
((y).val < IFX_SE_FIH_VAL_MASK((x).msk)) && \
ifx_se_fih_delay() && \
ifx_se_fih_uint_validate(x) && \
ifx_se_fih_check_gt_mask(&(x), &(y)) \
)

Standard greater than comparison for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be compared.
y2nd ifx_se_fih_uint value to be compared.
Returns
TRUE if x > y, FALSE otherwise.

◆ ifx_se_fih_uint_ge

#define ifx_se_fih_uint_ge (   x,
 
)
Value:
( ((x).val >= (y).val) && \
((y).val <= IFX_SE_FIH_VAL_MASK((x).msk)) && \
ifx_se_fih_delay() && \
ifx_se_fih_uint_validate(x) && \
ifx_se_fih_check_ge_mask(&(x), &(y)) \
)

Standard greater than or equal comparison for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be compared.
y2nd ifx_se_fih_uint value to be compared.
Returns
TRUE if x >= y, FALSE otherwise.

◆ ifx_se_fih_uint_lt

#define ifx_se_fih_uint_lt (   x,
 
)
Value:
( ((x).val < (y).val) && \
((y).val > IFX_SE_FIH_VAL_MASK((x).msk)) && \
ifx_se_fih_delay() && \
ifx_se_fih_uint_validate(x) && \
ifx_se_fih_check_lt_mask(&(x), &(y)) \
)

Standard less than comparison for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be compared.
y2nd ifx_se_fih_uint value to be compared.
Returns
TRUE if x < y, FALSE otherwise.

◆ ifx_se_fih_uint_le

#define ifx_se_fih_uint_le (   x,
 
)
Value:
( ((x).val <= (y).val) && \
((y).val >= IFX_SE_FIH_VAL_MASK((x).msk)) && \
ifx_se_fih_delay() && \
ifx_se_fih_uint_validate(x) && \
ifx_se_fih_check_le_mask(&(x), &(y)) \
)

Standard less than or equal comparison for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be compared.
y2nd ifx_se_fih_uint value to be compared.
Returns
TRUE if x <= y, FALSE otherwise.

Function Documentation

◆ ifx_se_fih_delay()

bool ifx_se_fih_delay ( void  )

Perform delay between FIH operations.

Returns
TRUE after delay
Note
This function is marked as WEAK so user should implement it in own project according to the platform environment

◆ ifx_se_fih_uint_validate()

__STATIC_FORCEINLINE bool ifx_se_fih_uint_validate ( ifx_se_fih_uint  x)

Validate ifx_se_fih_uint for tampering.

Parameters
xifx_se_fih_uint value to be validated.
Returns
TRUE if data is valid and not tampered otherwise raise panic loop.

◆ ifx_se_fih_uint_decode()

__STATIC_FORCEINLINE uint32_t ifx_se_fih_uint_decode ( ifx_se_fih_uint  x)

Convert a ifx_se_fih_uint to an unsigned int.

Parameters
xifx_se_fih_uint value to be converted.
Returns
Value converted to unsigned int.

◆ ifx_se_fih_uint_encode()

__STATIC_FORCEINLINE ifx_se_fih_uint ifx_se_fih_uint_encode ( uint32_t  x)

Convert an unsigned int to a ifx_se_fih_uint.

Parameters
xUnsigned integer value to be converted.
Returns
Value converted to ifx_se_fih_uint.

◆ ifx_se_fih_check_eq_mask()

IFX_SE_NOINLINE bool ifx_se_fih_check_eq_mask ( ifx_se_fih_uint a,
ifx_se_fih_uint b 
)

Compares masks for two FIH variables.

Parameters
apointer to the 1st ifx_se_fih_uint value.
bpointer to the 2nd ifx_se_fih_uint value.
Returns
TRUE if masks are equal in two variables otherwise FALSE.

◆ ifx_se_fih_check_not_eq_mask()

IFX_SE_NOINLINE bool ifx_se_fih_check_not_eq_mask ( ifx_se_fih_uint a,
ifx_se_fih_uint b 
)

Compares masks for two FIH variables.

Parameters
apointer to the 1st ifx_se_fih_uint value.
bpointer to the 2nd ifx_se_fih_uint value.
Returns
TRUE if masks are not equal in two variables otherwise FALSE.

◆ ifx_se_fih_check_gt_mask()

IFX_SE_NOINLINE bool ifx_se_fih_check_gt_mask ( ifx_se_fih_uint a,
ifx_se_fih_uint b 
)

Compares masks for two FIH variables.

Parameters
apointer to the 1st ifx_se_fih_uint value.
bpointer to the 2nd ifx_se_fih_uint value.
Returns
TRUE if masks are greater than in two variables otherwise FALSE.

◆ ifx_se_fih_check_ge_mask()

IFX_SE_NOINLINE bool ifx_se_fih_check_ge_mask ( ifx_se_fih_uint a,
ifx_se_fih_uint b 
)

Compares masks for two FIH variables.

Parameters
apointer to the 1st ifx_se_fih_uint value.
bpointer to the 2nd ifx_se_fih_uint value.
Returns
TRUE if masks are greater than or equal in two variables otherwise FALSE.

◆ ifx_se_fih_check_lt_mask()

IFX_SE_NOINLINE bool ifx_se_fih_check_lt_mask ( ifx_se_fih_uint a,
ifx_se_fih_uint b 
)

Compares masks for two FIH variables.

Parameters
apointer to the 1st ifx_se_fih_uint value.
bpointer to the 2nd ifx_se_fih_uint value.
Returns
TRUE if masks are less than in two variables otherwise FALSE.

◆ ifx_se_fih_check_le_mask()

IFX_SE_NOINLINE bool ifx_se_fih_check_le_mask ( ifx_se_fih_uint a,
ifx_se_fih_uint b 
)

Compares masks for two FIH variables.

Parameters
apointer to the 1st ifx_se_fih_uint value.
bpointer to the 2nd ifx_se_fih_uint value.
Returns
TRUE if masks are less than or equal in two variables otherwise FALSE.

◆ ifx_se_fih_uint_or()

__STATIC_FORCEINLINE ifx_se_fih_uint ifx_se_fih_uint_or ( ifx_se_fih_uint  x,
ifx_se_fih_uint  y 
)

Standard logical OR for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be ORed.
y2nd ifx_se_fih_uint value to be ORed.
Returns
ORed value

◆ ifx_se_fih_uint_and()

__STATIC_FORCEINLINE ifx_se_fih_uint ifx_se_fih_uint_and ( ifx_se_fih_uint  x,
ifx_se_fih_uint  y 
)

Standard logical AND for ifx_se_fih_uint values.

Parameters
x1st ifx_se_fih_uint value to be ANDed.
y2nd ifx_se_fih_uint value to be ANDed.
Returns
ANDed value

◆ ifx_se_fih_ptr_validate()

__STATIC_FORCEINLINE bool ifx_se_fih_ptr_validate ( ifx_se_fih_ptr_t  x)

Validate ifx_se_fih_ptr_t for tampering.

Parameters
xifx_se_fih_ptr_t value to be validated.
Returns
TRUE if data is valid and not tampered otherwise raise panic loop.

◆ ifx_se_fih_ptr_encode()

__STATIC_FORCEINLINE ifx_se_fih_ptr_t ifx_se_fih_ptr_encode ( const void *  x)

Convert pointer address to a ifx_se_fih_ptr_t.

Parameters
xPointer address to be converted.
Returns
Value converted to ifx_se_fih_ptr_t.

◆ ifx_se_fih_ptr_decode()

__STATIC_FORCEINLINE void * ifx_se_fih_ptr_decode ( ifx_se_fih_ptr_t  x)

Convert a ifx_se_fih_ptr_t to pointer address.

Parameters
xifx_se_fih_ptr_t value to be converted.
Returns
Value converted to pointer address.