1077
1081
int ellipticcurvelist_length = (*(sdata++) << 8);
1078
1082
ellipticcurvelist_length += (*(sdata++));
1080
if (ellipticcurvelist_length != size - 2)
1084
if (ellipticcurvelist_length != size - 2 ||
1085
ellipticcurvelist_length < 1)
1082
1087
*al = TLS1_AD_DECODE_ERROR;
1330
1335
/* session ticket processed earlier */
1336
#ifndef OPENSSL_NO_SRTP
1331
1337
else if (type == TLSEXT_TYPE_use_srtp)
1333
1339
if(ssl_parse_clienthello_use_srtp_ext(s, data, size,
1433
1440
unsigned char *sdata = data;
1434
1441
int ecpointformatlist_length = *(sdata++);
1436
if (ecpointformatlist_length != size - 1)
1443
if (ecpointformatlist_length != size - 1 ||
1444
ecpointformatlist_length < 1)
1438
1446
*al = TLS1_AD_DECODE_ERROR;
1527
1535
unsigned char selected_len;
1529
1537
/* We must have requested it. */
1530
if ((s->ctx->next_proto_select_cb == NULL))
1538
if (s->ctx->next_proto_select_cb == NULL)
1532
1540
*al = TLS1_AD_UNSUPPORTED_EXTENSION;
1782
1792
else if (s->initial_ctx != NULL && s->initial_ctx->tlsext_servername_callback != 0)
1783
1793
ret = s->initial_ctx->tlsext_servername_callback(s, &al, s->initial_ctx->tlsext_servername_arg);
1785
/* If status request then ask callback what to do.
1786
* Note: this must be called after servername callbacks in case
1787
* the certificate has changed.
1789
if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb)
1792
r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);
1795
/* We don't want to send a status request response */
1796
case SSL_TLSEXT_ERR_NOACK:
1797
s->tlsext_status_expected = 0;
1799
/* status request response should be sent */
1800
case SSL_TLSEXT_ERR_OK:
1801
if (s->tlsext_ocsp_resp)
1802
s->tlsext_status_expected = 1;
1804
s->tlsext_status_expected = 0;
1806
/* something bad happened */
1807
case SSL_TLSEXT_ERR_ALERT_FATAL:
1808
ret = SSL_TLSEXT_ERR_ALERT_FATAL;
1809
al = SSL_AD_INTERNAL_ERROR;
1814
s->tlsext_status_expected = 0;
1816
1795
#ifdef TLSEXT_TYPE_opaque_prf_input
1818
1797
/* This sort of belongs into ssl_prepare_serverhello_tlsext(),
1819
1798
* but we might be sending an alert in response to the client hello,
1820
* so this has to happen here in ssl_check_clienthello_tlsext(). */
1799
* so this has to happen here in
1800
* ssl_check_clienthello_tlsext_early(). */
1871
int ssl_check_clienthello_tlsext_late(SSL *s)
1873
int ret = SSL_TLSEXT_ERR_OK;
1876
/* If status request then ask callback what to do.
1877
* Note: this must be called after servername callbacks in case
1878
* the certificate has changed, and must be called after the cipher
1879
* has been chosen because this may influence which certificate is sent
1881
if ((s->tlsext_status_type != -1) && s->ctx && s->ctx->tlsext_status_cb)
1884
CERT_PKEY *certpkey;
1885
certpkey = ssl_get_server_send_pkey(s);
1886
/* If no certificate can't return certificate status */
1887
if (certpkey == NULL)
1889
s->tlsext_status_expected = 0;
1892
/* Set current certificate to one we will use so
1893
* SSL_get_certificate et al can pick it up.
1895
s->cert->key = certpkey;
1896
r = s->ctx->tlsext_status_cb(s, s->ctx->tlsext_status_arg);
1899
/* We don't want to send a status request response */
1900
case SSL_TLSEXT_ERR_NOACK:
1901
s->tlsext_status_expected = 0;
1903
/* status request response should be sent */
1904
case SSL_TLSEXT_ERR_OK:
1905
if (s->tlsext_ocsp_resp)
1906
s->tlsext_status_expected = 1;
1908
s->tlsext_status_expected = 0;
1910
/* something bad happened */
1911
case SSL_TLSEXT_ERR_ALERT_FATAL:
1912
ret = SSL_TLSEXT_ERR_ALERT_FATAL;
1913
al = SSL_AD_INTERNAL_ERROR;
1918
s->tlsext_status_expected = 0;
1923
case SSL_TLSEXT_ERR_ALERT_FATAL:
1924
ssl3_send_alert(s,SSL3_AL_FATAL,al);
1927
case SSL_TLSEXT_ERR_ALERT_WARNING:
1928
ssl3_send_alert(s,SSL3_AL_WARNING,al);
1891
1936
int ssl_check_serverhello_tlsext(SSL *s)
1893
1938
int ret=SSL_TLSEXT_ERR_NOACK;