Skip to content

Commit

Permalink
Merge pull request #888 from tlsfuzzer/layperson-explanation-fixups
Browse files Browse the repository at this point in the history
handle the 95% CI for 45% trimmed mean equal 0 for small pieces of code
  • Loading branch information
tomato42 committed Feb 4, 2024
2 parents 2dbbc24 + 3f89f46 commit b1a5c6d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions tlsfuzzer/analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
mpl.use('Agg')


VERSION = 5
VERSION = 6


_diffs = None
Expand Down Expand Up @@ -1323,10 +1323,22 @@ def _write_summary(self, difference, p_vals, sign_p_vals, worst_pair,
"Results suggesting side-channel found, "
"collecting more data necessary for confirmation")
else:
small_ci = min((diff_conf_int[key][2]-diff_conf_int[key][0])/2
for key in
["mean", "trim_mean_05", "trim_mean_25",
"trim_mean_45"])
small_cis = list(
(diff_conf_int[key][2]-diff_conf_int[key][0])/2
for key in
["mean", "median", "trim_mean_05", "trim_mean_25",
"trim_mean_45"])
if max(small_cis) == 0:
print("WARNING: all 95% CIs are equal 0. Too small sammple"
" or too low clock resolution for the measurement.")
# when measuring values below clock frequency
# or very small pieces of code with high resolution clock
# it may cause the 95% CI to equal 0.0; that's not a realistic
# value so ignore it
# (for median it would be nice to actually check if we're not
# in the vicinity of the clock resolution, and ignore median
# then, but that's much more complex so don't do it for now)
small_ci = min(i for i in small_cis if i != 0)
if small_ci < 1e-10:
explanation = (
"Implementation verified as not "
Expand All @@ -1339,7 +1351,7 @@ def _write_summary(self, difference, p_vals, sign_p_vals, worst_pair,
explanation = (
"Large confidence intervals detected, "
"collecting more data necessary. Side channel "
"leakege smaller than {0:.3e}s is possible".format(
"leakage smaller than {0:.3e}s is possible".format(
small_ci))
else:
explanation = (
Expand Down

0 comments on commit b1a5c6d

Please sign in to comment.