From 403cfce4177cab791e29209f63f665d7170c20e3 Mon Sep 17 00:00:00 2001 From: Peter Wu Date: Fri, 6 Dec 2013 00:06:35 +0100 Subject: openssl-{connect,listen}: fix usage, reduce output The CLIENT_RANDOM is applicable to clients only, so remove it from ServerHello. Also update notes with cmake+gcrypt instructions. --- notes.txt | 3 +++ openssl-connect | 8 +++++--- openssl-listen | 18 +++++++++--------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/notes.txt b/notes.txt index 68c527d..9e4d70f 100644 --- a/notes.txt +++ b/notes.txt @@ -6,12 +6,15 @@ cmake -DCMAKE_INSTALL_PREFIX=/tmp/wsroot -DENABLE_GTK3=0 -DENABLE_PORTAUDIO=0 -D # http://lists.gnupg.org/pipermail/gcrypt-devel/2013-October/002428.html) # Fix compile issue (missing fig2dev in doc, Makefile.in in tests is not # generated (Makefile/autotools of the repo too old?)) +sed '/^tests\/Makefile$/d' -i configure.ac && sed '/SUBDIRS/s/ doc tests//' -i Makefile.am && ./autogen.sh mkdir build && cd build ../configure --disable-static --disable-padlock-support --prefix=/tmp/libgcrypt/prefix make install # for libgcrypt-config test in wireshark ./configure PATH=/tmp/libgcrypt/prefix/bin:$PATH +# for cmake add: +-DGCRYPT_INCLUDE_DIR=/tmp/libgcrypt/prefix/include -DGCRYPT_LIBRARY=/tmp/libgcrypt/prefix/lib/libgcrypt.so # Build cyassl for AES-CCM testing patch -p1 < cyassl-Implement-SSLKEYLOGFILE-support-for-ClientRandom.patch diff --git a/openssl-connect b/openssl-connect index 4a977f7..23ebc47 100755 --- a/openssl-connect +++ b/openssl-connect @@ -2,16 +2,18 @@ # Connects to a SSL host for a list of ciphers # Author: Peter Wu +# Usage: $0 [host [portbase]] [openssl options] +# Defaults for host and portbase are shown below: host=localhost portbase=4430 PSK=12345678 PSK=0102030405060708091011121314151617181920 # assume that openssl options always start with - -if [[ $1 != -* ]]; then +if [ -n "$1" ] && [[ $1 != -* ]]; then host=$1; shift fi -if [[ $1 != -* ]]; then +if [ -n "$1" ] && [[ $1 != -* ]]; then portbase=$1; shift if ! [[ $portbase -gt 0 ]] || ! [[ $portbase -le 65535 ]]; then echo "Port must be between 1 and 65535" >&2 @@ -44,7 +46,7 @@ s_client_client_random() { } # Match TLS 1.2 Random bytes (over three lines) - / ClientHello|ServerHello$/{version=3;l=3;s=""} + / ClientHello/{version=3;l=3;s=""} # Match SSLv2 Challenge / CLIENT-HELLO$/{version=2;l=4;s=""} diff --git a/openssl-listen b/openssl-listen index 3919c40..c6c1025 100755 --- a/openssl-listen +++ b/openssl-listen @@ -15,15 +15,6 @@ PSK=0102030405060708091011121314151617181920 pkdir=$1; shift portbase=4430 -# assume that openssl options always start with - -if [[ $1 != -* ]]; then - portbase=$1; shift - if ! [[ $portbase -gt 0 ]] || ! [[ $portbase -le 65535 ]]; then - echo "Port must be between 1 and 65535" >&2 - exit 1 - fi -fi - if [ -z "$pkdir" ]; then cat <&2 + exit 1 + fi +fi + [[ $pkdir == */ ]] || pkdir+=/ if ! mkdir -p "$pkdir"; then -- cgit v1.2.1