summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorDr. Stephen Henson <steve@openssl.org>2011-12-31 23:00:36 +0000
committerDr. Stephen Henson <steve@openssl.org>2011-12-31 23:00:36 +0000
commitbd6941cfaa31ee8a3f8661cb98227a5cbcc0f9f3 (patch)
tree218fef78d2db96f5eb399893de2f44f448c58a84 /apps
parent578519edd0d0a810a11bfb7baede0f7b99c7d92b (diff)
PR: 2658
Submitted by: Robin Seggelmann <seggelmann@fh-muenster.de> Reviewed by: steve Support for TLS/DTLS heartbeats.
Diffstat (limited to 'apps')
-rw-r--r--apps/s_cb.c20
-rw-r--r--apps/s_client.c8
-rw-r--r--apps/s_server.c10
3 files changed, 38 insertions, 0 deletions
diff --git a/apps/s_cb.c b/apps/s_cb.c
index 7eafe72653..8a9461b364 100644
--- a/apps/s_cb.c
+++ b/apps/s_cb.c
@@ -600,6 +600,26 @@ void MS_CALLBACK msg_cb(int write_p, int version, int content_type, const void *
}
}
}
+
+#ifndef OPENSSL_NO_HEARTBEATS
+ if (content_type == 24) /* Heartbeat */
+ {
+ str_details1 = ", Heartbeat";
+
+ if (len > 0)
+ {
+ switch (((const unsigned char*)buf)[0])
+ {
+ case 1:
+ str_details1 = ", HeartbeatRequest";
+ break;
+ case 2:
+ str_details1 = ", HeartbeatResponse";
+ break;
+ }
+ }
+ }
+#endif
}
BIO_printf(bio, "%s %s%s [length %04lx]%s%s\n", str_write_p, str_version, str_content_type, (unsigned long)len, str_details1, str_details2);
diff --git a/apps/s_client.c b/apps/s_client.c
index b72e505fb1..b0702ce6fe 100644
--- a/apps/s_client.c
+++ b/apps/s_client.c
@@ -1862,6 +1862,14 @@ printf("read=%d pending=%d peek=%d\n",k,SSL_pending(con),SSL_peek(con,zbuf,10240
SSL_renegotiate(con);
cbuf_len=0;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ else if ((!c_ign_eof) && (cbuf[0] == 'B'))
+ {
+ BIO_printf(bio_err,"HEARTBEATING\n");
+ SSL_heartbeat(con);
+ cbuf_len=0;
+ }
+#endif
else
{
cbuf_len=i;
diff --git a/apps/s_server.c b/apps/s_server.c
index 2c02fc7d0c..950ab67610 100644
--- a/apps/s_server.c
+++ b/apps/s_server.c
@@ -2192,6 +2192,16 @@ static int sv_body(char *hostname, int s, unsigned char *context)
goto err;
}
+#ifndef OPENSSL_NO_HEARTBEATS
+ if ((buf[0] == 'B') &&
+ ((buf[1] == '\n') || (buf[1] == '\r')))
+ {
+ BIO_printf(bio_err,"HEARTBEATING\n");
+ SSL_heartbeat(con);
+ i=0;
+ continue;
+ }
+#endif
if ((buf[0] == 'r') &&
((buf[1] == '\n') || (buf[1] == '\r')))
{