Merge branch 'master' into frodo-aes
This commit is contained in:
commit
518e8656be
@ -1,9 +1,9 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "thash.h"
|
|
||||||
#include "address.h"
|
#include "address.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
|
#include "thash.h"
|
||||||
|
|
||||||
#include "fips202.h"
|
#include "fips202.h"
|
||||||
|
|
||||||
|
@ -1,11 +1,11 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
#include "utils.h"
|
|
||||||
#include "address.h"
|
#include "address.h"
|
||||||
#include "hash.h"
|
#include "hash.h"
|
||||||
#include "params.h"
|
#include "params.h"
|
||||||
#include "thash.h"
|
#include "thash.h"
|
||||||
|
#include "utils.h"
|
||||||
#include "wots.h"
|
#include "wots.h"
|
||||||
|
|
||||||
// TODO clarify address expectations, and make them more uniform.
|
// TODO clarify address expectations, and make them more uniform.
|
||||||
|
@ -30,8 +30,11 @@ def run_subprocess(command, working_dir='.', env=None, expected_returncode=0):
|
|||||||
env=env,
|
env=env,
|
||||||
)
|
)
|
||||||
print(result.stdout.decode('utf-8'))
|
print(result.stdout.decode('utf-8'))
|
||||||
assert result.returncode == expected_returncode, \
|
if expected_returncode is not None:
|
||||||
"Got unexpected return code {}".format(result.returncode)
|
assert result.returncode == expected_returncode, \
|
||||||
|
"Got unexpected return code {}".format(result.returncode)
|
||||||
|
else:
|
||||||
|
return (result.returncode, result.stdout.decode('utf-8'))
|
||||||
return result.stdout.decode('utf-8')
|
return result.stdout.decode('utf-8')
|
||||||
|
|
||||||
|
|
||||||
@ -111,8 +114,10 @@ def permit_test(testname, thing, **args):
|
|||||||
|
|
||||||
if isinstance(thing, pqclean.Implementation):
|
if isinstance(thing, pqclean.Implementation):
|
||||||
scheme = thing.scheme
|
scheme = thing.scheme
|
||||||
else:
|
elif isinstance(thing, pqclean.Scheme):
|
||||||
scheme = thing
|
scheme = thing
|
||||||
|
else:
|
||||||
|
return True
|
||||||
|
|
||||||
if 'PQCLEAN_ONLY_TYPES' in os.environ:
|
if 'PQCLEAN_ONLY_TYPES' in os.environ:
|
||||||
if not(scheme.type.lower() in os.environ['PQCLEAN_ONLY_TYPES'].lower().split(',')):
|
if not(scheme.type.lower() in os.environ['PQCLEAN_ONLY_TYPES'].lower().split(',')):
|
||||||
|
@ -70,7 +70,7 @@ class Implementation:
|
|||||||
def __init__(self, scheme, name):
|
def __init__(self, scheme, name):
|
||||||
self.scheme = scheme
|
self.scheme = scheme
|
||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
def metadata(self):
|
def metadata(self):
|
||||||
for i in self.scheme.metadata()['implementations']:
|
for i in self.scheme.metadata()['implementations']:
|
||||||
if i['name'] == self.name:
|
if i['name'] == self.name:
|
||||||
@ -79,9 +79,6 @@ class Implementation:
|
|||||||
def path(self, base='..') -> str:
|
def path(self, base='..') -> str:
|
||||||
return os.path.join(self.scheme.path(), self.name)
|
return os.path.join(self.scheme.path(), self.name)
|
||||||
|
|
||||||
def namespace_prefix(self):
|
|
||||||
return 'PQCLEAN_{}_{}_'.format(self.scheme.name.upper(), self.name.upper()).replace('-', '')
|
|
||||||
|
|
||||||
def libname(self) -> str:
|
def libname(self) -> str:
|
||||||
if os.name == 'nt':
|
if os.name == 'nt':
|
||||||
return "lib{}_{}.lib".format(self.scheme.name, self.name)
|
return "lib{}_{}.lib".format(self.scheme.name, self.name)
|
||||||
|
@ -12,7 +12,7 @@ import helpers
|
|||||||
def test_common():
|
def test_common():
|
||||||
for d in os.listdir('common'):
|
for d in os.listdir('common'):
|
||||||
primitive = re.sub(r"\.c$", "", d)
|
primitive = re.sub(r"\.c$", "", d)
|
||||||
yield check_common, primitive
|
if helpers.permit_test('common', None): yield check_common, primitive
|
||||||
|
|
||||||
|
|
||||||
def check_common(primitive):
|
def check_common(primitive):
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import os
|
import os
|
||||||
from glob import glob
|
from glob import glob
|
||||||
import sys
|
import sys
|
||||||
|
import unittest
|
||||||
|
|
||||||
import pqclean
|
import pqclean
|
||||||
import helpers
|
import helpers
|
||||||
@ -17,18 +18,26 @@ def test_clang_tidy():
|
|||||||
|
|
||||||
def check_tidy(implementation: pqclean.Implementation):
|
def check_tidy(implementation: pqclean.Implementation):
|
||||||
helpers.ensure_available('clang-tidy')
|
helpers.ensure_available('clang-tidy')
|
||||||
cfiles = glob(os.path.join(implementation.path(), '*.c'))
|
cfiles = implementation.cfiles()
|
||||||
common_files = glob(os.path.join('..', 'common', '*.c'))
|
common_files = glob(os.path.join('..', 'common', '*.c'))
|
||||||
helpers.run_subprocess(['clang-tidy',
|
(returncode, _) = helpers.run_subprocess(
|
||||||
'-quiet',
|
['clang-tidy',
|
||||||
'-header-filter=.*'] +
|
'-quiet',
|
||||||
additional_flags +
|
'-header-filter=.*',
|
||||||
[*cfiles,
|
*additional_flags,
|
||||||
*common_files,
|
*cfiles,
|
||||||
'--',
|
*common_files,
|
||||||
'-iquote', os.path.join('..', 'common'),
|
'--',
|
||||||
'-iquote', implementation.path(),
|
'-iquote', os.path.join('..', 'common'),
|
||||||
])
|
'-iquote', implementation.path()],
|
||||||
|
expected_returncode=None,
|
||||||
|
)
|
||||||
|
|
||||||
|
# Detect and gracefully avoid segfaults
|
||||||
|
if returncode == -11:
|
||||||
|
raise unittest.SkipTest("clang-tidy segfaulted")
|
||||||
|
else:
|
||||||
|
assert returncode == 0, "Clang-tidy returned %d" % returncode
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
Loading…
Reference in New Issue
Block a user