
Public key accelerator (PKA)
RM0453
702/1454
RM0453 Rev 2
Using precomputed Montgomery parameters (PKA fast mode)
As explained in
, when computing many operations with the same modulus it
can be beneficial for the application to compute only once the corresponding Montgomery
parameter (see, for example,
). This is know as “fast mode”.
To manage Fast Mode usage the recommended procedure is described below:
1.
Load in PKA RAM the modulus size and value information. Such information is
compiled in
2. Program in PKA_CR register the PKA in
Montgomery parameter computation
mode
(MODE=”0x1”) then assert the START bit.
3. Wait until the PROCENDF bit in the PKA_SR register is set to “1”, then read back from
PKA memory the corresponding Montgomery parameter, and then clear PROCENDF
bit by setting PROCENDFC bit in PKA_CLRFR.
4. Proceed with the required PKA operation, loading on top of regular input data the
Montgomery information R2 mod m. All addresses are indicated in
24.3.7
PKA error management
When PKA is used some errors can occur:
•
The access to PKA RAM falls outside the expected range. In this case the Address
Error flag (ADDRERRF) is set in the PKA_SR register.
•
An AHB access to the PKA RAM occurred while the PKA core was using it. In this case
the RAM Error Flag (RAMERRF) is set in the PKA_SR register, reads to PKA RAM
return zero, while writes are ignored.
For each error flag above PKA generates an interrupt if the application sets the
corresponding bit in PKA_CR register (see
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.
24.4
PKA operating modes
24.4.1 Introduction
The various operations supported by PKA are described in the following subsections,
clarifying the associated format of the input data and of the results, both stored in the PKA
RAM.
The following information applies to all PKA operations.
•
PKA core processes 32-bit words
•
Supported operand “Size” are:
–
ROS (RSA operand size): data size is (
rsa_size
/32+1) words, with
rsa_size
equal
to the chosen modulus length. For example, when computing RSA with an
operand size of 1024 bits, ROS is equal to 33 words, or 1056 bits.
–
EOS (ECC operand size): data size is (
ecc_size
/32+1) words, with
ecc_size
equal
to the chosen prime modulus length. For example, when computing ECC with an
operand size of 192 bits, EOS is equal to 7 words, or 224 bits.