Republished from a clean root: the compiled artifact is gone from history, and the local line of work joins the sanitized public line

The public history carried kat/__pycache__/mlkem768_reference.cpython-314.pyc,
a compiled Python artifact embedding the operator's absolute local path. Text
secret scanners do not read compiled binaries, which is exactly how it slipped
through, and removing it from the tip would have left it reachable through the
old root commits. So this repository is republished from a single clean root.

This root also carries, from the previously unpublished line of work:
- corrected LICENSE year, LICENSING.md, VERIFY-POLICY.md, and
  CITATIONS-UNRESOLVED.md remeasured 2026-08-11 (101 paths, README aligned)
- O-018: run_consensus_verification.py ran 19 of 29 models and reported PASS;
  it now runs all 29, and computemarket_smt.py gains resolveByTimeout /
  reclaimUnsettled cases plus a negative control
- O-006: the word 'audited' removed from next to Bouncy Castle, twice, after a
  concurrent edit resurrected it
- O-014: prior art named and dated - Algorand's native falcon_verify shipped
  about ten months before AERE's precompiles; the primacy claim is withdrawn
  where it was implied
- bench/ scripts parametrized so they actually run for an outsider (the
  earlier textual sanitization left $STAGING unexpanded inside Python strings)
- AIP-2/AIP-3 errata with measured figures, spec remeasurements at 2026-08-01,
  and the spec-zk-stack retractions (owner is an operational key, not the
  Foundation; 'maximally sound' withdrawn; aggregator V1 deprecated)
The redacted bench-host environment files from the sanitized line are kept
exactly as published; the unredacted local variants are not carried.
This commit is contained in:
Aere Network committed 2026-08-15 13:52:14 +03:00
commit 6cb0140fae
177 files changed
+33777

No files matched your search

+50
View File
@@ -0,0 +1,50 @@
# pq-finality-circuit
The off-chain research core of the Aere Network Post-Quantum Finality Certificate
(research item #4).
## What is here
`xmss-verify-core/` is the IMPLEMENTED and TESTED per-validator VERIFICATION CORE: an
RFC 8391 XMSS-SHA2_10_256 hash-based signature verifier (WOTS+ one-time signature plus
the XMSS Merkle authentication-path check that recovers the root public key). It is the
exact inner computation the aggregation zkVM guest runs for each validator. It is
`no_std`, allocation-free, float-free, hash-only, deterministic, and has ZERO external
dependencies, so it tests fully offline.
It is validated against the OFFICIAL github.com/XMSS/xmss-reference known-answer vector
committed at `../../contracts/test/fixtures/xmss-sha2_10_256-kat.json`, the same vector
the deployed on-chain `AereXmssVerifier.sol` uses.
## Run the test
```
cd xmss-verify-core
cargo test --offline
```
Expected: 12 tests pass. The genuine official signature verifies (recovers the official
root); every tamper (WOTS+ value, checksum chain, auth node, message, leaf index,
claimed root, R randomizer) fails; and the bundled SHA-256 matches FIPS 180-4.
## Regenerate the test vector
```
node scripts/gen_vectors.mjs
```
Reads the committed official KAT JSON and rewrites `xmss-verify-core/src/vectors.rs`, so
the Rust vector is provably derived from the official fixture with no hand transcription.
## Honest scope
- IMPLEMENTED and TESTED: the verification core (this crate).
- NOT implemented, `[MEASURE]`, multi-week specialist work: the full zkVM aggregation
guest, the SP1 proving pipeline, and the end-to-end certificate.
- UNCHANGED and fail-closed: the on-chain verifier and registry under
`../../contracts/contracts/pqfinality/`.
This is the ADDITIVE post-quantum finality-attestation read path. Aere consensus stays
classical ECDSA QBFT. Post-quantum finality is NOT live end to end.
Full design and effort estimate: `../../docs/AERE-XMSS-AGGREGATION-CIRCUIT.md`.
+103
View File
@@ -0,0 +1,103 @@
// gen_vectors.mjs
//
// Generate `xmss-verify-core/src/vectors.rs` from the OFFICIAL RFC 8391
// XMSS-SHA2_10_256 known-answer vector committed at
// aerenew/contracts/test/fixtures/xmss-sha2_10_256-kat.json
// (github.com/XMSS/xmss-reference deterministic test/vectors.c, oid=1, idx=512, msg=0x25).
//
// This exists so the Rust test vector is provably DERIVED from the committed
// official fixture, with no hand transcription of the 67 WOTS+ chains and 10
// authentication-path nodes. Run:
// node scripts/gen_vectors.mjs
//
// Deterministic: same input JSON -> byte-identical vectors.rs.
import { readFileSync, writeFileSync } from "node:fs";
import { fileURLToPath } from "node:url";
import { dirname, resolve } from "node:path";
const here = dirname(fileURLToPath(import.meta.url));
const katPath = resolve(
here,
"../../../contracts/test/fixtures/xmss-sha2_10_256-kat.json"
);
const outPath = resolve(here, "../xmss-verify-core/src/vectors.rs");
const kat = JSON.parse(readFileSync(katPath, "utf8"));
const strip = (h) => h.replace(/^0x/, "");
const bytes = (h) => {
const s = strip(h);
if (s.length % 2 !== 0) throw new Error(`odd hex: ${h}`);
const out = [];
for (let i = 0; i < s.length; i += 2) out.push(parseInt(s.slice(i, i + 2), 16));
return out;
};
const arr32 = (h) => {
const b = bytes(h);
if (b.length !== 32) throw new Error(`expected 32 bytes, got ${b.length}: ${h}`);
return b;
};
const fmtHash = (b) =>
"[" + b.map((x) => "0x" + x.toString(16).padStart(2, "0")).join(", ") + "]";
const fmtHashArray = (list, indent) =>
list.map((h) => `${indent}${fmtHash(arr32(h))},`).join("\n");
const msgBytes = bytes(kat.msg);
if (kat.wots.length !== 67) throw new Error(`expected 67 WOTS chains, got ${kat.wots.length}`);
if (kat.auth.length !== 10) throw new Error(`expected 10 auth nodes, got ${kat.auth.length}`);
const out = `// GENERATED by scripts/gen_vectors.mjs from the OFFICIAL committed KAT
// aerenew/contracts/test/fixtures/xmss-sha2_10_256-kat.json
// Source: ${kat.source}
// Do NOT edit by hand: re-run \`node scripts/gen_vectors.mjs\`.
//
// RFC 8391 XMSS-SHA2_10_256 (OID 0x00000001): n=32, w=16, len=67, h=10, SHA-256.
// This is the same official reference vector the on-chain AereXmssVerifier.sol and
// its independent JS oracle (contracts/test/xmssVerifier.test.js) are validated with.
use crate::{Hash, XmssPubKey, XmssSig, H, LEN};
/// Long-term XMSS public root (first 32 bytes of the XMSS public key).
pub const PUB_ROOT: Hash = ${fmtHash(arr32(kat.pubRoot))};
/// XMSS public SEED (last 32 bytes of the XMSS public key).
pub const PUB_SEED: Hash = ${fmtHash(arr32(kat.pubSeed))};
/// Leaf index used by the signer for this signature.
pub const IDX: u32 = ${kat.idx};
/// Per-signature randomizer R (from the signature).
pub const R: Hash = ${fmtHash(arr32(kat.R))};
/// The signed message bytes.
pub const MSG: [u8; ${msgBytes.length}] = ${fmtHash(msgBytes)};
/// The 67 WOTS+ one-time-signature chain values.
pub const WOTS: [Hash; LEN] = [
${fmtHashArray(kat.wots, " ")}
];
/// The h = 10 Merkle authentication-path nodes.
pub const AUTH: [Hash; H] = [
${fmtHashArray(kat.auth, " ")}
];
/// The official reference public key as a [\`XmssPubKey\`].
pub fn official_pubkey() -> XmssPubKey {
XmssPubKey { root: PUB_ROOT, seed: PUB_SEED }
}
/// The official reference signature as a [\`XmssSig\`].
pub fn official_sig() -> XmssSig {
XmssSig { idx: IDX, r: R, wots: WOTS, auth: AUTH }
}
`;
writeFileSync(outPath, out);
console.log(`wrote ${outPath}`);
console.log(` pubRoot ${kat.pubRoot}`);
console.log(` idx ${kat.idx}, msg ${kat.msg}, ${kat.wots.length} WOTS chains, ${kat.auth.length} auth nodes`);
+7
View File
@@ -0,0 +1,7 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 4
[[package]]
name = "xmss-verify-core"
version = "0.1.0"
@@ -0,0 +1,24 @@
# xmss-verify-core: offline-testable REFERENCE model of the per-validator inner
# logic of Aere Network's Post-Quantum Finality Certificate aggregation zkVM circuit.
#
# ZERO external dependencies on purpose: the RFC 8391 XMSS-SHA2_10_256 verification
# core (and its bundled dependency-free SHA-256) is validated against the OFFICIAL
# committed known-answer vector with `cargo test`, fully offline and deterministic,
# on any machine. A production SP1 guest replaces the bundled sha256 module with the
# SP1-patched `sha2` precompile crate (see ../../zk-light-client/guest/Cargo.toml);
# the bytes are identical.
#
# Empty [workspace] table so this crate is self-contained and is never accidentally
# pulled into a parent Cargo workspace (same convention as the SP1 guests here).
[workspace]
[package]
name = "xmss-verify-core"
version = "0.1.0"
edition = "2021"
license = "Apache-2.0"
description = "RFC 8391 XMSS-SHA2_10_256 hash-based signature verification core (WOTS+ one-time signature + XMSS Merkle authentication-path root recovery). The offline-testable reference model of the per-validator inner logic of Aere Network's Post-Quantum Finality Certificate aggregation zkVM circuit. Verification core only; the zkVM aggregation guest and SP1 proving are NOT implemented ([MEASURE])."
[dependencies]
[dev-dependencies]
@@ -0,0 +1,48 @@
//! `xmss-verify-core`: the offline-testable REFERENCE model of the per-validator
//! inner logic of Aere Network's Post-Quantum Finality Certificate aggregation
//! zkVM circuit (research item #4).
//!
//! # What this crate IS
//!
//! An RFC 8391 XMSS-SHA2_10_256 signature-VERIFICATION core: WOTS+ one-time
//! signature verification plus the XMSS Merkle authentication-path check that
//! recovers a validator's long-term root public key. This is precisely the
//! computation the aggregation guest runs FOR EACH validator when it proves that a
//! quorum of validators hash-based-signed a finalized block. It is `no_std`,
//! allocation-free, float-free, hash-only, and deterministic: the exact shape a
//! zkVM circuit needs. See `xmss.rs`.
//!
//! It is validated against the OFFICIAL github.com/XMSS/xmss-reference known-answer
//! vector committed at `aerenew/contracts/test/fixtures/xmss-sha2_10_256-kat.json`,
//! the same vector the already-deployed on-chain `AereXmssVerifier.sol` and its
//! independent JS oracle use. See `tests/kat.rs`.
//!
//! # What this crate IS NOT (the honest boundary)
//!
//! This is the VERIFICATION CORE only. It is NOT the zkVM guest, NOT the SP1
//! aggregation program, NOT a proof of anything. The full off-chain aggregation
//! circuit (recover N roots, check committee membership, count a >= ceil(2N/3)
//! quorum, emit the on-chain verifier's 192-byte public values) and its SP1
//! proving pipeline are NOT implemented and are `[MEASURE]` multi-week specialist
//! work. See `../../docs/AERE-XMSS-AGGREGATION-CIRCUIT.md`.
//!
//! Nothing here changes Aere consensus, which stays classical ECDSA QBFT. This is
//! the ADDITIVE post-quantum finality-attestation read path only. PQ finality is
//! NOT live end to end.
//!
//! # Hash backend
//!
//! `sha256.rs` is a dependency-free `no_std` SHA-256 so `cargo test` runs fully
//! offline and deterministically. A production SP1 guest swaps in the SP1-patched
//! `sha2` crate (the accelerated precompile); the output bytes are identical, only
//! the in-circuit cost changes.
#![no_std]
pub mod sha256;
pub mod xmss;
pub mod vectors;
pub use xmss::{
chain_lengths, xmss_recover_root, xmss_verify, Hash, XmssPubKey, XmssSig, H, LEN, N, W,
};
@@ -0,0 +1,190 @@
//! Dependency-free, `no_std`, deterministic SHA-256 (FIPS 180-4).
//!
//! WHY A HAND-ROLLED SHA-256. This crate is the offline-testable REFERENCE model
//! of the per-validator inner logic the aggregation zkVM guest runs. Keeping it at
//! zero external dependencies means `cargo test` verifies the RFC 8391 XMSS core
//! against the official known-answer vector with no network and no toolchain
//! surprises, on any machine.
//!
//! WHAT THE REAL SP1 GUEST USES INSTEAD. Inside the SP1 zkVM the production guest
//! would replace this module with the SP1-patched `sha2` crate (the accelerated
//! SHA-256 precompile), exactly as `../zk-light-client/guest/Cargo.toml` patches
//! `sha2` and `k256`. The BYTES are identical either way, so this module is a
//! faithful stand-in for the circuit's hash gate; only the in-circuit cost differs.
//! This is single-block-friendly, allocation-free, and float-free by construction.
const H0: [u32; 8] = [
0x6a09e667, 0xbb67ae85, 0x3c6ef372, 0xa54ff53a, 0x510e527f, 0x9b05688c, 0x1f83d9ab, 0x5be0cd19,
];
const K: [u32; 64] = [
0x428a2f98, 0x71374491, 0xb5c0fbcf, 0xe9b5dba5, 0x3956c25b, 0x59f111f1, 0x923f82a4, 0xab1c5ed5,
0xd807aa98, 0x12835b01, 0x243185be, 0x550c7dc3, 0x72be5d74, 0x80deb1fe, 0x9bdc06a7, 0xc19bf174,
0xe49b69c1, 0xefbe4786, 0x0fc19dc6, 0x240ca1cc, 0x2de92c6f, 0x4a7484aa, 0x5cb0a9dc, 0x76f988da,
0x983e5152, 0xa831c66d, 0xb00327c8, 0xbf597fc7, 0xc6e00bf3, 0xd5a79147, 0x06ca6351, 0x14292967,
0x27b70a85, 0x2e1b2138, 0x4d2c6dfc, 0x53380d13, 0x650a7354, 0x766a0abb, 0x81c2c92e, 0x92722c85,
0xa2bfe8a1, 0xa81a664b, 0xc24b8b70, 0xc76c51a3, 0xd192e819, 0xd6990624, 0xf40e3585, 0x106aa070,
0x19a4c116, 0x1e376c08, 0x2748774c, 0x34b0bcb5, 0x391c0cb3, 0x4ed8aa4a, 0x5b9cca4f, 0x682e6ff3,
0x748f82ee, 0x78a5636f, 0x84c87814, 0x8cc70208, 0x90befffa, 0xa4506ceb, 0xbef9a3f7, 0xc67178f2,
];
/// Incremental SHA-256 state. `no_std`, no allocation, deterministic.
pub struct Sha256 {
h: [u32; 8],
buf: [u8; 64],
buf_len: usize,
len_bits: u64,
}
impl Sha256 {
#[inline]
pub fn new() -> Self {
Sha256 { h: H0, buf: [0u8; 64], buf_len: 0, len_bits: 0 }
}
pub fn update(&mut self, mut data: &[u8]) {
self.len_bits = self.len_bits.wrapping_add((data.len() as u64) * 8);
// Fill any partial buffer first.
if self.buf_len > 0 {
let take = core::cmp::min(64 - self.buf_len, data.len());
self.buf[self.buf_len..self.buf_len + take].copy_from_slice(&data[..take]);
self.buf_len += take;
data = &data[take..];
if self.buf_len == 64 {
let block = self.buf;
self.compress(&block);
self.buf_len = 0;
}
}
// Compress full 64-byte blocks straight from the input.
while data.len() >= 64 {
let mut block = [0u8; 64];
block.copy_from_slice(&data[..64]);
self.compress(&block);
data = &data[64..];
}
// Stash the remainder.
if !data.is_empty() {
self.buf[..data.len()].copy_from_slice(data);
self.buf_len = data.len();
}
}
pub fn finalize(mut self) -> [u8; 32] {
let len_bits = self.len_bits;
// Padding: 0x80, then zeros, then the 64-bit big-endian bit length.
let mut pad = [0u8; 72];
pad[0] = 0x80;
// total padded region so that (buf_len + 1 + zeros + 8) % 64 == 0
let pad_zeros = if self.buf_len < 56 { 56 - self.buf_len } else { 120 - self.buf_len };
let total = pad_zeros + 8; // includes the 0x80 byte within pad_zeros count below
// Note: pad_zeros here already counts the 0x80 byte position; write length at the end.
pad[pad_zeros..pad_zeros + 8].copy_from_slice(&len_bits.to_be_bytes());
self.update_no_len(&pad[..total]);
let mut out = [0u8; 32];
for (i, word) in self.h.iter().enumerate() {
out[i * 4..i * 4 + 4].copy_from_slice(&word.to_be_bytes());
}
out
}
/// Same as `update` but does NOT advance the tracked message length (used only
/// to feed the precomputed padding block in `finalize`).
fn update_no_len(&mut self, mut data: &[u8]) {
if self.buf_len > 0 {
let take = core::cmp::min(64 - self.buf_len, data.len());
self.buf[self.buf_len..self.buf_len + take].copy_from_slice(&data[..take]);
self.buf_len += take;
data = &data[take..];
if self.buf_len == 64 {
let block = self.buf;
self.compress(&block);
self.buf_len = 0;
}
}
while data.len() >= 64 {
let mut block = [0u8; 64];
block.copy_from_slice(&data[..64]);
self.compress(&block);
data = &data[64..];
}
if !data.is_empty() {
self.buf[..data.len()].copy_from_slice(data);
self.buf_len = data.len();
}
}
fn compress(&mut self, block: &[u8; 64]) {
let mut w = [0u32; 64];
for i in 0..16 {
w[i] = u32::from_be_bytes([
block[i * 4],
block[i * 4 + 1],
block[i * 4 + 2],
block[i * 4 + 3],
]);
}
for i in 16..64 {
let s0 = w[i - 15].rotate_right(7) ^ w[i - 15].rotate_right(18) ^ (w[i - 15] >> 3);
let s1 = w[i - 2].rotate_right(17) ^ w[i - 2].rotate_right(19) ^ (w[i - 2] >> 10);
w[i] = w[i - 16]
.wrapping_add(s0)
.wrapping_add(w[i - 7])
.wrapping_add(s1);
}
let mut a = self.h[0];
let mut b = self.h[1];
let mut c = self.h[2];
let mut d = self.h[3];
let mut e = self.h[4];
let mut f = self.h[5];
let mut g = self.h[6];
let mut hh = self.h[7];
for i in 0..64 {
let s1 = e.rotate_right(6) ^ e.rotate_right(11) ^ e.rotate_right(25);
let ch = (e & f) ^ ((!e) & g);
let t1 = hh
.wrapping_add(s1)
.wrapping_add(ch)
.wrapping_add(K[i])
.wrapping_add(w[i]);
let s0 = a.rotate_right(2) ^ a.rotate_right(13) ^ a.rotate_right(22);
let maj = (a & b) ^ (a & c) ^ (b & c);
let t2 = s0.wrapping_add(maj);
hh = g;
g = f;
f = e;
e = d.wrapping_add(t1);
d = c;
c = b;
b = a;
a = t1.wrapping_add(t2);
}
self.h[0] = self.h[0].wrapping_add(a);
self.h[1] = self.h[1].wrapping_add(b);
self.h[2] = self.h[2].wrapping_add(c);
self.h[3] = self.h[3].wrapping_add(d);
self.h[4] = self.h[4].wrapping_add(e);
self.h[5] = self.h[5].wrapping_add(f);
self.h[6] = self.h[6].wrapping_add(g);
self.h[7] = self.h[7].wrapping_add(hh);
}
}
impl Default for Sha256 {
fn default() -> Self {
Self::new()
}
}
/// One-shot SHA-256 over `data`.
#[inline]
pub fn sha256(data: &[u8]) -> [u8; 32] {
let mut h = Sha256::new();
h.update(data);
h.finalize()
}
@@ -0,0 +1,120 @@
// GENERATED by scripts/gen_vectors.mjs from the OFFICIAL committed KAT
// aerenew/contracts/test/fixtures/xmss-sha2_10_256-kat.json
// Source: github.com/XMSS/xmss-reference @171ccbd26f098542a67eb5d2b128281c80bd71a6, deterministic test/vectors.c vectors_xmss(oid=1,mt=0): seed[i]=i, idx=2^(h-1)=512, msg=0x25
// Do NOT edit by hand: re-run `node scripts/gen_vectors.mjs`.
//
// RFC 8391 XMSS-SHA2_10_256 (OID 0x00000001): n=32, w=16, len=67, h=10, SHA-256.
// This is the same official reference vector the on-chain AereXmssVerifier.sol and
// its independent JS oracle (contracts/test/xmssVerifier.test.js) are validated with.
use crate::{Hash, XmssPubKey, XmssSig, H, LEN};
/// Long-term XMSS public root (first 32 bytes of the XMSS public key).
pub const PUB_ROOT: Hash = [0x9d, 0x89, 0x80, 0x33, 0xe3, 0x7a, 0xf4, 0x8e, 0x6a, 0x11, 0x6f, 0x8b, 0x15, 0x65, 0x1c, 0xc2, 0x67, 0x73, 0x46, 0x70, 0x07, 0xad, 0x19, 0x37, 0x5d, 0x38, 0xc2, 0x3c, 0x69, 0x0c, 0x34, 0x83];
/// XMSS public SEED (last 32 bytes of the XMSS public key).
pub const PUB_SEED: Hash = [0x40, 0x41, 0x42, 0x43, 0x44, 0x45, 0x46, 0x47, 0x48, 0x49, 0x4a, 0x4b, 0x4c, 0x4d, 0x4e, 0x4f, 0x50, 0x51, 0x52, 0x53, 0x54, 0x55, 0x56, 0x57, 0x58, 0x59, 0x5a, 0x5b, 0x5c, 0x5d, 0x5e, 0x5f];
/// Leaf index used by the signer for this signature.
pub const IDX: u32 = 512;
/// Per-signature randomizer R (from the signature).
pub const R: Hash = [0x8f, 0xf0, 0x30, 0x0b, 0xe4, 0x85, 0xde, 0xa7, 0xe5, 0xae, 0x2c, 0x56, 0x08, 0x03, 0x02, 0xfe, 0xbc, 0x91, 0xb4, 0x13, 0x18, 0xc5, 0x04, 0xf8, 0x95, 0xba, 0xab, 0x0b, 0x06, 0x89, 0x68, 0xf2];
/// The signed message bytes.
pub const MSG: [u8; 1] = [0x25];
/// The 67 WOTS+ one-time-signature chain values.
pub const WOTS: [Hash; LEN] = [
[0x22, 0xe5, 0xdd, 0x2e, 0x12, 0x05, 0x38, 0xcb, 0x72, 0xd1, 0x12, 0x67, 0xec, 0xf5, 0x5f, 0x62, 0x89, 0x7c, 0xb6, 0x41, 0x64, 0x33, 0x10, 0xf0, 0x39, 0xbe, 0x97, 0x57, 0xc5, 0xfa, 0x9d, 0x80],
[0xf7, 0x18, 0x84, 0xe3, 0x24, 0x47, 0xba, 0x71, 0xb4, 0xff, 0x1c, 0x50, 0xad, 0x42, 0x11, 0xc5, 0xd1, 0x07, 0x5b, 0xec, 0xa1, 0xa9, 0xf7, 0x57, 0x30, 0xf9, 0x12, 0x22, 0xe4, 0xc8, 0x9c, 0x6d],
[0x1e, 0x4e, 0x06, 0xd0, 0xa2, 0x22, 0x05, 0x3a, 0x60, 0x7b, 0x34, 0xa5, 0x42, 0x0f, 0xd7, 0xff, 0x8a, 0x13, 0x36, 0xa4, 0xda, 0x23, 0x8c, 0x23, 0x42, 0xd2, 0x10, 0xee, 0xee, 0x69, 0xc4, 0x69],
[0x75, 0x1a, 0x6e, 0x7b, 0xd5, 0x2d, 0xfb, 0x25, 0xd0, 0xc6, 0x32, 0x73, 0x35, 0xa8, 0x73, 0xfb, 0x4c, 0x4e, 0x98, 0xd8, 0x18, 0x5f, 0xdd, 0x47, 0x9d, 0x7a, 0x6b, 0x1d, 0x40, 0xe1, 0xe3, 0x9a],
[0x47, 0xff, 0x0d, 0xb1, 0x49, 0x37, 0xf3, 0x3b, 0x31, 0x03, 0x91, 0x5a, 0x9d, 0x43, 0x2f, 0xa6, 0x41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0xfa, 0x1a, 0xe8],
[0x4d, 0xbc, 0x8f, 0x65, 0x27, 0x24, 0x72, 0x4d, 0xf4, 0xa0, 0x85, 0xb0, 0x43, 0x70, 0x45, 0x63, 0x54, 0xf3, 0xee, 0x86, 0x38, 0x4d, 0x39, 0xf2, 0x30, 0x3f, 0x33, 0x6f, 0x06, 0xc9, 0x51, 0x82],
[0x5b, 0xc5, 0x6a, 0x75, 0xc1, 0x27, 0x9d, 0xc8, 0x50, 0xf0, 0x99, 0xe1, 0x99, 0x5e, 0xd0, 0x2a, 0xc1, 0x72, 0xe4, 0x39, 0x70, 0x15, 0x09, 0x87, 0xf8, 0xc7, 0xf4, 0xc6, 0xbd, 0xd1, 0x8f, 0xd2],
[0xea, 0xb2, 0x76, 0x93, 0x33, 0x88, 0xcd, 0x7f, 0xba, 0x18, 0x7c, 0xce, 0xaf, 0xee, 0x6e, 0x52, 0x9c, 0xd3, 0x96, 0x1b, 0x5b, 0xfe, 0xbc, 0xc8, 0x7c, 0xe1, 0x1a, 0x70, 0x84, 0x30, 0xc2, 0x74],
[0xce, 0xd6, 0x08, 0xd1, 0x79, 0x0b, 0x7d, 0x51, 0xbd, 0x66, 0x1e, 0x42, 0x1c, 0xba, 0x67, 0xfc, 0x20, 0xc4, 0xaf, 0x6c, 0xeb, 0xf1, 0x9a, 0x3a, 0xc9, 0x8d, 0xcf, 0x46, 0x74, 0x1f, 0xe0, 0x73],
[0x05, 0x85, 0x0e, 0xaa, 0x75, 0x10, 0x3f, 0xb1, 0xc8, 0x63, 0x50, 0x07, 0x58, 0xbc, 0x37, 0x6d, 0xb0, 0x6f, 0x29, 0x2a, 0x6e, 0x55, 0x6c, 0x9a, 0xc2, 0xa1, 0xc6, 0x13, 0x47, 0xe7, 0xd8, 0x83],
];
/// The h = 10 Merkle authentication-path nodes.
pub const AUTH: [Hash; H] = [
[0x5f, 0x13, 0x2f, 0x05, 0x9c, 0x3a, 0xbc, 0x25, 0x86, 0x8b, 0xd9, 0xb7, 0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 0xf0, 0x7b, 0x24, 0x3c, 0xd3, 0x43, 0x46, 0xbd, 0xaa, 0xff, 0xe5, 0xb7, 0xed, 0x4b, 0x64, 0xf8, 0xca, 0x7b, 0xa2, 0x89, 0x5f, 0x33, 0x96, 0x32, 0x92, 0xaf, 0x73, 0x76],
[0x53, 0x8d, 0x28, 0x31, 0x99, 0x8c, 0xbe, 0x8f, 0x07, 0x6d, 0x22, 0x31, 0xcc, 0x3a, 0x5d, 0xad, 0x0d, 0xa3, 0x6c, 0xe4, 0x9e, 0xec, 0x00, 0xe4, 0x0c, 0xc3, 0xa3, 0x40, 0xa4, 0x0f, 0xc2, 0x75],
[0xab, 0x1b, 0xea, 0x0f, 0x4e, 0x96, 0xe0, 0x08, 0xa4, 0x0d, 0x36, 0xc8, 0xa6, 0xbd, 0x04, 0x9b, 0xf2, 0x65, 0xf1, 0xb3, 0xdf, 0x85, 0x68, 0x6b, 0x53, 0xc6, 0x23, 0xb6, 0x40, 0xe3, 0x17, 0x5b],
[0xcb, 0x84, 0x95, 0x9b, 0x6d, 0x1e, 0x46, 0x95, 0x5e, 0x18, 0xbc, 0x5c, 0xf2, 0x7d, 0x5f, 0xe1, 0x3f, 0x72, 0x58, 0x9a, 0x39, 0x5e, 0x1e, 0xe0, 0x1e, 0xb9, 0x98, 0x3d, 0x5c, 0xe3, 0xe0, 0x4b],
];
/// The official reference public key as a [`XmssPubKey`].
pub fn official_pubkey() -> XmssPubKey {
XmssPubKey { root: PUB_ROOT, seed: PUB_SEED }
}
/// The official reference signature as a [`XmssSig`].
pub fn official_sig() -> XmssSig {
XmssSig { idx: IDX, r: R, wots: WOTS, auth: AUTH }
}
@@ -0,0 +1,286 @@
//! RFC 8391 XMSS-SHA2_10_256 signature VERIFICATION core.
//!
//! This is the exact inner computation the Post-Quantum Finality aggregation zkVM
//! guest runs PER VALIDATOR: recover a validator's long-term XMSS root from one
//! hash-based signature over the domain-bound block message. A validator's
//! attestation is VALID iff the recovered root equals the root the registry
//! committed for that validator.
//!
//! Parameter set XMSS-SHA2_10_256 (RFC 8391 OID 0x00000001):
//! n = 32 (SHA-256), Winternitz w = 16, len = 67 chains, single tree height h = 10.
//!
//! It is a byte-for-byte model of the already-validated on-chain
//! `AereXmssVerifier.sol` and its independent JS oracle
//! (`contracts/test/xmssVerifier.test.js`), which are checked against the official
//! github.com/XMSS/xmss-reference known-answer vector. Deterministic, `no_std`,
//! allocation-free, float-free, hash-only: exactly the shape a zkVM circuit needs.
//!
//! RFC 8391 keyed hash toolbox (padding_len = n = 32):
//! F(KEY, M) = SHA256( toByte(0,32) || KEY || M )
//! H(KEY, L||R) = SHA256( toByte(1,32) || KEY || L || R )
//! H_msg(KEY, M) = SHA256( toByte(2,32) || KEY || M )
//! PRF(KEY, ADRS) = SHA256( toByte(3,32) || KEY || ADRS )
//! with per-address keys/bitmasks derived by PRF(SEED, ADRS) over the 32-byte hash
//! address (type + OTS/L-tree/hash-tree fields + key_and_mask in {0,1,2}).
use crate::sha256::sha256;
/// Hash output size / node size in bytes (SHA-256).
pub const N: usize = 32;
/// Winternitz parameter.
pub const W: usize = 16;
/// Total WOTS+ chains (64 message digits + 3 checksum digits).
pub const LEN: usize = 67;
/// Single-tree Merkle height.
pub const H: usize = 10;
/// A 32-byte hash / node.
pub type Hash = [u8; N];
// XMSS hash-address types (RFC 8391 section 2.5).
const ADDR_OTS: u32 = 0;
const ADDR_LTREE: u32 = 1;
const ADDR_HASHTREE: u32 = 2;
/// An XMSS-SHA2_10_256 public key: the long-term root plus the public SEED.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub struct XmssPubKey {
/// Long-term XMSS public root (first 32 bytes of the XMSS public key).
pub root: Hash,
/// XMSS public SEED (last 32 bytes of the XMSS public key).
pub seed: Hash,
}
/// A single-tree XMSS-SHA2_10_256 signature.
#[derive(Clone, Copy, Debug)]
pub struct XmssSig {
/// Leaf index used by the signer (0 .. 2^h - 1).
pub idx: u32,
/// Per-signature randomizer R.
pub r: Hash,
/// The 67 WOTS+ one-time-signature chain values.
pub wots: [Hash; LEN],
/// The h = 10 Merkle authentication-path nodes.
pub auth: [Hash; H],
}
// --------------------------------------------------------------------------
// RFC 8391 keyed hash toolbox (SHA-256)
// --------------------------------------------------------------------------
/// A 32-byte big-endian encoding of a small domain-separation prefix
/// (`toByte(v, 32)`): 31 zero bytes then `v`.
#[inline]
fn to_byte32(v: u8) -> Hash {
let mut b = [0u8; 32];
b[31] = v;
b
}
/// Pack an XMSS 32-byte hash address. layer (bytes 0..4) and tree (bytes 4..12)
/// are always zero for single-tree XMSS-SHA2_10_256; then type (bytes 12..16),
/// the type-specific words a4/a5/a6 (bytes 16..20 / 20..24 / 24..28) and
/// key_and_mask (bytes 28..32). Matches `AereXmssVerifier._addr` exactly:
/// value = (typ<<128) | (a4<<96) | (a5<<64) | (a6<<32) | km (big-endian bytes32).
#[inline]
fn addr(typ: u32, a4: u32, a5: u32, a6: u32, km: u32) -> Hash {
let mut a = [0u8; 32];
a[12..16].copy_from_slice(&typ.to_be_bytes());
a[16..20].copy_from_slice(&a4.to_be_bytes());
a[20..24].copy_from_slice(&a5.to_be_bytes());
a[24..28].copy_from_slice(&a6.to_be_bytes());
a[28..32].copy_from_slice(&km.to_be_bytes());
a
}
/// PRF(SEED, ADRS) = SHA256( toByte(3,32) || SEED || ADRS ).
#[inline]
fn prf(seed: &Hash, address: &Hash) -> Hash {
let mut buf = [0u8; 96];
buf[0..32].copy_from_slice(&to_byte32(3));
buf[32..64].copy_from_slice(seed);
buf[64..96].copy_from_slice(address);
sha256(&buf)
}
#[inline]
fn xor32(a: &Hash, b: &Hash) -> Hash {
let mut o = [0u8; 32];
for i in 0..32 {
o[i] = a[i] ^ b[i];
}
o
}
/// RFC 8391 F: one hash-chain step. key = PRF(SEED, addr(km=0)),
/// mask = PRF(SEED, addr(km=1)), then F = SHA256( toByte(0,32) || key || (x^mask) ).
#[inline]
fn f_hash(seed: &Hash, typ: u32, a4: u32, a5: u32, a6: u32, x: &Hash) -> Hash {
let key = prf(seed, &addr(typ, a4, a5, a6, 0));
let mask = prf(seed, &addr(typ, a4, a5, a6, 1));
let masked = xor32(x, &mask);
let mut buf = [0u8; 96];
// toByte(0,32) is all zero.
buf[32..64].copy_from_slice(&key);
buf[64..96].copy_from_slice(&masked);
sha256(&buf)
}
/// RFC 8391 RAND_HASH / H over two n-byte children. key = PRF(addr(km=0)),
/// m0 = PRF(addr(km=1)), m1 = PRF(addr(km=2)), then
/// H = SHA256( toByte(1,32) || key || (L^m0) || (R^m1) ).
#[inline]
fn h_hash(seed: &Hash, typ: u32, a4: u32, a5: u32, a6: u32, left: &Hash, right: &Hash) -> Hash {
let key = prf(seed, &addr(typ, a4, a5, a6, 0));
let m0 = prf(seed, &addr(typ, a4, a5, a6, 1));
let m1 = prf(seed, &addr(typ, a4, a5, a6, 2));
let l = xor32(left, &m0);
let r = xor32(right, &m1);
let mut buf = [0u8; 128];
buf[0..32].copy_from_slice(&to_byte32(1));
buf[32..64].copy_from_slice(&key);
buf[64..96].copy_from_slice(&l);
buf[96..128].copy_from_slice(&r);
sha256(&buf)
}
// --------------------------------------------------------------------------
// WOTS+ (leaf)
// --------------------------------------------------------------------------
/// Derive the 67 base-16 chain lengths (64 message digits + 3 checksum digits)
/// from a 32-byte message hash, exactly per RFC 8391 chain_lengths.
pub fn chain_lengths(m: &Hash) -> [u32; LEN] {
let mut d = [0u32; LEN];
let mut csum: u32 = 0;
for i in 0..32 {
let b = m[i];
let hi = (b >> 4) as u32;
let lo = (b & 0x0f) as u32;
d[2 * i] = hi;
d[2 * i + 1] = lo;
csum += (15 - hi) + (15 - lo);
}
// csum << (8 - (len2*log_w % 8)) == csum << 4, then base_w over 2 big-endian bytes.
let c = csum << 4;
d[64] = (c >> 12) & 0x0f;
d[65] = (c >> 8) & 0x0f;
d[66] = (c >> 4) & 0x0f;
d
}
/// WOTS_PKFromSig: complete each of the 67 chains from the signature value to the
/// chain end (position w-1), returning the 67 WOTS+ public-key chain values.
fn wots_pk_from_sig(seed: &Hash, idx_leaf: u32, mhash: &Hash, sig: &[Hash; LEN]) -> [Hash; LEN] {
let lens = chain_lengths(mhash);
let mut pk = [[0u8; 32]; LEN];
for i in 0..LEN {
let mut x = sig[i];
// gen_chain: for s in [lens[i], w-1): F with hash-address s, chain-address i.
let mut s = lens[i];
while s < (W as u32) - 1 {
x = f_hash(seed, ADDR_OTS, idx_leaf, i as u32, s, &x);
s += 1;
}
pk[i] = x;
}
pk
}
/// L-tree: compress the 67 WOTS+ public-key values into a single n-byte leaf.
fn l_tree(seed: &Hash, idx_leaf: u32, pk: &[Hash; LEN]) -> Hash {
let mut nodes = *pk;
let mut l = LEN;
let mut height: u32 = 0;
while l > 1 {
let parent = l >> 1;
for i in 0..parent {
nodes[i] = h_hash(
seed,
ADDR_LTREE,
idx_leaf,
height,
i as u32,
&nodes[2 * i],
&nodes[2 * i + 1],
);
}
if l & 1 == 1 {
nodes[parent] = nodes[l - 1];
l = parent + 1;
} else {
l = parent;
}
height += 1;
}
nodes[0]
}
// --------------------------------------------------------------------------
// Merkle authentication path
// --------------------------------------------------------------------------
/// compute_root: fold the leaf with the h=10 authentication path up to the root,
/// using the hash-tree address (type 2) with the correct per-level height/index.
fn compute_root(seed: &Hash, leaf: &Hash, leaf_idx: u32, auth: &[Hash; H]) -> Hash {
let mut left: Hash;
let mut right: Hash;
if leaf_idx & 1 == 1 {
left = auth[0];
right = *leaf;
} else {
left = *leaf;
right = auth[0];
}
let mut li = leaf_idx;
for i in 0..(H - 1) {
li >>= 1;
let node = h_hash(seed, ADDR_HASHTREE, 0, i as u32, li, &left, &right);
if li & 1 == 1 {
left = auth[i + 1];
right = node;
} else {
left = node;
right = auth[i + 1];
}
}
li >>= 1;
h_hash(seed, ADDR_HASHTREE, 0, (H - 1) as u32, li, &left, &right)
}
// --------------------------------------------------------------------------
// Verify
// --------------------------------------------------------------------------
/// Recover the candidate XMSS root from a signature over `message`, binding to the
/// claimed public `root` in the message hash exactly as RFC 8391 H_msg requires:
/// M' = SHA256( toByte(2,32) || R || root || toByte(idx, 32) || M )
/// then WOTS_PKFromSig -> L-tree leaf -> compute_root along the auth path.
///
/// The signature is VALID iff the returned value equals `pk.root`. This function
/// is the exact per-validator obligation the aggregation circuit discharges.
pub fn xmss_recover_root(pk: &XmssPubKey, sig: &XmssSig, message: &[u8]) -> Hash {
// M' = H_msg( R || root || toByte(idx,32) || M ).
let mut msg_buf = [0u8; 32 + 32 + 32 + 32]; // prefix || R || root || toByte(idx,32)
msg_buf[0..32].copy_from_slice(&to_byte32(2));
msg_buf[32..64].copy_from_slice(&sig.r);
msg_buf[64..96].copy_from_slice(&pk.root);
// toByte(idx, 32): 28 zero bytes then the 4-byte big-endian index.
msg_buf[124..128].copy_from_slice(&sig.idx.to_be_bytes());
let mut hasher = crate::sha256::Sha256::new();
hasher.update(&msg_buf);
hasher.update(message);
let mhash = hasher.finalize();
let idx_leaf = sig.idx & ((1u32 << H) - 1);
let wpk = wots_pk_from_sig(&pk.seed, idx_leaf, &mhash, &sig.wots);
let leaf = l_tree(&pk.seed, idx_leaf, &wpk);
compute_root(&pk.seed, &leaf, idx_leaf, &sig.auth)
}
/// Verify an XMSS-SHA2_10_256 signature: true iff the recovered root equals the
/// public key's committed root. Constant-shape, hash-only, deterministic.
pub fn xmss_verify(pk: &XmssPubKey, sig: &XmssSig, message: &[u8]) -> bool {
xmss_recover_root(pk, sig, message) == pk.root
}
@@ -0,0 +1,147 @@
//! REAL known-answer validation of the XMSS-SHA2_10_256 verification core.
//!
//! The vector in `xmss_verify_core::vectors` is generated (by
//! `scripts/gen_vectors.mjs`) from the OFFICIAL github.com/XMSS/xmss-reference
//! deterministic known-answer vector committed at
//! `aerenew/contracts/test/fixtures/xmss-sha2_10_256-kat.json`, the same vector the
//! deployed on-chain `AereXmssVerifier.sol` and its independent JS oracle use.
//!
//! Positive test: the genuine signature verifies (recovered root == official root).
//! Negative tests: every single-bit tamper (WOTS+ value, auth node, message, index,
//! claimed root) MUST fail. If ANY negative test verified, the core would be unsound.
use xmss_verify_core::sha256::sha256;
use xmss_verify_core::vectors as v;
use xmss_verify_core::{xmss_recover_root, xmss_verify, XmssPubKey};
/// Flip the least-significant bit of byte 0 of a 32-byte value.
fn flip(mut h: [u8; 32]) -> [u8; 32] {
h[0] ^= 0x01;
h
}
#[test]
fn sha256_self_check_fips_abc() {
// FIPS 180-4 sample: SHA256("abc").
let got = sha256(b"abc");
let want = [
0xba, 0x78, 0x16, 0xbf, 0x8f, 0x01, 0xcf, 0xea, 0x41, 0x41, 0x40, 0xde, 0x5d, 0xae, 0x22,
0x23, 0xb0, 0x03, 0x61, 0xa3, 0x96, 0x17, 0x7a, 0x9c, 0xb4, 0x10, 0xff, 0x61, 0xf2, 0x00,
0x15, 0xad,
];
assert_eq!(got, want, "bundled SHA-256 disagrees with FIPS 180-4 SHA256(\"abc\")");
}
#[test]
fn sha256_self_check_empty() {
// SHA256("") — exercises the pure-padding block path.
let got = sha256(b"");
let want = [
0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a, 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9,
0x24, 0x27, 0xae, 0x41, 0xe4, 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52,
0xb8, 0x55,
];
assert_eq!(got, want, "bundled SHA-256 disagrees with FIPS 180-4 SHA256(\"\")");
}
#[test]
fn recovers_the_official_reference_root() {
let pk = v::official_pubkey();
let sig = v::official_sig();
let recovered = xmss_recover_root(&pk, &sig, &v::MSG);
assert_eq!(
recovered, v::PUB_ROOT,
"recovered XMSS root != official reference root"
);
}
#[test]
fn accepts_the_official_reference_signature() {
let pk = v::official_pubkey();
let sig = v::official_sig();
assert!(
xmss_verify(&pk, &sig, &v::MSG),
"official RFC 8391 XMSS-SHA2_10_256 KAT signature did not verify"
);
}
#[test]
fn rejects_a_tampered_wots_value() {
let pk = v::official_pubkey();
let mut sig = v::official_sig();
sig.wots[0] = flip(sig.wots[0]);
assert!(!xmss_verify(&pk, &sig, &v::MSG), "tampered WOTS+ value verified");
}
#[test]
fn rejects_a_tampered_wots_tail_value() {
let pk = v::official_pubkey();
let mut sig = v::official_sig();
sig.wots[66] = flip(sig.wots[66]); // last (checksum) chain
assert!(!xmss_verify(&pk, &sig, &v::MSG), "tampered checksum WOTS+ value verified");
}
#[test]
fn rejects_a_tampered_auth_path_node() {
let pk = v::official_pubkey();
let mut sig = v::official_sig();
sig.auth[9] = flip(sig.auth[9]); // top auth node
assert!(!xmss_verify(&pk, &sig, &v::MSG), "tampered authentication-path node verified");
}
#[test]
fn rejects_a_tampered_message() {
let pk = v::official_pubkey();
let sig = v::official_sig();
assert!(!xmss_verify(&pk, &sig, &[0x26]), "signature verified over a different message");
}
#[test]
fn rejects_a_wrong_leaf_index() {
let pk = v::official_pubkey();
let mut sig = v::official_sig();
sig.idx += 1;
assert!(!xmss_verify(&pk, &sig, &v::MSG), "signature verified at the wrong leaf index");
}
#[test]
fn rejects_a_wrong_claimed_root() {
// A different committed root must not be recoverable from this signature.
let pk = XmssPubKey { root: flip(v::PUB_ROOT), seed: v::PUB_SEED };
let sig = v::official_sig();
assert!(!xmss_verify(&pk, &sig, &v::MSG), "signature verified against a wrong claimed root");
}
#[test]
fn rejects_a_tampered_randomizer() {
let pk = v::official_pubkey();
let mut sig = v::official_sig();
sig.r = flip(sig.r);
assert!(!xmss_verify(&pk, &sig, &v::MSG), "signature verified with a tampered R randomizer");
}
#[test]
fn chain_lengths_checksum_shape() {
// The 3 checksum digits are a deterministic function of the 64 message digits;
// recompute the WOTS+ checksum independently and confirm the core agrees.
let pk = v::official_pubkey();
let sig = v::official_sig();
// Rebuild the exact message hash the verifier uses, then compare chain_lengths.
let mut buf = [0u8; 32 + 32 + 32 + 32 + 1];
buf[31] = 2; // toByte(2,32)
buf[32..64].copy_from_slice(&sig.r);
buf[64..96].copy_from_slice(&pk.root);
buf[124..128].copy_from_slice(&sig.idx.to_be_bytes());
buf[128] = v::MSG[0];
let mhash = sha256(&buf);
let d = xmss_verify_core::chain_lengths(&mhash);
let mut csum: u32 = 0;
for i in 0..32 {
csum += (15 - (mhash[i] >> 4) as u32) + (15 - (mhash[i] & 0x0f) as u32);
}
let c = csum << 4;
assert_eq!(d[64], (c >> 12) & 0x0f);
assert_eq!(d[65], (c >> 8) & 0x0f);
assert_eq!(d[66], (c >> 4) & 0x0f);
}