diff options
author | Matt Caswell <matt@openssl.org> | 2015-09-16 22:54:54 +0100 |
---|---|---|
committer | Matt Caswell <matt@openssl.org> | 2015-11-20 23:33:46 +0000 |
commit | 64c07bd2d8fd162147a75ff885165bc31388bfa7 (patch) | |
tree | b10d1202eac35b05022092a3aaa78cff871699b6 /apps | |
parent | 0ff2b9ac0b8b9cd62e20cd65bf4922b34f57a8c1 (diff) |
Fix s_server bug
If an async event occurs during a renegotiation in SSL_read then s_server
was looping around, detecting we were in init and calling
init_ssl_connection instead of re-calling SSL_read.
Reviewed-by: Rich Salz <rsalz@openssl.org>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/s_server.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/apps/s_server.c b/apps/s_server.c index 6b6035f0ba..14dd8a69db 100644 --- a/apps/s_server.c +++ b/apps/s_server.c @@ -2152,7 +2152,8 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context) int read_from_sslcon; read_from_terminal = 0; - read_from_sslcon = SSL_pending(con); + read_from_sslcon = SSL_pending(con) + || (async && SSL_waiting_for_async(con)); if (!read_from_sslcon) { FD_ZERO(&readfds); @@ -2348,7 +2349,13 @@ static int sv_body(char *hostname, int s, int stype, unsigned char *context) } } if (read_from_sslcon) { - if (!SSL_is_init_finished(con)) { + /* + * init_ssl_connection handles all async events itself so if we're + * waiting for async then we shouldn't go back into + * init_ssl_connection + */ + if ((!async || !SSL_waiting_for_async(con)) + && !SSL_is_init_finished(con)) { i = init_ssl_connection(con); if (i < 0) { |