#!/bin/sh
. $(dirname $0)/../test_library

start() {
  ../../src/stunnel -fd 0 <<EOT
  debug = debug
  syslog = no
  pid = ${result_path}/stunnel.pid
  output = ${result_path}/stunnel.log

  [client]
  client = yes
  accept = 127.0.0.1:${http1}
  connect = 127.0.0.1:${https1}
  PSKsecrets = ../certs/psk2.txt

  [server]
  accept = 127.0.0.1:${https1}
  connect = 127.0.0.1:${http_nc}
  ciphers = PSK
  PSKsecrets = ../certs/secrets.txt
EOT
}

if grep -q "OpenSSL 1" "results.log"
  then
    test_log_for "114_failure_PSK_secrets" "failure" "0" "$1" "$2" "$3" 2>> "stderr.log"
    exit $?
  else
    exit_logs "114_failure_PSK_secrets" "skipped" "error"
    exit 125
  fi
