From e7a8fecd0b1138b156bee71d92372abda956f1a8 Mon Sep 17 00:00:00 2001 From: Benjamin Kaduk Date: Mon, 26 Oct 2020 12:20:31 -0700 Subject: Add more diagnostics to ossl_shim We had several cases where the connection failed but we did not have an error message to differentiate which failure condition had been triggered. Add some more messages to help clarify what is going wrong. [extended tests] Reviewed-by: Tomas Mraz Reviewed-by: Matt Caswell (Merged from https://github.com/openssl/openssl/pull/13251) --- test/ossl_shim/ossl_shim.cc | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/test/ossl_shim/ossl_shim.cc b/test/ossl_shim/ossl_shim.cc index 1d32073f84..380e6853c6 100644 --- a/test/ossl_shim/ossl_shim.cc +++ b/test/ossl_shim/ossl_shim.cc @@ -1085,6 +1085,7 @@ static bool DoExchange(bssl::UniquePtr *out_session, } while (config->async && RetryAsync(ssl.get(), ret)); if (ret != 1 || !CheckHandshakeProperties(ssl.get(), is_resume)) { + fprintf(stderr, "resumption check failed\n"); return false; } @@ -1105,6 +1106,7 @@ static bool DoExchange(bssl::UniquePtr *out_session, return false; } if (WriteAll(ssl.get(), result.data(), result.size()) < 0) { + fprintf(stderr, "writing exported key material failed\n"); return false; } } @@ -1135,6 +1137,7 @@ static bool DoExchange(bssl::UniquePtr *out_session, if (config->shim_writes_first) { if (WriteAll(ssl.get(), reinterpret_cast("hello"), 5) < 0) { + fprintf(stderr, "shim_writes_first write failed\n"); return false; } } @@ -1160,6 +1163,7 @@ static bool DoExchange(bssl::UniquePtr *out_session, fprintf(stderr, "Invalid SSL_get_error output\n"); return false; } + fprintf(stderr, "Unexpected entry in error queue\n"); return false; } // Successfully read data. @@ -1179,6 +1183,7 @@ static bool DoExchange(bssl::UniquePtr *out_session, buf[i] ^= 0xff; } if (WriteAll(ssl.get(), buf.get(), n) < 0) { + fprintf(stderr, "write of inverted bitstream failed\n"); return false; } } -- cgit v1.2.3