Safe Rust primitives for first-order Boolean masking, a masked ChaCha20 reference, and a zero-dependency side-channel analysis harness.
SiCaS is pre-release research and engineering software. It has not been independently audited or hardware-validated. Do not use it to protect production secrets.
| Crate | Purpose |
|---|---|
sicas-core |
Constant-time comparisons, Secret<T>, two-share Masked<T>, masked addition, fail-closed entropy trait |
sicas-reference |
First-order Boolean masked ChaCha20, scalar and 64-block bitsliced batch |
sicas-harness |
Trace format, preprocessing, TVLA, CPA, DPA, timing checks, leakage model, CLI |
sicas-platform |
OS entropy adapter |
sicas-zeroize |
Experimental volatile zeroization adapter (unaudited) |
The workspace uses safe Rust, forbids unsafe code in the published logic crates, and has zero third-party runtime dependencies.
cargo build --workspace --release --locked
cargo test --workspace --all-targets --all-features --locked
cargo test --workspace --doc --locked
cargo run -p sicas-harness -- --helpFormatting and strict lints:
cargo +nightly-2026-08-03 fmt --all -- --check
cargo +nightly-2026-08-03 clippy --workspace --all-targets --all-features --locked \
-- -D warnings -D clippy::pedantic -D clippy::nurseryuse sicas_core::{ct, Masked, Secret};
let value = 0x1234_5678_u32;
let mask = 0xa5a5_a5a5_u32;
let masked = Masked::<u32>::mask(value, mask);
assert_eq!(*masked.unmask().expose_secret(), value);
assert_eq!(ct::eq_u32(value, value).as_u8(), 1);
let secret = Secret::new(value);
assert_eq!(format!("{secret:?}"), "Secret<redacted>");Secret::expose_secret, Secret::into_inner, and Masked::unmask are explicit
declassification boundaries.
use sicas_platform::entropy::OsEntropy;
use sicas_reference::chacha20::MaskedChaCha20;
let key = [0x42_u8; 32];
let nonce = [0x24_u8; 12];
let mut entropy = OsEntropy::new().unwrap();
let mut cipher = MaskedChaCha20::new(&key, &nonce, 0, &mut entropy).unwrap();
let block = cipher.keystream_block(&mut entropy).unwrap();
let batch = cipher.keystream_blocks(&mut entropy).unwrap();The keystream output is a declassification boundary. Never reuse a
(key, nonce, counter) tuple.
Generate deterministic synthetic traces:
cargo run -p sicas-harness -- synthetic \
--fixed-out fixed.bin --random-out random.bin \
--fixed-count 128 --random-count 128 --samples 4 \
--secret 0x42 --noise 10 --leakage 100 --seed 11Run fixed-vs-random TVLA:
cargo run -p sicas-harness -- tvla --fixed fixed.bin --random random.bin
cargo run -p sicas-harness -- tvla-streaming --fixed fixed.bin --random random.binGenerate and analyze CPA traces:
cargo run -p sicas-harness -- synthetic-cpa \
--out traces.bin --plaintexts-out plaintexts.bin \
--count 128 --samples 4 --secret 0x42 --noise 0 --leakage 100 --seed 7
cargo run -p sicas-harness -- cpa --traces traces.bin --plaintexts plaintexts.bin
cargo run -p sicas-harness -- dpa --traces traces.bin --plaintexts plaintexts.binOther commands:
timing— dudect-style fixed-vs-random timing check.ct— constant-time evidence suite for core primitives.leakage-check— first-order leakage model with a negative control.trim,filter,align— trace preprocessing.
magic: 8 bytes, b"SiCaSTR1"
version: u16 little-endian, currently 1
samples_per_trace:u32 little-endian
trace_count: u32 little-endian
samples: trace_count * samples_per_trace i16 little-endian
Limits:
- 1,000,000 traces;
- 1,000,000 samples per trace;
- 100,000,000 total samples for the in-memory reader;
- 1,000,000,000 total samples for the streaming reader.
The project includes unit, integration, property, differential, compile-fail, fuzz, Miri, ASan, Valgrind, Kani, mutation, coverage, assembly, timing, leakage-model, cross-architecture, and release-reproducibility checks. See the technical evidence:
- Constant-time evidence
- Performance evidence
- Mutation evidence
- Fuzz evidence
- Cross-architecture evidence
- Security test matrix
The primitives target a passive first-order side-channel adversary. They do not claim protection against higher-order DPA, profiling/template attacks, fault injection, invasive probing, cache-timing or microarchitectural leakage, supply-chain attacks, or malicious hardware. The masked ChaCha20 reference is a validation target, not an audited production cipher.
See:
- Threat model
- Bitsliced masking
- Evaluation guide
- Hardware measurement protocol
- Zeroization limitations
- Support matrix
- Code quality standard
- Tooling inventory
- Release process
GPL-3.0-only. See LICENSE.