Fix nightly qtesla failure on gcc5 (#573)

This commit is contained in:
Christian Paquin 2019-12-16 12:01:39 -05:00 committed by xvzcf
parent b4b262281c
commit d68bacfa58
2 changed files with 4 additions and 3 deletions

View File

@ -140,7 +140,7 @@ def available_use_options_by_name():
with open(os.path.join('include', 'oqs', 'oqsconfig.h')) as fh:
for line in fh:
if line.startswith("#define USE_") and line.endswith("1\n"):
option_name = line.split(' ')[1][len("USE_"):-1]
option_name = line.split(' ')[1][len("USE_"):]
enabled_use_options.append(option_name)
return enabled_use_options

View File

@ -28,10 +28,11 @@ def test_sig(sig_name):
)
output = output.replace("\r\n", "\n")
kats = []
avx2_aes_enabled = helpers.is_use_option_enabled_by_name('AVX2_INSTRUCTIONS') and helpers.is_use_option_enabled_by_name('AES_INSTRUCTIONS')
for filename in os.listdir(os.path.join('tests', 'KATs', 'sig')):
if filename.startswith(sig_name + '.') and filename.endswith('.kat'):
# qtesla's avx2 implementation uses an optimized sampling method that results in different KAT values; we use the correct one
if not sig_name.startswith('qTesla') or not (bool(helpers.is_use_option_enabled_by_name('AVX2_INSTRUCTION')) ^ bool('avx2' in filename)):
# qtesla's avx2 implementation uses an optimized sampling method that results in different KAT values; we use the correct one (if avx2/aes instructions are available)
if not (sig_name.startswith('qTesla')) or any([avx2_aes_enabled and 'avx2' in filename, not avx2_aes_enabled and not 'avx2' in filename]):
with open(os.path.join('tests', 'KATs', 'sig', filename), 'r') as myfile:
kats.append(myfile.read())
assert(output in kats)