diff options
| author | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-13 18:03:10 +0100 |
|---|---|---|
| committer | Kévin Le Gouguec <kevin.legouguec@airbus.com> | 2019-03-13 18:03:10 +0100 |
| commit | 2bebfc0d0b77f586f77107d37cd6157e36f4420d (patch) | |
| tree | a5debe3e580cb2175deba12fdd5e74b49d854910 /test/check-implementation.sh | |
| parent | ea7f29bb49ef3312c0bc22a3db2186c20162e09e (diff) | |
| parent | 590327c8d81e42079c1fb215512ff5f306d33ab0 (diff) | |
| download | lilliput-ae-implem-2bebfc0d0b77f586f77107d37cd6157e36f4420d.tar.xz | |
Merge branch 'implem-ti'
Diffstat (limited to 'test/check-implementation.sh')
| -rwxr-xr-x | test/check-implementation.sh | 30 |
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} |
