diff options
author | Marc <34656315+MarcT512@users.noreply.github.com> | 2020-06-29 00:45:04 +0100 |
---|---|---|
committer | Dmitry Belyavskiy <beldmit@gmail.com> | 2020-08-27 13:11:12 +0300 |
commit | fcc3a5204c6daa0f0bbc1679ce1ce82fb767190d (patch) | |
tree | 568420a71fd5ba355c032152ae2e6ea6bc4272b0 /ssl | |
parent | 50c911b0c56cd9aac360f09610f9bcdd74037a22 (diff) |
apps: -msg flag enhancement 2/2
Reviewed-by: Shane Lontis <shane.lontis@oracle.com>
Reviewed-by: Dmitry Belyavskiy <beldmit@gmail.com>
(Merged from https://github.com/openssl/openssl/pull/12310)
Diffstat (limited to 'ssl')
-rw-r--r-- | ssl/record/rec_layer_s3.c | 4 | ||||
-rw-r--r-- | ssl/record/ssl3_record.c | 10 |
2 files changed, 9 insertions, 5 deletions
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 |