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):
...
@@ -156,13 +156,12 @@ def main(argv):
try
:
try
:
b
=
build
(
d
,
template_dir
)
b
=
build
(
d
,
template_dir
)
test_script
.
write
(
"echo
\"
TESTING
%
s
\"\n
"
%
d
)
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
,
t
,
os
.
path
.
join
(
b
,
'test'
),
os
.
path
.
join
(
b
,
'test'
),
os
.
path
.
join
(
b
,
'test_stderr.log'
),
os
.
path
.
join
(
b
,
'test_stderr.log'
),
os
.
path
.
join
(
b
,
'test_stdout.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
)
print
(
"COMPILATION SUCCESS FOR
%
s"
%
d
)
except
Exception
:
except
Exception
:
...
...
templates/uno/src/main.ino
View file @
a7239a02
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
#define MAX_BYTES 100
#define MAX_BYTES 100
//#define DEBUG
//#define DEBUG
#define CRYPTO_BUSY 12
uint8_t
npub
[
CRYPTO_NPUBBYTES
];
uint8_t
npub
[
CRYPTO_NPUBBYTES
];
uint8_t
nsec
[
CRYPTO_NSECBYTES
];
uint8_t
nsec
[
CRYPTO_NSECBYTES
];
...
@@ -70,8 +71,8 @@ void assert(bool b) {
...
@@ -70,8 +71,8 @@ void assert(bool b) {
void
setup
()
{
void
setup
()
{
Serial
.
begin
(
115200
);
Serial
.
begin
(
115200
);
pinMode
(
LED_BUILTIN
,
OUTPUT
);
pinMode
(
CRYPTO_BUSY
,
OUTPUT
);
digitalWrite
(
LED_BUILTIN
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
delay
(
100
);
delay
(
100
);
Serial
.
print
(
"Hello, World!"
);
Serial
.
print
(
"Hello, World!"
);
}
}
...
@@ -98,18 +99,18 @@ void loop() {
...
@@ -98,18 +99,18 @@ void loop() {
case
'e'
:
case
'e'
:
noInterrupts
();
noInterrupts
();
asm
(
"nop"
);
asm
(
"nop"
);
digitalWrite
(
LED_BUILTIN
,
LOW
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
res
=
crypto_aead_encrypt
(
c
,
&
clen
,
m
,
mlen
,
ad
,
adlen
,
nsec
,
npub
,
k
);
digitalWrite
(
LED_BUILTIN
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
asm
(
"nop"
);
asm
(
"nop"
);
interrupts
();
interrupts
();
break
;
break
;
case
'd'
:
case
'd'
:
noInterrupts
();
noInterrupts
();
asm
(
"nop"
);
asm
(
"nop"
);
digitalWrite
(
LED_BUILTIN
,
LOW
);
digitalWrite
(
CRYPTO_BUSY
,
LOW
);
res
=
crypto_aead_decrypt
(
m
,
&
mlen
,
nsec
,
c
,
clen
,
ad
,
adlen
,
npub
,
k
);
res
=
crypto_aead_decrypt
(
m
,
&
mlen
,
nsec
,
c
,
clen
,
ad
,
adlen
,
npub
,
k
);
digitalWrite
(
LED_BUILTIN
,
HIGH
);
digitalWrite
(
CRYPTO_BUSY
,
HIGH
);
asm
(
"nop"
);
asm
(
"nop"
);
interrupts
();
interrupts
();
break
;
break
;
...
...
test.py
View file @
a7239a02
...
@@ -15,17 +15,19 @@ def main(argv):
...
@@ -15,17 +15,19 @@ def main(argv):
for
attempt
in
range
(
3
):
for
attempt
in
range
(
3
):
print
(
"beginning test
%
d of '
%
s' using test vectors '
%
s'"
%
(
attempt
,
' '
.
join
(
cmd
),
argv
[
1
]))
print
(
"beginning test
%
d of '
%
s' using test vectors '
%
s'"
%
(
attempt
,
' '
.
join
(
cmd
),
argv
[
1
]))
try
:
measurements
=
begin_measurement
()
measurements
=
begin_measurement
()
try
:
try
:
test
(
argv
[
1
],
cmd
)
test
(
argv
[
1
],
cmd
)
finally
:
end_measurement
(
measurements
)
print
(
"TEST SUCCESSFUL"
)
print
(
"TEST SUCCESSFUL"
)
return
0
return
0
except
Exception
as
ex
:
except
Exception
as
ex
:
print
(
str
(
ex
))
print
(
str
(
ex
))
print
(
"TEST FAILED"
)
print
(
"TEST FAILED"
)
finally
:
finally
:
end_measurement
(
measurements
)
sys
.
stdout
.
flush
()
sys
.
stdout
.
flush
()
sys
.
stderr
.
flush
()
sys
.
stderr
.
flush
()
...
@@ -135,19 +137,24 @@ def begin_measurement():
...
@@ -135,19 +137,24 @@ def begin_measurement():
import
saleae
import
saleae
import
time
import
time
sal
=
saleae
.
Saleae
()
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_sample_rate
(
sal
.
get_all_sample_rates
()[
0
])
sal
.
set_capture_seconds
(
6
000
)
sal
.
set_capture_seconds
(
1
000
)
sal
.
capture_start
()
sal
.
capture_start
()
time
.
sleep
(
1
)
time
.
sleep
(
1
)
if
sal
.
is_processing_complete
():
raise
Exception
(
"Capture didn't start successfully"
)
return
sal
return
sal
def
end_measurement
(
sal
):
def
end_measurement
(
sal
):
import
time
import
time
time
.
sleep
(
1
)
time
.
sleep
(
1
)
sal
.
capture_stop
();
sal
.
capture_stop
();
while
not
sal
.
is_processing_complete
():
for
attempt
in
range
(
3
):
pass
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
=
"measurement_
%
s.csv"
%
time
.
strftime
(
"
%
Y
%
m
%
d-
%
H
%
M
%
S"
)
outfile
=
os
.
path
.
join
(
"measurements"
,
outfile
)
outfile
=
os
.
path
.
join
(
"measurements"
,
outfile
)
if
os
.
path
.
isfile
(
outfile
):
if
os
.
path
.
isfile
(
outfile
):
...
@@ -158,6 +165,8 @@ def end_measurement(sal):
...
@@ -158,6 +165,8 @@ def end_measurement(sal):
mdbfile
=
open
(
mdbfile
,
"a"
)
mdbfile
=
open
(
mdbfile
,
"a"
)
mdbfile
.
write
(
"
%
s >
%
s
\n
"
%
(
' '
.
join
(
sys
.
argv
),
outfile
))
mdbfile
.
write
(
"
%
s >
%
s
\n
"
%
(
' '
.
join
(
sys
.
argv
),
outfile
))
mdbfile
.
close
()
mdbfile
.
close
()
return
0
raise
Exception
(
"Capture didn't complete successfully"
)
if
__name__
==
"__main__"
:
if
__name__
==
"__main__"
:
sys
.
exit
(
main
(
sys
.
argv
))
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