summaryrefslogtreecommitdiff
path: root/ssl/ssl_lib.c
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2018-05-08 14:34:27 +0100
committerMatt Caswell <matt@openssl.org>2018-05-11 14:51:08 +0100
commit5fe371570770e46f2d9e19e8b81c8bc0d47ec0d6 (patch)
tree8c3fd71c4dfc6a8ee1553ea1d2fa5945e2a5d058 /ssl/ssl_lib.c
parente825109236f6795fbe24c0c6a489ef89ca05a906 (diff)
downloadopenssl-new-5fe371570770e46f2d9e19e8b81c8bc0d47ec0d6.tar.gz
Flush server side unauthenticated writes
When a server call SSL_write_early_data() to write to an unauthenticated client the buffering BIO is still in place, so we should ensure we flush the write. Reviewed-by: Viktor Dukhovni <viktor@openssl.org> (Merged from https://github.com/openssl/openssl/pull/6198)
Diffstat (limited to 'ssl/ssl_lib.c')
-rw-r--r--ssl/ssl_lib.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
index 3aefa34ab2..41574c4bf2 100644
--- a/ssl/ssl_lib.c
+++ b/ssl/ssl_lib.c
@@ -2023,6 +2023,9 @@ int SSL_write_early_data(SSL *s, const void *buf, size_t num, size_t *written)
/* We are a server writing to an unauthenticated client */
s->early_data_state = SSL_EARLY_DATA_UNAUTH_WRITING;
ret = SSL_write_ex(s, buf, num, written);
+ /* The buffering BIO is still in place */
+ if (ret)
+ (void)BIO_flush(s->wbio);
s->early_data_state = early_data_state;
return ret;