Skip to content

Commit 018212d

Browse files
author
jsing
committed
We have defines for alert levels - use them instead of magic numbers.
1 parent 6a00056 commit 018212d

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/lib/libssl/d1_pkt.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: d1_pkt.c,v 1.104 2021/07/26 03:17:38 jsing Exp $ */
1+
/* $OpenBSD: d1_pkt.c,v 1.105 2021/07/31 09:31:04 jsing Exp $ */
22
/*
33
* DTLS implementation written by Nagendra Modadugu
44
* (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)
786786
cb(s, SSL_CB_READ_ALERT, j);
787787
}
788788

789-
if (alert_level == 1) /* warning */
790-
{
789+
if (alert_level == SSL3_AL_WARNING) {
791790
S3I(s)->warn_alert = alert_descr;
792791
if (alert_descr == SSL_AD_CLOSE_NOTIFY) {
793792
s->internal->shutdown |= SSL_RECEIVED_SHUTDOWN;
794793
return (0);
795794
}
796-
} else if (alert_level == 2) /* fatal */
797-
{
795+
} else if (alert_level == SSL3_AL_FATAL) {
798796
s->internal->rwstate = SSL_NOTHING;
799797
S3I(s)->fatal_alert = alert_descr;
800798
SSLerror(s, SSL_AD_REASON_OFFSET + alert_descr);

src/lib/libssl/ssl_pkt.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $OpenBSD: ssl_pkt.c,v 1.46 2021/07/26 03:17:38 jsing Exp $ */
1+
/* $OpenBSD: ssl_pkt.c,v 1.47 2021/07/31 09:31:04 jsing Exp $ */
22
/* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com)
33
* All rights reserved.
44
*
@@ -1204,7 +1204,7 @@ int
12041204
ssl3_send_alert(SSL *s, int level, int desc)
12051205
{
12061206
/* If a fatal one, remove from cache */
1207-
if ((level == 2) && (s->session != NULL))
1207+
if ((level == SSL3_AL_FATAL) && (s->session != NULL))
12081208
SSL_CTX_remove_session(s->ctx, s->session);
12091209

12101210
S3I(s)->alert_dispatch = 1;

0 commit comments

Comments
 (0)