Blob Blame History Raw
diff -up openssl-1.0.2k/ssl/d1_pkt.c.padding-oracle openssl-1.0.2k/ssl/d1_pkt.c
--- openssl-1.0.2k/ssl/d1_pkt.c.padding-oracle	2017-01-26 14:22:04.000000000 +0100
+++ openssl-1.0.2k/ssl/d1_pkt.c	2019-04-05 10:39:08.574409987 +0200
@@ -1290,6 +1290,7 @@ int dtls1_read_bytes(SSL *s, int type, u
             ERR_add_error_data(2, "SSL alert number ", tmp);
             s->shutdown |= SSL_RECEIVED_SHUTDOWN;
             SSL_CTX_remove_session(s->session_ctx, s->session);
+            s->state = SSL_ST_ERR;
             return (0);
         } else {
             al = SSL_AD_ILLEGAL_PARAMETER;
diff -up openssl-1.0.2k/ssl/s3_pkt.c.padding-oracle openssl-1.0.2k/ssl/s3_pkt.c
--- openssl-1.0.2k/ssl/s3_pkt.c.padding-oracle	2017-01-26 14:22:04.000000000 +0100
+++ openssl-1.0.2k/ssl/s3_pkt.c	2019-04-05 10:40:35.838894197 +0200
@@ -1495,6 +1495,7 @@ int ssl3_read_bytes(SSL *s, int type, un
             ERR_add_error_data(2, "SSL alert number ", tmp);
             s->shutdown |= SSL_RECEIVED_SHUTDOWN;
             SSL_CTX_remove_session(s->session_ctx, s->session);
+            s->state = SSL_ST_ERR;
             return (0);
         } else {
             al = SSL_AD_ILLEGAL_PARAMETER;
@@ -1714,9 +1715,12 @@ int ssl3_send_alert(SSL *s, int level, i
                                           * protocol_version alerts */
     if (desc < 0)
         return -1;
-    /* If a fatal one, remove from cache */
-    if ((level == 2) && (s->session != NULL))
-        SSL_CTX_remove_session(s->session_ctx, s->session);
+    /* If a fatal one, remove from cache and go into the error state */
+    if (level == SSL3_AL_FATAL) {
+        if (s->session != NULL)
+            SSL_CTX_remove_session(s->session_ctx, s->session);
+        s->state = SSL_ST_ERR;
+    }
 
     s->s3->alert_dispatch = 1;
     s->s3->send_alert[0] = level;