Encrypting packets on-the-fly in radio transmit mode

nRF5340 Product Specification

When CCM encrypts a packet on-the-fly while RADIO is transmitting it, RADIO must read the encrypted packet from the same memory location that CCM is writing to.

The OUTPTR pointer in CCM must point to the same memory location as the PACKETPTR pointer in RADIO, as illustrated in the following figure.

Figure 4. Configuration of on-the-fly encryption

The OUTPTR pointer in CCM pointing to the same memory location as the PACKETPTR pointer in RADIO

In order to match RADIO’s timing, the KSGEN task must be triggered early enough to allow the keystream generation to complete before packet encryption begins.

For short packets (MODE.LENGTH = Default), the KSGEN task must be triggered before or at the same time as the START task in RADIO is triggered. In addition, the shortcut between the ENDKSGEN event and the CRYPT task must be enabled. This use-case is illustrated in On-the-fly encryption of short packets (MODE.LENGTH = Default), using a PPI connection. It uses a PPI connection between the READY event in RADIO and the KSGEN task in CCM.

For long packets (MODE.LENGTH = Extended), the keystream generation needs to start earlier, such as when the TXEN task in RADIO is triggered.

Refer to Timing specification for information about the time needed for generating a keystream.

Figure 5. On-the-fly encryption of short packets (MODE.LENGTH = Default), using a PPI connection

KSGEN task triggered not later than triggering of the START task in the radio. The shortcut between the ENDKSGEN event and the CRYPT task enabled.

For long packets (MODE.LENGTH = Extended), the keystream generation will need to be started even earlier, for example at the time when the TXEN task in the radio is triggered.

Note: See Timing specification for information about the time needed for generating a keystream.