TIFS_SAFETY_CHECKERS

TIFS Safety Checkers library APIs are integrated into the safety application to verify the firewall configuration and validate the FWL configuration against golden reference.

Features Supported

The module supports below API’s for the application

  • API to request TIFS to open firewall.

  • API to generate Golden Reference using the list of firewall registers specified.

  • API compares the Golden Reference with runtime firewall register values and return success or failure.

  • API to request TIFS to close firewall.

SysConfig Features

  • None

Features NOT Supported

  • None

Important Usage Guidelines

Steps to update board configuration for TIFS Safety Checkers:

  • Add below lines to the file “ ${mcu_plus_sdk}/source/drivers/sciclient/sciclient_default_boardcfg/{board}/sciclient_defaultBoardcfg_security.c”

/* SA2UL RM config */
    .sa2ul_auth_cfg = {
        .subhdr = {
            .magic = TISCI_BOARDCFG_SA2UL_CFG_MAGIC_NUM_RSVD,
            .size = 0,
        },
        .auth_resource_owner = 0,
        .enable_saul_psil_global_config_writes = 0x5A,
        .safety_host_present = 0x5A,
        .safety_host = host_id
    },

Note

host_id = 0x1E for mcu-r5f :::

  • Use the following commands to build the Boardcfg changes For GP and HS-FS

cd ${mcu_plus_sdk}/tools/sysfw/boardcfg/
make SOC={board}

cd ${mcu_plus_sdk}
make scrub SOC={board}
make all SOC={board}

For HS-SE

cd ${mcu_plus_sdk}/tools/sysfw/boardcfg/
make SOC={board} DEVICE_TYPE=HS

cd ${mcu_plus_sdk}
make scrub SOC={board} DEVICE_TYPE=HS
make all SOC={board} DEVICE_TYPE=HS

Example Usage

The following shows an example of TIFS Safety Checkers API usage

Include the below file to access the APIs

#include "../../src/safety_checkers_tifs.h"

Request the TIFS to open firewall

SafetyCheckers_tifsReqFwlOpen();

Uses the pointer to firewall configuration pFwlConfig as input and updates pFwlConfig with the register dump of the firewall registers specified.

SafetyCheckers_tifsGetFwlCfg(pFwlConfig, gSize);

Verify and save firewall configuration as Golden Reference

Compare the golden reference with runtime firewall register values and return success or failure.

while (i > 0)
{
    status = SafetyCheckers_tifsVerifyFwlCfg(pFwlConfig, gSafetyCheckersTifsCfgSize);

    if (status == SAFETY_CHECKERS_REG_DATA_MISMATCH)
    {
        SAFETY_CHECKERS_log("\n Firewall register mismatch with Golden Reference !!\r\n");
    }

    SafetyCheckersApp_softwareDelay();
    i--;
}
if (status == SAFETY_CHECKERS_SOK)
{
    SAFETY_CHECKERS_log("\n No firewall register mismatch with Golden Reference \r\n");
}

Request the TIFS to close firewall

SafetyCheckers_tifsReqFwlClose();

API Reference

This file contains TIFS safety checker library interfaces and related data structures.

Defines

SAFETY_CHECKERS_TIFS_FWL_OPEN
SAFETY_CHECKERS_TIFS_FWL_CLOSE
SAFETY_CHECKERS_TIFS_FWL_BASE
SAFETY_CHECKERS_TIFS_CONTROL_REG
SAFETY_CHECKERS_TIFS_PRIV_ID0
SAFETY_CHECKERS_TIFS_PRIV_ID1
SAFETY_CHECKERS_TIFS_PRIV_ID2
SAFETY_CHECKERS_TIFS_START_ADDRL
SAFETY_CHECKERS_TIFS_START_ADDRH
SAFETY_CHECKERS_TIFS_END_ADDRL
SAFETY_CHECKERS_TIFS_END_ADDRH
SAFETY_CHECKERS_TIFS_MAX_REGIONS
SAFETY_CHECKERS_TIFS_ISC_BASE
SAFETY_CHECKERS_TIFS_CC_ISC_BASE
SAFETY_CHECKERS_TIFS_ISC_CONTROL0_REG
SAFETY_CHECKERS_TIFS_ISC_CONTROL1_REG
SAFETY_CHECKERS_TIFS_ISC_PRIVID_REG
SAFETY_CHECKERS_TIFS_ISC_PRIVID_LOCK_REG
SAFETY_CHECKERS_TIFS_ISC_CBASS_MAX_REGIONS
SAFETY_CHECKERS_TIFS_ISC_CCPRIV_MAX_REGION
SAFETY_CHECKERS_TIFS_ISC_RA_MAX_ID

Functions

int32_t SafetyCheckers_tifsReqFwlOpen(void)

API to request TIFS to open firewall.

Returns:

status SAFETY_CHECKERS_SOK : Success SAFETY_CHECKERS_FAIL: Failure

int32_t SafetyCheckers_tifsGetFwlCfg(SafetyCheckers_TifsFwlConfig *fwlConfig, uint32_t size)

API uses the pointer to firewall configuration fwlConfig as input and updates fwlConfig with the register dump of the firewall registers specified.

Parameters:
  • fwlConfig – [IN/OUT] Pointer to static firewall configuration to be populated with register values

  • size – [IN] Number of entries in the static firewall configuration

Returns:

status SAFETY_CHECKERS_SOK : Success SAFETY_CHECKERS_FAIL: Failure

int32_t SafetyCheckers_tifsGetIscCbassCfg(SafetyCheckers_TifsIscCbassConfig *iscConfig, uint32_t size)

API uses the pointer to cbass isc configuration iscConfig as input and updates iscConfig with the register dump of the isc registers specified.

Parameters:
  • iscConfig – [IN/OUT] Pointer to static isc configuration to be populated with register values

  • size – [IN] Number of entries in the static isc configuration

Returns:

status SAFETY_CHECKERS_SOK : Success SAFETY_CHECKERS_FAIL: Failure

int32_t SafetyCheckers_tifsVerifyFwlCfg(const SafetyCheckers_TifsFwlConfig *fwlConfig, uint32_t size)

API compares the fwlConfig (golden reference) with runtime firewall register values and return success or failure.

Parameters:
  • fwlConfig – [IN/OUT] Pointer to static firewall configuration / Golden Reference to be verified against

  • size – [IN] Number of entries in the static firewall configuration

Returns:

status SAFETY_CHECKERS_SOK : Success SAFETY_CHECKERS_FAIL: Failure

int32_t SafetyCheckers_tifsVerifyIscCbassCfg(const SafetyCheckers_TifsIscCbassConfig *iscConfig, uint32_t size)

API compares the cbass iscConfig (golden reference) with runtime isc register values and return success or failure.

Parameters:
  • iscConfig – [IN/OUT] Pointer to static isc configuration / Golden Reference to be verified against

  • size – [IN] Number of entries in the static isc configuration

Returns:

status SAFETY_CHECKERS_SOK : Success SAFETY_CHECKERS_FAIL: Failure

int32_t SafetyCheckers_tifsReqFwlClose(void)

API to request TIFS to close firewall.

Returns:

status SAFETY_CHECKERS_SOK : Success SAFETY_CHECKERS_FAIL: Failure

struct SafetyCheckers_TifsFwlRegList
#include <safety_checkers_tifs.h>

Structure for firewall configuration registers for a given firewall region.

Public Members

uint32_t controlReg
uint32_t privId0
uint32_t privId1
uint32_t privId2
uint32_t startAddrLow
uint32_t startAddrHigh
uint32_t endAddrLow
uint32_t endAddrHigh
struct SafetyCheckers_TifsFwlConfig
#include <safety_checkers_tifs.h>

Structure for firewall configuration register info for a given firewall id.

Public Members

uint32_t fwlId
uint32_t numRegions
uint32_t maxNumRegions
SafetyCheckers_TifsFwlRegList fwlCfgPerRegion[SAFETY_CHECKERS_TIFS_MAX_REGIONS]
struct SafetyCheckers_TifsIscCbassRegList
#include <safety_checkers_tifs.h>

Structure for CBASS ISC configuration registers for a given ISC region.

Public Members

uint32_t controlReg0
uint32_t controlReg1
uint32_t startAddrLow
uint32_t startAddrHigh
uint32_t endAddrLow
uint32_t endAddrHigh
struct SafetyCheckers_TifsIscCbassConfig
#include <safety_checkers_tifs.h>

Structure for CBASS ISC configuration register info for a given ISC id.

Public Members

uint32_t iscId
uint32_t numRegions
uint32_t maxNumRegions
SafetyCheckers_TifsIscCbassRegList iscCfgPerRegionCbass[SAFETY_CHECKERS_TIFS_ISC_CBASS_MAX_REGIONS]
uint32_t rcr