Blame SOURCES/openssl-1.1.1-reneg-no-extms.patch

7d1228
diff -up openssl-1.1.1g/include/openssl/ssl3.h.reneg-no-extms openssl-1.1.1g/include/openssl/ssl3.h
7d1228
--- openssl-1.1.1g/include/openssl/ssl3.h.reneg-no-extms	2020-04-21 14:22:39.000000000 +0200
7d1228
+++ openssl-1.1.1g/include/openssl/ssl3.h	2020-06-05 15:20:22.090682776 +0200
7d1228
@@ -292,6 +292,9 @@ extern "C" {
7d1228
 
7d1228
 # define TLS1_FLAGS_STATELESS                    0x0800
7d1228
 
7d1228
+/* Set if extended master secret extension required on renegotiation */
7d1228
+# define TLS1_FLAGS_REQUIRED_EXTMS               0x1000
7d1228
+
7d1228
 # define SSL3_MT_HELLO_REQUEST                   0
7d1228
 # define SSL3_MT_CLIENT_HELLO                    1
7d1228
 # define SSL3_MT_SERVER_HELLO                    2
7d1228
diff -up openssl-1.1.1g/ssl/statem/extensions.c.reneg-no-extms openssl-1.1.1g/ssl/statem/extensions.c
7d1228
--- openssl-1.1.1g/ssl/statem/extensions.c.reneg-no-extms	2020-04-21 14:22:39.000000000 +0200
7d1228
+++ openssl-1.1.1g/ssl/statem/extensions.c	2020-06-05 15:22:19.677653437 +0200
7d1228
@@ -1168,14 +1168,26 @@ static int init_etm(SSL *s, unsigned int
7d1228
 
7d1228
 static int init_ems(SSL *s, unsigned int context)
7d1228
 {
7d1228
-    if (!s->server)
7d1228
+    if (s->s3->flags & TLS1_FLAGS_RECEIVED_EXTMS) {
7d1228
         s->s3->flags &= ~TLS1_FLAGS_RECEIVED_EXTMS;
7d1228
+        s->s3->flags |= TLS1_FLAGS_REQUIRED_EXTMS;
7d1228
+    }
7d1228
 
7d1228
     return 1;
7d1228
 }
7d1228
 
7d1228
 static int final_ems(SSL *s, unsigned int context, int sent)
7d1228
 {
7d1228
+    /*
7d1228
+     * Check extended master secret extension is not dropped on
7d1228
+     * renegotiation.
7d1228
+     */
7d1228
+    if (!(s->s3->flags & TLS1_FLAGS_RECEIVED_EXTMS)
7d1228
+        && (s->s3->flags & TLS1_FLAGS_REQUIRED_EXTMS)) {
7d1228
+        SSLfatal(s, SSL_AD_HANDSHAKE_FAILURE, SSL_F_FINAL_EMS,
7d1228
+                 SSL_R_INCONSISTENT_EXTMS);
7d1228
+        return 0;
7d1228
+    }
7d1228
     if (!s->server && s->hit) {
7d1228
         /*
7d1228
          * Check extended master secret extension is consistent with