Skip to content
Post-Quantum-Cryptography (PQC) Cryptography

ML-KEM explained: Quantum-safe key exchange for embedded systems

Editoral Team
Editoral Team

Learn how ML-KEM establishes a shared secret and what it takes to implement it in embedded systems.


 

Content

 

1. Why do embedded systems need post-quantum key exchange?
2. What is ML-KEM and what is the shared secret used for?


 

When an embedded device sends data to the cloud, another device, or connects to a network, it needs to protect the information it exchanges by setting up an encrypted connection. Both parties first establish a shared secret which is used to derive encryption keys. These keys turn readable data (plaintext) into unreadable data (ciphertext) and allow the receiving side to turn it back into plaintext. This keeps the exchanged data confidential, since only someone with the right key can read it.

ML-KEM is the Module-Lattice-Based Key Encapsulation Mechanism which lets two endpoints establish a shared secret over a public network. Derived from CRYSTALS-Kyber and standardized by NIST in FIPS 203, ML-KEM provides a post-quantum option for key establishment.
This article explains how it works, where it is used, and what developers need to consider when implementing it in software or on an FPGA-based system.


 

1. Why do embedded systems need post-quantum key exchange?

Many systems today use Elliptic Curve Diffie–Hellman (ECDH) to establish a shared secret. Each endpoint combines its own private key with the other endpoint’s public key to compute the same secret. With suitable parameters, recovering that secret from the public information is considered computationally infeasible for classical computers. A sufficiently capable quantum computer running Shor’s algorithm would change that assumption.

An attacker can record encrypted traffic and public handshake values today and attempt to recover the session keys later. This is known as the harvest now, decrypt later scenario. For a long-lived embedded system, two timelines matter: how long the device will be deployed and how long the data it transmits must remain confidential. If you want to learn more about this, read about why post-quantum cryptography matters for embedded systems.


 

2. What is ML-KEM and what is the shared secret used for?

ML-KEM is a public-key mechanism that lets two endpoints establish the same secret without transmitting the secret itself. One endpoint uses a public encapsulation key to produce a shared secret and a ciphertext. The endpoint holding the corresponding private decapsulation key processes the ciphertext to obtain the same secret.

The shared secret is the starting point for deriving session keys. A communication protocol can feed the shared secret into a key derivation function so that both endpoints can independently derive the keys that protect their traffic. For example, the protocol can derive one key for messages from the device to the server and another for messages in the opposite direction. These keys can be used to encrypt application data and detect tampering in transit.

The protocol also defines how each endpoint verifies who it is communicating with. In a deployment that uses a public key infrastructure (PKI), certificates can support peer authentication. Digital signatures such as ML-DSA can be used where the protocol and its configuration support them.

Read how ML-DSA digital signatures work.

2.1 Where can embedded systems use ML-KEM?

  • TLS connections for connected devices: Embedded devices can use TLS to protect telemetry, remote maintenance sessions, or electronic transactions such as payment requests. A TLS configuration that supports ML-KEM can use it during the handshake to help establish the keys that protect that traffic.
  • IPsec VPNs between gateways: In an IKEv2 deployment that supports ML-KEM, the endpoints can use it during key establishment. IPsec then uses the derived keys to protect traffic through the tunnel.
  • Ethernet link protection with MACsec: MACsec uses symmetric keys to protect Ethernet frames. Whether ML-KEM can contribute to establishing those keys depends on how the network manages and distributes them.

2.2 ML-KEM vs. CRYSTALS-Kyber

ML-KEM is based on the third-round CRYSTALS-Kyber submission to NIST’s post-quantum cryptography standardization project. CRYSTALS-Kyber is the name of the original submission, while ML-KEM is the name of the standardized algorithm defined in FIPS 203. This is why you’ll often see “Kyber” in earlier papers and documentation and “ML-KEM” in references to the final standard.

FIPS 203 specifies a 32-byte shared secret for all three ML-KEM parameter sets. It also changes how the algorithm validates inputs and derives the shared secret compared with the earlier Kyber submission. If you’re evaluating a library or a hardware IP core, check whether it implements the final FIPS 203 specification or an earlier version of Kyber.


 

3. How does ML-KEM work?

FIPS 203 defines three operations. The communication protocol determines which endpoint performs each one.

  1. Key generation: The first party generates a public encapsulation key and a private decapsulation key. It sends the public key to the second party and keeps the private key local.
  2. Encapsulation: The second party uses the encapsulation key and fresh randomness to produce a ciphertext and a shared secret. It sends the ciphertext to the first party and keeps the secret local.
  3. Decapsulation: The first party uses its private decapsulation key to process the received ciphertext. When the exchange completes correctly, both parties hold the same 32-byte shared secret.

ML-KEM workflow showing one party sending its public encapsulation key and the other returning a ciphertext. Both parties obtain the same shared secret locally.FIPS 203 defines three operations (Key Generation, Encapsulation and Decapsulation). The parties exchange an encapsulation key and a ciphertext. Each obtains the same shared secret locally.


 

4. ML-KEM-512 vs. ML-KEM-768 vs. ML-KEM-1024

The three ML-KEM parameter sets differ in NIST security category and in the sizes of their keys and ciphertexts. FIPS 203 recommends ML-KEM-768 as the default. For a particular deployment, the protocol profile and security requirements guide the choice. 

Parameter set ML-KEM-512 ML-KEM-768 ML-KEM-1024
NIST security category 1 3 5
Encapsulation key 800 bytes 1,184 bytes 1,568 bytes
Decapsulation key 1,632 bytes 2,400 bytes 3,168 bytes
Ciphertext 768 bytes 1,088 bytes 1,568 bytes
Shared secret 32 bytes 32 bytes 32 bytes

 

With ML-KEM-768, the encapsulation key and ciphertext together account for 2,272 bytes when both are transmitted. The complete handshake can also include protocol headers, authentication data, and a classical key exchange component in a hybrid design. On the device, the private key and intermediate values contribute to local memory requirements. The amount of working memory depends on how ML-KEM is implemented.


 

5. What does ML-KEM change for embedded systems?

  • CPU load and working memory: ML-KEM uses polynomial arithmetic and hashing. Whether software can handle the workload depends on the processor, available memory, and expected connection rate. A device that reconnects occasionally may have enough CPU time to run ML-KEM in software. A system handling many simultaneous handshakes may need to evaluate the effect on its other tasks.
  • Data movement and connection setup: With hardware acceleration, the host prepares inputs, transfers data to the core, and handles the results. Measure both the core execution time and the full connection setup time. Driver overhead, bus transfers, and network exchanges can all affect how much a faster cryptographic operation improves the handshake.
  • Protocol integration: Some protocol profiles combine a classical key exchange such as ECDH with ML-KEM. The profile defines how the endpoints negotiate the exchange, combine the two secrets, and authenticate each other. It also determines how key material is carried in the handshake, which matters on links with tight packet-size constraints.

 

6. Implementing ML-KEM on an FPGA-based SoC

When does an ML-KEM IP core even make sense?

Start with the expected connection rate and the time budget for each handshake. Software may be sufficient if the processor meets both requirements within the available memory budget. If ML-KEM takes up too much CPU time or delays connection setup, FPGA offload is worth evaluating. Compare CPU load and end-to-end handshake latency on the target system, and account for the logic and memory resources the core would use.

In a host-controlled FPGA design, the protocol stack runs on the processor and calls the IP core for the cryptographic operations. KiviPQC-KEM IP Core supports KeyGen, Encaps, and Decaps for all three FIPS 203 parameter sets. The host accesses the core over AMBA AXI4-Lite. KiviCore provides platform-independent C code, a hardware abstraction layer, drivers, and integration examples.

KiviPQC-KEM variant Design priority What to check on the target system
Tiny Lower logic utilization Whether the core fits alongside the existing FPGA design and meets the connection setup requirements
Fast Faster ML-KEM processing Whether shorter operation times improve handshake latency or connection capacity within the available FPGA resources

 

Both variants support all three parameter sets. The protocol and security requirements guide the choice of parameter set. The resource and performance budgets guide the choice of core variant.

Explore the KiviPQC-KEM IP Core

Compare Tiny and Fast, review FPGA implementation results, and see how the core connects to your host software. 

 


 

7. Conclusion

ML-KEM establishes a shared secret that a communication protocol can use to derive the keys that protect traffic. For an embedded system, start with the parameter set that meets the protocol and security requirements. Then evaluate how that choice affects handshake size, working memory, and CPU load. On an FPGA-based SoC, measurements of the full connection setup help determine whether hardware offload fits the design.

Share this post