aboutsummaryrefslogtreecommitdiff
path: root/envelope/testsuite.sh
diff options
context:
space:
mode:
Diffstat (limited to 'envelope/testsuite.sh')
-rwxr-xr-xenvelope/testsuite.sh30
1 files changed, 30 insertions, 0 deletions
diff --git a/envelope/testsuite.sh b/envelope/testsuite.sh
new file mode 100755
index 0000000..f713cda
--- /dev/null
+++ b/envelope/testsuite.sh
@@ -0,0 +1,30 @@
+#!/usr/bin/env bash
+
+make -C ..
+make
+
+set -o pipefail
+
+function dotest() {
+ len="$1"
+ keylen="$2"
+ printf "\x1B[31;1mlen=$len keylen=$keylen\x1B[0m\n"
+ fname=".input.testsuite"
+ head -c "$len" </dev/urandom >"$fname"
+ keys="$(./envelope -k "$keylen")"
+ pubkey="$(echo "$keys" | head -1 | tr -d $'\n')"
+ privkey="$(echo "$keys" | tail -1 | tr -d $'\n')"
+ if ! diff "$fname" <(./envelope -e "$pubkey" <"$fname" | ./envelope -d "$privkey"); then
+ printf "\x1B[31;1m -- ERROR --\x1B[0m\n"
+ echo "pubkey = $pubkey"
+ echo "privkey = $privkey"
+ echo "data = $(base64 <"$fname")"
+ exit 1
+ fi
+}
+
+for keylen in 512 1024 2048; do
+ for len in 1 10 15 16 17 12345; do
+ dotest "$len" "$keylen"
+ done
+done