CCM Mode: Counter with CBC-MAC
You'll learn: How CCM mode combines two proven techniques—CTR encryption and CBC-MAC authentication—to deliver both confidentiality and integrity in resource-constrained devices.
What Is CCM Mode?
CCM (Counter with CBC-MAC) is an authenticated encryption mode that wraps two separate operations into one:
- CBC-MAC creates an authentication tag ensuring data hasn't been tampered with
- CTR mode encrypts both the plaintext and the authentication tag
Think of it like sealing a letter in an envelope with a tamper-evident sticker. CBC-MAC creates the "sticker" proving the contents are authentic, then CTR mode "seals the envelope" by encrypting everything, including the sticker itself.
Why CCM for IoT?
Unlike GCM mode (which you learned previously), CCM was specifically designed for resource-constrained environments like IoT sensors, Zigbee devices, and wireless controllers. It requires:
- Only one block cipher primitive (no separate multipliers)
- Less memory and simpler hardware
- Predictable, fixed timing (important for embedded systems)
The trade-off? CCM requires two passes over the data (one for MAC, one for encryption), making it slower than GCM on high-speed systems. However, for a battery-powered temperature sensor transmitting small packets, CCM's simplicity wins.
The CCM Process
- Format input data with a nonce and associated data (AAD)
- Run CBC-MAC over formatted data to generate authentication tag
- Use CTR mode with the same nonce to encrypt plaintext
- Encrypt the authentication tag with CTR mode
- Append encrypted tag to ciphertext
Key Takeaway: CCM mode combines CTR encryption with CBC-MAC authentication in a two-pass design optimized for IoT and embedded systems where simplicity and low resource usage matter more than raw speed.