[openssl] master update
beldmit at gmail.com
beldmit at gmail.com
Thu Aug 27 10:13:33 UTC 2020
The branch master has been updated
via fcc3a5204c6daa0f0bbc1679ce1ce82fb767190d (commit)
via 50c911b0c56cd9aac360f09610f9bcdd74037a22 (commit)
from 625679b6d79296e020bb0cad31d6ac24ad547a39 (commit)
- Log -----------------------------------------------------------------
commit fcc3a5204c6daa0f0bbc1679ce1ce82fb767190d
Author: Marc <34656315+MarcT512 at users.noreply.github.com>
Date: Mon Jun 29 00:45:04 2020 +0100
apps: -msg flag enhancement 2/2
Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12310)
commit 50c911b0c56cd9aac360f09610f9bcdd74037a22
Author: Marc <34656315+MarcT512 at users.noreply.github.com>
Date: Mon Jun 29 00:43:37 2020 +0100
apps: -msg flag enhancement 1/2
Reviewed-by: Shane Lontis <shane.lontis at oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit at gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12310)
-----------------------------------------------------------------------
Summary of changes:
apps/lib/s_cb.c | 31 +++++++++++++++++++++++++------
ssl/record/rec_layer_s3.c | 4 ++--
ssl/record/ssl3_record.c | 10 +++++++---
3 files changed, 34 insertions(+), 11 deletions(-)
diff --git a/apps/lib/s_cb.c b/apps/lib/s_cb.c
index c58f634609..0ae851d792 100644
--- a/apps/lib/s_cb.c
+++ b/apps/lib/s_cb.c
@@ -570,8 +570,8 @@ void msg_cb(int write_p, int version, int content_type, const void *buf,
{
BIO *bio = arg;
const char *str_write_p = write_p ? ">>>" : "<<<";
- const char *str_version = lookup(version, ssl_versions, "???");
- const char *str_content_type = "", *str_details1 = "", *str_details2 = "";
+ char tmpbuf[128];
+ const char *str_version, *str_content_type = "", *str_details1 = "", *str_details2 = "";
const unsigned char* bp = buf;
if (version == SSL3_VERSION ||
@@ -580,11 +580,14 @@ void msg_cb(int write_p, int version, int content_type, const void *buf,
version == TLS1_2_VERSION ||
version == TLS1_3_VERSION ||
version == DTLS1_VERSION || version == DTLS1_BAD_VER) {
+ str_version = lookup(version, ssl_versions, "???");
switch (content_type) {
- case 20:
+ case SSL3_RT_CHANGE_CIPHER_SPEC:
+ /* type 20 */
str_content_type = ", ChangeCipherSpec";
break;
- case 21:
+ case SSL3_RT_ALERT:
+ /* type 21 */
str_content_type = ", Alert";
str_details1 = ", ???";
if (len == 2) {
@@ -599,16 +602,32 @@ void msg_cb(int write_p, int version, int content_type, const void *buf,
str_details2 = lookup((int)bp[1], alert_types, " ???");
}
break;
- case 22:
+ case SSL3_RT_HANDSHAKE:
+ /* type 22 */
str_content_type = ", Handshake";
str_details1 = "???";
if (len > 0)
str_details1 = lookup((int)bp[0], handshakes, "???");
break;
- case 23:
+ case SSL3_RT_APPLICATION_DATA:
+ /* type 23 */
str_content_type = ", ApplicationData";
break;
+ case SSL3_RT_HEADER:
+ /* type 256 */
+ str_content_type = ", RecordHeader";
+ break;
+ case SSL3_RT_INNER_CONTENT_TYPE:
+ /* type 257 */
+ str_content_type = ", InnerContent";
+ break;
+ default:
+ BIO_snprintf(tmpbuf, sizeof(tmpbuf)-1, ", Unknown (content_type=%d)", content_type);
+ str_content_type = tmpbuf;
}
+ } else {
+ BIO_snprintf(tmpbuf, sizeof(tmpbuf)-1, "Not TLS data or unknown version (version=%d, content_type=%d)", version, content_type);
+ str_version = tmpbuf;
}
BIO_printf(bio, "%s %s%s [length %04lx]%s%s\n", str_write_p, str_version,
diff --git a/ssl/record/rec_layer_s3.c b/ssl/record/rec_layer_s3.c
index 1d9e803570..19483ef8c3 100644
--- a/ssl/record/rec_layer_s3.c
+++ b/ssl/record/rec_layer_s3.c
@@ -1107,14 +1107,14 @@ int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
if (s->msg_callback) {
recordstart = WPACKET_get_curr(thispkt) - len
- SSL3_RT_HEADER_LENGTH;
- s->msg_callback(1, 0, SSL3_RT_HEADER, recordstart,
+ s->msg_callback(1, thiswr->rec_version, SSL3_RT_HEADER, recordstart,
SSL3_RT_HEADER_LENGTH, s,
s->msg_callback_arg);
if (SSL_TREAT_AS_TLS13(s) && s->enc_write_ctx != NULL) {
unsigned char ctype = type;
- s->msg_callback(1, s->version, SSL3_RT_INNER_CONTENT_TYPE,
+ s->msg_callback(1, thiswr->rec_version, SSL3_RT_INNER_CONTENT_TYPE,
&ctype, 1, s, s->msg_callback_arg);
}
}
diff --git a/ssl/record/ssl3_record.c b/ssl/record/ssl3_record.c
index 80990e8296..27167ba92f 100644
--- a/ssl/record/ssl3_record.c
+++ b/ssl/record/ssl3_record.c
@@ -287,14 +287,14 @@ int ssl3_get_record(SSL *s)
}
} else {
/* SSLv3+ style record */
- if (s->msg_callback)
- s->msg_callback(0, 0, SSL3_RT_HEADER, p, 5, s,
- s->msg_callback_arg);
/* Pull apart the header into the SSL3_RECORD */
if (!PACKET_get_1(&pkt, &type)
|| !PACKET_get_net_2(&pkt, &version)
|| !PACKET_get_net_2_len(&pkt, &thisrr->length)) {
+ if (s->msg_callback)
+ s->msg_callback(0, 0, SSL3_RT_HEADER, p, 5, s,
+ s->msg_callback_arg);
SSLfatal(s, SSL_AD_DECODE_ERROR, SSL_F_SSL3_GET_RECORD,
ERR_R_INTERNAL_ERROR);
return -1;
@@ -302,6 +302,10 @@ int ssl3_get_record(SSL *s)
thisrr->type = type;
thisrr->rec_version = version;
+ if (s->msg_callback)
+ s->msg_callback(0, version, SSL3_RT_HEADER, p, 5, s,
+ s->msg_callback_arg);
+
/*
* Lets check version. In TLSv1.3 we only check this field
* when encryption is occurring (see later check). For the
More information about the openssl-commits
mailing list