Apple says testing missed flaws in new encryption designed to protect against future attacks from quantum computers, so it turned to mathematical proofs to make sure the code works correctly before wider rollout.
New research and source code published May 22 detail how Apple verified parts of its post-quantum cryptography stack. The research argues conventional software testing is good, but no longer provides sufficient guarantees for encryption systems used across more than 2.5 billion active devices.
The effort centers on corecrypto, Apple's low-level cryptographic library used across iPhone, iPad, Mac, and other platforms. Future quantum computers could eventually break many of today's public-key encryption systems, hence the effort.
Technology companies are racing to replace older encryption methods before practical attacks become possible.
Apple built a custom formal verification system that checks its post-quantum implementations against official NIST specifications. Mathematical proofs also verify that Apple's ML-KEM and ML-DSA code matches the standards for those algorithms.
Post-quantum protections have already reached iMessage. Apple is also expanding the technology into VPN services, TLS networking, and developer-facing CryptoKit APIs.
Cryptography that will defend against quantum computers is becoming foundational infrastructure inside Apple's security stack. Security framework, CryptoKit, and CommonCrypto all rely on corecrypto, which gives the library a central role across Apple's platforms and developer tools.
Apple says mathematical proofs caught bugs traditional testing missed
Formal verification work uncovered flaws that conventional testing missed during development. Engineers found a missing step in an early ML-DSA implementation that could produce incorrect cryptographic output in rare cases.
The research also identified and repaired an error in a third-party proof used during the project.
The missing-step issue could have silently corrupted cryptographic computations without triggering existing test suites. Cryptographic implementation bugs can weaken encryption without producing obvious crashes, warnings, or visible failures.
Corecrypto underpins encryption, hashing, digital signatures, and random number generation across Apple's platforms. A critical flaw inside the library could affect nearly every app or service that depends on Apple's security frameworks.
Post-quantum cryptography creates unusual implementation risks compared to older public-key systems. ML-KEM and ML-DSA rely on large polynomial arithmetic and deep mathematical operations that can produce subtle carry and borrow errors.
The paper notes the industry's limited experience with newer post-quantum algorithms compared to older elliptic curve cryptography systems. Earlier elliptic curve deployments had subtle implementation flaws that later created exploitable vulnerabilities.
Apple verified optimized Apple silicon code
Apple verified optimized production code for Apple Silicon rather than limiting the work to simplified academic models. Formal proofs cover portable C implementations and hand-optimized ARM64 assembly routines designed to improve performance and reduce timing leaks.
Apple verified its quantum-secure ML-KEM and ML-DSA implementations by proving its portable C and ARM64 assembly code matched official specifications.Post-quantum cryptography increases implementation complexity and expands the attack surface inside heavily optimized code paths. Apple also uses Apple silicon security features including Data Independent Timing, or DIT, and Pointer Authentication, known as PAC, to reduce some of those risks.
DIT reduces timing side-channel leakage, while PAC hardens software against certain memory corruption attacks. Engineers also rewrote sensitive cryptographic routines to gain tighter control over processor behavior during encryption operations.
Apple built a custom verification pipeline with Galois
Apple built a custom workflow combining Isabelle, SAW, Cryptol, and a new Cryptol-to-Isabelle translator developed with security firm Galois. The verification process translates implementations into formal mathematical models.
The resulting proofs required more than 50,000 individual proof steps. Apple also released updated corecrypto source code and several formal verification tools alongside the paper.
Published materials include Isabelle libraries, verification frameworks, ARM64 models, and the Cryptol-to-Isabelle translator used during development.
Formal verification isn't a complete solution to cryptographic security problems. Apple admitted that it still assumes compiler correctness and that some ML-DSA verification relies on conventional testing due to tooling limitations.
Mathematical verification is becoming crucial as post-quantum cryptography moves into global production systems. Apple is using formal proofs to verify its post-quantum encryption before deploying the technology more broadly across its platforms.






