aboutsummaryrefslogtreecommitdiffstats
path: root/ssl
diff options
context:
space:
mode:
authorMatt Caswell <matt@openssl.org>2015-11-04 11:20:50 +0000
committerMatt Caswell <matt@openssl.org>2015-12-10 12:47:49 +0000
commit50053969e39ae055d2aca7a6a8bf39a3e20c1931 (patch)
tree256f370b7d1edfe8434ff67e851038ef7da31a99 /ssl
parent01b5c1239b5d80bb50c17a3a8673bbfc183d25d4 (diff)
downloadopenssl-50053969e39ae055d2aca7a6a8bf39a3e20c1931.tar.gz
Ensure |rwstate| is set correctly on BIO_flush
A BIO_flush call in the DTLS code was not correctly setting the |rwstate| variable to SSL_WRITING. This means that SSL_get_error() will not return SSL_ERROR_WANT_WRITE in the event of an IO retry. Reviewed-by: Richard Levitte <levitte@openssl.org> (cherry picked from commit 67f60be8c9ae5ff3129fcd6238baf124385a41d8)
Diffstat (limited to 'ssl')
-rw-r--r--ssl/d1_both.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ssl/d1_both.c b/ssl/d1_both.c
index dc3f58a531..d1fc716d5c 100644
--- a/ssl/d1_both.c
+++ b/ssl/d1_both.c
@@ -295,6 +295,8 @@ int dtls1_do_write(SSL *s, int type)
blocksize = 0;
frag_off = 0;
+ s->rwstate = SSL_NOTHING;
+
/* s->init_num shouldn't ever be < 0...but just in case */
while (s->init_num > 0) {
if (type == SSL3_RT_HANDSHAKE && s->init_off != 0) {
@@ -343,8 +345,10 @@ int dtls1_do_write(SSL *s, int type)
* grr.. we could get an error if MTU picked was wrong
*/
ret = BIO_flush(SSL_get_wbio(s));
- if (ret <= 0)
+ if (ret <= 0) {
+ s->rwstate = SSL_WRITING;
return ret;
+ }
used_len = DTLS1_RT_HEADER_LENGTH + mac_size + blocksize;
if (s->d1->mtu > used_len + DTLS1_HM_HEADER_LENGTH) {
curr_mtu = s->d1->mtu - used_len;