13. Public key accelerator (PKA)

13.1 Introduction

The Public Key Accelerator (PKA) is intended for the computation of cryptographic public key primitives, specifically those related to RSA, Diffie-Hellmann or ECC (Elliptic Curve Cryptography) over GF(p) (Galois fields). To achieve high performance at a reasonable cost, these operations are executed in the Montgomery domain. All needed computations are performed within the accelerator, so no further hardware/software elaboration is needed to process the inputs or the outputs.

13.2 PKA main features

13.3 PKA functional description

Figure 25. Block diagram shows the block diagram of the Public Key Accelerator.

Figure 25. Block diagram

Block diagram of the Public Key Accelerator (PKA) functional description. The diagram shows the internal structure and connections of the PKA. At the top is a block labeled '894 words Internal 32-bit RAM'. Below it is a block labeled 'PKA_Core' (part of 'PKA v7c'). To the left of the PKA_Core is a vertical double-headed arrow labeled '32-bit'. Below the PKA_Core is a block labeled 'AHB control wrapper (32-bit)'. At the bottom is a horizontal double-headed arrow labeled 'AHB Bus'. An arrow labeled 'IRQ' points down from the AHB control wrapper. The RAM is connected to the PKA_Core via a bus. The PKA_Core is connected to the AHB control wrapper via a bus. The AHB control wrapper is connected to the AHB Bus via a bus.
graph TD
    RAM["894 words
Internal 32-bit RAM"] <--> PKA_Core subgraph PKA_v7c ["PKA v7c"] PKA_Core end PKA_Core <--> AHB_Wrapper["AHB control wrapper (32-bit)"] AHB_Wrapper <--> AHB_Bus["AHB Bus"] AHB_Wrapper --> IRQ PKA_Core <--> |32-bit| AHB_Wrapper
Block diagram of the Public Key Accelerator (PKA) functional description. The diagram shows the internal structure and connections of the PKA. At the top is a block labeled '894 words Internal 32-bit RAM'. Below it is a block labeled 'PKA_Core' (part of 'PKA v7c'). To the left of the PKA_Core is a vertical double-headed arrow labeled '32-bit'. Below the PKA_Core is a block labeled 'AHB control wrapper (32-bit)'. At the bottom is a horizontal double-headed arrow labeled 'AHB Bus'. An arrow labeled 'IRQ' points down from the AHB control wrapper. The RAM is connected to the PKA_Core via a bus. The PKA_Core is connected to the AHB control wrapper via a bus. The AHB control wrapper is connected to the AHB Bus via a bus.

PKA can be used for accelerating Rivest, Shamir and Adleman (RSA), Diffie-Hellman (DH) and Elliptic Curve Cryptography (ECC) operations over a \( GF(p) \) field for operand sizes up to 3136 bits for RSA and DH, and up to 640 bits for ECC.

A memory of 3576 bytes (894 words of 32 bits) is used for providing initial data to the PKA, and for holding the results after computation is completed. This memory is called PKA RAM. Access is done through the PKA AHB interface.

A typical computing sequence by the PKA is composed by the following steps:

  1. 1. Calculation of \( R2 \pmod n \) parameter to enter the Montgomery domain
  2. 2. Conversion of inputs into the Montgomery residue-system representation
  3. 3. Computation of the requested primitive (modular exponentiation for RSA/DH and point multiplication for ECC)
  4. 4. Conversion out from Montgomery representation

If several operations are computed sequentially using the same modulus \( n \) , the first step can be skipped, since the PKA can store the last computed \( R2 \pmod n \) . User software is also able to load precomputed values of \( R2 \pmod n \) directly into the PKA.

13.3.1 Enabling/disabling PKA

Setting the EN bit (PKA_CR[0]) to '1' enables the PKA peripheral. When EN='0', the PKA peripheral is reset, no operation can be started, and the PKA memory cannot be accessed.

Clearing EN bit while a calculation is in progress causes the operation to be aborted. In this case, the content of the PKA RAM (described here below) is not guaranteed.

13.3.2 PKA RAM

The PKA RAM is an internal memory block of 3576 bytes which is organized as 894 words of 32 bits. Each 32-bit word has an address associated with it, from decimal offset 0 to 893.

The offset address to access the first word of the memory block is 0x400. External masters may access this internal memory block from the PKA AHB interface.

Note: Only 32 bits access are supported.

Accesses are allowed only while there is no computation in progress (BUSY = 0). During computation the internal memory block is accessed by the PKA core itself.

13.3.3 Executing a PKA operation

PKA is able to perform 18 types of operations. Each of those PKA operations is executed using the following procedure:

  1. 1. Load initial data into the PKA internal RAM.
  2. 2. Load the MODE[5:0] field specifying the operation to be executed and assert the START bit. Both fields are in the PKA_CR register.
  3. 3. Wait until the PROCENDF bit in the PKA_SR register is set, which indicates that the computation is complete.
  4. 4. Read the result data from the PKA internal RAM.

The operations and their corresponding input data and results are described in Section 13.4: Operating modes .

13.3.4 Security level

The PKA device offers a countermeasure to thwart side band channel attack. This protection can be activated by setting the bit SEC_LVL in the PKA_CR register. One must know that this specific protection mode increases the processing time by 25% on average.

13.3.5 PKA error management

When PKA is used some errors can occur:

For each error flag above, PKA generates an interrupt if the application sets the corresponding bit in PKA_CR register (see Section 13.5.1: PKA interrupts for details).

ADDRERRF and RAMERRF errors are cleared by setting the corresponding bit in PKA_CLRFR.

The PKA can be re-initialized at any moment by resetting the EN bit in the PKA_CR register.

13.4 Operating modes

There are 18 types of operations that the PKA can perform. Each of these operating modes has an associated code which is to be written to the MODE[5:0] field in the PKA_CR register.

Table 35. Operating modes

MODE[5:4]MODE[3:0]Operation performed
000000Compute Montgomery parameter and modular exponentiation
000001Compute Montgomery parameter
000010Compute modular exponentiation only (Montgomery parameter should be loaded)
100000Compute Montgomery parameter and compute ECC kP operation
100010Compute the ECC kP primitive only (Montgomery parameter should be loaded)
100100ECDSA sign
100110ECDSA verification
101000Point Check
000111RSA CRT exponentiation
001000Modular inversion
001001Arithmetic addition
001010Arithmetic subtraction
001011Arithmetic multiplication
001100Comparison
001101Modular reduction
001110Modular addition
001111Modular subtraction
010000Montgomery multiplication

The format of the input data and the results in the PKA RAM are specified for each operating mode in the following sections.

The size of the operands is configurable. For RSA operations (where MODE[5]=0), the maximum “rsa_size” is 3136 bits. For ECC operations (where MODE[5]=1), the maximum “ecc_size” is 640.

In the tables below, the acronyms ROS (RSA operand size) and EOS (ECC operand size) indicate how many words the given field includes.

\[ ROS = (rsa\_size / 32) + 1 \]

\[ EOS = (ecc\_size / 32) + 1 \]

Fractional results are rounded up to the nearest integer since the PKA's processing is based on 32-bit words. The maximum ROS is 99 (3136-bit maximum exponent size), while the maximum EOS is 21 (640-bit maximum operand size).

For example, if you want to compute RSA with an operand of 1024 bits, then ROS equals 33. If you want to compute ECC with an operand of 192 bits, then EOS = 7.

Note: For the input fields whose size is ROS, ROS/2, or EOS, an additional word which is entirely zeros must be written after the last word. For example, to prepare for the calculation of the Montgomery parameter, ROS words are written for the modulus starting at address 305 until address 305+ROS-1. A word of all zeros must also be written at address 305+ROS before starting the calculation.

13.4.1 Compute Montgomery parameter

During this operation the PKA computes the Montgomery parameter \( R^2 \pmod n \) .

Table 36. Montgomery parameter input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Number of bits of the modulus10x004041
Modulus 'n'5990x0D5CROS

Table 37. Montgomery parameter output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Montgomery parameter1010x0594ROS

Note: Computation of the Montgomery parameter depends on the word size of the core, so for a given modulus the core produces a different Montgomery parameter with word size = 64 than with word size = 32.

13.4.2 Compute modular exponentiation

During this operation the PKA computes the modular exponentiation \( m^e \pmod n \) .

Table 38. Modular exponentiation input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Number of bits of the exponent 'e'00x04001
Number of bits of the operands 'm'10x04041
Storage area for Montgomery parameter.
Must be used if MODE[5:0]="000010"
(modular exponentiation only)
1010x0594ROS
Base of the exponentiation 'm'4010x0A44ROS
Exponent to process 'e'5000x0BD0ROS
Modulus 'n'5990x0D5CROS

Table 39. Modular exponentiation output data

Output data decimal addressHexadecimalOffset in PKASize (words)
Storage area for Montgomery parameter (OPTIONAL)1010x0594ROS
S and M algorithm accumulator1 (result of the exponentiation)2010x0724ROS
S and M algorithm accumulator2 (square)3010x08B4ROS
Base of the exponentiation 'm'4010x0A44ROS
S and M algorithm accumulator3 (dummy if sec_level=1)6990x0EECROS

Note: The core supports only odd modulus. If modulus randomization is applied, the randomized modulus has to be an odd number. Both exponent and operand are unsigned integers represented in binary form on 32 bits. Both must be less or equal to max_rsa_size (3136).

13.4.3 Compute the ECC scalar multiplication

During this operation the PKA computes the ECC scalar multiplication \( kP \) .

Table 40. ECC scalar multiplication input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Number of bits of 'k'00x04001
Number of bits of the modulus GF(p). For NIST P-256 value is 256.10x04041
ECC curve 'a' coefficient sign.
0x0: positive; 0x1:negative
For NIST curves over prime fields value is 0x1.
20x04081
ECC curve 'a' coefficient absolute value.
For NIST curves over prime fields value is 0x3.
30x040CEOS
ECC curve prime modulus 'p'240x0460EOS
Storage area for Montgomery Parameter.
Must be used if MODE[5:0]="100010" (scalar multiplication only).
450x04B4EOS
The 'k' of \( kP \)660x0508EOS
Initial point 'P' coordinates
X870x055CEOS
Y1080x05B0EOS

Table 41. ECC scalar multiplication output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Coordinates of the result
X870x055CEOS
Y1080x05B0EOS
Coordinates of last double
X16340x0DE8EOS
Y16550x0E3CEOS
Z16760x0E90EOS
Coordinates of check point
X26970x0EE4EOS
Y27180x0F38EOS
Z27390x0F8CEOS

Note: The core supports only prime modulus; it is not possible to apply modulus randomization. The input value \( k \) is required to be greater than zero. If the user wants to execute the side channel protection known as scalar blinding (where the scalar 'k' is randomized via the addition of a multiple of the order of the curve \( n \) ), the PKA core is not able to deal with the case where the internal temporary result falls in the point at infinity. It is very unlikely to fall in the point at infinity, but it is possible to check that this inconvenience has happened by checking the final result. I.e. if the temporary result is equal to the point at infinity, the final result has both coordinates \( x \) and \( y \) equal to zero, that is not a point on the curve. When the scalar 'k' is smaller than the order, it is not possible to reach the point at infinity.

13.4.4 Point check

During this operation the PKA computes a boolean informing whether the given point P satisfies the curve over prime fields equation or not. If output error is equal to zero the point is on the curve.

Table 42. Point check input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Number of bits of the modulus GF(p). For NIST P-256 value is 256.10x04041
ECC curve 'a' coefficient sign.
0x0: positive; 0x1:negative
For NIST curves over prime fields value is 0x1.
20x04081
ECC curve 'a' coefficient absolute value.30x040CEOS
ECC curve 'b' coefficient absolute value.2550x07FCEOS
ECC curve prime modulus 'p'240x0460EOS
The point 'P' coordinates
X
Y
87
108
0x055C
0x05B0
EOS
EOS

Table 43. Point check output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Error output result. If it is different from zero the point 'P' is not on the curve.00x04001

Note: Coordinates X and Y of the point P must be smaller than the modulus.

13.4.5 ECDSA sign

During this operation the PKA computes a signed message using elliptic curves over prime fields.

Table 44. ECDSA sign input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Number of bits of the order. For SHA-256 value is 256.10x04001
Number of bits of the modulus GF(p). For NIST P-256 value is 256.10x4041
ECC curve 'a' coefficient sign.
0x0: positive
0x1: negative
For NIST curves over prime fields value is 0x1.
20x4081
ECC curve 'a' coefficient absolute value.
For NIST curves over prime fields value is 0x3.
30x040CEOS
ECC curve prime modulus 'p'240x0460EOS
Random integer 'k' generated outside the PKA for this ECDSA signature660x0508EOS
The initial point 'P' coordinates
X870x055CEOS
Y1080x05B0EOS
Hash of the message 'e'6340x0DE8EOS
Private key 'd'6550x0E3CEOS
Integer prime order of the curve 'n'6770x0E94EOS

Table 45. ECDSA sign output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Error output result. If it is different from zero, a new 'k' should be generated and ECDSA sign operation needs to be repeated6980x0EE81
Signature part 'r'1920x0700EOS
Signature part 's'2130x0754EOS
The final point 'kP' (optional)
X7830x103CEOS
Y8040x1090EOS

Note: The prime modulus for P-256 curve is \( p = 2^{256} - 2^{224} + 2^{192} + 2^{96} - 1 \) which corresponds to hexadecimal value 0xFFFFFFFF 00000001 00000000 00000000 00000000 FFFFFFFF FFFFFFFF FFFFFFFF .

13.4.6 ECDSA verification

During this operation the PKA computes a boolean informing whether given signature is valid or not. This signature is based on an elliptic curve over prime fields.

If output error is equal to zero the signature is valid.

Table 46. ECDSA verification input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Number of bits of the order. For SHA-256 value is 256.10x04041
Number of bits of the modulus GF(p). For NIST P-256 value is 256.450x04B41
ECC curve 'a' coefficient sign.
0x0: positive; 0x1: negative
For NIST curves over prime fields value is 0x1.
230x045C1
ECC curve 'a' coefficient absolute value.
For NIST curves over prime fields value is 0x3.
240x0460EOS
ECC curve prime modulus 'p'460x04B8EOS
The initial point 'P' coordinates
X1220x05E8EOS
Y1430x063CEOS
Public key point 'Qa' coordinates
X7200x0F40EOS
Y7410x0F94EOS
Signature part 'r'8060x1098EOS
Signature part 's'4010x0A44EOS
Hash of the message 'e'7620x0FE8EOS
Integer prime order of the curve 'n'5990x0D5CEOS

Table 47. ECDSA verification output data

Output dataDecimal addressHexadecimal offset in PKASize (Words)
Error output result. If it is different from 0, the signature is not verified.1080x05B01

13.4.7 RSA CRT exponentiation

During this operation the PKA computes the Chinese Remainder Theorem (CRT) optimization.

Table 48. RSA CRT exponentiation input

Input dataDecimal addressHexadecimal offset in PKAsize (words)
Number of bits of the operands10x04041
CRT parameter 'Dp'1510x065CROS/2
CRT parameter 'Dq'5000x0BD0ROS/2
CRT parameter 'qInv'2510x07ECROS/2
Prime 'p'3510x097CROS/2
Prime 'q'5990x0D5CROS/2
Base of the exponentiation6990x0EECROS

Table 49. RSA CRT exponentiation output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result2010x0724ROS

Note: CRT is supported for modulus up to 3072 bits, with prime p and q of the same length i.e. half of the length of the modulus.

13.4.8 Modular reduction

During this operation the PKA computes a modular reduction.

Table 50. Modular reduction input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length00x04001
Operand3010x08B4ROS
Modulus length10x04041
Modulus4010x0A44ROS

Table 51. Modular reduction output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result5000x0BD0ROS

13.4.9 Arithmetic addition

During this operation the PKA computes the arithmetic addition of two inputs, op1 and op2.

Table 52. Arithmetic addition input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS

Table 53. Arithmetic addition output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result:
op1 + op2
5000x0BD0ROS+1

13.4.10 Arithmetic Subtraction

During this operation the PKA computes the arithmetic subtraction of two inputs, op1 and op2.

Table 54. Arithmetic subtraction input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS

Table 55. Arithmetic subtraction output data

Output dataDecimal addressHexadecimal offset in PKAsize (words)
Operation result:
op1 - op2
5000x0BD0ROS

13.4.11 Comparison

During this operation, given two inputs op1 and op2, the PKA computes comparisons as follow:

Table 56. Comparison input data

Input dataDecimal addressHexadecimal offset in PKAsize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS

Table 57. Comparison output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result:
If op1 = op2, then result = 0
If op1 > op2, then result = 1
If op1 < op2, then result = 2
5000x0BD01

13.4.12 Arithmetic multiplication

During this operation the PKA computes the arithmetic multiplication of two inputs, op1 and op2.

Table 58. Arithmetic multiplication input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS

Table 59. Arithmetic multiplication output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result:
op1 x op2
5000x0BD02*ROS

13.4.13 Modular addition

During this operation the PKA computes the addition of op1 by op2 modulus op3.

Table 60. Modular addition input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS
op3 (modulus)5990x0D5CROS

Table 61. Modular addition output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result:
(op1 + op2) mod op3
5000x0BD0ROS

13.4.14 Modular inversion

During this operation the PKA computes the inversion of op1 modulus op2. Note that op1 must be smaller than the modulus op2.

Table 62. Modular inversion input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op2 (modulus)4010x0A44ROS

Table 63. Modular inversion output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result5000x0BD0ROS

Note: The operand to invert should be coprime with the modulus. In case this is not known, and the operand is a divisor of the modulus, the result is a multiple of a factor of the modulus.

13.4.15 Modular subtraction

During this operation the PKA computes the subtraction of op1 by op2 modulus op3.

Table 64. Modular subtraction input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS
op3 (modulus)5990x0D5CROS

Table 65. Modular subtraction output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result:
(op1 - op2) mod op3
5000x0BD0ROS

Note: Reduction happens when op2 is larger than op1. The result is always smaller than op3 and equal or larger than zero.

13.4.16 Montgomery multiplication

During this operation the PKA computes the multiplication of op1 by op2 modulus op3 in the Montgomery space. Before issuing this operation the PKA needs to set some internal registers, which can be done by issuing a Montgomery parameter computation, an ECC scalar multiplication or any ECC operation.

Table 66. Montgomery multiplication input data

Input dataDecimal addressHexadecimal offset in PKASize (words)
Operand length10x04001
op13010x08B4ROS
op24010x0A44ROS
op3 (modulus)5990x0D5CROS

Table 67. Montgomery multiplication output data

Output dataDecimal addressHexadecimal offset in PKASize (words)
Operation result5000x0BD0ROS

Note: In order to convert a number from natural representation to Montgomery domain it is necessary to perform a Montgomery multiplication between the number and the Montgomery parameter (called also \( R^2 \bmod n \) ). Besides, in order to convert a number from Montgomery domain to natural domain a Montgomery multiplication between the Montgomery number and one has to be computed.

13.5 Processing time

The following tables summarize the PKA computation times, expressed in clock cycles.

Table 68. Modular exponentiation

Exponent length (in bits)ModeOperand length (in bits)
102420483072
3Normal152000407000864000
Fast2300082000178000
17Normal163000448000955000
Fast34000123000267000
\( 2^{16}+1 \)Normal2080006110001308000
Fast79000286000622000
1024Normal5832000--
Fast5640000--
2048Normal-41917000-
Fast-41023000-
3072Normal--137477000
Fast--136761000

Table 69. ECC scalar multiplication

ModeModulus length (in bits)
160192256320384512521
Normal81700012500002462000425400068210001444500016580000
Fast81500012470002458000424700068070001442100016579000

Note: These times depend on the number of “1”s included in the scalar parameter.

Table 70. ECDSA signature average computation time

Modulus length (in bits)
160192256320384512521
88000013320002645000450800072980001530900017770000

Note: These values are average execution times of random moduli of given length, as they depend upon the length and the value of the modulus. The execution time for the moduli that define the finite field of NIST elliptic curves is shorter than that needed for the moduli used for Brainpool elliptic curves or for random moduli of the same size.

Table 71. ECDSA verification average computation times

Modulus length (in bits)
160192256320384512521
1750000267500052490009063000145590003067300035794000
Table 72. Montgomery parameters average computation times
Modulus length (in bits)
160192256320384512521102420483072
225939235924745110841175063200059768233073552321

Note: The computation times depend upon the length and the value of the modulus, hence these values are average execution times of random moduli of given length.

13.5.1 PKA interrupts

There are three individual maskable interrupt sources generated by the public key accelerator when enabled by EN bit, signaling the following events:

  1. 1. Access to unmapped address (ADDRERRF), see Section 13.3.5: PKA error management
  2. 2. PKARAM access while PKA operation is in progress (RAMERRF), see Section 13.3.5: PKA error management
  3. 3. PKA end of operation (PROCENDF)

Three interrupt sources are connected to the same global interrupt request signal pka_it. The user can enable or disable the above interrupt sources individually by changing the mask bits in Section 13.6.1: PKA control register (PKA_CR) . Setting the appropriate mask bit to 1 enables the interrupt. The status of the individual interrupt events can be read from the PKA status register (PKA_SR), and it is cleared in the PKA_CLRFR register.

Table 73. PKA interrupt requests gives a summary of the available features.

Table 73. PKA interrupt requests

Interrupt eventEvent flagEnable control bit
Access to unmapped address errorADDRERRFADDRERRIE
PKA RAM access errorRAMERRFRAMERRIE
PKA end of operationPROCENDFPROCENDIE

13.6 PKA registers

13.6.1 PKA control register (PKA_CR)

Address offset: 0x00

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ADDR ERRIERAM ERRIERes.PROC ENDIERes.
rwrwrw
1514131211109876543210
Res.Res.ModeRes.Res.Res.Res.Res.SECLVLSTARTNE
rwrwrwrwrwrwrwrwrw
Bits 31:21Reserved, must be kept at zero
Bit 20ADDRERRIE : Address error interrupt enable
  • 0: Interrupt is disabled
  • 1: An interrupt is generated when ADDRERRF (PKA_SR[20]) is set.
Bit 19RAMERRIE : RAM error interrupt enable
  • 0: Interrupt is disabled
  • 1: An interrupt is generated when RAMERRF (PKA_SR[19]) is set
Bit 18Reserved, must be kept at zero
Bit 17PROCENDI : End of operation interrupt enable
  • 0: Interrupt is disabled
  • 1: An interrupt is generated when PROCENDF (PKA_SR[17]) is set
Bit 16:14Reserved, must be kept at zero
Bit 13:8MODE [5:0] : PKA operation code
  • 000000 : Compute Montgomery parameter and modular exponentiation
  • 000001 : Compute Montgomery parameter
  • 000010 : Compute modular exponentiation only (Montgomery parameter should be loaded)
  • 100000 : Compute Montgomery parameter and compute ECC kP operation
  • 100010 : Compute the ECC kP primitive only (Montgomery parameter should be loaded)
  • 100100 : ECDSA sign
  • 100110 : ECDSA Verification
  • 101000 : Point check
  • 000111 : RSA CRT exponentiation
  • 001000 : Modular inversion
  • 001001 : Arithmetic addition
  • 001010 : Arithmetic subtraction
  • 001011 : Arithmetic multiplication
  • 001100 : Comparison
  • 001101 : Modular reduction
  • 001110 : Modular addition
  • 001111 : Modular subtraction
  • 010000 : Montgomery multiplication
Bit 7:3Reserved, must be kept at zero
Bit 2SECLVL : Security enable
  • 0: No side channel countermeasure
  • • 1: Square and multiply always / double and add always
Bit 1

START : start the operation

Writing '1' to this bit starts the operation which is selected by MODE[5:0], using the operands and data already written to the PKA RAM. This bit is always read as '0'.

Note: START is ignored if PKA is busy.

Bit 0

EN : peripheral enable

  • • 0: Disable PKA
  • • 1: Enable PKA

13.6.2 PKA status register (PKA_SR)

Address offset: 0x04

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ADDR ERRFRAM ERRFRes.PROC ENDFBUSY
rrrr
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Bits 31:21Reserved, must be kept at zero
Bit 20ADDRERRF : Address error flag
  • 0: No Address error
  • 1: Address access is out of range (unmapped address)
Bit 19RAMERRF : PKA RAM error flag
  • 0: No PKA RAM access error
  • 1: An AHB access to the PKA RAM occurred while the PKA core was computing and using its internal RAM (AHB PKA_RAM access are not allowed while PKA operation is in progress)
Bit 18Reserved, must be kept at zero
Bit 17PROCENDF : PKA end of operation flag
  • 0: operation in progress
  • 1: PKA operation is completed. This flag is set when the BUSY bit is de-asserted.
Bit 16BUSY : PKA operation is in progress
This bit is set to '1' whenever START bit in the PKA_CR is set. It is automatically cleared when the computation is complete, meaning that PKA RAM can be safely accessed and a new operation can be started.
  • 0: No operation is in progress (default)
  • 1: An operation is in progress
Note: if PKA is started with a wrong opcode the IP is busy for a couple of cycles then it aborts automatically the operation and goes back to ready (BUSY bit is set to '0').
Bit 15Reserved, must be kept zero

13.6.3 PKA clear flag register (PKA_CLRFR)

Address offset: 0x08

Reset value: 0x0000 0000

31302928272625242322212019181716
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ADDR ERRFCRAM ERRFCRes.PROC ENDFCRes.
w_r0w_r0rw_r0
1514131211109876543210
Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Bits 31:21Reserved, must be kept at zero
Bit 20ADDRERRFC : Clear address error flag
  • 0: No action
  • 1: Clear the address flag
Bit 19RAMERRFC : Clear PKA RAM error flag
  • 0: No action
  • 1: Clear the RAMERRF flag
Bit 18Reserved, must be kept at zero
Bit 17PROCENDFC : Clear PKA end of operation flag
  • 0: No action
  • 1: Clear the PROCENDFC flag
Bit 16:0Reserved, must be kept at zero
Note: reading PKA_CLRFR returns all zeroes

13.6.4 PKA RAM memory

Address offset: 0x400

The PKA_RAM is memory mapped at the offset address of 0x0400 compared to the PKA base address. Only word access (32 bits) are supported. RAM size is 3576 bytes (max. word offset: 0x11F4)

13.6.5 PKA register map

Table 74. PKA register map

OffsetRegister313029282726252423222120191817161514131211109876543210
0x0000PKA_CRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ADDRERRIERAMERRIERes.PROCENDIERes.Res.Res.MODE[5 : 0]Res.Res.Res.Res.Res.SCLVLSTARTEN
Reset value00000000000000000000000000000000
0x0004PKA_SRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ADDRERRFRAMERRFRes.PROCENDFBUSYRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00000000000000000000000000000000
0x0008PKA_CLRFRRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.ADDRERRFCRAMERRFCRes.PROCENDFCRes.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.Res.
Reset value00000000000000000000000000000000
STMicroelectronics logo
STMicroelectronics logo