diff options
| author | Jung-uk Kim <jkim@FreeBSD.org> | 2018-11-20 18:59:41 +0000 | 
|---|---|---|
| committer | Jung-uk Kim <jkim@FreeBSD.org> | 2018-11-20 18:59:41 +0000 | 
| commit | 8c3f9abd70b3f447a4795c1b00b386b044fb322d (patch) | |
| tree | 884976f2693f42bade35b92edc3c1f7f8c53825b /ssl/statem/statem_srvr.c | |
| parent | a43ce912fc025d11e1395506111f75fc194d7ba5 (diff) | |
Diffstat (limited to 'ssl/statem/statem_srvr.c')
| -rw-r--r-- | ssl/statem/statem_srvr.c | 44 | 
1 files changed, 27 insertions, 17 deletions
| diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c index 346b1e398916..e7c11c4bea4d 100644 --- a/ssl/statem/statem_srvr.c +++ b/ssl/statem/statem_srvr.c @@ -1519,8 +1519,10 @@ MSG_PROCESS_RETURN tls_process_client_hello(SSL *s, PACKET *pkt)               * So check cookie length...               */              if (SSL_get_options(s) & SSL_OP_COOKIE_EXCHANGE) { -                if (clienthello->dtls_cookie_len == 0) +                if (clienthello->dtls_cookie_len == 0) { +                    OPENSSL_free(clienthello);                      return MSG_PROCESS_FINISHED_READING; +                }              }          } @@ -2056,10 +2058,6 @@ static int tls_early_post_process_client_hello(SSL *s)  #else          s->session->compress_meth = (comp == NULL) ? 0 : comp->id;  #endif -        if (!tls1_set_server_sigalgs(s)) { -            /* SSLfatal() already called */ -            goto err; -        }      }      sk_SSL_CIPHER_free(ciphers); @@ -2227,19 +2225,25 @@ WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)      if (wst == WORK_MORE_B) {          if (!s->hit || SSL_IS_TLS13(s)) {              /* Let cert callback update server certificates if required */ -            if (!s->hit && s->cert->cert_cb != NULL) { -                int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg); -                if (rv == 0) { -                    SSLfatal(s, SSL_AD_INTERNAL_ERROR, -                             SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, -                             SSL_R_CERT_CB_ERROR); -                    goto err; +            if (!s->hit) { +                if (s->cert->cert_cb != NULL) { +                    int rv = s->cert->cert_cb(s, s->cert->cert_cb_arg); +                    if (rv == 0) { +                        SSLfatal(s, SSL_AD_INTERNAL_ERROR, +                                 SSL_F_TLS_POST_PROCESS_CLIENT_HELLO, +                                 SSL_R_CERT_CB_ERROR); +                        goto err; +                    } +                    if (rv < 0) { +                        s->rwstate = SSL_X509_LOOKUP; +                        return WORK_MORE_B; +                    } +                    s->rwstate = SSL_NOTHING;                  } -                if (rv < 0) { -                    s->rwstate = SSL_X509_LOOKUP; -                    return WORK_MORE_B; +                if (!tls1_set_server_sigalgs(s)) { +                    /* SSLfatal already called */ +                    goto err;                  } -                s->rwstate = SSL_NOTHING;              }              /* In TLSv1.3 we selected the ciphersuite before resumption */ @@ -2876,7 +2880,7 @@ int tls_construct_certificate_request(SSL *s, WPACKET *pkt)          }      } -    if (!construct_ca_names(s, pkt)) { +    if (!construct_ca_names(s, get_ca_names(s), pkt)) {          /* SSLfatal() already called */          return 0;      } @@ -3222,6 +3226,12 @@ static int tls_process_cke_ecdhe(SSL *s, PACKET *pkt)                       SSL_R_LENGTH_MISMATCH);              goto err;          } +        if (skey == NULL) { +            SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_ECDHE, +                     SSL_R_MISSING_TMP_ECDH_KEY); +            goto err; +        } +          ckey = EVP_PKEY_new();          if (ckey == NULL || EVP_PKEY_copy_parameters(ckey, skey) <= 0) {              SSLfatal(s, SSL_AD_INTERNAL_ERROR, SSL_F_TLS_PROCESS_CKE_ECDHE, | 
