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
9f0816f9
authored
5 years ago
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test.py with flag for ram testing
parent
28a6d424
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
3 deletions
+14
-3
test.py
+14
-3
No files found.
test.py
View file @
9f0816f9
...
...
@@ -8,6 +8,8 @@ from subprocess import Popen, PIPE
def
main
(
argv
):
speed_test
=
True
if
len
(
argv
)
<
3
:
print
(
"Usage: test.py LWC_AEAD_KAT.txt program [arguments]"
)
...
...
@@ -16,11 +18,13 @@ def main(argv):
for
attempt
in
range
(
3
):
print
(
"beginning test
%
d of '
%
s' using test vectors '
%
s'"
%
(
attempt
,
' '
.
join
(
cmd
),
argv
[
1
]))
try
:
measurements
=
begin_measurement
()
if
speed_test
:
measurements
=
begin_measurement
()
try
:
test
(
argv
[
1
],
cmd
)
finally
:
end_measurement
(
measurements
)
if
speed_test
:
end_measurement
(
measurements
)
print
(
"TEST SUCCESSFUL"
)
return
0
...
...
@@ -33,7 +37,7 @@ def main(argv):
return
1
def
test
(
test_file
,
cmd
):
def
test
(
test_file
,
cmd
,
ram_test
=
False
):
test_file
=
open
(
test_file
,
'r'
)
p
=
Popen
(
cmd
,
bufsize
=
0
,
stdin
=
PIPE
,
stdout
=
PIPE
)
...
...
@@ -114,6 +118,13 @@ def test(test_file, cmd):
print
(
" m =
%
s"
%
output
.
hex
())
if
m
!=
output
:
raise
Exception
(
"output of encryption is different from expected ciphertext"
)
if
ram_test
:
# RAM test only tests the first test vector
write
(
b
'u'
)
output
=
obtain
()
print
(
" untouched memory =
%
d"
%
struct
.
unpack
(
"<I"
,
output
))
break
elif
res
is
not
None
:
if
res
[
1
]
.
lower
()
==
'count'
:
...
...
This diff is collapsed.
Click to expand it.
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