Skip to main content

OnSecurityLocalQueryFreshness

Valid for: CANoe DE • CANoe4SW DE Note
Replaces OnLocalSecurityQueryLocalFreshness.

Function Syntax

Description

This callback is called for every secured PDU for which a MAC has to be calculated or verified. The callback is triggered before the MAC calculation starts. It provides the possibility to calculate a freshness value in CAPL and force the Security Manager to use this freshness value for the next MAC calculation/verification.

Parameters

  • dword context
    • 1: PDU is received (MAC verification)
    • 0: PDU is transmitted (MAC calculation)
  • char pduName[]
    The name of the PDU.
  • dword dataId
    The data ID of the PDU.
  • dword freshnessValueId
    The freshness value ID of the PDU.
  • dword attemptNr
    The number of the attempted verification.
  • byte payload[]
    The payload of the PDU.
  • dword payloadLength
    The payload length of the PDU in bytes.
  • qword& freshness [Out]
    The freshness the CAPL code provides.
  • dword& freshnessLength [Out]
    The freshness length of the freshness the CAPL code provides in bits.
  • qword truncatedRxFreshness
    The received freshness (only in case context is 1).
  • dword truncatedRxFreshnessBitLength
    The received freshness length in bits (only in case context is 1).

Return Values

  • qword& freshness [Out]
    The freshness the CAPL code provides.
  • dword& freshnessLength [Out]
    The freshness length of the freshness the CAPL code provides in bits.
  • long: 0
    No freshness is provided by this callback.
  • long: 1
    The freshness and freshnessLength shall be used for MAC calculation/verification.

Example

Example 1
Example 2