summaryrefslogtreecommitdiff
path: root/test/check-implementation.sh
diff options
context:
space:
mode:
Diffstat (limited to 'test/check-implementation.sh')
-rwxr-xr-xtest/check-implementation.sh30
1 files changed, 22 insertions, 8 deletions
diff --git a/test/check-implementation.sh b/test/check-implementation.sh
index 4113637..5f46606 100755
--- a/test/check-implementation.sh
+++ b/test/check-implementation.sh
@@ -1,6 +1,7 @@
#!/bin/bash
set -eu
+shopt -s extglob
# Run NIST's genkat_aead.c against the reference implementation as
# well as another one, and compare vectors.
@@ -11,6 +12,24 @@ ROOT_DIR=${TEST_DIR}/..
implem=$1
+list-implementation-files ()
+{
+ local mode=$1
+ local key_length=$2
+ local src_dir=${ROOT_DIR}/src
+
+ # src/${implem} can contain arbitrary files; we need to copy
+ # everything save for the unused AE mode.
+
+ for f in ${src_dir}/${implem}/!(lilliput-i|lilliput-ii).[ch]
+ do
+ echo ${f}
+ done
+
+ echo ${src_dir}/${implem}/lilliput-${mode}.c
+ echo ${src_dir}/${mode}-${key_length}/parameters.h
+}
+
run-genkat ()
{
local tmp_dir=$1
@@ -32,21 +51,16 @@ run-genkat ()
tweakey.{c,h}
)
- mkdir -p ${genkat_dir} # "-p" to allow comparing ref against ref.
+ mkdir -p ${genkat_dir} # "-p" allows comparing ref against ref.
- local f
- for f in ${source_files[@]}
- do
- cp ${src_dir}/${implem}/${f} ${genkat_dir}
- done
+ list-implementation-files ${mode} ${keylen} | xargs cp -t ${genkat_dir}
- cp ${src_dir}/${mode}-${keylen}/parameters.h ${genkat_dir}
cp ${ROOT_DIR}/nist/{api.h,encrypt.c} ${genkat_dir}
cp ${ROOT_DIR}/nist/TestVectorGen/* ${genkat_dir}
local nist_flags=(-std=c99 -Wall -Wextra -Wshadow -fsanitize=address,undefined -O2)
- gcc ${nist_flags[@]} -Werror -I${genkat_dir} ${genkat_dir}/*.c -o ${genkat}
+ gcc ${nist_flags[@]} -I${genkat_dir} ${genkat_dir}/*.c -o ${genkat}
${genkat}
mv LWC_AEAD_KAT*.txt ${vectors_dir}/${mode}-${keylen}