{
  "id": "s2n-bignum",
  "name": "s2n-bignum",
  "aka": [
    "s2n-bignum HOL Light framework"
  ],
  "summary": "Prove hand-written x86-64 or Arm64 assembly correct in HOL Light, on the exact bytes of the built object file; used for AWS's cryptography code.",
  "use_if": [
    "You write performance-critical assembly (for example cryptography) and need proofs about the object code that actually ships.",
    "You also need constant-time, memory-safety or equivalence proofs (for example after vectorizing or reordering code)."
  ],
  "avoid_if": [
    "Your code uses system instructions, interrupts, floating point or threads; the machine models are user-mode, integer/SIMD and single-core.",
    "You want push-button checking; proofs are written by hand in HOL Light with tactic support."
  ],
  "effort": "interactive",
  "open": "open-source",
  "license": "Apache-2.0 OR ISC OR MIT-0",
  "maintainers": [
    "Amazon Web Services (awslabs)"
  ],
  "links": {
    "repo": "https://github.com/awslabs/s2n-bignum",
    "docs": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md",
    "paper": "https://arxiv.org/abs/2505.14348",
    "tutorial": "https://github.com/awslabs/s2n-bignum/tree/main/arm/tutorial"
  },
  "components": [
    {
      "role": "frontend",
      "name": "OCaml ELF loader (reads the .text bytes of the built object file)",
      "assurance": "trusted",
      "note": "The soundness review notes a loader error would usually make the proof fail rather than pass wrongly."
    },
    {
      "role": "semantics",
      "name": "s2n-bignum x86-64 model (hand-written in HOL Light)",
      "assurance": "validated",
      "note": "Instructions are added as needed; tested by random co-simulation against real hardware in CI."
    },
    {
      "role": "semantics",
      "name": "s2n-bignum AArch64 model (hand-written in HOL Light)",
      "assurance": "validated",
      "note": "Instructions are added as needed; tested by random co-simulation in CI. A partial RV32IM RISC-V model was added in September 2026, with tutorial examples only."
    },
    {
      "role": "translation",
      "name": "Symbolic simulation tactics in HOL Light",
      "assurance": "checked"
    },
    {
      "role": "checker",
      "name": "HOL Light kernel",
      "ref": "hol-light",
      "ref_kind": "prover",
      "assurance": "trusted"
    },
    {
      "role": "compiler",
      "name": "Assembler (GNU as via gcc or another)",
      "assurance": "validated",
      "note": "Each proof checks its byte sequence against the object file from the build. Projects that reassemble the .S files elsewhere do not get this check."
    }
  ],
  "verifies": [
    {
      "target": "x86-64",
      "note": "Library routines for bignums, elliptic curves, ML-KEM, ML-DSA and SHA-3; some need the BMI and ADX extensions (MULX, ADCX, ADOX)."
    },
    {
      "target": "aarch64",
      "note": "Library routines for bignums, elliptic curves, ML-KEM, ML-DSA, SHA-3, AES-XTS and AES-GCM; some need crypto extensions."
    }
  ],
  "properties": {
    "no-ub": {
      "status": "partial",
      "note": "Memory-safety proofs (all accesses inside the declared buffers) exist for the functions AWS-LC uses, not yet for the whole library. They do not check accesses below the stack pointer, and the memory model has no unmapped pages, so the caller must pass mapped memory.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "functional": {
      "status": "full",
      "note": "Each function has a HOL Light theorem that the code computes a mathematical specification for all inputs.",
      "source": "https://github.com/awslabs/s2n-bignum#testing-and-formal-verification"
    },
    "equivalence": {
      "status": "full",
      "note": "A relational Hoare logic (CAV 2025) is used to prove optimized code (NEON vectorization, SLOTHY reordering) equivalent to a reference version.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/doc/program_equivalence.md"
    },
    "info-flow": {
      "status": "full",
      "note": "Since late 2025, constant-time proofs show the instruction sequence and memory addresses do not depend on secrets and no variable-time instructions are used; done for the functions AWS-LC uses. They cannot rule out timing differences inside the hardware.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "concurrency": {
      "status": "none",
      "note": "The machine model is sequential and single-core.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "termination": {
      "status": "full",
      "note": "Specifications state that execution eventually reaches the postcondition (total correctness).",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    }
  },
  "features": {
    "isa.user": {
      "status": "partial",
      "note": "Only the user-mode integer, load/store and branch instructions needed so far are modeled (\"modeled by need\").",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/arm/INSTRUCTION.md"
    },
    "isa.fp": {
      "status": "none",
      "note": "No floating-point arithmetic; on Arm only register moves such as FMOV and FCSEL are modeled.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/arm/proofs/instruction.ml"
    },
    "isa.simd": {
      "status": "partial",
      "note": "A subset of Arm NEON (including AES, SHA-3 and polynomial-multiply instructions) and of x86 SSE/AVX, added as needed.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/x86/INSTRUCTION.md"
    },
    "isa.privileged": {
      "status": "none",
      "note": "No system registers, privilege levels, interrupts or exceptions.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "isa.mmu": {
      "status": "none",
      "note": "Flat address space; no page tables or page faults.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "isa.memory-model": {
      "status": "none",
      "note": "No caches, memory ordering or multiple cores.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    }
  },
  "trust": {
    "checker": {
      "level": "green",
      "summary": "The HOL Light kernel (about 400 lines of OCaml) checks every proof.",
      "note": "OCaml's compiler and runtime are also trusted. Independent re-checking is possible in principle (Candle, HOLTrace) but not part of the build.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "semantics": {
      "level": "amber",
      "summary": "Hand-written instruction models; random co-simulation against real CPUs in CI.",
      "note": "Models are written from the Intel/AMD and Arm manuals, not taken from an official model. CI compares random instruction encodings and states against an independent backend (hardware, an emulator or another model); we found no published report of these results.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "frontend": {
      "level": "green",
      "summary": "The proved bytes are checked against the object file produced by the build.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "binary_gap": {
      "level": "green",
      "summary": "Proofs are about the object code; the assembler is not trusted.",
      "note": "Downstream projects that reassemble the .S files on another system are not checked against the proved bytes.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md"
    },
    "escape_hatches": {
      "level": "green",
      "summary": "Every proof build runs check_axioms, which fails if any extra axiom was added.",
      "source": "https://github.com/awslabs/s2n-bignum/blob/main/tools/build-proof.sh"
    }
  },
  "stage_evidence": {
    "public_artifact": {
      "met": true,
      "evidence": "https://github.com/awslabs/s2n-bignum"
    },
    "published_use": {
      "met": true,
      "evidence": "https://arxiv.org/abs/2505.14348",
      "note": "Relational Hoare Logic for Realistically Modelled Machine Code (CAV 2025), demonstrated on s2n-bignum."
    },
    "installs_on_current": {
      "met": true,
      "evidence": "https://github.com/awslabs/s2n-bignum/actions",
      "note": "CI on main passes (checked 2026-11-26); proofs need a recent HOL Light from GitHub."
    },
    "user_docs": {
      "met": true,
      "evidence": "https://github.com/awslabs/s2n-bignum/tree/main/arm/tutorial",
      "note": "README, tutorials for Arm and x86, instruction-modeling guides and a soundness review."
    },
    "external_users": {
      "met": true,
      "evidence": "https://github.com/pq-code-package/mlkem-native",
      "note": "mlkem-native (PQ Code Package) proves its AArch64 and x86-64 assembly with the s2n-bignum infrastructure; some of its maintainers also work at AWS. The CAV 2025 paper has co-authors from CMU and Stanford."
    },
    "soundness_channel": {
      "met": true,
      "evidence": "https://github.com/awslabs/s2n-bignum/issues",
      "note": "Public issue tracker; security issues go through AWS vulnerability reporting (see CONTRIBUTING.md)."
    }
  },
  "production_users": [
    {
      "org": "Amazon Web Services",
      "what": "AWS-LC, the cryptographic library that AWS managed services such as AWS KMS rely on, uses machine-checked code from s2n-bignum (per the AWS Security Blog, Nov 2026).",
      "source": "https://aws.amazon.com/blogs/security/make-post-quantum-cryptography-updates-routine-with-aws-lc/"
    }
  ],
  "last_release": {
    "version": "main@3ab28d2",
    "date": "2026-11-26",
    "source": "https://github.com/awslabs/s2n-bignum/commits/main"
  },
  "used_for": [
    {
      "name": "AWS-LC elliptic-curve, RSA and Montgomery arithmetic",
      "url": "https://aws.amazon.com/blogs/security/aws-lc-fips-3-0-first-cryptographic-library-to-include-ml-kem-in-fips-140-3-validation/"
    },
    {
      "name": "mlkem-native AArch64 and x86-64 assembly (functional correctness, memory safety, constant time)",
      "url": "https://github.com/pq-code-package/mlkem-native"
    }
  ],
  "last_checked": "2026-11-26",
  "attestation": "maintainer",
  "claimed_by_authors": false,
  "sources": [
    {
      "url": "https://github.com/awslabs/s2n-bignum",
      "title": "s2n-bignum README",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/awslabs/s2n-bignum/blob/main/SOUNDNESS.md",
      "title": "s2n-bignum soundness review",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/awslabs/s2n-bignum/blob/main/doc/program_equivalence.md",
      "title": "Program equivalence proofs",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/awslabs/s2n-bignum/blob/main/arm/INSTRUCTION.md",
      "title": "Arm instruction modeling",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/awslabs/s2n-bignum/blob/main/x86/INSTRUCTION.md",
      "title": "x86-64 instruction modeling",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/awslabs/s2n-bignum/tree/main/riscv",
      "title": "Partial RISC-V (RV32IM) model",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://github.com/jrh13/hol-light/blob/master/Help/check_axioms.hlp",
      "title": "HOL Light check_axioms",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://arxiv.org/abs/2505.14348",
      "title": "Relational Hoare Logic for Realistically Modelled Machine Code (CAV 2025)",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://aws.amazon.com/blogs/security/make-post-quantum-cryptography-updates-routine-with-aws-lc/",
      "title": "AWS Security Blog, 25 Nov 2026",
      "accessed": "2026-11-26"
    },
    {
      "url": "https://aws.amazon.com/security/opensource/cryptography/",
      "title": "AWS open-source cryptography page",
      "accessed": "2026-11-26"
    }
  ],
  "computed": {
    "kind": "toolchains",
    "methodology_version": "0.1",
    "built": "2026-11-26",
    "links": {
      "html": "/toolchains/s2n-bignum/",
      "json": "/toolchains/s2n-bignum.json",
      "markdown": "/toolchains/s2n-bignum.md"
    },
    "stage": {
      "stage": 1,
      "name": "Usable",
      "criteria": [
        {
          "key": "public_artifact",
          "stage": 0,
          "label": "Publicly available",
          "met": true,
          "evidence": "https://github.com/awslabs/s2n-bignum",
          "computed": false
        },
        {
          "key": "published_use",
          "stage": 0,
          "label": "At least one published verification uses it",
          "met": true,
          "evidence": "https://arxiv.org/abs/2505.14348",
          "note": "Relational Hoare Logic for Realistically Modelled Machine Code (CAV 2025), demonstrated on s2n-bignum.",
          "computed": false
        },
        {
          "key": "recent_release",
          "stage": 1,
          "label": "Released or updated in the last 12 months",
          "met": true,
          "evidence": "https://github.com/awslabs/s2n-bignum/commits/main",
          "note": "Latest release: main@3ab28d2, 2026-11-26.",
          "computed": true
        },
        {
          "key": "installs_on_current",
          "stage": 1,
          "label": "Installs and runs on current platforms",
          "met": true,
          "evidence": "https://github.com/awslabs/s2n-bignum/actions",
          "note": "CI on main passes (checked 2026-11-26); proofs need a recent HOL Light from GitHub.",
          "computed": false
        },
        {
          "key": "user_docs",
          "stage": 1,
          "label": "User documentation or tutorial",
          "met": true,
          "evidence": "https://github.com/awslabs/s2n-bignum/tree/main/arm/tutorial",
          "note": "README, tutorials for Arm and x86, instruction-modeling guides and a soundness review.",
          "computed": false
        },
        {
          "key": "external_users",
          "stage": 1,
          "label": "Used by a group other than its authors",
          "met": true,
          "evidence": "https://github.com/pq-code-package/mlkem-native",
          "note": "mlkem-native (PQ Code Package) proves its AArch64 and x86-64 assembly with the s2n-bignum infrastructure; some of its maintainers also work at AWS. The CAV 2025 paper has co-authors from CMU and Stanford.",
          "computed": false
        },
        {
          "key": "production_users",
          "stage": 2,
          "label": "Verified code in production at two or more independent organizations",
          "met": false,
          "note": "1 recorded: Amazon Web Services.",
          "computed": true
        },
        {
          "key": "checker_not_red",
          "stage": 2,
          "label": "Checker axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "semantics_not_red",
          "stage": 2,
          "label": "Semantics axis is not red",
          "met": true,
          "computed": true
        },
        {
          "key": "soundness_channel",
          "stage": 2,
          "label": "Public channel for soundness bugs",
          "met": true,
          "evidence": "https://github.com/awslabs/s2n-bignum/issues",
          "note": "Public issue tracker; security issues go through AWS vulnerability reporting (see CONTRIBUTING.md).",
          "computed": false
        }
      ],
      "missing_for_next": [
        "production_users"
      ]
    }
  }
}