64.6.11 Scrambling/Unscrambling Function
The scrambling/unscrambling function cannot be performed on devices other than memories.
Scrambling is possible only if SMM =1.
If TFRTYP=1, on-the-fly scrambling via system bus accesses is possible (see Figure 64-16, Figure 64-17 and Figure 64-19 for specific flowcharts).
If TFRTYP=0 and SMRM=1, scrambling via peripheral bus accesses is possible for write accesses (see Figure 64-15 and Figure 64-18 for specific flowcharts).
The external data lines can be scrambled in order to prevent intellectual property data located in off-chip memories from being easily recovered by analyzing data at the package pin level of either the microcontroller or the QSPI client device (memory, for example).
The scrambling/unscrambling function can be enabled by writing a 1 to the SCREN bit in the QSPI Scrambling Mode register (QSPI_SMR).
The scrambling and unscrambling are performed on-the-fly without impacting the throughput.
The scrambling method depends on the user-configurable user scrambling key (field USRK) in the QSPI Scrambling Key register (QSPI_SKR). QSPI_SKR is only accessible in Write mode.
When QSPI_SMR.SCRKL has been written once to 1, QSPI_SKR.USRK cannot be written again until the next reset.
If QSPI_SMR.RVDIS is written to 0, the scrambling/unscrambling algorithm includes the user scrambling key plus a random value depending on device processing characteristics. Data scrambled by a given microcontroller cannot be unscrambled by another.
If QSPI_SMR.RVDIS is written to 1, the scrambling/unscrambling algorithm includes only the user scrambling key. No random value is part of the key.
The user scrambling key or the seed for key generation must be securely stored in a reliable nonvolatile memory in order to recover data from the off-chip memory. Any data scrambled with a given key cannot be recovered if the key is lost.