Don't change the state of the ETM flags until CCS processing
[openssl.git] / ssl / statem / extensions.c
index 99326b2b55f58710259fbc587fdc7a95e58f9632..8e1b502083f9627f7436ab0c0702a54ac42a35fa 100644 (file)
@@ -36,7 +36,9 @@ static int init_etm(SSL *s, unsigned int context);
 static int init_ems(SSL *s, unsigned int context);
 static int final_ems(SSL *s, unsigned int context, int sent, int *al);
 static int init_psk_kex_modes(SSL *s, unsigned int context);
+#ifndef OPENSSL_NO_EC
 static int final_key_share(SSL *s, unsigned int context, int sent, int *al);
+#endif
 #ifndef OPENSSL_NO_SRTP
 static int init_srtp(SSL *s, unsigned int context);
 #endif
@@ -205,7 +207,7 @@ static const EXTENSION_DEFINITION ext_defs[] = {
 #endif
     {
         TLSEXT_TYPE_encrypt_then_mac,
-        EXT_CLIENT_HELLO | EXT_TLS1_2_SERVER_HELLO | EXT_TLS1_2_AND_BELOW_ONLY,
+        EXT_CLIENT_HELLO | EXT_TLS1_2_SERVER_HELLO | EXT_TLS1_2_AND_BELOW_ONLY | EXT_SSL3_ALLOWED,
         init_etm, tls_parse_ctos_etm, tls_parse_stoc_etm,
         tls_construct_stoc_etm, tls_construct_ctos_etm, NULL
     },
@@ -244,6 +246,7 @@ static const EXTENSION_DEFINITION ext_defs[] = {
         init_psk_kex_modes, tls_parse_ctos_psk_kex_modes, NULL, NULL,
         tls_construct_ctos_psk_kex_modes, NULL
     },
+#ifndef OPENSSL_NO_EC
     {
         /*
          * Must be in this list after supported_groups. We need that to have
@@ -257,6 +260,7 @@ static const EXTENSION_DEFINITION ext_defs[] = {
         tls_construct_stoc_key_share, tls_construct_ctos_key_share,
         final_key_share
     },
+#endif
     {
         /*
          * Special unsolicited ServerHello extension only used when
@@ -908,7 +912,7 @@ static int init_srp(SSL *s, unsigned int context)
 
 static int init_etm(SSL *s, unsigned int context)
 {
-    s->s3->flags &= ~TLS1_FLAGS_ENCRYPT_THEN_MAC;
+    s->ext.use_etm = 0;
 
     return 1;
 }
@@ -960,7 +964,7 @@ static int final_sig_algs(SSL *s, unsigned int context, int sent, int *al)
     return 1;
 }
 
-
+#ifndef OPENSSL_NO_EC
 static int final_key_share(SSL *s, unsigned int context, int sent, int *al)
 {
     if (!SSL_IS_TLS13(s))
@@ -1018,7 +1022,7 @@ static int final_key_share(SSL *s, unsigned int context, int sent, int *al)
                        != 0)) {
             const unsigned char *pcurves, *pcurvestmp, *clntcurves;
             size_t num_curves, clnt_num_curves, i;
-            unsigned int group_id;
+            unsigned int group_id = 0;
 
             /* Check if a shared group exists */
 
@@ -1078,6 +1082,7 @@ static int final_key_share(SSL *s, unsigned int context, int sent, int *al)
 
     return 1;
 }
+#endif
 
 static int init_psk_kex_modes(SSL *s, unsigned int context)
 {