[Openvpn-devel] tests: remove dependency on base64

Message ID E1hGico-0000de-16@sfs-ml-4.v29.lw.sourceforge.com
State Superseded
Headers show
Series [Openvpn-devel] tests: remove dependency on base64 | expand

Commit Message

Steffan Karger April 17, 2019, 1 a.m. UTC
From: Steffan Karger <steffan.karger@fox-it.com>

Triggered by the report from Ilya, that if base64 is missing, the tests
would still report success:

  Testing tls-crypt-v2 key generation (max length metadata)..../t_lpback.sh: base64: not found
  OK
  PASS: t_lpback.sh

The easiest way to fix that, is to remove the dependency on base64 (which
is it's current form wouldn't work on OSX anyway, because their base64
doesn't understand "-w0").

Signed-off-by: Steffan Karger <steffan.karger@fox-it.com>
---
 tests/t_lpback.sh | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

Comments

Arne Schwabe May 7, 2019, 1:04 a.m. UTC | #1
Am 17.04.19 um 13:00 schrieb Steffan Karger:
> From: Steffan Karger <steffan.karger@fox-it.com>
> 
> Triggered by the report from Ilya, that if base64 is missing, the tests
> would still report success:
> 
>   Testing tls-crypt-v2 key generation (max length metadata)..../t_lpback.sh: base64: not found
>   OK
>   PASS: t_lpback.sh
> 
> The easiest way to fix that, is to remove the dependency on base64 (which
> is it's current form wouldn't work on OSX anyway, because their base64
> doesn't understand "-w0").


OS X base64 understands -b0 which is the same as w0. But for example
FreeBSD does not have base64 at all, so I agree with this change.

openssl base64 -A  might also be an alternative but that "breaks" mbed
TLS build.

ACK on the basis that is actually improves things until Gert comes along
with a super obscure UNIX without seq.

Acked-By: Arne Schwabe <arne@rfc2549.org>
Gert Doering May 7, 2019, 1:20 a.m. UTC | #2
Hi,

On Tue, May 07, 2019 at 01:04:44PM +0200, Arne Schwabe wrote:
> ACK on the basis that is actually improves things until Gert comes along
> with a super obscure UNIX without seq.

Like, OpenBSD?

AIX and OpenSolaris do have seq :-)

gert

Patch

diff --git a/tests/t_lpback.sh b/tests/t_lpback.sh
index fb43211d..dd6c34e5 100755
--- a/tests/t_lpback.sh
+++ b/tests/t_lpback.sh
@@ -77,10 +77,15 @@  else
     echo "OK"
 fi
 
+# Generate max-length base64 metadata ('A' is 0b000000 in base64)
+METADATA=""
+for i in $(seq 1 732); do
+    METADATA="${METADATA}A"
+done
 echo -n "Testing tls-crypt-v2 key generation (max length metadata)..."
 "${top_builddir}/src/openvpn/openvpn" --tls-crypt-v2 tc-server-key.$$ \
-    --tls-crypt-v2-genkey client tc-client-key.$$ \
-    $(head -c732 /dev/zero | base64 -w0) >log.$$ 2>&1
+    --tls-crypt-v2-genkey client tc-client-key.$$ "${METADATA}" \
+    >log.$$ 2>&1
 if [ $? != 0 ] ; then
     echo "FAILED"
     cat log.$$