The attached patch uses warning/fatal constants instead of numbers with
comments for warning/alerts in d1_pkt.c and s3_pkt.c

---
Kurt Cancemi
https://www.x64architecture.com

>From 1b07f801c5eb1ef05c50575e800ebf16a6bd69fb Mon Sep 17 00:00:00 2001
From: Kurt Cancemi <[email protected]>
Date: Fri, 27 Feb 2015 22:05:56 -0500
Subject: [PATCH] Use warning/fatal constants instead of numbers with comments

---
 ssl/d1_pkt.c | 4 ++--
 ssl/s3_pkt.c | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/ssl/d1_pkt.c b/ssl/d1_pkt.c
index d66ecf5..b1d9156 100644
--- a/ssl/d1_pkt.c
+++ b/ssl/d1_pkt.c
@@ -1088,7 +1088,7 @@ int 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) {
             s->s3->warn_alert = alert_descr;
             if (alert_descr == SSL_AD_CLOSE_NOTIFY) {
 #ifndef OPENSSL_NO_SCTP
@@ -1137,7 +1137,7 @@ int dtls1_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
                 }
             }
 #endif
-        } else if (alert_level == 2) { /* fatal */
+        } else if (alert_level == SSL3_AL_FATAL) {
             char tmp[16];
 
             s->rwstate = SSL_NOTHING;
diff --git a/ssl/s3_pkt.c b/ssl/s3_pkt.c
index 11b1c55..935d96f 100644
--- a/ssl/s3_pkt.c
+++ b/ssl/s3_pkt.c
@@ -1447,7 +1447,7 @@ int ssl3_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) {
             s->s3->warn_alert = alert_descr;
             if (alert_descr == SSL_AD_CLOSE_NOTIFY) {
                 s->shutdown |= SSL_RECEIVED_SHUTDOWN;
@@ -1470,7 +1470,7 @@ int ssl3_read_bytes(SSL *s, int type, unsigned char *buf, int len, int peek)
             else if (alert_descr == SSL_AD_MISSING_SRP_USERNAME)
                 return (0);
 #endif
-        } else if (alert_level == 2) { /* fatal */
+        } else if (alert_level == SSL3_AL_FATAL) {
             char tmp[16];
 
             s->rwstate = SSL_NOTHING;
-- 
2.3.0

_______________________________________________
openssl-dev mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-dev

Reply via email to