Commit f68f7f7e by Enrico Pozzobon

fixes for xoody

parent fbf91878
build/ build/
measurements/
logs/
all-lwc-submission-files/ all-lwc-submission-files/
*.log *.log
...@@ -148,12 +148,22 @@ def main(argv): ...@@ -148,12 +148,22 @@ def main(argv):
test_script_path = os.path.join("build", "test_all.sh") test_script_path = os.path.join("build", "test_all.sh")
with open(test_script_path, 'w') as test_script: with open(test_script_path, 'w') as test_script:
test_script.write("#!/bin/sh\n") test_script.write("#!/bin/sh\n")
test_script.write("mkdir -p logs\n")
test_script.write("mkdir -p measurements\n")
for t, d in files: for t, d in files:
print() print()
print(d) print(d)
try: try:
b = build(d, template_dir) b = build(d, template_dir)
test_script.write("echo \"TESTING %s\"\n./test.py %s %s\n" % (d, t, os.path.join(b, 'test'))) test_script.write("echo \"TESTING %s\"\n" % d)
test_script.write("./test.py %s %s 2> %s | tee %s\n" % (
t,
os.path.join(b, 'test'),
os.path.join(b, 'test_stderr.log'),
os.path.join(b, 'test_stdout.log'))
#./test.py all-lwc-submission-files/tinyjambu/Implementations/crypto_aead/tinyjambu192/LWC_AEAD_KAT_192_96.txt build/731759111/test 2> build/731759111/test_stderr.log | tee build/731759111/test_stdout.log
print("COMPILATION SUCCESS FOR %s" % d) print("COMPILATION SUCCESS FOR %s" % d)
except Exception: except Exception:
print("COMPILATION FAILED FOR %s" % d) print("COMPILATION FAILED FOR %s" % d)
......
#!/bin/bash #!/bin/bash
mv -n *.c *.C *.s *.S src/ mv -n *.c *.C *.s *.S src/
mv -n *.h *.H include/ mv -n *.inc *.h *.H include/
sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g" sed -i src/encrypt.c -e "s/\(\s\)init(/\1_init(/g"
exit 0 exit 0
...@@ -11,14 +11,13 @@ def main(argv): ...@@ -11,14 +11,13 @@ def main(argv):
if len(argv) < 3: if len(argv) < 3:
print("Usage: test.py LWC_AEAD_KAT.txt program [arguments]") print("Usage: test.py LWC_AEAD_KAT.txt program [arguments]")
test_file = open(argv[1], 'r')
cmd = argv[2:] cmd = argv[2:]
for attempt in range(3): for attempt in range(3):
print("beginning test %d of '%s' using test vectors '%s'" % (attempt, ' '.join(cmd), argv[1])) print("beginning test %d of '%s' using test vectors '%s'" % (attempt, ' '.join(cmd), argv[1]))
measurements = begin_measurement() measurements = begin_measurement()
try: try:
test(test_file, cmd) test(argv[1], cmd)
print("TEST SUCCESSFUL") print("TEST SUCCESSFUL")
return 0 return 0
except Exception as ex: except Exception as ex:
...@@ -34,6 +33,7 @@ def main(argv): ...@@ -34,6 +33,7 @@ def main(argv):
def test(test_file, cmd): def test(test_file, cmd):
test_file = open(test_file, 'r')
p = Popen(cmd, bufsize=0, stdin=PIPE, stdout=PIPE) p = Popen(cmd, bufsize=0, stdin=PIPE, stdout=PIPE)
def write(data): def write(data):
...@@ -113,8 +113,6 @@ def test(test_file, cmd): ...@@ -113,8 +113,6 @@ def test(test_file, cmd):
if m != output: if m != output:
raise Exception("output of encryption is different from expected ciphertext") raise Exception("output of encryption is different from expected ciphertext")
elif res is not None: elif res is not None:
if res[1].lower() == 'count': if res[1].lower() == 'count':
i = int(res[2], 10) i = int(res[2], 10)
...@@ -129,9 +127,9 @@ def test(test_file, cmd): ...@@ -129,9 +127,9 @@ def test(test_file, cmd):
elif res[1].lower() == 'ct': elif res[1].lower() == 'ct':
c = bytes.fromhex(res[2]) c = bytes.fromhex(res[2])
else: else:
print("ERROR: unparsed line in test vectors file: '%s'" % res) raise Exception("ERROR: unparsed line in test vectors file: '%s'" % res)
else: else:
print("ERROR: unparsed line in test vectors file: '%s'" % line) raise Exception("ERROR: unparsed line in test vectors file: '%s'" % line)
def begin_measurement(): def begin_measurement():
import saleae import saleae
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment