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:

Active Tamper Sequence

@startuml

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

== Configuration of active tampers ==

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

    app -> tamp : HAL_TAMP_ACTIVE_SetConfigTampers(tampers_input, tamper_output, &p_config)
    tamp --> app : HAL_OK

== Start the active tampers ==

    app -> tamp : HAL_TAMP_ACTIVE_Start(interruption)
    tamp --> app: HAL_OK
    app -> tamp : HAL_TAMP_ACTIVE_SetSeed(&p_values)
    tamp --> app: HAL_OK

== Tamp IRQ handler ==

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

== Active Tamper handler ==

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

== Stop the active tampers ==

    app -> tamp : HAL_TAMP_ACTIVE_Stop()
    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:

Monotonic Counter Operation

@startuml

participant Application as app
participant "Tamper Driver" as tamp

==  Monotonic Counter  ==

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

    app -> tamp : HAL_TAMP_MONOTONIC_GetCounter()
    tamp --> app : value

@enduml

Functions called:

Resource Protection Sequence

@startuml

participant Application as app
participant "Tamper Driver" as tamp

== Resources protection  ==

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

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

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

@enduml

Functions called: