server/tests.at: Add roundtrip test for the crypto transforms.
authorMark Wooding <mdw@distorted.org.uk>
Sun, 22 Sep 2019 13:46:53 +0000 (14:46 +0100)
committerMark Wooding <mdw@distorted.org.uk>
Sun, 22 Sep 2019 14:00:41 +0000 (15:00 +0100)
This should avoid future débâcles like the one we had this time.

server/tests.at

index 3fd2e47..eb2e561 100644 (file)
@@ -39,6 +39,9 @@ m4_define([TRIPE],
 m4_define([TRIPECTL], [$abs_top_builddir/client/tripectl -d. -aadmin])
 m4_define([USLIP], [$abs_top_builddir/uslip/tripe-uslip])
 m4_define([MITM], [$abs_top_builddir/proxy/tripe-mitm])
+m4_define([BULKTEST],
+  [$abs_top_builddir/server/tripe-test \
+     ${TRIPE_TEST_TRACEOPTS+-T$TRIPE_TEST_TRACEOPTS}])
 
 ## WITH_STRACE(tag, cmd)
 ##
@@ -806,4 +809,32 @@ WITH_2TRIPES([alice], [bob], [-nslip], [-talice], [-tbob], [
 
 AT_CLEANUP
 
+###--------------------------------------------------------------------------
+### Key-exchange ad bulk crypto round trip.
+
+AT_SETUP([server roundtrip])
+AT_KEYWORDS([roundtrip])
+
+while read label genalg paramalg spec; do
+  paramopts=${spec%--*} attrs=${spec#*--}
+  key -kkeyring.$label add -a$paramalg -eforever $paramopts -tparam tripe-param $attrs
+  key -kkeyring.$label add -a$genalg -pparam -eforever -talice tripe
+  key -kkeyring.$label extract -f-secret keyring.$label-pub
+  { sh -c "echo $$"; date; } >msg
+  AT_CHECK([BULKTEST -kkeyring.$label -talice \
+    ies-encrypt 99 "$(cat msg)nl"], [0], [stdout], [stderr])
+  cp msg expout; mv stdout ct
+  AT_CHECK([BULKTEST -kkeyring.$label -talice \
+    ies-decrypt 99 "$(cat ct)"], [0], [expout], [stderr])
+done <<EOF
+vanilla dh dh-param -Ccatacomb-ll-256-3072 --
+suite-b ec ec-param -Cnist-p256 -- kx-group=ec bulk=iiv cipher=rijndael-counter hash=sha256
+djb x25519 empty -- kx-group=x25519 bulk=naclbox cipher=salsa20
+fancy x448 empty -- kx-group=x448 bulk=aead cipher=chacha20-poly1305 hash=shake256 mgf=shake256-xof
+weird x25519 empty -- kx-group=x25519 bulk=aead cipher=blowfish-ocb3 hash=sha256 tagsz=48
+terrible ec ec-param -Csecp112r1 -- kx-group=ec bulk=aead cipher=des-ccm mac=aead/16
+EOF
+
+AT_CLEANUP
+
 ###----- That's all, folks --------------------------------------------------