Expand description
Statistical core of sidecheck.
Methodology based on Crosby, Wallach, Riedi, “Opportunities and Limits of Remote Timing Attacks” (ACM TISSEC, 2009): the network can only add delay, never remove it, so the low percentiles of a sample carry far less noise than the mean or even the raw minimum. This is what the “box test” builds on — comparing the low percentiles of two samples.
Structs§
- BoxTest
Result - Result of a box test: the difference between the low percentiles of two samples, plus a confidence interval obtained via bootstrap (no assumption of normally-distributed network latency).
Constants§
- BOOTSTRAP_
ITERATIONS - Number of bootstrap resampling iterations for the confidence interval. Pulled out into a constant so it can be reported honestly — not just “confidence: 95%”, but explicitly “bootstrap confidence over N iterations”.
Functions§
- box_
test - Box test per the Crosby-Wallach methodology: compares the low percentile (p10 by default) of two response-time samples; the confidence interval is built via bootstrap resampling.
- estimate_
jitter - Estimates network jitter from a pilot sample. Used to be computed as the standard deviation around the low percentile — but variance (squared deviations) is extremely sensitive to single outliers (the first request after connection setup, a GC pause, OS scheduling): one slow request out of three hundred could inflate the estimate several times over, which is why two independent measurements of the same channel could disagree wildly.
- percentile
- Returns the p-th percentile of a sorted sample (p in [0.0, 100.0]).
- required_
samples - Estimates the minimum number of requests per class needed to detect a leak of the given size at the given network noise level. Formula from power analysis for comparing means: n ≈ 2 * (z_alpha/2 + z_beta)^2 * sigma^2 / delta^2