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
a7239a02
authored
Jul 17, 2019
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
trying to make test measurements more stable
parent
f68f7f7e
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
24 additions
and
15 deletions
+24
-15
compile_all.py
+2
-3
templates/uno/src/main.ino
+7
-6
test.py
+15
-6
No files found.
compile_all.py
View file @
a7239a02
...
...
@@ -156,13 +156,12 @@ def main(argv):
try
:
b
=
build
(
d
,
template_dir
)
test_script
.
write
(
"echo
\"
TESTING
%
s
\"\n
"
%
d
)
test_script
.
write
(
"./test.py
%
s
%
s 2>
%
s | tee
%
s
\n
"
%
(
test_script
.
write
(
"
python3 -u
./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
)
except
Exception
:
...
...
templates/uno/src/main.ino
View file @
a7239a02
...
...
@@ -5,6 +5,7 @@
#define MAX_BYTES 100
//#define DEBUG
#define CRYPTO_BUSY 12
uint8_t
npub
[
CRYPTO_NPUBBYTES
];
uint8_t
nsec
[
CRYPTO_NSECBYTES
];
...
...
@@ -70,8 +71,8 @@ void assert(bool b) {
void
setup
()
{
Serial
.
begin
(
115200
);
pinMode
(
LED_BUILTIN
,
OUTPUT
);
digitalWrite
(
LED_BUILTIN
,
HIGH
);
pinMode
(
CRYPTO_BUSY
,
OUTPUT
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
delay
(
100
);
Serial
.
print
(
"Hello, World!"
);
}
...
...
@@ -98,18 +99,18 @@ void loop() {
case
'e'
:
noInterrupts
();
asm
(
"nop"
);
digitalWrite
(
LED_BUILTIN
,
LOW
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
digitalWrite
(
LED_BUILTIN
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
asm
(
"nop"
);
interrupts
();
break
;
case
'd'
:
noInterrupts
();
asm
(
"nop"
);
digitalWrite
(
LED_BUILTIN
,
LOW
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
res
=
crypto_aead_decrypt
(
m
,
&
mlen
,
nsec
,
c
,
clen
,
ad
,
adlen
,
npub
,
k
);
digitalWrite
(
LED_BUILTIN
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
asm
(
"nop"
);
interrupts
();
break
;
...
...
test.py
View file @
a7239a02
...
...
@@ -15,17 +15,19 @@ 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
()
try
:
test
(
argv
[
1
],
cmd
)
finally
:
end_measurement
(
measurements
)
print
(
"TEST SUCCESSFUL"
)
return
0
except
Exception
as
ex
:
print
(
str
(
ex
))
print
(
"TEST FAILED"
)
finally
:
end_measurement
(
measurements
)
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
...
...
@@ -135,19 +137,24 @@ def begin_measurement():
import
saleae
import
time
sal
=
saleae
.
Saleae
()
sal
.
set_active_channels
([
0
,
1
],
[])
sal
.
set_active_channels
([
0
,
1
,
2
,
3
],
[])
sal
.
set_sample_rate
(
sal
.
get_all_sample_rates
()[
0
])
sal
.
set_capture_seconds
(
6
000
)
sal
.
set_capture_seconds
(
1
000
)
sal
.
capture_start
()
time
.
sleep
(
1
)
if
sal
.
is_processing_complete
():
raise
Exception
(
"Capture didn't start successfully"
)
return
sal
def
end_measurement
(
sal
):
import
time
time
.
sleep
(
1
)
sal
.
capture_stop
();
while
not
sal
.
is_processing_complete
():
pass
for
attempt
in
range
(
3
):
if
not
sal
.
is_processing_complete
():
print
(
"waiting for capture to complete"
)
time
.
sleep
(
1
)
continue
outfile
=
"measurement_
%
s.csv"
%
time
.
strftime
(
"
%
Y
%
m
%
d-
%
H
%
M
%
S"
)
outfile
=
os
.
path
.
join
(
"measurements"
,
outfile
)
if
os
.
path
.
isfile
(
outfile
):
...
...
@@ -158,6 +165,8 @@ def end_measurement(sal):
mdbfile
=
open
(
mdbfile
,
"a"
)
mdbfile
.
write
(
"
%
s >
%
s
\n
"
%
(
' '
.
join
(
sys
.
argv
),
outfile
))
mdbfile
.
close
()
return
0
raise
Exception
(
"Capture didn't complete successfully"
)
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
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