Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
lwc
/
compare
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Pipelines
Members
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
a5fb9cb2
authored
Jul 06, 2020
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trying to prefetch code for encryption, specifically for ESP32
parent
e16525dc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
33 additions
and
4 deletions
+33
-4
test_common.py
+33
-4
No files found.
test_common.py
View file @
a5fb9cb2
...
@@ -149,7 +149,7 @@ class UARTP:
...
@@ -149,7 +149,7 @@ class UARTP:
return
buf
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
()
eprint
(
"Count =
%
d"
%
i
)
eprint
(
"Count =
%
d"
%
i
)
eprint
(
" m =
%
s"
%
m
.
hex
())
eprint
(
" m =
%
s"
%
m
.
hex
())
...
@@ -668,7 +668,39 @@ def run_nist_lws_aead_test(dut, vectors_file, build_dir,
...
@@ -668,7 +668,39 @@ def run_nist_lws_aead_test(dut, vectors_file, build_dir,
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
write
(
"Board prepared
\n
"
)
sys
.
stdout
.
flush
()
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
()]
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
)
tool
=
LogicMultiplexerTimeMeasurements
(
logic_mask
)
try
:
try
:
...
@@ -679,9 +711,6 @@ def run_nist_lws_aead_test(dut, vectors_file, build_dir,
...
@@ -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
)
run_nist_aead_test_line
(
dut
,
i
,
m
,
ad
,
k
,
npub
,
c
)
tool
.
unarm
()
tool
.
unarm
()
if
i
==
1
and
ram_dumps
[
0
]
is
not
None
:
ram_dumps
.
append
(
dut
.
dump_ram
())
except
Exception
as
ex
:
except
Exception
as
ex
:
print
(
"TEST FAILED"
)
print
(
"TEST FAILED"
)
raise
ex
raise
ex
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment