Introduce max number of measurements

This commit is contained in:
2019-10-16 08:49:54 +02:00
parent aef9360d4b
commit 97176b6a52

View File

@@ -9,6 +9,7 @@ import threading
from Crypto.Cipher import AES from Crypto.Cipher import AES
#context.log_level = "debug" #context.log_level = "debug"
max_measurements = 20000
allowed_chars = string.ascii_letters + string.digits + string.punctuation allowed_chars = string.ascii_letters + string.digits + string.punctuation
@@ -104,7 +105,11 @@ key = []
# We keep gathering measurements until we are certain enoguh which key the correct one is # We keep gathering measurements until we are certain enoguh which key the correct one is
while len(key) < 16: while len(key) < 16:
if len(measurements) < max_measurements:
measurements.update(gather_measurements(remotes, 1000)) measurements.update(gather_measurements(remotes, 1000))
else:
log.failure("Unable to restore key after using the maximum configured number of measurements. This can mean one of two things: Either we just got very unlucky with the random numbers and this error will not occur again during the next run. In this case this error can be ignored. If this error keeps occuring the challange is broken.")
sys.exit(1)
log.info("Total number of unique measurements gathered: {}".format(len(measurements))) log.info("Total number of unique measurements gathered: {}".format(len(measurements)))
# This attack allows us to test each aes key byte independently # This attack allows us to test each aes key byte independently