aboutsummaryrefslogtreecommitdiff
path: root/envelope
diff options
context:
space:
mode:
Diffstat (limited to 'envelope')
-rw-r--r--envelope/.gitignore1
-rw-r--r--envelope/Makefile7
-rwxr-xr-xenvelope/envelopebin116616 -> 116616 bytes
-rw-r--r--envelope/main.cpp1
-rwxr-xr-xenvelope/testsuite.sh30
5 files changed, 37 insertions, 2 deletions
diff --git a/envelope/.gitignore b/envelope/.gitignore
new file mode 100644
index 0000000..68a39b8
--- /dev/null
+++ b/envelope/.gitignore
@@ -0,0 +1 @@
+.input.testsuite
diff --git a/envelope/Makefile b/envelope/Makefile
index 06b0419..19e92ed 100644
--- a/envelope/Makefile
+++ b/envelope/Makefile
@@ -13,9 +13,12 @@ endif
BIN = envelope
-.PHONY: all clean remake
+.PHONY: all clean remake makelib
-all: $(BIN)
+makelib:
+ make -C ..
+
+all: makelib $(BIN)
clean:
rm -rf $(BIN) *.o *.dSYM
diff --git a/envelope/envelope b/envelope/envelope
index 50b479f..5582c01 100755
--- a/envelope/envelope
+++ b/envelope/envelope
Binary files differ
diff --git a/envelope/main.cpp b/envelope/main.cpp
index 49b41ff..f0e544e 100644
--- a/envelope/main.cpp
+++ b/envelope/main.cpp
@@ -1,5 +1,6 @@
#include <iostream>
#include <cstdlib>
+#include <cstring>
#include "../base64.h"
#include "../envelope.h"
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