952
SAM4CP [DATASHEET]
43051E–ATPL–08/14
41.4.5.3.5 Processing a Message with only AAD (GHASH
H
)
Figure 41-6.
Single GHASH
H
Block Diagram (AADLEN
0x10 and CLEN = 0)
It is possible to process a message with only AAD setting the CLEN field to ‘0’ in the AES_CLENR, this can be used for
J
0
generation when len(IV)
≠
96 for instance.
Example: Processing
J
0
when len(IV)
≠
96.
To process
J
0
= GHASH
H
(
IV
|| 0
s
+64
|| [len(
IV
)]
64
) perform the following steps:
1.
In AES_MR set OPMOD to GCM and GTAGEN to ‘0’ (configuration as usual for the rest).
2.
Set KEYW in AES_KEYWRx and wait until DATRDY bit of AES_ISR is set (GCM hash subkey complete), use
interrupt if needed.
After the GCM hash subkey
generation is complete the GCM hash subkey can be read or over-
written with
specific value in the AES_GCMHRx (
see Section
Section 41.4.5.2 ”Key Writing and Automatic Hash
Subkey Calculation”
for details).
3.
Set AADLEN field with ‘len(
IV
|| 0
s
+64
|| [len(
IV
)]
64
)’ in AES_AADLENR and CLEN field to ‘0’ in AES_CLENR. This
will allow running a GHASH
H
only.
4.
Fill the IDATA field of AES_IDATARx with the message to process (
IV
|| 0
s
+64
|| [len(
IV
)]
64
) according to the SMOD
configuration used. If Manual Mode or Auto Mode is used, the DATRDY bit indicates when a GHASH
H
step is over,
use interrupt if needed.
5.
Read the GHASH field of AES_GHASHRx to obtain the J
0
value.
Note:
The GHASH value can be overwritten at any time by writing the GHASH field value of AES_GHASHRx, used to
perform a GHASH
H
with an initial value for GHASH (write GHASH field between step 3 and step 4 in this case).
41.4.5.3.6 Processing a Single GF
128
Multiplication
The AES can also be used to process a single multiplication in the Galois Field on 128 bits (GF
128
) using a single
GHASH
H
with custom H value (See
Figure 41-6
).
To run a GF
128
multiplication (A x B) perform the following steps:
1.
In AES_MR set OPMOD to GCM and GTAGEN to ‘0’ (configuration as usual for the rest).
2.
Set AADLEN field with 0x10 (16 bytes) in AES_AADLENR and CLEN field to ‘0’ in AES_CLENR. This will allow
running a single GHASH
H
.
3.
Fill the H field of the AES_GCMHRx with B value.
4.
Fill the IDATA field of AES_IDATARx with the A value according to the SMOD configuration used. If Manual Mode
or Auto Mode is used, the DATRDY bit indicates when a GHASH
H
computation is over, use interrupt if needed.
5.
Read the GHASH field of AES_GHASHRx to obtain the result.
Note:
GHASH field of AES_GHASHRx can be initialized with a value C between step 3 and step 4 to run a
((A XOR C) x B) GF
128
multiplication.
IDATA
GHASH
GHASH
GF
128
Mult(H)