HAL TAMP Use Cases

Initialization Sequence

@startuml

participant Application as app
participant "System Drivers" as driv

== Initialization ==

app -> driv: HAL_Init()
driv --> app

app -> driv: Configure GPIO, NVIC
driv --> app

app -> driv: Configure system clock same as RTC
driv --> app

app -> driv: Power driver disable write\n protection on backup domain
driv --> app


@enduml

Passive Tamper Workflow

@startuml

participant Application as app
participant "Tamper Driver" as tamp
participant "Interruption" as int

== Configuration of passive tampers ==

    app -> tamp : HAL_TAMP_PASSIVE_SetConfig(&p_config)
    tamp --> app : HAL_OK

    app -> tamp : HAL_TAMP_PASSIVE_SetConfigTampers(tampers, &p_config)
    tamp --> app : HAL_OK

== Start the passive tampers ==

    app -> tamp : HAL_TAMP_PASSIVE_Start(tampers, interruption)
    tamp --> app: HAL_OK

== Tamp IRQ handler ==

    group Interruption mode
    int -> tamp : HAL_TAMP_TamperIRQHandler()
    end

== Passive Tamper handler ==

    group Polling mode
    app -> tamp: HAL_TAMP_PASSIVE_PollForEvent(tampers, timeout)
    tamp --> app : HAL_OK
    end

== Stop the passive tampers ==

    app -> tamp : HAL_TAMP_PASSIVE_Stop(tampers)
    tamp --> app: HAL_OK

@enduml

Functions called:

Internal Tamper Handling

@startuml

participant Application as app
participant "Tamper Driver" as tamp
participant "Interruption" as int

== Configuration of internal tampers ==

    app -> tamp : HAL_TAMP_INTERNAL_SetConfigTampers(tampers, &p_config)
    tamp --> app : HAL_OK

== Start the internal tampers ==

    app -> tamp : HAL_TAMP_INTERNAL_Start(tampers, interruption)
    tamp --> app: HAL_OK

== Tamp IRQ handler ==

    group Interruption mode
    int -> tamp : HAL_TAMP_TamperIRQHandler()
    end

== internal Tamper handler ==

    group Polling mode
    app -> tamp: HAL_TAMP_INTERNAL_PollForEvent(tampers, timeout)
    tamp --> app : HAL_OK
    end

== Stop the internal tampers ==

    app -> tamp : HAL_TAMP_INTERNAL_Stop(tampers)
    tamp --> app: HAL_OK

@enduml

Functions called:

Backup Registers Usage Flow

@startuml

participant Application as app
participant "Tamper Driver" as tamp

== Program and retrieve a value  ==

    app -> tamp : HAL_TAMP_WriteBackupRegisterValue(backup_register_index, data_32bit)

    app -> tamp : HAL_TAMP_ReadBackupRegisterValue(backup_register_index)
    tamp --> app : value

@enduml

Functions called:

Device Secrets Management

@startuml

participant Application as app
participant "Tamper Driver" as tamp

== Device secrets access  ==

    app -> tamp : HAL_TAMP_UnblockDeviceSecretsAccess()
    tamp --> app: HAL_OK

    app -> tamp : HAL_TAMP_BlockDeviceSecretsAccess()
    tamp --> app: HAL_OK

    app -> tamp : HAL_TAMP_IsBlockedDeviceSecretsAccess()
    tamp --> app : status

== Erase device ==

    app -> tamp : HAL_TAMP_EraseDeviceSecrets()
    tamp --> app: HAL_OK


@enduml

Functions called: