summaryrefslogtreecommitdiffstats
path: root/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h
diff options
context:
space:
mode:
authorTimur Pocheptsov <timur.pocheptsov@qt.io>2020-04-13 20:31:34 +0200
committerTimur Pocheptsov <timur.pocheptsov@qt.io>2020-04-16 11:26:04 +0200
commit8ddffc6ba4f38bb8dbeb0cf61b6b10ee73505bbb (patch)
treed370a49ed40eec55f680b35e8b493e0ab1c56fac /src/network/ssl/qsslsocket_opensslpre11_symbols_p.h
parentc034089fa697e6dc22f04b3209768a9dc1abcb9c (diff)
OpenSSL: handle SSL_shutdown's errors properly
Do not call SSL_shutdown on a session that is in handshake state (SSL_in_init(s) returns 1). Also, do not call SSL_shutdown if a session encountered a fatal error (SSL_ERROR_SYSCALL or SSL_ERROR_SSL was found before). If SSL_shutdown was unsuccessful (returned code != 1), we have to clear the error(s) it queued. Unfortunately, SSL_in_init was a macro in OpenSSL 1.0.x. We have to resolve SSL_state to implement SSL_in_init. Fixes: QTBUG-83450 Change-Id: I6326119f4e79605429263045ac20605c30dccca3 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 8907635da59c2ae0e8db01f27b24a841b830e655)
Diffstat (limited to 'src/network/ssl/qsslsocket_opensslpre11_symbols_p.h')
-rw-r--r--src/network/ssl/qsslsocket_opensslpre11_symbols_p.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h b/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h
index f5626d5d16..9284101779 100644
--- a/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h
+++ b/src/network/ssl/qsslsocket_opensslpre11_symbols_p.h
@@ -121,6 +121,8 @@ SSL_CTX *q_SSL_CTX_new(const SSL_METHOD *a);
int q_SSL_library_init();
void q_SSL_load_error_strings();
+int q_SSL_state(const SSL *a);
+#define q_SSL_in_init(a) (q_SSL_state(a) & SSL_ST_INIT)
#if OPENSSL_VERSION_NUMBER >= 0x10001000L
int q_SSL_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);