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
0d6d46d3
authored
Jul 08, 2019
by
Enrico Pozzobon
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better!
parent
0aa71a11
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
63 additions
and
25 deletions
+63
-25
compile_all.py
+61
-25
templates/linux/configure
+1
-0
templates/linux/main.c
+1
-0
No files found.
get_algos
.py
→
compile_all
.py
View file @
0d6d46d3
...
...
@@ -6,8 +6,7 @@ import shutil
import
random
import
subprocess
def
bench
(
algo_dir
,
template_dir
=
"templates/linux"
):
print
(
algo_dir
)
def
build
(
algo_dir
,
template_dir
=
"templates/linux"
):
build_dir
=
None
while
build_dir
is
None
:
r
=
"
%09
d"
%
random
.
randint
(
0
,
999999999
)
...
...
@@ -40,35 +39,41 @@ def bench(algo_dir, template_dir="templates/linux"):
else
:
raise
Exception
(
"I don't know what
%
s is"
%
src
)
env
=
os
.
environ
env
[
'SRC_FILES'
]
=
' '
.
join
(
cfiles
)
env
[
'HDR_FILES'
]
=
' '
.
join
(
hfiles
)
wd
=
os
.
getcwd
()
try
:
env
=
os
.
environ
env
[
'SRC_FILES'
]
=
' '
.
join
(
cfiles
)
env
[
'HDR_FILES'
]
=
' '
.
join
(
hfiles
)
os
.
chdir
(
build_dir
)
if
os
.
path
.
isfile
(
'./configure'
):
p
=
subprocess
.
Popen
([
"./configure"
],
env
=
env
)
compout
,
comperr
=
p
.
communicate
()
print
(
compout
)
print
(
"---"
)
print
(
comperr
)
p
=
subprocess
.
Popen
([
"./configure"
])
p
.
wait
()
assert
p
.
returncode
==
0
pargs
=
[
'make'
]
p
=
subprocess
.
Popen
(
pargs
,
env
=
env
)
compout
,
comperr
=
p
.
communicate
()
print
(
compout
)
print
(
"---"
)
print
(
comperr
)
p
=
subprocess
.
Popen
([
'make'
])
p
.
wait
()
assert
p
.
returncode
==
0
finally
:
os
.
chdir
(
wd
)
# shutil.rmtree(build_dir)
exit
(
0
)
# stop immediately for now
return
build_dir
def
find_test_vectors
(
d
):
kat
=
None
while
kat
is
None
:
if
d
==
''
:
raise
Exception
(
"Test vector not found"
)
for
f
in
os
.
listdir
(
d
):
if
f
.
startswith
(
"LWC_AEAD_KAT_"
)
and
f
.
endswith
(
".txt"
):
if
kat
is
not
None
:
raise
Exception
(
"Multiple test vectors?"
)
kat
=
f
d
=
os
.
path
.
split
(
d
)[
0
]
kat
=
os
.
path
.
join
(
d
,
kat
)
return
kat
def
main
(
argv
):
submissions_dir
=
"all-lwc-submission-files"
...
...
@@ -78,20 +83,51 @@ def main(argv):
print
(
"Using template
%
s"
%
template_dir
)
subs
=
os
.
listdir
(
submissions_dir
)
files
=
set
()
# get all the submissions by looking for files named "encrypt.c"
files
=
[]
for
submission
in
subs
:
implementations_dir
=
os
.
path
.
join
(
submissions_dir
,
submission
,
"Implementations"
,
"crypto_aead"
)
if
not
os
.
path
.
isdir
(
implementations_dir
):
continue
if
"NOT ACCEPTED"
in
implementations_dir
:
continue
print
()
print
(
"###
%
s ###"
%
submission
)
c
=
0
# r=root, d=directories, f = files
for
r
,
d
,
f
in
os
.
walk
(
implementations_dir
):
for
file
in
f
:
if
file
==
"
encrypt.c
"
:
if
file
==
"
api.h
"
:
f
=
os
.
path
.
join
(
r
,
file
)
d
=
os
.
path
.
split
(
f
)[
0
]
bench
(
d
,
template_dir
)
assert
os
.
path
.
isdir
(
d
)
files
.
add
(
d
)
print
(
d
)
t
=
find_test_vectors
(
d
)
print
(
t
)
files
.
append
(
d
)
c
+=
1
if
c
==
0
:
raise
Exception
(
"No implementations found"
)
# For testing, we only do the first
files
=
files
[:
1
]
if
os
.
path
.
isdir
(
'build'
):
shutil
.
rmtree
(
'build'
)
print
()
for
d
in
files
:
print
()
print
(
d
)
b
=
build
(
d
)
if
__name__
==
"__main__"
:
...
...
templates/linux/configure
View file @
0d6d46d3
#!/bin/bash
echo
"test ./configure has been run"
templates/linux/main.c
View file @
0d6d46d3
...
...
@@ -4,6 +4,7 @@
#include <stdbool.h>
#include <assert.h>
#include "crypto_aead.h"
#include "api.h"
#ifndef KEY_LENGTH
#define KEY_LENGTH 16
...
...
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