summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjsing <>2021-06-15 19:09:03 +0000
committerjsing <>2021-06-15 19:09:03 +0000
commit01cb4f1997a7e75f5de7a76da42ef7d98f97e964 (patch)
tree7d2257c79d6cc0db2a8758cdf8bc4b629d10aaca
parenteb169b8d33525f2c68a82e98b035a3ca5650ba28 (diff)
downloadopenbsd-01cb4f1997a7e75f5de7a76da42ef7d98f97e964.tar.gz
openbsd-01cb4f1997a7e75f5de7a76da42ef7d98f97e964.tar.bz2
openbsd-01cb4f1997a7e75f5de7a76da42ef7d98f97e964.zip
Mop up part of dtls1_dispatch_alert().
The original DTLS code had some strange alert handling code (basically one type of alert included extra data) - a few years later this was "fixed", however the rest of the code was left as is. This means that rather than sending the alert data from send_alert (like ssl3_dispatch_alert() does), we have a local buffer on the stack, which we memset, copy the send_alert bytes into, then send from. ok inoguchi@ tb@
-rw-r--r--src/lib/libssl/d1_pkt.c11
1 files changed, 2 insertions, 9 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c
index 504044d8af..11735f0d2c 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.97 2021/06/11 11:13:53 jsing Exp $ */ 1/* $OpenBSD: d1_pkt.c,v 1.98 2021/06/15 19:09:03 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.
@@ -1160,19 +1160,12 @@ dtls1_dispatch_alert(SSL *s)
1160{ 1160{
1161 int i, j; 1161 int i, j;
1162 void (*cb)(const SSL *ssl, int type, int val) = NULL; 1162 void (*cb)(const SSL *ssl, int type, int val) = NULL;
1163 unsigned char buf[DTLS1_AL_HEADER_LENGTH];
1164 unsigned char *ptr = &buf[0];
1165 1163
1166 S3I(s)->alert_dispatch = 0; 1164 S3I(s)->alert_dispatch = 0;
1167 1165
1168 memset(buf, 0, sizeof(buf)); 1166 i = do_dtls1_write(s, SSL3_RT_ALERT, &S3I(s)->send_alert[0], 2);
1169 *ptr++ = S3I(s)->send_alert[0];
1170 *ptr++ = S3I(s)->send_alert[1];
1171
1172 i = do_dtls1_write(s, SSL3_RT_ALERT, &buf[0], sizeof(buf));
1173 if (i <= 0) { 1167 if (i <= 0) {
1174 S3I(s)->alert_dispatch = 1; 1168 S3I(s)->alert_dispatch = 1;
1175 /* fprintf( stderr, "not done with alert\n" ); */
1176 } else { 1169 } else {
1177 if (S3I(s)->send_alert[0] == SSL3_AL_FATAL) 1170 if (S3I(s)->send_alert[0] == SSL3_AL_FATAL)
1178 (void)BIO_flush(s->wbio); 1171 (void)BIO_flush(s->wbio);