diff options
author | jsing <> | 2022-09-10 15:37:13 +0000 |
---|---|---|
committer | jsing <> | 2022-09-10 15:37:13 +0000 |
commit | b9b7e24dd08d9f1c9b144d42e8f56eacfefeb36b (patch) | |
tree | a4fef62ea484fe919484f443ae886cb2b9a6bdee | |
parent | 212aacd76080ec12b9b4f04d5c72dc835aad01dd (diff) | |
download | openbsd-b9b7e24dd08d9f1c9b144d42e8f56eacfefeb36b.tar.gz openbsd-b9b7e24dd08d9f1c9b144d42e8f56eacfefeb36b.tar.bz2 openbsd-b9b7e24dd08d9f1c9b144d42e8f56eacfefeb36b.zip |
Use CBS to parse TLS alerts in the legacy stack.
ok tb@
-rw-r--r-- | src/lib/libssl/ssl_pkt.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/lib/libssl/ssl_pkt.c b/src/lib/libssl/ssl_pkt.c index 3dd0269540..4ec22f7d53 100644 --- a/src/lib/libssl/ssl_pkt.c +++ b/src/lib/libssl/ssl_pkt.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: ssl_pkt.c,v 1.58 2022/03/26 15:05:53 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_pkt.c,v 1.59 2022/09/10 15:37:13 jsing Exp $ */ |
2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
3 | * All rights reserved. | 3 | * All rights reserved. |
4 | * | 4 | * |
@@ -690,6 +690,7 @@ ssl3_read_alert(SSL *s) | |||
690 | { | 690 | { |
691 | SSL3_RECORD_INTERNAL *rr = &s->s3->rrec; | 691 | SSL3_RECORD_INTERNAL *rr = &s->s3->rrec; |
692 | uint8_t alert_level, alert_descr; | 692 | uint8_t alert_level, alert_descr; |
693 | CBS cbs; | ||
693 | 694 | ||
694 | /* | 695 | /* |
695 | * TLSv1.2 permits an alert to be fragmented across multiple records or | 696 | * TLSv1.2 permits an alert to be fragmented across multiple records or |
@@ -713,10 +714,15 @@ ssl3_read_alert(SSL *s) | |||
713 | return 1; | 714 | return 1; |
714 | } | 715 | } |
715 | 716 | ||
716 | ssl_msg_callback(s, 0, SSL3_RT_ALERT, s->s3->alert_fragment, 2); | 717 | CBS_init(&cbs, s->s3->alert_fragment, sizeof(s->s3->alert_fragment)); |
718 | |||
719 | ssl_msg_callback_cbs(s, 0, SSL3_RT_ALERT, &cbs); | ||
720 | |||
721 | if (!CBS_get_u8(&cbs, &alert_level)) | ||
722 | return -1; | ||
723 | if (!CBS_get_u8(&cbs, &alert_descr)) | ||
724 | return -1; | ||
717 | 725 | ||
718 | alert_level = s->s3->alert_fragment[0]; | ||
719 | alert_descr = s->s3->alert_fragment[1]; | ||
720 | s->s3->alert_fragment_len = 0; | 726 | s->s3->alert_fragment_len = 0; |
721 | 727 | ||
722 | ssl_info_callback(s, SSL_CB_READ_ALERT, | 728 | ssl_info_callback(s, SSL_CB_READ_ALERT, |