Modify handshake_patch such that app data is sent along with CCS/Finished.
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
index 8916a0b..63f1342 100644
--- a/ssl/s3_lib.c
+++ b/ssl/s3_lib.c
@@ -2551,9 +2551,22 @@
static int ssl3_read_internal(SSL *s, void *buf, int len, int peek)
{
- int ret;
+ int n,ret;
clear_sys_error();
+ if ((s->s3->flags & SSL3_FLAGS_POP_BUFFER) && (s->wbio == s->bbio))
+ {
+ /* Deal with an application that calls SSL_read() when handshake data
+ * is yet to be written.
+ */
+ if (BIO_wpending(s->wbio) > 0)
+ {
+ s->rwstate=SSL_WRITING;
+ n=BIO_flush(s->wbio);
+ if (n <= 0) return(n);
+ s->rwstate=SSL_NOTHING;
+ }
+ }
if (s->s3->renegotiate) ssl3_renegotiate_check(s);
s->s3->in_read_app_data=1;
ret=s->method->ssl_read_bytes(s,SSL3_RT_APPLICATION_DATA,buf,len,peek);