summaryrefslogtreecommitdiff
path: root/src/lib/libssl/d1_pkt.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libssl/d1_pkt.c')
-rw-r--r--src/lib/libssl/d1_pkt.c29
1 files changed, 8 insertions, 21 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c
index 4f0678f0b8..f99b8ff371 100644
--- a/src/lib/libssl/d1_pkt.c
+++ b/src/lib/libssl/d1_pkt.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: d1_pkt.c,v 1.106 2021/08/30 19:12:25 jsing Exp $ */ 1/* $OpenBSD: d1_pkt.c,v 1.107 2021/08/30 19:25:43 jsing Exp $ */
2/* 2/*
3 * DTLS implementation written by Nagendra Modadugu 3 * DTLS implementation written by Nagendra Modadugu
4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. 4 * (nagendra@cs.stanford.edu) for the OpenSSL project 2005.
@@ -515,10 +515,9 @@ dtls1_get_record(SSL *s)
515int 515int
516dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) 516dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
517{ 517{
518 int al, i, j, ret; 518 int al, i, ret;
519 unsigned int n; 519 unsigned int n;
520 SSL3_RECORD_INTERNAL *rr; 520 SSL3_RECORD_INTERNAL *rr;
521 void (*cb)(const SSL *ssl, int type2, int val) = NULL;
522 521
523 if (S3I(s)->rbuf.buf == NULL) /* Not initialized yet */ 522 if (S3I(s)->rbuf.buf == NULL) /* Not initialized yet */
524 if (!ssl3_setup_buffers(s)) 523 if (!ssl3_setup_buffers(s))
@@ -727,9 +726,8 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
727 726
728 /* no need to check sequence number on HELLO REQUEST messages */ 727 /* no need to check sequence number on HELLO REQUEST messages */
729 728
730 if (s->internal->msg_callback) 729 ssl_msg_callback(s, 0, SSL3_RT_HANDSHAKE,
731 s->internal->msg_callback(0, s->version, SSL3_RT_HANDSHAKE, 730 D1I(s)->handshake_fragment, 4);
732 D1I(s)->handshake_fragment, 4, s, s->internal->msg_callback_arg);
733 731
734 if (SSL_is_init_finished(s) && 732 if (SSL_is_init_finished(s) &&
735 !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) && 733 !(s->s3->flags & SSL3_FLAGS_NO_RENEGOTIATE_CIPHERS) &&
@@ -774,19 +772,10 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
774 772
775 D1I(s)->alert_fragment_len = 0; 773 D1I(s)->alert_fragment_len = 0;
776 774
777 if (s->internal->msg_callback) 775 ssl_msg_callback(s, 0, SSL3_RT_ALERT, D1I(s)->alert_fragment, 2);
778 s->internal->msg_callback(0, s->version, SSL3_RT_ALERT,
779 D1I(s)->alert_fragment, 2, s, s->internal->msg_callback_arg);
780 776
781 if (s->internal->info_callback != NULL) 777 ssl_info_callback(s, SSL_CB_READ_ALERT,
782 cb = s->internal->info_callback; 778 (alert_level << 8) | alert_descr);
783 else if (s->ctx->internal->info_callback != NULL)
784 cb = s->ctx->internal->info_callback;
785
786 if (cb != NULL) {
787 j = (alert_level << 8) | alert_descr;
788 cb(s, SSL_CB_READ_ALERT, j);
789 }
790 779
791 if (alert_level == SSL3_AL_WARNING) { 780 if (alert_level == SSL3_AL_WARNING) {
792 S3I(s)->warn_alert = alert_descr; 781 S3I(s)->warn_alert = alert_descr;
@@ -832,9 +821,7 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
832 821
833 rr->length = 0; 822 rr->length = 0;
834 823
835 if (s->internal->msg_callback) 824 ssl_msg_callback(s, 0, SSL3_RT_CHANGE_CIPHER_SPEC, rr->data, 1);
836 s->internal->msg_callback(0, s->version, SSL3_RT_CHANGE_CIPHER_SPEC,
837 rr->data, 1, s, s->internal->msg_callback_arg);
838 825
839 /* We can't process a CCS now, because previous handshake 826 /* We can't process a CCS now, because previous handshake
840 * messages are still missing, so just drop it. 827 * messages are still missing, so just drop it.