4.3 Program Flow

The following figure illustrates the program flow in the application software for the transmitter and verifier. After initialization, the payload is generated, the MAC is calculated and both are encrypted, followed by the FEC coding before transmitting the data packet. The start of the verifier operation is delayed allowing the receiver to process the received data packet and to load the prover response data. After the verifier operation, the timeout is checked together with the received RNRp payload data from the prover response. If there is an error, the RC is incremented and the SC and secure data are kept unchanged. If no error occurs, SC is incremented, RC is set to zero and the secure data is updated with the TCK before starting the next data transfer.
Figure 4-2. Program Flow of the Application Software (Transmitter and Verifier)
The following figure illustrates the program flow in the application software for the receiver and prover. After initialization, the receiver starts to wait for an incoming data packet. If the SSID check fails, the receiver is restarted for a correctly addressed packet. After the reception of a data packet with the valid address, the FEC checking is applied, followed by the decryption and the MAC calculation of the payload. This calculation time is synchronized to the transmitter operation with the delay of the verifier operation (see Figure 4-2). If the MAC0 included in the payload does not correspond to the calculated MAC0, an error code, ERR, is set for the prover RNRp response data. Otherwise, it is checked if the SC and RC are correct to load the previous MAC-1 data for the prover response RNRp. If the prover operation is correct, the actual MAC0 and SC are stored, the secure data is updated with the TCK and the payload is stored. Otherwise, the secure data remain unchanged and the SC are stored to compare it with the next packet.
Figure 4-3. Program Flow of the Application Software (Receiver and Prover)

The coding and crypto operations used in the demo software are simple operations without any high security levels to show the proof of concept. This operation can be replaced with appropriate coding and crypto algorithms.

To allow the restart of both devices in the case of erroneous SC and RC data, a maximum value for the RC is set (max. RC = 20). In this case, the SC, RC, MAC0 and data payload are reset at both devices.