]> git.ipfire.org Git - thirdparty/openssl.git/commitdiff
Add more diagnostics to ossl_shim
authorBenjamin Kaduk <bkaduk@akamai.com>
Mon, 26 Oct 2020 19:20:31 +0000 (12:20 -0700)
committerBenjamin Kaduk <bkaduk@akamai.com>
Mon, 2 Nov 2020 19:28:24 +0000 (11:28 -0800)
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 <tmraz@fedoraproject.org>
Reviewed-by: Matt Caswell <matt@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/13251)

test/ossl_shim/ossl_shim.cc

index 1d32073f8432d8f92ed78f260f6b5cd84287b5ef..380e6853c642da0a1786bbf1f3166809b22dfd44 100644 (file)
@@ -1085,6 +1085,7 @@ static bool DoExchange(bssl::UniquePtr<SSL_SESSION> *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<SSL_SESSION> *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<SSL_SESSION> *out_session,
     if (config->shim_writes_first) {
       if (WriteAll(ssl.get(), reinterpret_cast<const uint8_t *>("hello"),
                    5) < 0) {
+        fprintf(stderr, "shim_writes_first write failed\n");
         return false;
       }
     }
@@ -1160,6 +1163,7 @@ static bool DoExchange(bssl::UniquePtr<SSL_SESSION> *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<SSL_SESSION> *out_session,
           buf[i] ^= 0xff;
         }
         if (WriteAll(ssl.get(), buf.get(), n) < 0) {
+          fprintf(stderr, "write of inverted bitstream failed\n");
           return false;
         }
       }