Skip to content
Cryptography Encryption

AES in embedded systems: Understanding the most important AES modes

Editoral Team
Editoral Team

Compare AES modes for embedded devices and choose the right protection for data in transit or at rest.


 

Content

1. What is an AES and its mode of operation?


 

An embedded device might encrypt packets before sending them to another device and also encrypt data stored on its local drive. Both functions can use the Advanced Encryption Standard (AES), but they solve different problems. A communication protocol may require the receiver to detect changes to a packet before acting on it. A storage controller may need to read and rewrite individual sectors without processing the entire drive.

These requirements help narrow the choice of AES mode. AES-GCM and AES-CCM provide authenticated encryption for protocols that specify them. AES-CTR provides confidentiality for data streams and can be used where the protocol handles authentication separately. AES-XTS is designed for confidentiality on sector-based storage. In an FPGA-based system, that choice also determines what the hardware accelerator processes and what the surrounding software or logic must handle.


 

1. What is an AES and its mode of operation?

The Advanced Encryption Standard (AES) is a widely used symmetric block cipher in embedded systems. It uses the same secret key for encryption and decryption, processes 128-bit blocks, and supports 128-, 192-, and 256-bit keys. NIST standardized AES in FIPS 197 in 2001. Embedded systems use AES to protect data in transit, such as command and telemetry traffic or data streams between an FPGA and a communication module, and data at rest, such as sensitive configuration data stored in external flash.

Since AES is a symmetric block cipher, a mode of operation defines how those block operations protect a larger message, packet, or storage sector. The mode also determines whether the recipient can detect unauthorized changes to the data.

AES Mode Use Cases Main consideration
AES-ECB - Identical plaintext blocks produce identical ciphertext blocks under the same key.
AES-CBC Legacy VPNs and encrypted firmware formats. Encryption requires an unpredictable IV. Authentication is separate.
AES-XTS Sector-based storage encryption for SSDs, eMMC and FPGA boot storage. Supports independent sector access. Tamper detection requires a separate integrity mechanism.
AES-CTR High-throughput FPGA streams and DMA-driven data paths. Each complete counter block must be unique under a given key. Authentication is separate.
AES-CCM Authenticated encryption in Bluetooth Low Energy and IEEE 802.15.4 networks. Encryption and authentication can share an AES core. CBC-MAC limits parallelism within a message.
AES-GCM High-throughput authenticated encryption for TLS, IPsec and MACsec. Supports parallel processing. Each encryption requires a unique IV under a given key.

 

1.1 AES-ECB: Why it should almost never be used

Electronic Codebook (ECB) is the simplest AES mode. The mode is standardized in NIST SP 800-38A. Each plaintext block is encrypted independently using the same key. This makes ECB easy to implement in hardware because it requires little control logic. Its main weakness is that identical 128-bit plaintext blocks always produce identical ciphertext blocks under the same key. As a result, repetitions in structured data can remain visible after encryption. This is especially relevant when patterns align with AES block boundaries. Examples include:

  • Repetitive configuration data
  • Images with large uniform regions
  • FPGA bitstreams with repeating regions
  • Industrial protocol messages containing repeated blocks

ECB is generally unsuitable for protecting application data. It illustrates how the choice of AES mode affects what an observer can learn from the ciphertext.

1.2 AES-CBC: A common mode in legacy embedded systems

Cipher Block Chaining (CBC) combines each plaintext block with the previous ciphertext block before encryption. The first block is combined with an initialization vector (IV), which must be unpredictable when encrypting. Different IVs allow the same message to produce different ciphertexts under the same key. During encryption, the dependency between consecutive blocks limits parallel processing within a message. The mode is standardized in NIST SP 800-38A.

CBC was widely used in older VPN and IPsec deployments, encrypted firmware containers, and embedded Linux systems. It provides confidentiality only. Where integrity and authentication are required, the protocol or file format must provide them separately. One common design pattern combines AES-CBC with HMAC-SHA-256.

CBC remains relevant when a device must support an existing protocol or file format. New designs that require authenticated encryption often use AES-GCM or AES-CCM, depending on the protocol and implementation constraints.

1.3 AES-XTS: Encryption for storage and memory

XTS-AES was designed for storage encryption. It can protect data stored on SSDs, eMMC and flash memory, and is used in disk encryption implementations such as Linux dm-crypt. The mode is standardized in NIST SP 800-38E. XTS uses a value called a tweak to account for the location of the data being encrypted. Individual sectors can be read or written independently, and blocks can generally be processed in parallel. This makes XTS useful in storage controllers that handle random reads and writes. Some memory encryption architectures also use XTS to protect external DDR organized into independently addressable data units. Typical embedded applications include:

  • Encrypted storage for FPGA bitstreams and boot images
  • Encrypted external flash memory
  • Industrial edge devices with encrypted SSDs
  • Disk or volume encryption in embedded Linux systems

XTS provides confidentiality only. A system that also needs to detect tampering requires a separate integrity mechanism. For example, an FPGA system can encrypt a stored bitstream and separately verify its authenticity before loading it.

1.4 AES-CTR: Turning AES into a stream cipher

Counter Mode (CTR) uses AES to encrypt a sequence of counter blocks and generate a keystream. It combines that keystream with the plaintext using XOR. Because the AES operations on the counter blocks are independent, hardware can pipeline them, process several in parallel, or generate keystream ahead of time. This makes CTR useful for low-latency, high-throughput FPGA implementations and DMA-driven data paths. The mode is standardized in NIST SP 800-38A. Typical applications include:

  • High-speed FPGA communication paths
  • Software-defined radio data paths
  • Internal high-bandwidth data streams
  • Memory or storage encryption in architectures that maintain counter uniqueness across writes

CTR provides confidentiality only. The system needs a separate authentication mechanism if it must detect tampering. It must also ensure that no complete counter block is reused under the same key, even across messages or after a device restart. Reusing a counter block repeats the corresponding keystream and reveals the XOR of the two plaintext blocks.

1.5 AES-CCM: Authenticated encryption for constrained systems

CCM stands for Counter with CBC-MAC and is standardized in NIST SP 800-38C. It combines AES-CTR for encryption with CBC-MAC for authentication. It can also authenticate associated data, such as packet headers that must remain readable. CCM is used in protocols and systems such as:

  • IEEE 802.15.4 and Zigbee networks
  • Bluetooth Low Energy link-layer encryption
  • Selected TLS 1.2 and TLS 1.3 cipher suites
  • IPsec deployments using AES-CCM for ESP
  • Industrial wireless sensor networks based on IEEE 802.15.4

The CBC-MAC calculation depends on the preceding block, which limits parallelism within a message. The CTR operations can run alongside authentication if the implementation has the resources to do both concurrently. A compact implementation can share an AES core between encryption and authentication. GCM offers more scope to parallelize authentication and uses additional logic for GHASH.

CCM requires a unique nonce for each message encrypted under the same key. The nonce length determines the maximum message size. The authentication tag length is configurable and is typically specified by the protocol. For general cryptographic applications, BSI TR-02102-1 recommends a CCM tag of at least 96 bits.

1.6 AES-GCM: The modern standard for secure communication

Galois/Counter Mode (GCM) combines AES counter-mode encryption with GHASH-based authentication. It encrypts the payload and produces an authentication tag that also covers any associated data, such as selected packet headers. The receiver verifies the tag before accepting the decrypted payload. GCM is standardized in NIST SP 800-38D. Typical embedded applications include:

  • Industrial gateways using TLS or IPsec
  • Ethernet links protected by MACsec
  • FPGA-to-host communication where the protocol specifies AES-GCM
  • Embedded Linux devices connecting to cloud services over TLS

GCM is well suited to FPGA acceleration. Both counter-mode encryption and GHASH can be implemented with pipelining and parallel processing. The mode generates its own authentication tag, so it can provide encryption and authentication in one hardware data path.

AES-GCM also introduces one of the most underestimated engineering challenges in embedded security: IV management which is part of the system design. GCM requires a unique initialization vector (IV), also called a nonce, for every encryption under a given key. If an IV repeats, the repeated keystream reveals the XOR of the plaintexts. IV reuse can also compromise authentication and enable forgery. NIST recommends 96-bit IVs, which GCM can process directly without an extra GHASH calculation for the IV.

Tag length affects resistance to forgery. BSI TR-02102-1 recommends GCM tags of at least 96 bits for general cryptographic applications. NIST has announced plans to remove support for tags shorter than 96 bits in its revision of SP 800-38D. A protocol may specify a particular tag length and impose its own usage limits.

A single GCM encryption can process up to 232 − 2 blocks of plaintext. The limits across all encryptions under one key depend on factors such as the IV construction and the protocol. Long-running embedded systems need to account for these limits when deciding when to rotate keys.

In practice, nonce management raises several questions:

  • What happens to the transmit counter after a reboot or unexpected power loss?
  • Which component manages the nonce, the firmware or the FPGA?
  • How do multiple channels or devices avoid duplicate IVs if they share a key?
  • How does the device preserve nonce state or switch to a fresh key before resuming encryption?

These scenarios are covered in more detail in Why nonce reuse can break AES-GCM security in embedded systems.

Where the protocol supports it, AES-GCM-SIV is an option for systems that need to tolerate accidental nonce reuse. It is defined in RFC 8452 and included in BSI TR-02102-1. It derives a synthetic IV from the nonce, the plaintext and any associated data. Within the RFC’s usage bounds, reusing a nonce can reveal when the same plaintext and associated data were encrypted with that nonce. The RFC still recommends randomly generated nonces.


 

2. AES-GCM vs. AES-CCM

AES-GCM and AES-CCM both provide authenticated encryption. The main implementation difference is how they calculate the authentication tag. GCM uses GHASH, which can be implemented with parallel processing. CCM uses CBC-MAC, where each authentication step depends on the preceding block. A compact CCM implementation can reuse AES logic for both operations, while a GCM design needs logic for GHASH as well as AES.

Start with the protocol. If it specifies CCM or GCM, that requirement governs the choice. If both are available, compare implementations on the target device using representative message sizes. A gateway processing many packets may benefit from a pipelined GCM architecture. A constrained device that already has an AES accelerator may be able to reuse it for CCM. The system-level trade-off depends on the available hardware, how the two operations are scheduled, and how much data the application needs to process.


 

3. AES-GCM vs. AES-CTR

AES-GCM provides confidentiality and authentication in one mode. AES-CTR provides confidentiality. When a protocol specifies GCM, it defines how the sender and receiver handle the authentication tag and any associated data. When a protocol specifies CTR and requires integrity protection, it must also define how the data is authenticated and how verification fits into the receive path.

Both modes can use a pipelined AES data path. With GCM, the integration also has to carry any associated data, handle the tag, and ensure the receiver only accepts authenticated plaintext. With CTR, the integration has to allocate counter blocks without overlap under the same key. If the protocol provides authentication separately, the design must account for that path when assessing resources and throughput.


 

4. How AES fits into an FPGA data path

Consider a gateway built around a SoC FPGA. In this example, protocol software on the processor manages the session and supplies the parameters for each operation. The FPGA handles encryption in the streaming data path. Two implementations of that architecture illustrate how the choice of mode changes the division of work:

  • AES-GCM path: The protocol software supplies the IV and any associated data, such as headers that stay readable. The hardware core encrypts the payload and produces an authentication tag. On receive, the design checks the tag and accepts the decrypted payload only if verification succeeds.
  • AES-CTR path: The protocol software supplies the initial counter block, and the hardware core encrypts the payload. Where the protocol requires authentication, a separate mechanism handles it according to the protocol. The surrounding system coordinates counter allocation and any verification required before the application uses the received data.

Two SoC FPGA send paths comparing AES-GCM with built-in authentication and AES-CTR with separate ciphertext authentication.

Two illustrative SoC FPGA send paths showing where authentication takes place with AES-GCM and AES-CTR. The CTR example shows a protocol that authenticates ciphertext separately.

For FPGA and ASIC designs that require authenticated encryption, the KiviCrypt-AES-GCM IP core offers Tiny and Fast variants for different resource and throughput requirements. The KiviCrypt-AES-CTR IP core implements the encryption and decryption path for applications that use Counter Mode. Both cores provide AXI Stream data interfaces. Their product pages list implementation results for specific FPGA families.

AES encryption IP cores for FPGA and ASIC

Explore KiviCrypt-AES-GCM for authenticated encryption and KiviCrypt-AES-CTR for streaming data encryption. 

 


 

5. Conclusion

Start with the protocol or storage format and the protection the application needs. For authenticated communication, GCM and CCM are both options where the protocol permits them. For a streaming path with separate authentication, CTR can handle encryption. For sector-based storage confidentiality, XTS addresses the need to access data units independently.

Once the mode is set, work through what happens at the system boundary. Who supplies the IV or counter? Where does authentication take place? When can the application use the decrypted data? The answers determine how the AES core fits into the FPGA design and which functions the surrounding system must provide.

Share this post