summaryrefslogtreecommitdiff
path: root/nist/make-package.sh
diff options
context:
space:
mode:
Diffstat (limited to 'nist/make-package.sh')
-rwxr-xr-xnist/make-package.sh39
1 files changed, 25 insertions, 14 deletions
diff --git a/nist/make-package.sh b/nist/make-package.sh
index 77c4057..124da4b 100755
--- a/nist/make-package.sh
+++ b/nist/make-package.sh
@@ -1,6 +1,7 @@
#!/bin/bash
set -Eeu
+shopt -s extglob
# Generate NIST's expected tree:
#
@@ -34,6 +35,25 @@ cleanup ()
trap cleanup ERR
+list-implementation-files ()
+{
+ local mode=$1
+ local key_length=$2
+ local implem=$3
+
+ # src/${implem} can contain arbitrary files; we need to copy
+ # everything save for the unused AE mode.
+
+ local f
+ for f in ${ROOT}/src/${implem}/!(lilliput-i|lilliput-ii).[ch]
+ do
+ echo ${f}
+ done
+
+ echo ${ROOT}/src/${implem}/lilliput-${mode}.c
+ echo ${ROOT}/src/${mode}-${key_length}/parameters.h
+}
+
add-variant ()
{
mode=$1
@@ -43,29 +63,20 @@ add-variant ()
mkdir -p ${dest}
- source_files=(
- cipher.{c,h}
- constants.h
- lilliput-ae{.h,-utils.h}
- lilliput-${mode}.c
- tweakey.{c,h}
- )
-
implementations=(
ref
+ add_threshold
add_tweakeyloop
)
for implem in ${implementations[@]}
do
mkdir ${dest}/${implem}
- cp ${ROOT}/src/${mode}-${key_length}/parameters.h ${dest}/${implem}
- cp ${NIST_DIR}/{api.h,encrypt.c} ${dest}/${implem}
- for f in ${source_files[@]}
- do
- cp ${ROOT}/src/${implem}/${f} ${dest}/${implem}
- done
+ list-implementation-files ${mode} ${key_length} ${implem} |
+ xargs cp -t ${dest}/${implem}
+
+ cp ${NIST_DIR}/{api.h,encrypt.c} ${dest}/${implem}
done
}