diff options
| author | jsing <> | 2021-07-26 03:17:38 +0000 |
|---|---|---|
| committer | jsing <> | 2021-07-26 03:17:38 +0000 |
| commit | 907273055df37d9ecbdb81a886140a181c2352e8 (patch) | |
| tree | d5c4303283f0e876353ed068b657a28628fa0880 /src/lib/libssl/d1_pkt.c | |
| parent | 39d0a7dfa5d400dda05bac8c922031f22ae47944 (diff) | |
| download | openbsd-907273055df37d9ecbdb81a886140a181c2352e8.tar.gz openbsd-907273055df37d9ecbdb81a886140a181c2352e8.tar.bz2 openbsd-907273055df37d9ecbdb81a886140a181c2352e8.zip | |
Dedup dtls1_dispatch_alert()/ssl3_dispatch_alert().
The code for dtls1_dispatch_alert() and ssl3_dispatch_alert() is largely
identical - with a bit of reshuffling we can use ssl3_dispatch_alert() for
both protocols and remove the ssl_dispatch_alert function pointer.
ok inoguchi@ tb@
Diffstat (limited to 'src/lib/libssl/d1_pkt.c')
| -rw-r--r-- | src/lib/libssl/d1_pkt.c | 40 |
1 files changed, 2 insertions, 38 deletions
diff --git a/src/lib/libssl/d1_pkt.c b/src/lib/libssl/d1_pkt.c index 0416ee9c59..acd66e622c 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.103 2021/07/21 08:42:14 jsing Exp $ */ | 1 | /* $OpenBSD: d1_pkt.c,v 1.104 2021/07/26 03:17:38 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. |
| @@ -126,10 +126,6 @@ | |||
| 126 | #include "pqueue.h" | 126 | #include "pqueue.h" |
| 127 | #include "ssl_locl.h" | 127 | #include "ssl_locl.h" |
| 128 | 128 | ||
| 129 | static int do_dtls1_write(SSL *s, int type, const unsigned char *buf, | ||
| 130 | unsigned int len); | ||
| 131 | |||
| 132 | |||
| 133 | /* mod 128 saturating subtract of two 64-bit values in big-endian order */ | 129 | /* mod 128 saturating subtract of two 64-bit values in big-endian order */ |
| 134 | static int | 130 | static int |
| 135 | satsub64be(const unsigned char *v1, const unsigned char *v2) | 131 | satsub64be(const unsigned char *v1, const unsigned char *v2) |
| @@ -1057,7 +1053,7 @@ do_dtls1_write(SSL *s, int type, const unsigned char *buf, unsigned int len) | |||
| 1057 | 1053 | ||
| 1058 | /* If we have an alert to send, let's send it */ | 1054 | /* If we have an alert to send, let's send it */ |
| 1059 | if (S3I(s)->alert_dispatch) { | 1055 | if (S3I(s)->alert_dispatch) { |
| 1060 | if ((ret = s->method->ssl_dispatch_alert(s)) <= 0) | 1056 | if ((ret = ssl3_dispatch_alert(s)) <= 0) |
| 1061 | return (ret); | 1057 | return (ret); |
| 1062 | /* If it went, fall through and send more stuff. */ | 1058 | /* If it went, fall through and send more stuff. */ |
| 1063 | } | 1059 | } |
| @@ -1139,38 +1135,6 @@ dtls1_record_bitmap_update(SSL *s, DTLS1_BITMAP *bitmap, | |||
| 1139 | } | 1135 | } |
| 1140 | } | 1136 | } |
| 1141 | 1137 | ||
| 1142 | int | ||
| 1143 | dtls1_dispatch_alert(SSL *s) | ||
| 1144 | { | ||
| 1145 | int i, j; | ||
| 1146 | void (*cb)(const SSL *ssl, int type, int val) = NULL; | ||
| 1147 | |||
| 1148 | S3I(s)->alert_dispatch = 0; | ||
| 1149 | |||
| 1150 | i = do_dtls1_write(s, SSL3_RT_ALERT, &S3I(s)->send_alert[0], 2); | ||
| 1151 | if (i <= 0) { | ||
| 1152 | S3I(s)->alert_dispatch = 1; | ||
| 1153 | } else { | ||
| 1154 | if (S3I(s)->send_alert[0] == SSL3_AL_FATAL) | ||
| 1155 | (void)BIO_flush(s->wbio); | ||
| 1156 | |||
| 1157 | if (s->internal->msg_callback) | ||
| 1158 | s->internal->msg_callback(1, s->version, SSL3_RT_ALERT, | ||
| 1159 | S3I(s)->send_alert, 2, s, s->internal->msg_callback_arg); | ||
| 1160 | |||
| 1161 | if (s->internal->info_callback != NULL) | ||
| 1162 | cb = s->internal->info_callback; | ||
| 1163 | else if (s->ctx->internal->info_callback != NULL) | ||
| 1164 | cb = s->ctx->internal->info_callback; | ||
| 1165 | |||
| 1166 | if (cb != NULL) { | ||
| 1167 | j = (S3I(s)->send_alert[0]<<8)|S3I(s)->send_alert[1]; | ||
| 1168 | cb(s, SSL_CB_WRITE_ALERT, j); | ||
| 1169 | } | ||
| 1170 | } | ||
| 1171 | return (i); | ||
| 1172 | } | ||
| 1173 | |||
| 1174 | static DTLS1_BITMAP * | 1138 | static DTLS1_BITMAP * |
| 1175 | dtls1_get_bitmap(SSL *s, SSL3_RECORD_INTERNAL *rr, unsigned int *is_next_epoch) | 1139 | dtls1_get_bitmap(SSL *s, SSL3_RECORD_INTERNAL *rr, unsigned int *is_next_epoch) |
| 1176 | { | 1140 | { |
