25. Coupling and chaining bridge (CCB)

This section only applies to STM32C59x/5A3 products.

25.1 CCB introduction

The coupling and chaining bridge (CCB) is a sophisticated security mechanism designed to ensure that private keys are protected, even against CPU access, and are wrapped with unique device keys, and stored securely in a secure storage.

The CCB can be programmed to implement special coupling and chaining operations required to protect private keys used in PKA protected operations.

These coupling and chaining operations involve the PKA, the SAES, and sometimes the RNG peripherals.

25.2 CCB main features

The principal features of the CCB are listed below:

25.3 CCB implementation

The CCB connects the peripherals listed in Table 187.

Table 187. Peripherals connected by CCB interconnect

PeripheralCoupling and chaining feature(1)Tamper status flag in CCB_SR
RNGYesTAMP_EVT0
SAESYesTAMP_EVT1
PKAYesTAMP_EVT2 (registers + PKA RAM)
TAMP_EVT3 (PKA operations)
CCBYesTAMP_EVT4
AESNoTAMP_EVT5
HASHNo-

1. See Section 25.4.4 for details.

25.4 CCB functional description

25.4.1 CCB block diagram

Figure 165 shows the CCB block diagram. Peripherals connected to the CCB interconnect, with optional coupling/chaining features, are defined in Section 25.3.

Figure 165. CCB block diagram

Figure 165. CCB block diagram. The diagram shows a 32-bit AHB bus connected to a CCB (+ AHB interconnect) block. The CCB block contains a CCB interconnect, RNG, SAES, PKA, and CCB registers. The CCB interconnect is connected to a Peripheral block and the CCB registers. The RNG, SAES, and PKA blocks are connected to the CCB interconnect via optional coupling or chaining features, indicated by asterisks (*). The CCB registers are connected to the CCB interconnect and the RCC block. The RCC block is connected to the CCB interconnect via enable signals: rng_hclk_en, pka_hclk_en, saes_hclk_en, and ccb_hclk_en.

The diagram illustrates the CCB block structure. A 32-bit AHB bus with a hclk signal enters the CCB (+ AHB interconnect) block. Inside this block, the CCB interconnect is linked to a Peripheral block and CCB registers. Optional coupling or chaining features, marked with (*), connect the CCB interconnect to the RNG, SAES, and PKA blocks. The CCB registers interface with the CCB interconnect and output enable signals (rng_hclk_en, pka_hclk_en, saes_hclk_en, ccb_hclk_en) to the RCC block.

(*) Optional coupling or chaining

MSv71138V2

Figure 165. CCB block diagram. The diagram shows a 32-bit AHB bus connected to a CCB (+ AHB interconnect) block. The CCB block contains a CCB interconnect, RNG, SAES, PKA, and CCB registers. The CCB interconnect is connected to a Peripheral block and the CCB registers. The RNG, SAES, and PKA blocks are connected to the CCB interconnect via optional coupling or chaining features, indicated by asterisks (*). The CCB registers are connected to the CCB interconnect and the RCC block. The RCC block is connected to the CCB interconnect via enable signals: rng_hclk_en, pka_hclk_en, saes_hclk_en, and ccb_hclk_en.

25.4.2 CCB internal signals

Table 188 describes the relevant internal signals interfacing the CCB peripheral. Signals targeting peripherals connected to the CCB are not listed.

Table 188. CCB internal input/output signals

Signal nameSignal typeDescription
hclkDigital inputInterconnect system clock input
ccb_hclk_enDigital outputCCB clock request to the RCC
x_hclk_enDigital outputPeripheral x clock request to the RCC (x = SAES, PKA, or RNG)

25.4.3 CCB reset and clocks

The CCB shares the same clock used by the AHB bus. Once the CCB clock is activated in the RCC, and coupling and chaining activity is activated by setting CCOP ≠ 0 in CCB_CR, the CCB automatically requests the RCC to enable RNG, SAES, and PKA clocks. These clocks remain enabled until the application gates them in the RCC, with CCOP cleared in the CCB_CR register.

The CCB has a dedicated reset bit in the RCC, and a system reset input. Locally to the CCB it is also possible to trigger a reset of the peripheral based on IPRST (do not use it when the application does not use CCB) in the CCB_CR register (refer to the bitfield description for details). Status register CCB_SR has a specific reset behavior (see Section 25.7.2).

When at least a cryptographic peripheral raises a tamper event, the CCB requests its clock to the RCC. The tamper status TAMP_EVTi of these peripherals can be found in the CCB_SR register, as defined in Section 25.3.

25.4.4 CCB coupling and chaining

Note: The selection of these chaining modes is defined in Section 25.5. In most of these operations, a read of the PKA RAM returns 0 (shown with a purple circle in the following figures).

Coupling CPU → PKA + SAES (write)

When the corresponding OPSTEP is selected, the CCB takes the write requests that go to the PKA RAM, and sends them to SAES_DINR, as shown in Figure 166. Write to SAES_DINR is not coupled to the PKA. The CCB sends both data and address to SAES_DINR.

Figure 166. CCB operation CPU → PKA + SAES (write)

Diagram of CCB operation CPU to PKA + SAES (write). A CPU is connected to a System bus, which is connected to a CCB block. The CCB is connected to SAES and PKA blocks. A pink arrow labeled 'Coupling' shows data flow from the System bus to the CCB, then to SAES, and then to PKA. A pink circle with a minus sign is between SAES and PKA. The label 'MSv71139V1' is in the bottom right corner.
Diagram of CCB operation CPU to PKA + SAES (write). A CPU is connected to a System bus, which is connected to a CCB block. The CCB is connected to SAES and PKA blocks. A pink arrow labeled 'Coupling' shows data flow from the System bus to the CCB, then to SAES, and then to PKA. A pink circle with a minus sign is between SAES and PKA. The label 'MSv71139V1' is in the bottom right corner.

Chaining PKA → SAES

When the corresponding OPSTEP is selected, for each 32-bit write request to the PKA RAM of magic number 0xCCB, the CCB generates a read request from the write target (in the PKA RAM) to SAES_DINR.

Figure 167. CCB operation PKA → SAES

Diagram of CCB operation PKA to SAES. A CPU is connected to a System bus, which is connected to a CCB block. The CCB is connected to SAES and PKA blocks. A pink arrow labeled 'Chaining' shows data flow from the System bus to the CCB, then to PKA, and then to SAES. A pink circle with a minus sign is between PKA and SAES. The label 'MSv71140V1' is in the bottom right corner.
Diagram of CCB operation PKA to SAES. A CPU is connected to a System bus, which is connected to a CCB block. The CCB is connected to SAES and PKA blocks. A pink arrow labeled 'Chaining' shows data flow from the System bus to the CCB, then to PKA, and then to SAES. A pink circle with a minus sign is between PKA and SAES. The label 'MSv71140V1' is in the bottom right corner.

Chaining SAES → PKA

When the corresponding OPSTEP is selected, the CCB takes the write requests that go to the PKA RAM, and substitutes these data by a 32-bit word coming from SAES_DOUTR. When available, this chaining is activated when the application writes 0xCCB to PKA RAM.

Figure 168. CCB operation SAES → PKA

Diagram of CCB operation SAES to PKA. A CPU is connected to a System bus, which is connected to a CCB block. The CCB is connected to SAES and PKA blocks. A blue arrow labeled 'Chaining' shows data flow from the System bus to the CCB, then to SAES, and then to PKA. A blue circle with a minus sign is between SAES and PKA. The label 'MSv71150V1' is in the bottom right corner.
Diagram of CCB operation SAES to PKA. A CPU is connected to a System bus, which is connected to a CCB block. The CCB is connected to SAES and PKA blocks. A blue arrow labeled 'Chaining' shows data flow from the System bus to the CCB, then to SAES, and then to PKA. A blue circle with a minus sign is between SAES and PKA. The label 'MSv71150V1' is in the bottom right corner.

Chaining SAES → CCB

When the corresponding OPSTEP is selected, the CCB takes the read requests to SAES_DOUTR, and sends them to the system interconnect and to CCB_REFTAGRx holding the reference TAG information. For confidentiality reason, read data toward system bus are zeroed by the CCB.

If the CCB finds that the transfered value matches its reference information, it signals to the PKA that it can proceed with the protected PKA operation (START bit can be set).

Figure 169. CCB operation SAES → CCB

Figure 169: CCB operation SAES → CCB diagram. The diagram shows a CPU connected to a System bus. The CCB is connected to the System bus and contains internal components: SAES, PKA, and REFTAG. A solid blue arrow points from the System bus to the CCB. Inside the CCB, a solid blue arrow points from the CCB to SAES, and a dashed blue arrow points from the CCB to REFTAG. A solid blue arrow points from REFTAG to PKA. A dashed blue arrow points from PKA back to the CCB, labeled 'operation ok/ not ok'. A dashed blue arrow points from the CCB back to the System bus, labeled 'Chaining'. A purple circle with a minus sign is on the System bus line between the CPU and the CCB.

MSv71151V1

Figure 169: CCB operation SAES → CCB diagram. The diagram shows a CPU connected to a System bus. The CCB is connected to the System bus and contains internal components: SAES, PKA, and REFTAG. A solid blue arrow points from the System bus to the CCB. Inside the CCB, a solid blue arrow points from the CCB to SAES, and a dashed blue arrow points from the CCB to REFTAG. A solid blue arrow points from REFTAG to PKA. A dashed blue arrow points from PKA back to the CCB, labeled 'operation ok/ not ok'. A dashed blue arrow points from the CCB back to the System bus, labeled 'Chaining'. A purple circle with a minus sign is on the System bus line between the CPU and the CCB.

Chaining RNG → PKA (write)

When the corresponding OPSTEP is selected, the CCB takes the write requests that go to the PKA RAM, and substitutes these data with random numbers coming from RNG_DR. For consistency, the application can write 0xCCB to activate this chaining.

Figure 170. CCB operation RNG → PKA (write)

Figure 170: CCB operation RNG → PKA (write) diagram. The diagram shows a CPU connected to a System bus. The CCB is connected to the System bus and contains internal components: RNG and PKA. A solid blue arrow points from the System bus to the CCB. Inside the CCB, a solid blue arrow points from the CCB to RNG, and a dashed blue arrow points from the CCB to PKA. A solid blue arrow points from RNG to PKA. A dashed blue arrow points from PKA back to the CCB. A dashed blue arrow points from the CCB back to the System bus, labeled 'Chaining'. A purple circle with a minus sign is on the System bus line between the CPU and the CCB.

MSv71152V1

Figure 170: CCB operation RNG → PKA (write) diagram. The diagram shows a CPU connected to a System bus. The CCB is connected to the System bus and contains internal components: RNG and PKA. A solid blue arrow points from the System bus to the CCB. Inside the CCB, a solid blue arrow points from the CCB to RNG, and a dashed blue arrow points from the CCB to PKA. A solid blue arrow points from RNG to PKA. A dashed blue arrow points from PKA back to the CCB. A dashed blue arrow points from the CCB back to the System bus, labeled 'Chaining'. A purple circle with a minus sign is on the System bus line between the CPU and the CCB.

Chaining RNG → SAES (write)

When the corresponding OPSTEP is selected, the CCB takes the write requests that go to SAES_IVR1 to IVR3, and substitutes these data with random numbers coming from RNG_DR. For consistency, the application can write 0xCCB to activate this chaining.

Figure 171. CCB operation RNG → SAES (write)

Diagram of CCB operation RNG → SAES (write). A CPU is connected to a System bus. The CCB is connected to the System bus and has bidirectional data paths to both the RNG and the SAES. A dashed blue line labeled 'Chaining' indicates a data flow from the RNG to the SAES.

The diagram illustrates the data flow for a write operation from the RNG to the SAES via the CCB. The CPU connects to the System bus, which in turn connects to the CCB. The CCB has bidirectional data paths to both the RNG and the SAES. A dashed blue line labeled 'Chaining' shows the data path from the RNG to the SAES.

Diagram of CCB operation RNG → SAES (write). A CPU is connected to a System bus. The CCB is connected to the System bus and has bidirectional data paths to both the RNG and the SAES. A dashed blue line labeled 'Chaining' indicates a data flow from the RNG to the SAES.

MSv71153V1

25.4.5 CCB error management

When the CCB detects an error during a coupling and chaining operation (see Section 25.5), it sets accordingly OPERR[5:0] in CCB_SR (see Section 25.7.2 for the possible errors).

When OPERR[5:0] ≠ 0 in CCB_SR, the CCB raises IPRST in CCB_CR, sets OPSTEP[4:0] to 0x1F, and sets CCB_BUSY bit to 1. The application must clear IPRST to be able to use again the CCB and the peripheral(s) used by the coupling and chaining operation.

25.5 CCB coupling and chaining operations

When an application must enforce private key confidentiality by wrapping them with a 256-bit hardware unique key, the following steps are needed:

  1. 1. Select the protected operation in the PKA that uses this private key (ECDSA signature, scalar multiplication, modular exponentiation). Then, choose the CCOP value in the CCB that corresponds to the selected operation, as defined in this section. Then, as multiple cryptographic peripherals are used, make sure to follow the guidelines described in Section 25.5.1
  2. 2. When CCB is active (OPSTEP=0x1), select in the SAES the DHUK (with optional XOR with BHK), or unwrap in the SAES an existing blob encryption key that has been encrypted (in wrapped-key mo.de) using the DHUK. A 256-bit KEYSIZE must be selected.
    As the DHUK value is different when CCB is active or inactive, the operation of wrapping or unwrapping blob encryption key in SAES (with KMOD[1:0]=0x1) must be done when OPSTEP=0x1. Refer to operation with wrapped keys in Section 28: Secure AES coprocessor (SAES) for details.
  3. 3. When the application uses this protected operation in the PKA, it must load the related blob information in the PKA RAM and in SAES_DINR.
    • – If the information exactly matches the conditions of the blob generation (choice and order of the writes of protected parameters in the PKA RAM, selection of blob

encryption key, use of original encrypted secrets), the CCB allows the application to set START bit in PKA_CR.

Figure 172. Blob creation scenarios

Flowchart showing blob creation scenarios for ECDSA signature, ECC scalar mult, and RSA modular exp. Each scenario involves protected operations (blue boxes) and verification steps. ECDSA: (1) ECDSA sign blob creation, (2) ECDSA sign blob usage for public key computation, (3) ECDSA signature verification, (4) ECDSA sign blob usage. ECC: (1) ECC key blob creation, (2) ECC key blob usage for public key computation, (3) ECC key blob usage. RSA: (1) RSA key blob creation, (2) RSA key blob usage for blob verification, (3) RSA key blob usage. Legend: Blue box = Protected operation.

The diagram illustrates three blob creation scenarios, each consisting of a sequence of protected operations (indicated by blue boxes) and verification steps.

Legend: A blue rounded rectangle represents a Protected operation.

MSv58432V1

Flowchart showing blob creation scenarios for ECDSA signature, ECC scalar mult, and RSA modular exp. Each scenario involves protected operations (blue boxes) and verification steps. ECDSA: (1) ECDSA sign blob creation, (2) ECDSA sign blob usage for public key computation, (3) ECDSA signature verification, (4) ECDSA sign blob usage. ECC: (1) ECC key blob creation, (2) ECC key blob usage for public key computation, (3) ECC key blob usage. RSA: (1) RSA key blob creation, (2) RSA key blob usage for blob verification, (3) RSA key blob usage. Legend: Blue box = Protected operation.

This section describes how to do the above steps, for all available protected operations in the PKA. Note that:

Note: It is not possible to generate RSA key pairs with the CCB, they must be generated outside the device.

25.5.1 Preliminary steps before any protected operation

The following steps are required before running any operation described in this section:

  1. 1. Initialize the GTZC using the same security/privilege configuration protections for the SAES, PKA, RNG and CCB peripherals Section 5: Global TrustZone® controller (GTZC). Otherwise OPERR=0x1A occurs (see Section 25.7.2).
  2. 2. Activate both RNG clocks, then initialize the peripheral to be fully functional, without pending errors.
  3. 3. Activate the PKA clock, then release the PKA reset. The PKA is functional once its RAM is automatically erased, and it has fetched the necessary random numbers. For further details refer to enabling/disabling PKA in Section 30: Public key accelerator (PKA).
  4. 4. Activate the SAES clock, then release the SAES reset. The SAES is functional once it has fetched necessary random numbers.
  5. 5. Activate the CCB clock, set IPRST bit in CCB_CR, then clear it when CCB_BUSY=0x0 in CCB_SR.

Note: Step 4 can be done before step 3, as CCOP = 0x0.

25.5.2 ECDSA signature

This PKA operation is protected against side-channel attacks. When CCOP = 0x0, all parameters loaded in the PKA RAM are managed in the clear by the application. When CCOP = 0xC3, the private key d can be manipulated by the application only if encrypted, using a special blob called “ECDSA signature blob”.

ECDSA signature blob creation

The ECDSA signing operation is prepared by generating and then encrypting the private key d, and computing the reference GCM tag. This process is summarized Table 189, with coupling and chaining operations described in Section 25.4.4. This sequence starts by setting CCOP to 0xC0 or 0xC2 in CCB_CR.

Table 189. Blob creation steps for ECDSA signature (CCOP = 0b110000<i>0)

OP STEPMODE in PKAGCMPH in SAESCoupling or chainingEnd-step event(1)CPU action in the step
0x1N/AN/AN/AAES GCM selected, GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x24 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally decrypt the blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set AES-GCM up in 256-bit encryption mode, with the DHUK or the decrypted key in register (if applicable).
  • – Write hash z in the PKA RAM.
0x20x0RNG -> SAESGCMPH = 0x1 (following GCM initialization)
  • – Complete GCM initialization in encryption mode. SAES_IVR1 to SAES_IVR3 are loaded with randoms.
  • – Read back blob IV in SAES_IVR registers.
0x30x240x1CPU -> PKA + SAESGCMPH = 0x2Write ECC signature parameters in the PKA RAM, clearing CCF flags in the SAES triggered after each 2x32-bit write.
0x6 (<i>=1)0x240x2RNG -> PKARNGOKF setWrite incrementally d in the PKA, using 0xCCB magic number. Values are drawn from the RNG. The PKA runs a special sanity check to verify random compliance with NIST standard (RNGERRF is set if sanity check fails).
0x4 (<i>=0)n/aDATAOKF setWrite incrementally d in the PKA.
0x80x24PKA -> SAESDATAOKF set
  • – Read incrementally d from the PKA (writing 0xCCB magic numbers), and run AES encryption rounds. Special rule must be used for the last 64-bit word (see step 7 after the table).
  • – Read encrypted d in SAES_DOUTR.
  • – Repeat for each 16 bytes block of data.
0x9RNG -> PKARNGOKF set, GCMPH = 0x3
  • – Write incrementally k in the PKA, using 0xCCB magic number. Values are drawn from the RNG. The PKA runs a special sanity check to verify random compliance with NIST standard (RNGERRF is set if the sanity check fails).
0xA(2)0x3N/A
  • – Complete GCM final.
  • – Read reference tag in the SAES.
  • – Start the operation in PKA setting START bit in PKA_CR
For the first two steps keep the SAES enabled (EN bit set).

Table 189. Blob creation steps for ECDSA signature (CCOP = 0b110000&lt;i&gt;0) (continued)

OP STEPMODE in PKAGCMPH in SAESCoupling or chainingEnd-step event(1)CPU action in the step
0x19(3)0x24N/AN/APROCENDF setThe PKA computes the operation, PKA RAM reads as 0
0x1AN/AN/AIPRST set in the CCB
  • Read signature (r,s) in PKA RAM, and save it in SRAM. It is used (at least once) for blob creation verification.
  • Set IPRST in CCB
0x0N/AN/AN/AN/A
  1. 1. The application must clear and/or perform the described event for the CCB to automatically go to the next step.
  2. 2. Once START bit is set SAES is reset, and OPERR linked to SAES are deactivated. Also when START bit is set, CCB sets OPSTEP to 0x19 after a few cycles.
  3. 3. SAES cannot be used for any operations, for security reasons.

The sequence described in Table 189 is detailed below. Refer to the table for OPSTEP values and related coupling/chaining modes.

  1. 1. Write CCOP = 0xC0 or 0xC2 in CCB_CR.
  2. 2. Enable the PKA in the correct mode, writing in PKA_CR MODE=0x24 and EN=1 (repeat if the EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  3. 3. Write the hash of the message in the PKA RAM
  4. 4. Initialize the ECC signature blob key in the SAES. This key can be the DHUK (KEYSEL = 0x1 or 0x4), or a key decrypted in 256-bit wrapped key mode by the DHUK (KEYSEL = 0x1 or 0x4, KMOD = 0x1, MODE = 0x1 or 0x2). See Section 28: Secure AES coprocessor (SAES) for details.
  5. 5. In the SAES, set the GCM chaining mode in encryption mode (CHMOD = 0x3, GCMPH = 0x0, MODE = 0x0, DATATYPE = 0x0). Then:
    1. a) Configure the 256-bit key size using KEYSIZE.
    2. b) Write SAES_IVRx, with any value (except SAES_IVR0 that must be equal to 0x2). For SAES_IV1 to IV3, random values are loaded into the SAES by the CCB. If an error occurs, RNGERRF is set in CCB_SR.
    3. c) Read back SAES_IVR1 to SAES_IVR3, and save the value in non-volatile memory after blob verification.
    4. d) Set EN in SAES_CR, and wait until CCF = 1 in SAES_ISR (end of GCM init).
    5. e) Clear CCF flag in SAES_ICR.
  6. 6. Select the header phase of the running GCM chaining mode (GCMPH = 0x1). Write the protected operation (ECDSA signature) mandatory parameters in the PKA RAM, as described in Section 30: Public key accelerator (PKA). Do the following when writing data in the PKA:
    1. a) Write two 32-bit word in the PKA RAM, then wait until CCF is set in SAES_ISR. An SAES interrupt can be triggered when this flag is set.
    2. b) Clear CCF in SAES_ICR.
  1. 7. Select the payload phase of the running GCM chaining mode (GCMPH = 0x2). Write the private key d in the PKA RAM using the following sequence:
    1. a) If CCOP = 0xC0, write the private key d value in the PKA RAM. If CCOP = 0xC2, write the 32-bit magic number 0xCCB to the private key d parameter addresses in the PKA memory. The CCB then draws the value of d from the RNG, with PKA running a special sanity check to verify random compliance with NIST standard.
    2. b) Complete parameter information with the mandatory two 32-bit zeroed words. At the end of this process, the private key d of size d_size is written in the PKA RAM. Clear the error flag, then restart step 6 if the PKA sets RNGERRF when BUSY is cleared.
  2. 8. When the PKA sets its completion flag (RNGOKF if CCOP = 0xC2, DATAOKF if CCOP = 0xC0), clear it, then read the private key d in the PKA RAM using the sequence below (starting from the LSB word in the PKA RAM, and increasing the addresses modulo 0x8):
    1. a) For each 64-bit word in the PKA RAM, write twice the 32-bit magic number 0xCCB to the private key d parameter addresses in the PKA memory. The target content of the PKA memory is transferred to SAES_DINR by the CCB. Wait until CCF is set in SAES_ISR (end of AES encryption). An SAES interrupt can be triggered when this flag is set.
    2. b) Clear CCF flag in SAES_ICR. Then read the encrypted private key d in SAES_DOUT, to save it in the non-volatile memory after blob verification.
    3. c) For the final 64-bit word (mandatory zeroed word): if the d_size is proportional to 16 bytes (for example, for 192- and 521-bit curves), the final 64 bits must be written to with two 32-bit magic numbers 0xCCB. If the d_size is not proportional to 16 bytes (for example, for 256- and 512-bit curves), the final 64 bits must be written with 0s.
  3. 9. When DATAOKF = 1 in PKA_SR (private key d ok), clear this flag. Then write to the integer k parameter addresses in the PKA memory, starting from the LSB word in the PKA RAM, and increasing the addresses modulo 0x8. The CCB draws the value of k from the RNG. The PKA then runs a special sanity check to verify random compliance with NIST standard. Clear the error flag then restart this step if the PKA sets RNGERRF when BUSY is cleared.
  4. 10. When RNGOKF = 1 in PKA_SR (random k OK), clear this flag. Then select the final phase of the running GCM chaining mode (GCMPH = 0x3). Write the last GCM block in SAES_DINR. Then wait until CCF is set in SAES_ISR (end of GCM final).
  5. 11. Read SAES_DOUTR four times to retrieve the ECDSA signature blob reference tag. Save it in the non-volatile memory after blob verification. Do not disable SAES by clearing the EN bit.
  6. 12. Set START bit in PKA_CR to run the ECDSA signature operation.
  7. 13. When the PROCENDF completion flag is set save the ECDSA signature (r,s) of the hash z in SRAM to use it after using the new blob for public-key computation.
  8. 14. Clear CCOP by setting IPRST bit in CCB_CR. After CCB_BUSY is cleared in CCB_SR, clear the IPRST bit. The SAES, and PKA can again be used for any tasks. They are unprotected by the CCB until CCOP is written different from 0.

ECDSA signature blob usage for ECDSA signature

Table 190 summarizes the ECDSA signing operation using the encrypted private key d, the reference blob IV, and the computed GCM tag of Table 189. Coupling and chaining traffic options are described in Section 25.4.4. This sequence starts by setting CCOP to 0xC3 in the CCB_CR register.

Table 190. Blob use steps for ECDSA signature (CCOP = 0b11000011)

OPSTEPMODE in PKAGCMPHCoupling or chaining operationsEnd-step event(1)CPU action in step
0x1N/AN/AN/AAES GCM selected, GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x24 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally decrypt the blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set AES-GCM up in 256-bit encryption mode, with the DHUK or the decrypted key in register (if applicable).
  • – Write hash z.
0x120x0N/AGCMPH = 0x1 (following GCM initialization)
  • – Complete GCM initialization in decryption mode, using saved random IV.
  • – Write reference tag in CCB_REFTAGR.
0x130x240x1CPU → PKA + SAESGCMPH = 0x2Write ECC signature parameters in the PKA RAM, clearing CCF flags in the SAES, triggered after each 64-bit write.
0x140x2SAES → PKADATAOKF set
  • – Write encrypted d in SAES_DINR, and runs AES decryption round.
  • – Write incrementally private key d in the PKA, using 0xCCB magic number. A special rule must be used for the last 64-bit write (see step 7 in the sequence detailed after this table).
  • – Repeat for each 16-byte block of data.
0x16RNG → PKARNGOKF set, GCMPH = 0x3Write incrementally k in the PKA, using 0xCCB magic number. Values are drawn from the RNG. The PKA runs a special sanity check to verify random compliance with NIST standard (RNGERRF is set if the sanity check fails).
0x170x3SAES → CCBTag matches REFTAGR?
  • – Complete GCM final.
  • – Read computed tag in the SAES (returns 0).
0x180x24N/AN/ASTART = 0x1Start the operation in PKA setting START bit in PKA_CR.
0x19(2)N/AN/APROCENDF setThe PKA computes the operation, PKA RAM is read as 0.
0x1AN/AN/AN/ARead signature (r,s) in the PKA RAM.
  1. 1. The application must clear and/or perform the described event for the CCB to automatically go to the next step.
  2. 2. SAES cannot be used for any operations, for security reasons..

The sequence described in Table 190 is detailed below. Refer to the table for the OPSTEP values and related coupling and chaining modes.

  1. 1. Write CCOP = 0xC3 in CCB_CR.
  2. 2. Enable the PKA in the correct mode, writing in PKA_CR MODE=0x24 and EN=1 (repeat if the EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  3. 3. Write the hash of the message in the PKA RAM.
  4. 4. Initialize the ECC signature blob key in the SAES. This key can be the DHUK (KEYSEL = 0x1 or 0x4), or a key decrypted in 256-bit wrapped key mode by the DHUK (KEYSEL = 0x1 or 0x4, KMOD = 0x1, MODE = 0x1). Refer to Section 28: Secure AES coprocessor (SAES) for details.
  5. 5. Set the GCM chaining mode in decryption in the SAES (CHMOD = 0x3, GCMPH = 0x0, MODE = 0x2, DATATYPE = 0x0). Then:
    1. a) Configure the 256-bit key size using KEYSIZE.
    2. b) Write to SAES_IVRx registers the value saved in non-volatile memory.
    3. c) Set EN in SAES_CR, and wait until CCF is set in SAES_ISR (end of GCM init).
    4. d) Clear CCF flag in SAES_ICR.
    5. e) Write to CCB_REFTAGR registers, the ECDSA signature blob reference tag value saved in non-volatile memory.
  6. 6. Select the header phase of the running GCM chaining mode (GCMPH = 0x1). Write the protected operation (ECDSA signature) mandatory parameters in the PKA RAM, exactly as done during the blob creation. See step 5 in ECDSA signature blob creation for details.
  7. 7. Select the payload phase of the running GCM chaining mode (GCMPH = 0x2). Write the protected private key d in the PKA RAM, following the below sequence (starting from the LSB word in the PKA RAM, and increasing the addresses modulo 0x8):
    1. a) Write two 64-bit words of encrypted private key d in SAES_DINR. Wait until CCF is set in SAES_ISR (end of AES decryption). An SAES interrupt can be triggered when this flag is set.
    2. b) Clear the CCF flag in the SAES_ICR register. Then, for both 64-bit words, write four times the 32-bit magic number 0xCCB to the private key d parameter addresses in the PKA memory. The CCB transfers the clear-text content of SAES_DOUTR to the PKA.
    3. c) For the final 64-bit word (mandatory zeroed word): If d_size defined in step 6 in ECDSA signature blob creation is not proportional to 16-bytes (for example, for 256- and 512-bit curves), the final 64 bits must be written with 0s.
  8. 8. When DATAOKF = 1 in PKA_SR (private key d ok), clear this flag. Then write to the integer k parameter addresses in the PKA memory, starting from the LSB word in the PKA RAM, and increasing the addresses modulo 0x8. The CCB draws the value of k from the RNG. The PKA then runs a special sanity check to verify random compliance with NIST standard. Clear the error flag, then restart step 7 if the PKA sets RNGERRF when BUSY is cleared.
  9. 9. When RNGOKF = 1 in PKA_SR (random k ok), clear this flag. Then select the final phase of the running GCM chaining mode (GCMPH = 0x3). Write the last GCM block in SAES_DINR. Then wait until CCF is set in SAES_ISR (end of GCM final).
  10. 10. Read four times SAES_DOUTR (returns 0s). If PKA parameters were written exactly like during the blob creation, and the correct private key d was used, and all expected DATAOKF/RNGOKF flags were raised then cleared, the application can set START bit

in PKA_CR to run the ECDSA signature operation. Otherwise, IPRST in CCB_CR must be used to restart the sequence from step 1.

  1. 11. Clear CCOP by setting IPRST in CCB_CR. After CCB_BUSY is cleared in CCB_SR, clear the IPRST bit. The SAES, and PKA can again be used for any tasks. They are unprotected by the CCB until CCOP in CCB_CR is written different from 0.

ECDSA signature blob use for public-key computation

The ECC public key computation using the encrypted private key d, the reference blob IV, and the computed GCM tag of Table 189 is summarized in Table 191. The additional ECDSA verification at the end of the sequence must be used before saving a new ECDSA signature blob in non-volatile memory. Shown coupling and chaining traffic options are described in Section 25.4.4. This sequence starts by setting CCOP to 0x81 in the CCB_CR register.

Table 191. Blob use steps for signing public key computation (CCOP = 0b10000001)

OPSTEPMODE in PKAGCMPH in SAESCoupling or chaining operationsEnd-step event(1)CPU action
0x1N/AN/AN/AAES GCM selected, GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x20 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally decrypt blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set up AES-GCM in decryption mode with DHUK or the decrypted key in register (if applicable).
0x120x200x0N/AGCMPH = 0x1 (following GCM initialization)
  • – Complete GCM initialization in decryption mode, using saved random IV.
  • – Write reference tag in CCB_REFTAGR.
0x130x1CPU -> PKA + SAESGCMPH = 0x2Write ECC signature parameters in the PKA RAM, clearing CCF flags in SAES, triggered after each 2x32-bit write.
0x140x2SAES -> PKADATAOKF set, GCMPH = 0x3
  • – Write encrypted d in SAES DINR and run AES decryption round.
  • – Write incrementally scalar multiplier k in the PKA, using 0xCCB magic number.
  • – Repeat for each 16 bytes block of data.
0x170x3SAES -> CCBTag matches REFTAGR?
  • – Complete GCM final.
  • – Read computed tag in the SAES (returns 0).
0x180x20N/AN/ASTART = 0x1Start the operation in PKA setting START bit in PKA_CR.
0x19(2)N/AN/APROCENDF setThe PKA computes the operation. PKA RAM is read as 0.
0x1A0x20N/AN/AN/A– Read public key point Q in PKA RAM
Table 191. Blob use steps for signing public key computation (CCOP = 0b10000001)
OPSTEPMODE in PKAGCMPH in SAESCoupling or chaining operationsEnd-step event(1)CPU action
0x1A0x20N/AN/AIPRST set in the CCB
  • – Read public key point Q in PKA RAM
  • – Set IPRST in CCB
0x00x26N/AN/AN/A

Clear the IPRST bit in CCB when CCB_BUSY and OPSTEP are cleared in CCB_SR.

Before writing new ECDSA signature blob in non-volatile memory do the following:

  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x26 and EN=1. Wait for INITOK=1.
  • – Write the hash z used during blob creation (see Table 189)
  • – Write ECDSA verification parameters in PKA, including the public key coordinates computed in step 0x1A.
  • – Start the operation setting START bit in PKA_CR
  • – Wait for PROCENDF bit is set. If the signature is valid save the created blob in non-volatile memory.
  1. 1. The application must clear and/or perform described event for CCB to automatically go to the next step.
  2. 2. SAES cannot be used for any operations, for security reasons.

25.5.3 ECC scalar multiplication

This operation consists in the computation of k × P, where P is a point on a curve over prime fields, and “×” is the elliptic curve scalar point multiplication. The computation result is a point that belongs to the same curve, or a point at infinity.

The scalar multiplication operation is protected against side-channel attacks. When CCOP = 0x0 in CCB_CR, all parameters loaded in the PKA RAM are managed in the clear by the application. When CCOP = 0x81, the scalar multiplier k can be manipulated by the application only if encrypted, using a special blob called “ECC key blob”.

Scalar multiplication “ECC key” blob creation

The scalar multiplication operation is prepared by generating then encrypting the scalar multiplier k, and computing the reference GCM tag. This process is summarized in Table 192. Coupling and chaining operations described in Section 25.4.4. This sequence starts by setting CCOP to 0x80 or 0x82 in CCB_CR register.

Table 192. Blob creation steps for scalar multiplication (CCOP = 0b100000&lt;i&gt;0)

OPSTEPMODE in PKAGCMPH in SAESCoupling or chaining operationsEnd-step event(1)CPU action in step
0x1N/AN/AN/AAES GCM selected, GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x20 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally decrypt blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set up AES-GCM in 256-bit encryption mode with DHUK or the decrypted key in register (if applicable)
  • – Write base point G coordinates as input in PKA RAM.
0x20x0RNG → SAESGCMPH = 0x1 (following GCM initialization)
  • – Complete GCM initialization in encryption mode. Registers IVR1 to 3 are loaded with randoms.
  • – Read back blob IV in IVR registers.
0x30x200x1CPU → PKA + SAESGCMPH = 0x2Write ECC scalar multiplication parameters in the PKA RAM, clearing CCF flags in SAES, triggered after each 64-bit write.
0x6 (<i>=1)0x200x2RNG → PKARNGOKF setWrite incrementally k in the PKA, using 0xCCB magic number. Values are drawn from the RNG. The PKA runs a special sanity check to verify random compliance with NIST standard (RNGERRF is set if the sanity check fails).
0x4 (<i>=0)N/ADATAOKF setWrite incrementally k in the PKA.
0x80x200x2PKA → SAESDATAOKF set, GCMPH = 0x3
  • – Read incrementally k from the PKA (writing 0xCCB magic numbers), and runs AES encryption rounds.
  • – Read encrypted k in SAES DOUTR.
  • – Repeat for each 16-byte block of data..
0xA(2)0x3N/ASTART= 0x1
  • – Complete GCM final.
  • – Read reference tag in the SAES.
  • – Start the operation in PKA setting START bit in PKA_CR

For the first two steps keep the SAES enabled (EN bit set).

0x19(3)0x20N/AN/APROCENDF setThe PKA computes the operation, PKA RAM reads as 0
0x1AN/AN/AIPRST set in the CCB
  • – Read reference public key point Q in PKA RAM, and save it in SRAM to verify the new blob.
  • – Set IPRST in CCB.
0x0N/AN/AN/AN/AClear the IPRST bit in CCB when CCB_BUSY and OPSTEP are cleared in CCB_SR.
  1. 1. The application must clear and/or perform described event for CCB to automatically go to the next step.
  2. 2. Once START bit is set SAES is reset, and OPERR linked to SAES are deactivated. Also when START bit is set, CCB sets OPSTEP to 0x19 after a few cycles.
  3. 3. SAES cannot be used for any operations, for security reasons.

Scalar multiplication blob use for example for ECC decryption

ECC scalar multiplication computation using the encrypted k, the reference blob IV and the computed GCM tag of Table 192 is summarized in Table 193. Shown coupling and chaining traffic options are described in Section 25.4.4. This sequence starts by setting CCOP to 0x81 in CCB_CR register.

Table 193. Blob use steps for scalar multiplication (CCOP = 0b10000001)

OPSTEPMODE in PKAGCMPH in SAESCoupling or chaining operationsEnd-step event(1)CPU action
0x1N/AN/AN/AAES GCM selected, GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x20 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally, decrypt blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set up AES-GCM in decryption mode with DHUK or the decrypted key in register (if applicable).
  • – Write input point P coordinates in the PKA RAM. When computing a public key, write basepoint G coordinates.
0x120x200x0N/AGCMPH = 0x1 (following GCM initialization)
  • – Complete GCM initialization in decryption mode, using saved random IV.
  • – Write reference tag in CBB_REFTAGR.
0x130x1CPU -> PKA + SAESGCMPH = 0x2Write ECC scalar multiplication parameters in the PKA RAM, clearing CCF flags in the SAES, triggered after each 64-bit write.
0x140x2SAES -> PKADATAOKF set, GCMPH = 0x3
  • – Write encrypted k in SAES_DINR, and runs AES decryption round.
  • – Write incrementally scalar multiplier k in the PKA, using 0xCCB magic number.
  • – Repeat for each 16 bytes block of data.
0x170x3N/ATag matches REFTAGR?
  • – Complete GCM final.
  • – Read computed tag in the SAES (returns 0).
0x180x20N/AN/ASTART = 0x1Start the operation in PKA setting START bit in PKA_CR. Do not use SAES during this step (under reset).
0x19(2)PROCENDF setThe PKA computes the operation. The PKA RAM is read as 0.
0x1AN/ARead kP point coordinates in the PKA RAM. If this point is the public key verify it matches the reference public key computed in Table 192 before saving the created blob in non-volatile memory.
  1. 1. The application must clear and/or perform described event for CCB to automatically go to the next step.
  2. 2. SAES cannot be used for any operations, for security reasons.

25.5.4 RSA modular exponentiation

The modular exponentiation operation is commonly used to perform a single-step RSA operation. It consists in the computation of \(A^e \bmod n\).

This modular exponentiation operation (MODE = 0x3) is protected against side-channel attacks. When CCOP = 0x0, all parameters loaded in the PKA RAM are managed in the clear by the application. When CCOP = 0x45, the exponent e and ϕ value can only be manipulated encrypted by application, using a special blob called “RSA key blob”.

Modular exponentiation “RSA key” blob creation

Modular exponentiation operation is prepared by generating then encrypting the scalar multiplier k and computing the reference GCM tag. This process is summarized in Table 194. The coupling and chaining operations described in Section 25.4.4. This sequence starts by setting CCOP to 0x44 in CCB_CR register.

Table 194. Blob creation steps for modular exponentiation (CCOP = 0b01000100)

OPSTEPMODE in PKAGCMPH in SAESCoupling or chaining operationsEnd-step event(1)CPU action in step
0x1N/AN/AN/AAES GCM selected, GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x3 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally decrypt blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set up AES-GCM in 256-bit encryption mode with DHUK or the decrypted key in register (if applicable).
  • – Write a constant K as operand A in the PKA RAM.
0x20x0RNG -> SAESGCMPH = 0x1 (following GCM initialization)
  • – Complete GCM initialization in encryption mode. SAES_IVR1 to 3 registers are loaded with randoms.
  • – Read back blob IV in SAES_IVR registers.
0x30x030x1CPU -> PKA + SAESGCMPH = 0x2Write protected modular exponentiation parameters (PKA mode 0x3) in the PKA RAM, clearing CCF flags in the SAES triggered after each 2x32-bit write.
0x40x30x2N/ADATAOKF setWrite incrementally clear-text exponent e.
0x5DATAOKF setWrite incrementally clear-text ϕ.
0x8PKA -> SAESDATAOKF set
  • – Read incrementally e from the PKA (writing 0xCCB magic numbers), and runs AES encryption rounds.
  • – Read encrypted e in SAES_DOUTR.
  • – Repeat for each 16 bytes block of data.
0x9DATAOKF set, GCMPH = 0x3
  • – Read incrementally ϕ from the PKA (writing 0xCCB magic numbers), and run AES encryption rounds.
  • – Read encrypted ϕ in SAES_DOUTR.
  • – Repeat for each 16 bytes block of data
0xA(2)0x30x3N/ASTART= 0x1
  • – Complete GCM final.
  • – Read reference tag in the SAES.
  • – Start the operation in PKA setting START bit in PKA_CR.
  • For the first two steps keep the SAES enabled (EN bit set).
Table 194. Blob creation steps for modular exponentiation (CCOP = 0b01000100)
OPSTEPMODE
in PKA
GCMPH
in SAES
Coupling or
chaining
operations
End-step
event(1)
CPU action in step
0x19(3)0x3N/AN/APROCENDF
set
The PKA computes the operation, PKA RAM is read as 0
0x1AN/AN/AIPRST set
in the CCB
  • – Read the reference modular exponentiation \(K^e \bmod n\) in PKA RAM, and save it in SRAM to verify the new blob.
  • – Set IPRST in CCB
0x0N/AN/AN/AN/AClear the IPRST bit in CCB when CCB_BUSY and OPSTEP are cleared in CCB_SR.
  1. 1. The application must clear and/or perform described event for CCB to automatically go to the next step.
  2. 2. Once START bit is set SAES is reset, and OPERR linked to SAES are deactivated. Also when START bit is set, CCB sets OPSTEP to 0x19 after a few cycles.
  3. 3. SAES cannot be used for any operations, for security reasons.

Modular exponentiation blob use (for example for RSA decryption)

The modular exponentiation computation using the encrypted e and ϕ, the reference blob IV, and the computed GCM tag of Table 194 is summarized on Table 195. Shown coupling and chaining traffic options are described in Section 25.4.4. This sequence starts by setting CCOP to 0x45 in CCB_CR register.

Table 195. Blob use steps for modular exponentiation (CCOP = 0b01000101)
OPSTEPMODE
in PKA
GCMPH
in SAES
Coupling or
chaining
operations
End-step
event(1)
CPU action
0x1N/AN/AN/AAES GCM
selected,
GCMPH = 0x0
  • – Enable the PKA in the correct mode, writing in PKA_CR MODE= 0x3 and EN=1 (repeat if EN bit stays clear). Wait for INITOK=1 in PKA_SR.
  • – Optionally decrypt blob encryption key in the SAES, using DHUK in 256-bit wrapped key mode.
  • – Set up AES-GCM in decryption mode with DHUK or the decrypted key in register (if applicable).
  • – Write operand A in the PKA RAM. Write constant K as operand A defined in Table 194 when verifying the created blob.

Table 195. Blob use steps for modular exponentiation (CCOP = 0b01000101)

OPSTEPMODE
in PKA
GCMPH
in SAES
Coupling or
chaining
operations
End-step
event(1)
CPU action
0x120x030x0N/AGCMPH = 0x1
(following GCM
initialization)
– Complete GCM initialization in decryption mode, using
saved random IV.
– Write reference tag in CCB_REFTAGR.
0x130x1CPU → PKA
+ SAES
GCMPH = 0x2Write protected modular exponentiation parameters
(PKA mode 0x3) in the PKA RAM, clearing CCF flags in
the SAES, triggered after each -bit write.
0x140x2SAES → PKADATAOKF set– Write encrypted e in SAES_DINR, and runs AES
decryption round.
– Write incrementally exponent e in the PKA, using
0xCCB magic number.
– Repeat for each 16-byte block of data.
0x15DATAOKF set,
GCMPH = 0x3
– Write encrypted phi in SAES_DINR, and runs AES
decryption round.
– Write incrementally phi in the PKA, using 0xCCB
magic number.
– Repeat for each 16-byte block of data.
0x170x3SAES →
CCB
Tag matches
REFTAGR?
– Complete GCM final.
– Read computed tag in the SAES (returns 0).
0x180x03N/AN/ASTART = 0x1Start the operation in PKA setting START bit in
PKA_CR.
0x19(2)PROCENDF setThe PKA computes the operation, PKA RAM is read as
0.
0x1AN/ARead \(A^e \bmod n\) in the PKA RAM. If the result is \(K^e \bmod n\)
verify it matches the reference computed in Table 194
before saving the created blob in non-volatile memory.
  1. 1. The application must clear and/or perform described event for CCB to automatically go to the next step.
  2. 2. SAES cannot be used for any operations, for security reasons.

25.6 CCB interrupts

The CCB does not support any interrupt.

25.7 CCB registers

The following section provides information on registers.

Reserved bits (marked as Res.) must be kept at their reset values, unless otherwise specified.

For general information relative to register description, refer to Document conventions.

These registers are accessible through the AHB interface of the CCB (32-bit words only). All reads are supported. Writes accesses must be 32-bit word only (other access types generate an AHB error).

25.7.1 CCB control register (CCB_CR)

Address offset: 0x000

Reset value: 0x0000 0000

Following a CCB hardware reset, the above reset value applies if OPERR[5:0] = 0x0 and no TAMP_EVT bit is set.

31302928272625242322212019181716
IPRSTRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
rw
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.CCOP[7:0]
rwrwrwrwrwrwrwrw

Bit 31 IPRST: CCB reset

Set this bit to start or abort any PKA protected operation defined in Section 25.5. IPRST bit must be low while writing to any CCB register.

After setting this bit, the application must clear it when CCB_BUSY and OPSTEP are cleared in CCB_SR (IPRST clear is ignored otherwise). After this clear all CCB registers are read with their reset valuesSetting IPRST clears any data stored in the SAES and the PKA.

When IPRST and CCB_BUSY are set, SAES registers are not accessible (read as 0, write ignored), and writes to EN and START bits in PKA_CR are ignored.

This bit is set by CCB when OPERR[5:0] ≠ 0 or any TAMP_EVT bit is set.

Bits 30:8 Reserved, must be kept at reset value.

Bits 7:0 CCOP[7:0]: Coupling and chaining operation

These bits must be set according to the chosen PKA protected operation (see Section 25.5).

0x044: Modular exponentiation blob creation with priv key from the CPU

0x045: Modular exponentiation blob use

0x080: ECC scalar multiplication blob creation with priv key from the CPU

0x082: ECC scalar multiplication blob creation with priv key from the RNG

0x081: ECC scalar multiplication blob use, or ECDSA signature blob use for public key computation

0x0C0: ECDSA signature blob creation with priv key from the CPU

0x0C2: ECDSA signature blob creation with priv key from the RNG

0x0C3: ECDSA signature blob use for ECDSA signature

Note: When an operation not listed here is written by the application, the write to CCOP[7:0] is ignored. All these operations implement protections against side-channel attacks. Write to CCOP is ignored when CCB_BUSY is set in CCB_SR.

25.7.2 CCB status register (CCB_SR)

Address offset: 0x004

Reset value: 0x0000 0000

This register is reset by a system reset, or after clearing IPRST in CCB_CR. The CCB reset input from the RCC has no effect on this register.

31302928272625242322212019181716
Res.Res.TAMP_EVT5TAMP_EVT4TAMP_EVT3TAMP_EVT2TAMP_EVT1TAMP_EVT0Res.Res.Res.Res.Res.Res.Res.CCB_BUSY
rrrrrrr
1514131211109876543210
Res.Res.OPERR[5:0]Res.Res.Res.OPSTEP[4:0]
rrrrrrrrrrr

Bits 31:30 Reserved, must be kept at reset value.

Bits 29:24 TAMP_EVTi: Tamper i flag (i = 5 to 0)

0: No event

1: Tamper event i has been raised. Global tamper event is raised. See Section 25.3 for details on the events.

This bit is cleared by writing 0 to IPRST bit in CCB_CR. When at least one TAMP_EVT bit is set, CCB sets IPRST bit.

Bits 23:17 Reserved, must be kept at reset value.

Bit 16 CCB_BUSY: CCB busy

This flag is set when CCB is busy, or when OPSTEP[4:0] ≠ 0 following a CCB reset (hardware reset or use of IPRST in CCB_CR).

0: CCB idle

1: CCB busy or PKA RAM is being cleared following a peripheral reset.

When IPRST and CCB_BUSY are set, the SAES registers are not accessible (write ignored, read returns 0), and writes to EN or START bits in PKA_CR are ignored.

Bits 15:14 Reserved, must be kept at reset value.

Bits 13:8 OPERR[5:0]: Operation error

When an error is detected during a protected PKA operation, the CCB raises IPRST in CCB_CR, and OPSTEP[4:0] is set to 0x1F. The bitfield is cleared by setting IPRST to 0.

0x0: No error detected during protected PKA operation (if applicable)

0x1: CCB RCC reset has been detected when OPSTEP > 0x0

0x2: SAES RCC reset has been detected when OPSTEP > 0x0

0x3: PKA RCC reset has been detected when OPSTEP > 0x0

0x4: RNG RCC reset has been detected when OPSTEP > 0x0

0x5: The RCC has gated the CCB clock when OPSTEP > 0x0.

0x6: The RCC has gated the SAES clock when OPSTEP > 0x0.

0x7: The RCC has gated the PKA clock when OPSTEP > 0x0.

0x8: The RCC has gated the RNG clock when OPSTEP > 0x0.

0x9: Random in SAES_IV1 is trivial (all 0s or all 1s) when OPSTEP = 0x2

0xA: Random in SAES_IV2 is trivial (all 0s or all 1s) when OPSTEP = 0x2

0xB: Random in SAES_IV3 is trivial (all 0s or all 1s) when OPSTEP = 0x2

0xC: When OPSTEP = 0x17 SAES GCM TAG comparison with CCB_REFTAG failed, or a register different from SAES_DOUT was read in the SAES.

0xD: KEYSIZE ≠ 256 bits in SAES_CR when the SAES is enabled, and OPSTEP > 0x0.

0xE: CHMOD ≠ GCM in SAES_CR when 0x1 < OPSTEP < 0x18, or the SAES is not enabled, or KEYVALID is cleared when GCMPH > 0x0.

0xF: KMOD different from wrapped key mode in SAES_CR when the SAES is enabled, and OPSTEP = 0x1, or 0x1A.

0x10: KEYSEL ≠ 0x1 or 0x4 in SAES_CR when the SAES is enabled, KEYVALID is set, and OPSTEP = 0x1.

0x11: GCMPH not correct (not incremented) in SAES_CR when OPSTEP > 0x1.

0x12: MODE in SAES_CR does not match the expected value (selected by CCOP in CCB_CR) when OPSTEP > 0x1.

0x13: BUSY = 1 in SAES_SR when OPSTEP= 0x18 or 0x19. SAES must not be used when PKA is computing a protected operation.

0x14: EN = 0 in PKA_CR when OPSTEP > 0x2 (except 0x12). In other words, PKA must be enabled in any OPSTEP except 0x1, 0x2, or 0x12.

0x15: INITOK = 0 in PKA_SR when OPSTEP > 0x2 (except 0x12).

0x16: Authorized by local firewall, but unexpected AHB error detected when OPSTEP > 0x0.

0x17: LMF = 1 in PKA_SR (only ECDSA verification available) when OPSTEP > 0x0.

0x18: CCB_REFTAGRx registers are equal to 0 when OPSTEP > 0x12.

0x1A: Security, privilege protections inconsistent (seeSection 5: Global TrustZone® controller (GTZC) for the peripherals SAES, PKA, RNG, and CCB when OPSTEP > 0x0. This error is also triggered when the protections change while OPSTEP > 0x0,

0x1B: MODE in PKA_CR does not match the expected value (selected by CCOP in CCB_CR) when OPSTEP > 0x0.

0x1C: OPSTEP end-step event not found at OPSTEP= 0x0 (SAES KEYVALID is set). Use CCB IPRST before starting a coupling and chaining operation.

0x1D: OPSTEP end-step event not found at OPSTEP = 0x1.

0x1E: OPSTEP end-step event not found at OPSTEP = 0x2.

0x1F: OPSTEP end-step event not found at OPSTEP = 0x3.

0x20: OPSTEP end-step event not found at OPSTEP = 0xA.

0x21: OPSTEP end-step event not found at OPSTEP = 0x12.

0x22: OPSTEP end-step event not found at OPSTEP = 0x13.

0x23: OPSTEP end-step event not found at OPSTEP = 0x17.

For error codes 0x1C to 0x23, details on end-step events are found in Section 25.5. Those errors are also triggered when values written in SAES_CR register do not correspond to the selected CCOP and the expectations in the current OPSTEP.

Bits 7:5 Reserved, must be kept at reset value.

Bits 4:0 OPSTEP[4:0]: Operation step

This read-only information indicates the current step of the coupling and chaining operation (indicated by CCOP). See Section 25.5 for details. .

This bitfield can be cleared only using IPRST in CCB_CR. OPSTEP[4:0] = 0x1F when the IPRST procedure is in progress.

25.7.3 CCB reference tag register (CCB_REFTAGRx)

Address offset: 0x010 + 0x4 * x (x = 0 to 3)

Reset value: 0x0000 0000

Writes to this register are ignored when CCB_BUSY is set in the CCB_SR register. The register is cleared when IPRST is set and CCB_BUSY is cleared.

31302928272625242322212019181716
REFTAG{i + 32 * x}
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw
1514131211109876543210
REFTAG{i + 32 * x}
rwrwrwrwrwrwrwrwrwrwrwrwrwrwrwrw

Bits 31:0 REFTAG{i + 32 * x}: Reference tag bits {i + 32 * x} (i = 31 to 0)

The application must write in these registers, the reference GCM tag of the required operation blob (respectively ECC signature, ECC key, or RSA key). This enables the PKA protected operation (respectively ECC signature/public key computation, scalar multiplication, or modular exponentiation). Refer to Section 25.5 for details.

Write to this register is ignored unless OPSTEP = 0x12 in CCB_SR.

25.7.4 CCB register map

Table 196. CCB register map and reset values

OffsetRegister name313029282726252423222120191817161514131211109876543210
0x000CCB_CRIPRSTRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.CCOP[7:0]
Reset value000000000
0x004CCB_SRRes.Res.TAMP_EVT5TAMP_EVT4TAMP_EVT3TAMP_EVT2TAMP_EVT1TAMP_EVT0Res.Res.Res.Res.Res.Res.Res.CCB_BUSYRes.Res.OPERR[5:0]Res.Res.Res.OPSTEP[4:0]
Reset value000000000000000000
0x010 +
0x4 * x
(x=0 to 3)
CCB_REFTAGRxREFTAG{i + 32 * x} (i = 31 to 0)
Reset value00000000000000000000000000000000

Refer to Section 2.2: Memory organization for the register boundary addresses.