-/* $OpenBSD: d1_pkt.c,v 1.113 2021/10/23 13:36:03 jsing Exp $ */
+/* $OpenBSD: d1_pkt.c,v 1.114 2021/10/25 10:09:28 jsing Exp $ */
/*
* DTLS implementation written by Nagendra Modadugu
* (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
* Application data while renegotiating is allowed.
* Try reading again.
*/
- BIO *bio;
-
S3I(s)->in_read_app_data = 2;
- bio = SSL_get_rbio(s);
- s->internal->rwstate = SSL_READING;
- BIO_clear_retry_flags(bio);
- BIO_set_retry_read(bio);
- return (-1);
+ ssl_force_want_read(s);
+ return -1;
} else {
/* Not certain if this is the right error handling */
al = SSL_AD_UNEXPECTED_MESSAGE;
}
if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) {
- if (S3I(s)->rbuf.left == 0) /* no read-ahead left? */
- {
- BIO *bio;
- /* In the case where we try to read application data,
- * but we trigger an SSL handshake, we return -1 with
- * the retry option set. Otherwise renegotiation may
- * cause nasty problems in the blocking world */
- s->internal->rwstate = SSL_READING;
- bio = SSL_get_rbio(s);
- BIO_clear_retry_flags(bio);
- BIO_set_retry_read(bio);
+ if (S3I(s)->rbuf.left == 0) {
+ ssl_force_want_read(s);
return (-1);
}
}
}
if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) {
- if (S3I(s)->rbuf.left == 0) /* no read-ahead left? */
- {
- BIO *bio;
- /* In the case where we try to read application data,
- * but we trigger an SSL handshake, we return -1 with
- * the retry option set. Otherwise renegotiation may
- * cause nasty problems in the blocking world */
- s->internal->rwstate = SSL_READING;
- bio = SSL_get_rbio(s);
- BIO_clear_retry_flags(bio);
- BIO_set_retry_read(bio);
+ if (S3I(s)->rbuf.left == 0) {
+ ssl_force_want_read(s);
return (-1);
}
}
-/* $OpenBSD: ssl_locl.h,v 1.367 2021/10/25 10:01:46 jsing Exp $ */
+/* $OpenBSD: ssl_locl.h,v 1.368 2021/10/25 10:09:28 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
int ssl3_renegotiate_check(SSL *ssl);
+void ssl_force_want_read(SSL *s);
+
int ssl3_dispatch_alert(SSL *s);
int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek);
int ssl3_write_bytes(SSL *s, int type, const void *buf, int len);
-/* $OpenBSD: ssl_pkt.c,v 1.50 2021/08/30 19:25:43 jsing Exp $ */
+/* $OpenBSD: ssl_pkt.c,v 1.51 2021/10/25 10:09:28 jsing Exp $ */
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
* All rights reserved.
*
* Force a WANT_READ return for certain error conditions where
* we don't want to spin internally.
*/
-static void
+void
ssl_force_want_read(SSL *s)
{
- BIO * bio;
+ BIO *bio;
bio = SSL_get_rbio(s);
BIO_clear_retry_flags(bio);
BIO_set_retry_read(bio);
+
s->internal->rwstate = SSL_READING;
}
if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) {
if (S3I(s)->rbuf.left == 0) {
- /* no read-ahead left? */
- /* In the case where we try to read application data,
- * but we trigger an SSL handshake, we return -1 with
- * the retry option set. Otherwise renegotiation may
- * cause nasty problems in the blocking world */
ssl_force_want_read(s);
return (-1);
}
}
if (!(s->internal->mode & SSL_MODE_AUTO_RETRY)) {
- if (S3I(s)->rbuf.left == 0) { /* no read-ahead left? */
- /* In the case where we try to read application data,
- * but we trigger an SSL handshake, we return -1 with
- * the retry option set. Otherwise renegotiation may
- * cause nasty problems in the blocking world */
+ if (S3I(s)->rbuf.left == 0) {
ssl_force_want_read(s);
return (-1);
}