diff options
Diffstat (limited to 'test/check-implementation.sh')
| -rwxr-xr-x | test/check-implementation.sh | 28 |
1 files changed, 21 insertions, 7 deletions
diff --git a/test/check-implementation.sh b/test/check-implementation.sh index 0750d1b..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,15 +51,10 @@ 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} |
