commit 156b597dbe5900635fd629fd95783917b7c964d8
parent 5c2e3db3b4be30bee0f2cd87361da19a9febf854
Author: Kévin Le Gouguec <kevin.legouguec@airbus.com>
Date: Mon, 3 Dec 2018 08:26:11 +0100
Documentation de l'implémentation de référence (reste)
- crypto_aead
- nist
- traces
Diffstat:
6 files changed, 88 insertions(+), 34 deletions(-)
diff --git a/Makefile b/Makefile
@@ -18,18 +18,13 @@ $(delegated)::
exit $$status
clean::
- - rm traces*.tgz
- rm -r results
-# To generate complete traces, apply this patch before running "make traces":
-# $ git apply traces.patch
-# To update this patch, add print statements, then run
-# $ git diff src > traces.patch
traces: traces-ae traces-tbc
traces-%: | results
@ echo "Collecting traces"
- @ ./collect-traces.sh $@
+ @ ./traces/collect-traces.sh $@
nist: | results
./nist/make-package.sh
diff --git a/README.md b/README.md
@@ -30,3 +30,57 @@ Also contains some support files:
- `debug.h`: helper functions to ease debugging and dump intermediate
values
+`crypto_aead`
+-------------
+
+Contains parameter-dependent code. There is one subfolder per member
+of the Lilliput-AE family, named according to NIST's requirements:
+
+> The second-level directory name is a lowercase version of the name
+> of the algorithm, including the version number and a family member
+> identifier (if multiple family members in submission). […] Dashes,
+> dots, slashes, and other punctuation marks are omitted; the
+> directory name consists solely of digits (0123456789) and lowercase
+> ASCII letters (acbdefghijklmnopqrstuvwxyz).
+
+
+The subfolders are thus named `lilliputae${mode}${keybits}v1`:
+
+- mode is either i (for ΘCB3) or ii (for SCT-2)
+- keybits is either 128, 192 or 256.
+
+Each subfolders contains:
+
+- a `ref` directory, containing parameter-dependent code for the
+ reference implementation and tests for these specific parameters
+- other directories with additional implementations, named `add_*`
+
+TODO: the tests for a given family member should be moved up alongside
+`ref` and `add_*` folders since they should apply to all
+implementations. Also, the "parameter-dependent" code has been reduced
+to a header with three constants; maybe the whole `crypto_aead` folder
+could be removed.
+
+`nist`
+------
+
+Contains code to
+
+- generate the directory structure required by NIST
+- compile each member of the Lilliput-AE family against NIST's
+ `genkat_aead.c`
+- generate test vectors
+- package code and test vectors together into `results/crypto_aead`
+
+The code can be run with `make nist`.
+
+`traces`
+--------
+
+Contains patches to add print statements for inputs, outputs and
+intermediate values. `make traces` will
+
+- apply the patches
+- run the trace programs
+- collect traces
+- revert the patches
diff --git a/collect-traces.sh b/collect-traces.sh
@@ -1,28 +0,0 @@
-#!/bin/bash
-
-set -eu
-
-trace_type=$1
-
-d=$(mktemp -d)
-
-git apply ${trace_type}.patch
-
-for makefile in $(find crypto_aead -name Makefile)
-do
- implem_dir=$(dirname ${makefile})
- make -C ${implem_dir} clean
-
- [[ ${implem_dir} =~ lilliputae(i|ii)([0-9]+)v ]]
-
- ae_type=${BASH_REMATCH[1]}
- keysize=${BASH_REMATCH[2]}
- make -C ${implem_dir} ${trace_type}-${keysize}-${ae_type}
- cp ${implem_dir}/results/traces*.txt ${d}
-done
-
-tar czf results/${trace_type}.tgz -C ${d} .
-
-rm -r ${d}
-
-git apply --reverse ${trace_type}.patch
diff --git a/traces/collect-traces.sh b/traces/collect-traces.sh
@@ -0,0 +1,33 @@
+#!/bin/bash
+
+set -eu
+
+trace_type=$1
+patch=traces/${trace_type}.patch
+
+# To update these patches:
+# - add the tracing code you need to the source files
+# - run "git diff src > traces/foo.patch"
+
+d=$(mktemp -d)
+
+git apply ${patch}
+
+for makefile in $(find crypto_aead -name Makefile)
+do
+ implem_dir=$(dirname ${makefile})
+ make -C ${implem_dir} clean
+
+ [[ ${implem_dir} =~ lilliputae(i|ii)([0-9]+)v ]]
+
+ ae_type=${BASH_REMATCH[1]}
+ keysize=${BASH_REMATCH[2]}
+ make -C ${implem_dir} ${trace_type}-${keysize}-${ae_type}
+ cp ${implem_dir}/results/traces*.txt ${d}
+done
+
+tar czf results/${trace_type}.tgz -C ${d} .
+
+rm -r ${d}
+
+git apply --reverse ${patch}
diff --git a/traces-ae.patch b/traces/traces-ae.patch
diff --git a/traces-tbc.patch b/traces/traces-tbc.patch