UM10503
All information provided in this document is subject to legal disclaimers.
© NXP B.V. 2015. All rights reserved.
User manual
Rev. 2.1 — 10 December 2015
109 of 1441
NXP Semiconductors
UM10503
Chapter 8: LPC43Sxx Security API
8.4.1 AES functions
The ROM-based security AES API controls the AES block. AES API functions are
provided to encrypt or decrypt data from memory to memory using an ECB or CBC
algorithm. If the CBC algorithm is selected, a user-defined initialization vector can be
defined.
To transfer data between memory and the AES peripheral using the GPDMA, additional
API functions are provided that configure the GPDMA, DMA peripheral input mux, and the
AES appropriately.
The AES API can load one of four keys to encrypt or decrypt data:
•
Key1 stored in OTP memory bank 1. This is a secure key used by the boot code for
decrypting the boot image.
•
Key2 stored in OTP memory bank 2.
•
A software-generated key.
•
A key generated by the on-chip random number generator.
Two APIs are provided to store keys in the OTP memory banks 1 and 2.
Table 76.
AES API calls
Function
Offset relative to
the API entry
point
Description
aes_Init
0x00
Initialize AES engine
Parameter - void
Return - void
aes_SetMode
0x04
Defines AES engine operation mode
Parameter: unsigned cmd with values:
0 - ECB encode AES_API_CMD_ENCODE_ECB (if the parts are not
configured for encryption, using aes_SetMode with this parameter returns an
error)
1 - ECB decode AES_API_CMD_DECODE_ECB
2 - CBC encode AES_API_CMD_ENCODE_CBC (if the parts are not
configured for encryption, using aes_SetMode with this parameter returns an
error)
3 - CBC decode AES_API_CMD_DECODE_CBC
Return - unsigned: see general error codes.
aes_LoadKey1
0x08
Loads 128-bit AES user key 1
Parameter - void
Return - unsigned: see general error codes.
aes_LoadKey2
0x0C
Loads 128-bit AES user key 2
Parameter - void
Return - unsigned: see general error codes.
aes_LoadKeyRNG
0x10
Loads randomly generated key in AES engine. To update the RNG and load
a new random number, use the API call otp_GenRand before
aes_LoadKeyRNG.
Parameter - void
Return - void