From: jsing Date: Sat, 31 Jul 2021 09:31:04 +0000 (+0000) Subject: We have defines for alert levels - use them instead of magic numbers. X-Git-Url: http://artulab.com/gitweb/?a=commitdiff_plain;h=9b9a30eef8647df3bea6e7988cbd60c188866959;p=openbsd We have defines for alert levels - use them instead of magic numbers. --- diff --git a/lib/libssl/d1_pkt.c b/lib/libssl/d1_pkt.c index acd66e622cc..6963e58ed35 100644 --- a/lib/libssl/d1_pkt.c +++ b/lib/libssl/d1_pkt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: d1_pkt.c,v 1.104 2021/07/26 03:17:38 jsing Exp $ */ +/* $OpenBSD: d1_pkt.c,v 1.105 2021/07/31 09:31:04 jsing Exp $ */ /* * DTLS implementation written by Nagendra Modadugu * (nagendra@cs.stanford.edu) for the OpenSSL project 2005. @@ -786,15 +786,13 @@ dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek) cb(s, SSL_CB_READ_ALERT, j); } - if (alert_level == 1) /* warning */ - { + if (alert_level == SSL3_AL_WARNING) { S3I(s)->warn_alert = alert_descr; if (alert_descr == SSL_AD_CLOSE_NOTIFY) { s->internal->shutdown |= SSL_RECEIVED_SHUTDOWN; return (0); } - } else if (alert_level == 2) /* fatal */ - { + } else if (alert_level == SSL3_AL_FATAL) { s->internal->rwstate = SSL_NOTHING; S3I(s)->fatal_alert = alert_descr; SSLerror(s, SSL_AD_REASON_OFFSET + alert_descr); diff --git a/lib/libssl/ssl_pkt.c b/lib/libssl/ssl_pkt.c index c3fd4a73652..2b1a6a41a2b 100644 --- a/lib/libssl/ssl_pkt.c +++ b/lib/libssl/ssl_pkt.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_pkt.c,v 1.46 2021/07/26 03:17:38 jsing Exp $ */ +/* $OpenBSD: ssl_pkt.c,v 1.47 2021/07/31 09:31:04 jsing Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -1204,7 +1204,7 @@ int ssl3_send_alert(SSL *s, int level, int desc) { /* If a fatal one, remove from cache */ - if ((level == 2) && (s->session != NULL)) + if ((level == SSL3_AL_FATAL) && (s->session != NULL)) SSL_CTX_remove_session(s->ctx, s->session); S3I(s)->alert_dispatch = 1;