silentops/lib.rs
1// SPDX-License-Identifier: Apache-2.0
2// Copyright 2026 Cédric Mesnil <cslashm@pm.me>
3
4//! # silentops — side-channel countermeasure toolkit
5//!
6//! `silentops` gathers the side-channel building blocks shared by the
7//! `krypteia` workspace (post-quantum crate `quantica` and classical
8//! crate `arcana`).
9//!
10//! Three modules are exposed today:
11//!
12//! - [`ct`] — constant-time primitives with architecture-specific
13//! assembly backends (`no_std`). This is the former `ct_ops` crate.
14//! - [`ct_grind`] — Valgrind memcheck client-request helpers
15//! (`poison` / `unpoison`) used to verify constant-time code under
16//! `valgrind --error-exitcode=1`. Emits real instrumentation on
17//! `x86_64-linux` / `aarch64-linux` when the `ct-grind` feature is
18//! enabled; elsewhere the calls are zero-cost no-ops (`no_std`).
19//! - `verify` — dudect-style timing leakage detector based on
20//! Welch's t-test (`std` only). This is the former `ct_verify`
21//! crate, refactored as a reusable library.
22//!
23//! Future modules will host additional shared SCA helpers (masking,
24//! shuffling, fault-injection countermeasures, …) so that both
25//! classical and post-quantum sides reuse the same primitives.
26//!
27//! # `no_std`
28//!
29//! The crate is `no_std` by default. The `verify` module is only
30//! compiled when the `std` feature is enabled.
31//!
32//! # Re-exports
33//!
34//! For convenience, all primitives from [`ct`] are re-exported at
35//! the crate root, so call sites can write `silentops::ct_eq(...)`
36//! instead of `silentops::ct::ct_eq(...)`.
37
38#![no_std]
39
40#[cfg(feature = "std")]
41extern crate std;
42
43pub mod ct;
44pub use ct::*;
45
46pub mod ct_grind;
47
48#[cfg(feature = "std")]
49pub mod verify;