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
72e9cc76
authored
May 13, 2020
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor changes
parent
3538b59b
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
28 additions
and
19 deletions
+28
-19
compile_all.py
+5
-8
templates/esp32/platformio.ini
+1
-0
test-dude.py
+16
-7
test_common.py
+6
-4
No files found.
compile_all.py
View file @
72e9cc76
...
...
@@ -10,7 +10,7 @@ import subprocess
def
build
(
algo_dir
,
template_dir
,
build_dir
):
if
os
.
path
.
isdir
(
build_dir
):
r
eturn
None
r
aise
Exception
(
"Directory
%
s doesn't exist"
%
build_dir
)
print
(
"Building in
%
s"
%
build_dir
)
...
...
@@ -77,7 +77,7 @@ def build(algo_dir, template_dir, build_dir):
os
.
chdir
(
wd
)
# if execution arrives here, the build was successful
return
build_dir
return
True
# Find test vectors in directory or one of the parent directories
...
...
@@ -201,18 +201,15 @@ def main(argv):
print
()
# Build all found algorithms
for
i
,
(
t
,
d
,
name
,
st_mtime
)
in
enumerate
(
files
)
:
for
t
,
d
,
name
,
st_mtime
in
files
:
print
()
print
(
d
)
try
:
build_dir
=
os
.
path
.
join
(
build_root_dir
,
name
)
b
=
b
uild
(
d
,
template_dir
,
build_dir
)
build
(
d
,
template_dir
,
build_dir
)
if
b
is
None
:
continue
shutil
.
copyfile
(
t
,
os
.
path
.
join
(
b
,
'LWC_AEAD_KAT.txt'
))
shutil
.
copyfile
(
t
,
os
.
path
.
join
(
build_dir
,
'LWC_AEAD_KAT.txt'
))
mdate_path
=
os
.
path
.
join
(
build_dir
,
'cipher_mtime.txt'
)
with
open
(
mdate_path
,
'wt'
)
as
mdate_file
:
...
...
templates/esp32/platformio.ini
View file @
72e9cc76
...
...
@@ -3,6 +3,7 @@ platform = espressif32
platform_packages
=
toolchain-xtensa32
@
2.50200.80
board
=
esp32dev
board_build.f_cpu
=
240000000L
framework
=
arduino
build_type
=
release
build_flags
=
...
...
test-dude.py
View file @
72e9cc76
...
...
@@ -8,6 +8,7 @@ import signal
import
datetime
import
threading
import
subprocess
import
json
from
flask
import
Flask
,
request
,
Response
from
flask_restful
import
Resource
,
Api
from
flask_jsonpify
import
jsonify
...
...
@@ -34,12 +35,13 @@ class ScheduledTest:
_next_id
=
1
def
__init__
(
self
,
**
kwargs
):
self
.
path
=
kwargs
[
'build_dir'
]
self
.
cipher
=
kwargs
[
'cipher'
]
self
.
cipher_timestamp
=
kwargs
[
'cipher_timestamp'
]
self
.
template_timestamp
=
kwargs
[
'template_timestamp'
]
self
.
template
=
kwargs
[
'template'
]
self
.
template_commit
=
kwargs
[
'template_commit'
]
if
len
(
kwargs
)
>
0
:
self
.
path
=
kwargs
[
'build_dir'
]
self
.
cipher
=
kwargs
[
'cipher'
]
self
.
cipher_timestamp
=
kwargs
[
'cipher_timestamp'
]
self
.
template_timestamp
=
kwargs
[
'template_timestamp'
]
self
.
template
=
kwargs
[
'template'
]
self
.
template_commit
=
kwargs
[
'template_commit'
]
self
.
id
=
str
(
ScheduledTest
.
_next_id
)
ScheduledTest
.
_next_id
+=
1
...
...
@@ -60,7 +62,8 @@ class ScheduledTest:
a
=
ScheduledTest
()
for
k
in
ScheduledTest
.
__slots__
:
if
k
not
in
ScheduledTest
.
_unserialized_slots
:
setattr
(
a
,
k
,
dict
[
k
])
if
k
!=
'id'
:
setattr
(
a
,
k
,
dict
[
k
])
return
a
...
...
@@ -303,4 +306,10 @@ if __name__ == '__main__':
sys
.
exit
(
0
)
signal
.
signal
(
signal
.
SIGINT
,
signal_handler
)
if
len
(
sys
.
argv
)
>
1
:
with
open
(
sys
.
argv
[
1
],
'r'
)
as
fin
:
saved
=
json
.
load
(
fin
)
for
job
in
saved
[
'schedule'
]:
schedule
.
append
(
ScheduledTest
.
from_dict
(
job
))
app
.
run
(
port
=
'5002'
)
test_common.py
View file @
72e9cc76
...
...
@@ -170,8 +170,9 @@ def run_nist_aead_test_line(dut, i, m, ad, k, npub, c):
output
=
dut
.
obtain_var
(
ord
(
'C'
))
print
(
" c =
%
s"
%
output
.
hex
())
if
c
!=
output
:
raise
Exception
(
"output of encryption is different from "
+
"expected ciphertext"
)
raise
Exception
(
(
"output of encryption (
%
s) is different from "
+
"expected ciphertext (
%
s)"
)
%
(
output
.
hex
(),
c
.
hex
()))
dut
.
send_var
(
ord
(
'm'
),
b
"
\0
"
*
len
(
c
))
dut
.
send_var
(
ord
(
's'
),
b
""
)
...
...
@@ -185,8 +186,9 @@ def run_nist_aead_test_line(dut, i, m, ad, k, npub, c):
output
=
dut
.
obtain_var
(
ord
(
'M'
))
print
(
" m =
%
s"
%
output
.
hex
())
if
m
!=
output
:
raise
Exception
(
"output of encryption is different from "
+
"expected ciphertext"
)
raise
Exception
(
(
"output of decryption (
%
s) is different from "
+
"expected plaintext (
%
s)"
)
%
(
output
.
hex
(),
m
.
hex
()))
def
parse_nist_aead_test_vectors
(
test_file_path
):
...
...
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