diff --git a/get_submissions.sh b/get_submissions.sh index be08cd7..6cb9fb3 100755 --- a/get_submissions.sh +++ b/get_submissions.sh @@ -4,6 +4,7 @@ mkdir all-lwc-submission-files || exit 1 cd all-lwc-submission-files wget https://csrc.nist.gov/CSRC/media/Projects/Lightweight-Cryptography/documents/round-1/submissions/all-lwc-submission-files.zip unzip all-lwc-submission-files.zip +cp -r ../mbed_aes_gcm/ . cd .. mkdir -p all-lwc-submission-files/aes-gcm/Implementations/crypto_aead/aesgcm128-128 diff --git a/mbed_aes_gcm/LWC_AEAD_KAT_128_96.txt b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/LWC_AEAD_KAT_128_96.txt similarity index 100% rename from mbed_aes_gcm/LWC_AEAD_KAT_128_96.txt rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/LWC_AEAD_KAT_128_96.txt diff --git a/mbed_aes_gcm/Makefile b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/Makefile similarity index 100% rename from mbed_aes_gcm/Makefile rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/Makefile diff --git a/mbed_aes_gcm/aes.c b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/aes.c similarity index 100% rename from mbed_aes_gcm/aes.c rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/aes.c diff --git a/mbed_aes_gcm/aes.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/aes.h similarity index 100% rename from mbed_aes_gcm/aes.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/aes.h diff --git a/mbed_aes_gcm/api.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/api.h similarity index 100% rename from mbed_aes_gcm/api.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/api.h diff --git a/mbed_aes_gcm/cipher.c b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher.c similarity index 100% rename from mbed_aes_gcm/cipher.c rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher.c diff --git a/mbed_aes_gcm/cipher.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher.h similarity index 100% rename from mbed_aes_gcm/cipher.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher.h diff --git a/mbed_aes_gcm/cipher_internal.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher_internal.h similarity index 100% rename from mbed_aes_gcm/cipher_internal.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher_internal.h diff --git a/mbed_aes_gcm/cipher_wrap.c b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher_wrap.c similarity index 100% rename from mbed_aes_gcm/cipher_wrap.c rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/cipher_wrap.c diff --git a/mbed_aes_gcm/config.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/config.h similarity index 100% rename from mbed_aes_gcm/config.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/config.h diff --git a/mbed_aes_gcm/crypto_aead.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/crypto_aead.h similarity index 100% rename from mbed_aes_gcm/crypto_aead.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/crypto_aead.h diff --git a/mbed_aes_gcm/gcm.c b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/gcm.c similarity index 100% rename from mbed_aes_gcm/gcm.c rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/gcm.c diff --git a/mbed_aes_gcm/gcm.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/gcm.h similarity index 100% rename from mbed_aes_gcm/gcm.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/gcm.h diff --git a/mbed_aes_gcm/genkat_aead.c b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/genkat_aead.c similarity index 100% rename from mbed_aes_gcm/genkat_aead.c rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/genkat_aead.c diff --git a/mbed_aes_gcm/platform_util.c b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/platform_util.c similarity index 100% rename from mbed_aes_gcm/platform_util.c rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/platform_util.c diff --git a/mbed_aes_gcm/platform_util.h b/mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/platform_util.h similarity index 100% rename from mbed_aes_gcm/platform_util.h rename to mbed_aes_gcm/Implementations/crypto_aead/aes128k96n/ref/platform_util.h diff --git a/parse_logic.py b/parse_logic.py new file mode 100755 index 0000000..2d1fc16 --- /dev/null +++ b/parse_logic.py @@ -0,0 +1,78 @@ +#!/usr/bin/python3 + +import os +import sys +import re + +def parse_capture(filename): + f = open('measurements/' + filename) + #counter = 0 + counter = 1 + lets_use_a_flag = False + six_ts = '' + two_ts = '' + enc_deltas = {} + dec_deltas = {} + for l in f.readlines(): + l_array = l.split(" ") + bit_field = l_array[-1][:-1] + # l_array? That's the best you came up with? + if bit_field == '6': + six_ts = l_array[0][:-1] + lets_use_a_flag = True + continue + if lets_use_a_flag: + if bit_field == '2': + #if counter == 0: + #counter = counter + 1 + #continue + two_ts = l_array[0][:-1] + delta = float(two_ts) - float(six_ts) + if counter % 2 == 1: + enc_deltas[(counter+1)/2] = delta + else: + dec_deltas[counter/2] = delta + counter = counter + 1 + else: + lets_use_a_flag = False + f.close() + for key in enc_deltas: + print("Vector %d was encrypted in %f seconds" % (key, enc_deltas[key])) + for key in dec_deltas: + print("Vector %d was decrypted in %f seconds" % (key, dec_deltas[key])) + print(len(enc_deltas)) + print(len(dec_deltas)) + +def read_log(d): + # Soo readlines, much efficient + f = open(d + '/test_stdout.log', 'r') + content = f.readlines() + + are_we_happy = content[-1].split(' ')[-1] + if are_we_happy != 'SUCCESSFUL\n': + print ("Test unsuccesful or log file structure corrupted") + return + + # I like to split it, split it + algorithm = content[0].split(' ')[-1].split('/')[-2] + # Path to logic data is in the second to last line + logic_file = content[-2].split('/')[-1][:-2] + + f. close() + + print("Let's evaluate the test results of algorithm %s by using %s" % (algorithm, logic_file)) + + parse_capture(logic_file) + +def main(): + print('THE LWC BENCHMARK SPLITTER') + print('powered by Deutsche Bahn') + build_dir = 'build/' + for d in os.listdir(build_dir): + read_log(os.path.join(build_dir + d)) + + + +if __name__ == "__main__": + main() +