Commit a5fb9cb2 by Enrico Pozzobon

Trying to prefetch code for encryption, specifically for ESP32

parent e16525dc
......@@ -149,7 +149,7 @@ class UARTP:
return buf
def run_nist_aead_test_line(dut, i, m, ad, k, npub, c):
def run_nist_aead_test_line(dut, i, m, ad, k, npub, c=None):
eprint()
eprint("Count = %d" % i)
eprint(" m = %s" % m.hex())
......@@ -668,7 +668,39 @@ def run_nist_lws_aead_test(dut, vectors_file, build_dir,
sys.stdout.write("Board prepared\n")
sys.stdout.flush()
# For targets that support memory utilization testing, the RAM should now
# contain a known pattern pattern that is identical for all algorithms,
# minus the differences in static memory. Now we dump the RAM before and
# after running the first test vector, to measure how much of the memory
# was affected by one execution of encryption and decryption
ram_dumps = [dut.dump_ram()]
if ram_dumps[0] is not None:
i, m, ad, k, npub, c = kat[0]
run_nist_aead_test_line(dut, i, m, ad, k, npub, c)
ram_dumps.append(dut.dump_ram())
# This is a dummy test to ensure the encryption and decryption code is in
# the cache for devices that make use of a slow flash for storing the code.
# The duration of this test is not measured.
# It uses the same length for the message and AD as the last line of the
# test vector file, which is assumed to be the longest.
i, m, ad, k, npub, c = kat[-1]
run_nist_aead_test_line(
dut,
-1,
b"m" * len(m),
b"a" * len(ad),
b"k" * len(k),
b"n" * len(npub),
None
)
# Now we do the encryption and decryption speed test. The tool object
# provides an abstraction to the logic analyzer that will check how long
# the encryption/decryption takes by mean of the CRYPTO_BUSY GPIO on the
# board.
tool = LogicMultiplexerTimeMeasurements(logic_mask)
try:
......@@ -679,9 +711,6 @@ def run_nist_lws_aead_test(dut, vectors_file, build_dir,
run_nist_aead_test_line(dut, i, m, ad, k, npub, c)
tool.unarm()
if i == 1 and ram_dumps[0] is not None:
ram_dumps.append(dut.dump_ram())
except Exception as ex:
print("TEST FAILED")
raise ex
......
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