ocsp-stapling.test 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516
  1. #!/usr/bin/env bash
  2. # ocsp-stapling.test
  3. # Test requires HAVE_OCSP and HAVE_CERTIFICATE_STATUS_REQUEST
  4. # Note, this script makes connection(s) to the public Internet.
  5. SCRIPT_DIR="$(dirname "$0")"
  6. if [[ -z "${RETRIES_REMAINING-}" ]]; then
  7. export RETRIES_REMAINING=2
  8. fi
  9. if test "$WOLFSSL_EXTERNAL_TEST" == "0"; then
  10. echo 'skipping oscp-stapling.test because WOLFSSL_EXTERNAL_TEST is \
  11. defined to the value 0.'
  12. exit 77
  13. fi
  14. if ! ./examples/client/client -V | grep -q 3; then
  15. echo 'skipping ocsp-stapling.test because TLS1.2 is not available.' 1>&2
  16. exit 77
  17. fi
  18. if ./examples/client/client '-#' | fgrep -q -e ' -DWOLFSSL_SNIFFER '; then
  19. echo 'skipping oscp-stapling.test because WOLFSSL_SNIFFER defined.'
  20. exit 77
  21. fi
  22. if openssl s_server -help 2>&1 | fgrep -q -i ipv6 && nc -h 2>&1 | fgrep -q -i ipv6; then
  23. IPV6_SUPPORTED=yes
  24. else
  25. IPV6_SUPPORTED=no
  26. fi
  27. if ./examples/client/client '-#' | fgrep -q -e ' -DTEST_IPV6 '; then
  28. if [[ "$IPV6_SUPPORTED" == "no" ]]; then
  29. echo 'Skipping IPV6 test in environment lacking IPV6 support.'
  30. exit 77
  31. fi
  32. LOCALHOST='[::1]'
  33. LOCALHOST_FOR_NC='::1'
  34. V4V6=6
  35. V4V6_FLAG=-6
  36. else
  37. LOCALHOST='127.0.0.1'
  38. LOCALHOST_FOR_NC='127.0.0.1'
  39. if [[ "$IPV6_SUPPORTED" == "yes" ]]; then
  40. V4V6_FLAG=-4
  41. else
  42. V4V6_FLAG=
  43. fi
  44. V4V6=4
  45. fi
  46. PARENTDIR="$PWD"
  47. # create a unique workspace directory ending in PID for the script instance ($$)
  48. # to make this instance orthogonal to any others running, even on same repo.
  49. # TCP ports are also carefully formed below from the PID, to minimize conflicts.
  50. WORKSPACE="${PARENTDIR}/workspace.pid$$"
  51. mkdir "${WORKSPACE}" || exit $?
  52. cp -pR ${SCRIPT_DIR}/../certs "${WORKSPACE}"/ || exit $?
  53. cd "$WORKSPACE" || exit $?
  54. ln -s ../examples
  55. CERT_DIR="./certs/ocsp"
  56. ready_file="$WORKSPACE"/wolf_ocsp_s1_readyF$$
  57. ready_file2="$WORKSPACE"/wolf_ocsp_s1_readyF2$$
  58. printf '%s\n' "ready file: \"$ready_file\""
  59. test_cnf="ocsp_s1.cnf"
  60. wait_for_readyFile(){
  61. counter=0
  62. while [ ! -s "$1" -a "$counter" -lt 20 ]; do
  63. if [[ -n "${2-}" ]]; then
  64. if ! kill -0 $2 2>&-; then
  65. echo "pid $2 for port ${3-} exited before creating ready file. bailing..."
  66. exit 1
  67. fi
  68. fi
  69. echo -e "waiting for ready file..."
  70. sleep 0.1
  71. counter=$((counter+ 1))
  72. done
  73. if test -e "$1"; then
  74. echo -e "found ready file, starting client..."
  75. else
  76. echo -e "NO ready file at \"$1\" -- ending test..."
  77. exit 1
  78. fi
  79. }
  80. remove_single_rF(){
  81. if test -e "$1"; then
  82. printf '%s\n' "removing ready file: \"$1\""
  83. rm "$1"
  84. fi
  85. }
  86. #create a configure file for cert generation with the port 0 solution
  87. create_new_cnf() {
  88. printf '%s\n' "Random Port Selected: $1"
  89. printf '%s\n' "#" > $test_cnf
  90. printf '%s\n' "# openssl configuration file for OCSP certificates" >> $test_cnf
  91. printf '%s\n' "#" >> $test_cnf
  92. printf '%s\n' "" >> $test_cnf
  93. printf '%s\n' "# Extensions to add to a certificate request (intermediate1-ca)" >> $test_cnf
  94. printf '%s\n' "[ v3_req1 ]" >> $test_cnf
  95. printf '%s\n' "basicConstraints = CA:false" >> $test_cnf
  96. printf '%s\n' "subjectKeyIdentifier = hash" >> $test_cnf
  97. printf '%s\n' "authorityKeyIdentifier = keyid:always,issuer:always" >> $test_cnf
  98. printf '%s\n' "keyUsage = nonRepudiation, digitalSignature, keyEncipherment" >> $test_cnf
  99. printf '%s\n' "authorityInfoAccess = OCSP;URI:http://127.0.0.1:$1" >> $test_cnf
  100. printf '%s\n' "" >> $test_cnf
  101. printf '%s\n' "# Extensions to add to a certificate request (intermediate2-ca)" >> $test_cnf
  102. printf '%s\n' "[ v3_req2 ]" >> $test_cnf
  103. printf '%s\n' "basicConstraints = CA:false" >> $test_cnf
  104. printf '%s\n' "subjectKeyIdentifier = hash" >> $test_cnf
  105. printf '%s\n' "authorityKeyIdentifier = keyid:always,issuer:always" >> $test_cnf
  106. printf '%s\n' "keyUsage = nonRepudiation, digitalSignature, keyEncipherment" >> $test_cnf
  107. printf '%s\n' "authorityInfoAccess = OCSP;URI:http://127.0.0.1:22222" >> $test_cnf
  108. printf '%s\n' "" >> $test_cnf
  109. printf '%s\n' "# Extensions to add to a certificate request (intermediate3-ca)" >> $test_cnf
  110. printf '%s\n' "[ v3_req3 ]" >> $test_cnf
  111. printf '%s\n' "basicConstraints = CA:false" >> $test_cnf
  112. printf '%s\n' "subjectKeyIdentifier = hash" >> $test_cnf
  113. printf '%s\n' "authorityKeyIdentifier = keyid:always,issuer:always" >> $test_cnf
  114. printf '%s\n' "keyUsage = nonRepudiation, digitalSignature, keyEncipherment" >> $test_cnf
  115. printf '%s\n' "authorityInfoAccess = OCSP;URI:http://127.0.0.1:22223" >> $test_cnf
  116. printf '%s\n' "" >> $test_cnf
  117. printf '%s\n' "# Extensions for a typical CA" >> $test_cnf
  118. printf '%s\n' "[ v3_ca ]" >> $test_cnf
  119. printf '%s\n' "basicConstraints = CA:true" >> $test_cnf
  120. printf '%s\n' "subjectKeyIdentifier = hash" >> $test_cnf
  121. printf '%s\n' "authorityKeyIdentifier = keyid:always,issuer:always" >> $test_cnf
  122. printf '%s\n' "keyUsage = keyCertSign, cRLSign" >> $test_cnf
  123. printf '%s\n' "authorityInfoAccess = OCSP;URI:http://127.0.0.1:22220" >> $test_cnf
  124. printf '%s\n' "" >> $test_cnf
  125. printf '%s\n' "# OCSP extensions." >> $test_cnf
  126. printf '%s\n' "[ v3_ocsp ]" >> $test_cnf
  127. printf '%s\n' "basicConstraints = CA:false" >> $test_cnf
  128. printf '%s\n' "subjectKeyIdentifier = hash" >> $test_cnf
  129. printf '%s\n' "authorityKeyIdentifier = keyid:always,issuer:always" >> $test_cnf
  130. printf '%s\n' "extendedKeyUsage = OCSPSigning" >> $test_cnf
  131. mv $test_cnf $CERT_DIR/$test_cnf
  132. cd $CERT_DIR
  133. CURR_LOC="$PWD"
  134. printf '%s\n' "echo now in $CURR_LOC"
  135. ./renewcerts-for-test.sh $test_cnf
  136. cd "$WORKSPACE"
  137. }
  138. remove_ready_file() {
  139. if test -e "$ready_file"; then
  140. printf '%s\n' "removing ready file"
  141. rm "$ready_file"
  142. fi
  143. if test -e "$ready_file2"; then
  144. printf '%s\n' "removing ready file: \"$ready_file2\""
  145. rm "$ready_file2"
  146. fi
  147. }
  148. cleanup()
  149. {
  150. exit_status=$?
  151. for i in $(jobs -pr)
  152. do
  153. kill -s KILL "$i"
  154. done
  155. remove_ready_file
  156. rm $CERT_DIR/$test_cnf
  157. cd "$PARENTDIR" || return 1
  158. rm -r "$WORKSPACE" || return 1
  159. if [[ ("$exit_status" == 1) && ($RETRIES_REMAINING -gt 0) ]]; then
  160. echo "retrying..."
  161. RETRIES_REMAINING=$((RETRIES_REMAINING - 1))
  162. exec $0 "$@"
  163. fi
  164. }
  165. trap cleanup EXIT INT TERM HUP
  166. [ ! -x ./examples/client/client ] && echo -e "\n\nClient doesn't exist" && exit 1
  167. ./examples/client/client '-?' 2>&1 | grep -- 'Client not compiled in!'
  168. if [ $? -eq 0 ]; then
  169. exit 0
  170. fi
  171. # check if supported key size is large enough to handle 4096 bit RSA
  172. size="$(./examples/client/client '-?' | grep "Max RSA key")"
  173. size="${size//[^0-9]/}"
  174. if [ ! -z "$size" ]; then
  175. printf 'check on max key size of %d ...' $size
  176. if [ $size -lt 4096 ]; then
  177. printf '%s\n' "4096 bit RSA keys not supported"
  178. exit 0
  179. fi
  180. printf 'OK\n'
  181. fi
  182. # choose consecutive ports based on the PID, skipping any that are
  183. # already bound, to avoid the birthday problem in case other
  184. # instances are sharing this host.
  185. get_first_free_port() {
  186. local ret="$1"
  187. while :; do
  188. if [[ "$ret" -ge 65536 ]]; then
  189. ret=1024
  190. fi
  191. if ! nc -z $V4V6_FLAG $LOCALHOST_FOR_NC "$ret"; then
  192. break
  193. fi
  194. ret=$((ret+1))
  195. done
  196. echo "$ret"
  197. return 0
  198. }
  199. base_port=$((((($$ + $RETRIES_REMAINING) * 5) % (65536 - 2048)) + 1024))
  200. port1=$(get_first_free_port $base_port)
  201. port2=$(get_first_free_port $((port1 + 1)))
  202. port3=$(get_first_free_port $((port2 + 1)))
  203. # test interop fail case
  204. ready_file=$PWD/wolf_ocsp_readyF$$
  205. printf '%s\n' "ready file: \"$ready_file\""
  206. ./examples/server/server -b -p $port1 -o -R "$ready_file" &
  207. wolf_pid=$!
  208. wait_for_readyFile "$ready_file" $wolf_pid $port1
  209. if [ ! -f "$ready_file" ]; then
  210. printf '%s\n' "Failed to create ready file: \"$ready_file\""
  211. exit 1
  212. else
  213. # should fail if ocspstapling is also enabled
  214. OPENSSL_OUTPUT=$(echo "hi" | openssl s_client -status $V4V6_FLAG -legacy_renegotiation -connect "${LOCALHOST}:$port1" -cert ./certs/client-cert.pem -key ./certs/client-key.pem -CAfile ./certs/ocsp/root-ca-cert.pem 2>&1)
  215. OPENSSL_RESULT=$?
  216. echo "$OPENSSL_OUTPUT"
  217. fgrep -q 'self signed certificate in certificate chain' <<< "$OPENSSL_OUTPUT"
  218. FGREP1_RESULT=$?
  219. fgrep -q 'self-signed certificate in certificate chain' <<< "$OPENSSL_OUTPUT"
  220. FGREP2_RESULT=$?
  221. if [ $OPENSSL_RESULT -eq 0 -a $FGREP1_RESULT -ne 0 -a $FGREP2_RESULT -ne 0 ]; then
  222. printf '%s\n' "Expected verification error from s_client is missing."
  223. remove_single_rF "$ready_file"
  224. exit 1
  225. fi
  226. remove_single_rF "$ready_file"
  227. wait $wolf_pid
  228. if [ $? -ne 0 ]; then
  229. printf '%s\n' "wolfSSL server unexpected fail"
  230. exit 1
  231. fi
  232. fi
  233. # create a port to use with openssl ocsp responder
  234. ./examples/server/server -b -p $port2 -R "$ready_file" &
  235. wolf_pid2=$!
  236. wait_for_readyFile "$ready_file" $wolf_pid2 $port2
  237. if [ ! -f "$ready_file" ]; then
  238. printf '%s\n' "Failed to create ready file: \"$ready_file\""
  239. exit 1
  240. else
  241. printf '%s\n' "Random port selected: $port2"
  242. # Use client connection to shutdown the server cleanly
  243. ./examples/client/client -p $port2
  244. create_new_cnf $port2
  245. fi
  246. sleep 0.1
  247. # is our desired server there? - login.live.com doesn't answers PING
  248. #./scripts/ping.test $server 2
  249. # client test against the server
  250. server=login.live.com
  251. #ca=certs/external/baltimore-cybertrust-root.pem
  252. ca=./certs/external/ca_collection.pem
  253. if [[ "$V4V6" == "4" ]]; then
  254. ./examples/client/client -C -h $server -p 443 -A $ca -g -W 1
  255. RESULT=$?
  256. [ $RESULT -ne 0 ] && echo -e "\n\nClient connection failed" && exit 1
  257. else
  258. echo "Skipping OCSP test on $server (IPv6 test client)"
  259. fi
  260. # Test with example server
  261. ./examples/server/server '-?' 2>&1 | grep -- 'Server not compiled in!'
  262. if [ $? -eq 0 ]; then
  263. exit 0
  264. fi
  265. # setup ocsp responder
  266. # OLD: ./certs/ocsp/ocspd-intermediate1-ca-issued-certs.sh &
  267. # NEW: openssl isn't being cleaned up, invoke directly in script for cleanup
  268. # purposes!
  269. openssl ocsp -port $port2 -nmin 1 \
  270. -index certs/ocsp/index-intermediate1-ca-issued-certs.txt \
  271. -rsigner certs/ocsp/ocsp-responder-cert.pem \
  272. -rkey certs/ocsp/ocsp-responder-key.pem \
  273. -CA certs/ocsp/intermediate1-ca-cert.pem \
  274. "$@" &
  275. sleep 0.1
  276. # "jobs" is not portable for posix. Must use bash interpreter!
  277. [ $(jobs -r | wc -l) -ne 1 ] && \
  278. printf '\n\n%s\n' "Setup ocsp responder failed, skipping" && exit 0
  279. printf '%s\n\n' "------------- TEST CASE 1 SHOULD PASS ------------------------"
  280. # client test against our own server - GOOD CERT
  281. ./examples/server/server -c certs/ocsp/server1-cert.pem -R "$ready_file2" \
  282. -k certs/ocsp/server1-key.pem -p $port3 &
  283. wolf_pid3=$!
  284. wait_for_readyFile "$ready_file2" $wolf_pid3 $port3
  285. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -p $port3
  286. RESULT=$?
  287. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 1 failed" && exit 1
  288. printf '%s\n\n' "Test PASSED!"
  289. printf '%s\n\n' "------------- TEST CASE 2 SHOULD REVOKE ----------------------"
  290. # client test against our own server - REVOKED CERT
  291. remove_single_rF "$ready_file2"
  292. ./examples/server/server -c certs/ocsp/server2-cert.pem -R "$ready_file2" \
  293. -k certs/ocsp/server2-key.pem -p $port3 &
  294. wolf_pid3=$!
  295. wait_for_readyFile "$ready_file2" $wolf_pid3 $port3
  296. sleep 0.1
  297. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -p $port3
  298. RESULT=$?
  299. [ $RESULT -ne 1 ] && printf '\n\n%s\n' "Client connection 2 succeeded $RESULT" \
  300. && exit 1
  301. printf '%s\n\n' "Test successfully REVOKED!"
  302. if ./examples/client/client -V | grep -q 4; then
  303. printf '%s\n\n' "------------- TEST CASE 3 SHOULD PASS --------------------"
  304. # client test against our own server - GOOD CERT
  305. remove_single_rF "$ready_file2"
  306. ./examples/server/server -c certs/ocsp/server1-cert.pem -R "$ready_file2" \
  307. -k certs/ocsp/server1-key.pem -v 4 \
  308. -p $port3 &
  309. wolf_pid3=$!
  310. wait_for_readyFile "$ready_file2" $wolf_pid3 $port3
  311. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1 \
  312. -p $port3
  313. RESULT=$?
  314. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 3 failed" && exit 1
  315. printf '%s\n\n' "Test PASSED!"
  316. printf '%s\n\n' "------------- TEST CASE 4 SHOULD PASS --------------------"
  317. # client test against our own server, must staple - GOOD CERT
  318. remove_single_rF "$ready_file2"
  319. ./examples/server/server -c certs/ocsp/server1-cert.pem -R "$ready_file2" \
  320. -k certs/ocsp/server1-key.pem -v 4 \
  321. -p $port3 &
  322. wolf_pid3=$!
  323. wait_for_readyFile "$ready_file2" $wolf_pid3 $port3
  324. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1m -v 4 -F 1 \
  325. -p $port3
  326. RESULT=$?
  327. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 4 failed" && exit 1
  328. printf '%s\n\n' "Test PASSED!"
  329. printf '%s\n\n' "------------- TEST CASE 5 SHOULD REVOKE ------------------"
  330. # client test against our own server - REVOKED CERT
  331. remove_single_rF "$ready_file2"
  332. ./examples/server/server -c certs/ocsp/server2-cert.pem -R "$ready_file2" \
  333. -k certs/ocsp/server2-key.pem -v 4 \
  334. -p $port3 &
  335. wolf_pid3=$!
  336. wait_for_readyFile "$ready_file2" $wolf_pid3 $port3
  337. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -W 1 -v 4 -F 1 \
  338. -p $port3
  339. RESULT=$?
  340. [ $RESULT -ne 1 ] && \
  341. printf '\n\n%s\n' "Client connection 5 succeeded $RESULT" \
  342. && exit 1
  343. printf '%s\n\n' "Test successfully REVOKED!"
  344. else
  345. echo 'skipping TLS1.3 stapling tests.' 1>&2
  346. fi
  347. # DTLS 1.2 and 1.3 cases
  348. if ./examples/client/client -? 2>&1 | grep -q 'DTLSv1.2'; then
  349. printf '%s\n\n' "------------- TEST CASE DTLS-1 SHOULD PASS -------------------"
  350. # client test against our own server, must staple - GOOD CERT
  351. echo $ready_file2
  352. ./examples/server/server -c certs/ocsp/server1-cert.pem -R "$ready_file2" \
  353. -k certs/ocsp/server1-key.pem -u -v 3 \
  354. -p $port3 &
  355. wolf_pid3=$!
  356. sleep 0.2
  357. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -u -v 3 \
  358. -W 1 -p $port3
  359. RESULT=$?
  360. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 5 failed" && exit 1
  361. printf '%s\n\n' "Test PASSED!"
  362. fi
  363. if ./examples/client/client -? 2>&1 | grep -q 'DTLSv1.3'; then
  364. printf '%s\n\n' "------------- TEST CASE DTLS-2 SHOULD PASS -------------------"
  365. # client test against our own server, must staple - GOOD CERT
  366. ./examples/server/server -c certs/ocsp/server1-cert.pem -R "$ready_file2" \
  367. -k certs/ocsp/server1-key.pem -u -v 4 \
  368. -p $port3 &
  369. wolf_pid3=$!
  370. sleep 0.2
  371. ./examples/client/client -C -A certs/ocsp/root-ca-cert.pem -u -v 4 \
  372. -W 1 -p $port3
  373. RESULT=$?
  374. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 5 failed" && exit 1
  375. printf '%s\n\n' "Test PASSED!"
  376. fi
  377. # need a unique port since may run the same time as testsuite
  378. generate_port() {
  379. #-------------------------------------------------------------------------#
  380. # Generate a random port number
  381. #-------------------------------------------------------------------------#
  382. if [[ "$OSTYPE" == "linux"* ]]; then
  383. port=$(($(od -An -N2 /dev/urandom) % (65535-49512) + 49512))
  384. elif [[ "$OSTYPE" == "darwin"* ]]; then
  385. port=$(($(od -An -N2 /dev/random) % (65535-49512) + 49512))
  386. else
  387. echo "Unknown OS TYPE"
  388. exit 1
  389. fi
  390. }
  391. # Start OpenSSL server that has no OCSP responses to return
  392. generate_port
  393. openssl s_server $V4V6_FLAG -cert ./certs/server-cert.pem -key certs/server-key.pem -www -port $port &
  394. openssl_pid=$!
  395. MAX_TIMEOUT=10
  396. until nc -z localhost $port # Wait for openssl to be ready
  397. do
  398. sleep 0.05
  399. if [ "$MAX_TIMEOUT" == "0" ]; then
  400. break
  401. fi
  402. ((MAX_TIMEOUT--))
  403. done
  404. printf '%s\n\n' "------------- TEST CASE 6 SHOULD PASS ----------------------"
  405. # client asks for OCSP staple but doesn't fail when none returned
  406. ./examples/client/client -p $port -g -v 3 -W 1
  407. RESULT=$?
  408. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 6 failed" && exit 1
  409. printf '%s\n\n' "Test PASSED!"
  410. printf '%s\n\n' "------------- TEST CASE 7 SHOULD UNKNOWN -------------------"
  411. # client asks for OCSP staple but doesn't fail when none returned
  412. ./examples/client/client -p $port -g -v 3 -W 1m
  413. RESULT=$?
  414. [ $RESULT -ne 1 ] && printf '\n\n%s\n' "Client connection 7 succeeded $RESULT" \
  415. && exit 1
  416. printf '%s\n\n' "Test PASSED!"
  417. openssl ciphers -tls1_3
  418. openssl_tls13=$?
  419. ./examples/client/client -V | grep -q 4
  420. wolfssl_tls13=$?
  421. if [ "$openssl_tls13" = "0" -a "$wolfssl_tls13" = "0" ]; then
  422. printf '%s\n\n' "------------- TEST CASE 8 SHOULD PASS --------------------"
  423. # client asks for OCSP staple but doesn't fail when none returned
  424. ./examples/client/client -p $port -g -v 4 -W 1
  425. RESULT=$?
  426. [ $RESULT -ne 0 ] && printf '\n\n%s\n' "Client connection 8 failed" && exit 1
  427. printf '%s\n\n' "Test PASSED!"
  428. printf '%s\n\n' "------------- TEST CASE 9 SHOULD UNKNOWN -----------------"
  429. # client asks for OCSP staple but doesn't fail when none returned
  430. ./examples/client/client -p $port -g -v 4 -W 1m
  431. RESULT=$?
  432. [ $RESULT -ne 1 ] \
  433. && printf '\n\n%s\n' "Client connection 9 succeeded $RESULT" \
  434. && exit 1
  435. printf '%s\n\n' "Test PASSED!"
  436. else
  437. echo -n 'skipping TLS1.3 stapling interoperability test:' 1>&2
  438. if [ "$openssl_tls13" != "0" ]; then
  439. echo -n ' OpenSSL' 1>&2
  440. fi
  441. if [ "$wolfssl_tls13" != "0" ]; then
  442. if [ "$openssl_tls13" != "0" ]; then
  443. echo -n ' and' 1>&2
  444. fi
  445. echo -n ' wolfSSL' 1>&2
  446. fi
  447. echo -n ' missing TLS1.3 support.' 1>&2
  448. fi
  449. printf '%s\n\n' "------------------- TESTS COMPLETE ---------------------------"
  450. exit 0