2021-06-04 10:06:51 +00:00
|
|
|
# clocktower
|
|
|
|
|
2021-06-05 17:36:49 +00:00
|
|
|
clocktower is a python package implementing efficient strategies for executing adaptive timing side
|
|
|
|
channel attacks. the goal is to use statistics to guide public input guesses in order to reveal the
|
|
|
|
secret with a given level of statistical significance in a minimum number of rounds. the current
|
|
|
|
strategy already significantly outperforms the naive non-adaptive strategy, and thus can be used as
|
|
|
|
a framework for mounting attacks
|
|
|
|
|
|
|
|
## howto
|
|
|
|
|
|
|
|
currently the model is that a correct guess will result in a longer time taken to execute, and all
|
|
|
|
incorrect guesses will take the same (lower) time to execute
|
|
|
|
more abstraction is planned for different target models
|
|
|
|
|
|
|
|
```
|
|
|
|
import clocktower
|
|
|
|
|
|
|
|
# default input space: 0-255
|
|
|
|
# default significance level: 0.01
|
|
|
|
mgr = clocktower.ClocktowerManager()
|
|
|
|
|
|
|
|
# when next_guess() returns None, the algoritm has a statistically significant answer
|
|
|
|
while (guess := mgr.next_guess()) is not None:
|
|
|
|
# execute the guess and get the result
|
|
|
|
timing_value = run_attack(guess)
|
|
|
|
mgr.update(guess, timing_value)
|
|
|
|
|
|
|
|
print(mgr.get_best_guess())
|
|
|
|
```
|