Update to OpenSSL 1.0.2.o
This commit is contained in:
50
ssl/t1_lib.c
50
ssl/t1_lib.c
@@ -56,7 +56,7 @@
|
||||
* [including the GNU Public Licence.]
|
||||
*/
|
||||
/* ====================================================================
|
||||
* Copyright (c) 1998-2007 The OpenSSL Project. All rights reserved.
|
||||
* Copyright (c) 1998-2018 The OpenSSL Project. All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
@@ -1035,7 +1035,7 @@ static unsigned char suiteb_sigalgs[] = {
|
||||
tlsext_sigalg_ecdsa(TLSEXT_hash_sha384)
|
||||
};
|
||||
# endif
|
||||
size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs)
|
||||
size_t tls12_get_psigalgs(SSL *s, int sent, const unsigned char **psigs)
|
||||
{
|
||||
/*
|
||||
* If Suite B mode use Suite B sigalgs only, ignore any other
|
||||
@@ -1057,7 +1057,7 @@ size_t tls12_get_psigalgs(SSL *s, const unsigned char **psigs)
|
||||
}
|
||||
# endif
|
||||
/* If server use client authentication sigalgs if not NULL */
|
||||
if (s->server && s->cert->client_sigalgs) {
|
||||
if (s->server == sent && s->cert->client_sigalgs) {
|
||||
*psigs = s->cert->client_sigalgs;
|
||||
return s->cert->client_sigalgslen;
|
||||
} else if (s->cert->conf_sigalgs) {
|
||||
@@ -1121,7 +1121,7 @@ int tls12_check_peer_sigalg(const EVP_MD **pmd, SSL *s,
|
||||
# endif
|
||||
|
||||
/* Check signature matches a type we sent */
|
||||
sent_sigslen = tls12_get_psigalgs(s, &sent_sigs);
|
||||
sent_sigslen = tls12_get_psigalgs(s, 1, &sent_sigs);
|
||||
for (i = 0; i < sent_sigslen; i += 2, sent_sigs += 2) {
|
||||
if (sig[0] == sent_sigs[0] && sig[1] == sent_sigs[1])
|
||||
break;
|
||||
@@ -1169,7 +1169,7 @@ void ssl_set_client_disabled(SSL *s)
|
||||
* Now go through all signature algorithms seeing if we support any for
|
||||
* RSA, DSA, ECDSA. Do this for all versions not just TLS 1.2.
|
||||
*/
|
||||
sigalgslen = tls12_get_psigalgs(s, &sigalgs);
|
||||
sigalgslen = tls12_get_psigalgs(s, 1, &sigalgs);
|
||||
for (i = 0; i < sigalgslen; i += 2, sigalgs += 2) {
|
||||
switch (sigalgs[1]) {
|
||||
# ifndef OPENSSL_NO_RSA
|
||||
@@ -1440,7 +1440,7 @@ unsigned char *ssl_add_clienthello_tlsext(SSL *s, unsigned char *buf,
|
||||
if (SSL_CLIENT_USE_SIGALGS(s)) {
|
||||
size_t salglen;
|
||||
const unsigned char *salg;
|
||||
salglen = tls12_get_psigalgs(s, &salg);
|
||||
salglen = tls12_get_psigalgs(s, 1, &salg);
|
||||
|
||||
/*-
|
||||
* check for enough space.
|
||||
@@ -1769,6 +1769,9 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
|
||||
return NULL;
|
||||
s2n(TLSEXT_TYPE_session_ticket, ret);
|
||||
s2n(0, ret);
|
||||
} else {
|
||||
/* if we don't add the above TLSEXT, we can't add a session ticket later */
|
||||
s->tlsext_ticket_expected = 0;
|
||||
}
|
||||
|
||||
if (s->tlsext_status_expected) {
|
||||
@@ -1913,7 +1916,7 @@ unsigned char *ssl_add_serverhello_tlsext(SSL *s, unsigned char *buf,
|
||||
s2n(TLSEXT_TYPE_application_layer_protocol_negotiation, ret);
|
||||
s2n(3 + len, ret);
|
||||
s2n(1 + len, ret);
|
||||
*ret++ = len;
|
||||
*ret++ = (unsigned char)len;
|
||||
memcpy(ret, selected, len);
|
||||
ret += len;
|
||||
}
|
||||
@@ -2281,8 +2284,12 @@ static int ssl_scan_clienthello_tlsext(SSL *s, unsigned char **p,
|
||||
# ifndef OPENSSL_NO_EC
|
||||
else if (type == TLSEXT_TYPE_ec_point_formats) {
|
||||
unsigned char *sdata = data;
|
||||
int ecpointformatlist_length = *(sdata++);
|
||||
int ecpointformatlist_length;
|
||||
|
||||
if (size == 0)
|
||||
goto err;
|
||||
|
||||
ecpointformatlist_length = *(sdata++);
|
||||
if (ecpointformatlist_length != size - 1 ||
|
||||
ecpointformatlist_length < 1)
|
||||
goto err;
|
||||
@@ -2708,8 +2715,14 @@ static int ssl_scan_serverhello_tlsext(SSL *s, unsigned char **p,
|
||||
# ifndef OPENSSL_NO_EC
|
||||
else if (type == TLSEXT_TYPE_ec_point_formats) {
|
||||
unsigned char *sdata = data;
|
||||
int ecpointformatlist_length = *(sdata++);
|
||||
int ecpointformatlist_length;
|
||||
|
||||
if (size == 0) {
|
||||
*al = TLS1_AD_DECODE_ERROR;
|
||||
return 0;
|
||||
}
|
||||
|
||||
ecpointformatlist_length = *(sdata++);
|
||||
if (ecpointformatlist_length != size - 1) {
|
||||
*al = TLS1_AD_DECODE_ERROR;
|
||||
return 0;
|
||||
@@ -3502,6 +3515,10 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
|
||||
EVP_CIPHER_CTX ctx;
|
||||
SSL_CTX *tctx = s->initial_ctx;
|
||||
|
||||
/* Need at least keyname + iv */
|
||||
if (eticklen < 16 + EVP_MAX_IV_LENGTH)
|
||||
return 2;
|
||||
|
||||
/* Initialize session ticket encryption and HMAC contexts */
|
||||
HMAC_CTX_init(&hctx);
|
||||
EVP_CIPHER_CTX_init(&ctx);
|
||||
@@ -3510,9 +3527,12 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
|
||||
int rv = tctx->tlsext_ticket_key_cb(s, nctick, nctick + 16,
|
||||
&ctx, &hctx, 0);
|
||||
if (rv < 0)
|
||||
return -1;
|
||||
if (rv == 0)
|
||||
goto err;
|
||||
if (rv == 0) {
|
||||
HMAC_CTX_cleanup(&hctx);
|
||||
EVP_CIPHER_CTX_cleanup(&ctx);
|
||||
return 2;
|
||||
}
|
||||
if (rv == 2)
|
||||
renew_ticket = 1;
|
||||
} else {
|
||||
@@ -3574,8 +3594,14 @@ static int tls_decrypt_ticket(SSL *s, const unsigned char *etick,
|
||||
p = sdec;
|
||||
|
||||
sess = d2i_SSL_SESSION(NULL, &p, slen);
|
||||
slen -= p - sdec;
|
||||
OPENSSL_free(sdec);
|
||||
if (sess) {
|
||||
/* Some additional consistency checks */
|
||||
if (slen != 0 || sess->session_id_length != 0) {
|
||||
SSL_SESSION_free(sess);
|
||||
return 2;
|
||||
}
|
||||
/*
|
||||
* The session ID, if non-empty, is used by some clients to detect
|
||||
* that the ticket has been accepted. So we copy it to the session
|
||||
@@ -3803,7 +3829,7 @@ static int tls1_set_shared_sigalgs(SSL *s)
|
||||
conf = c->conf_sigalgs;
|
||||
conflen = c->conf_sigalgslen;
|
||||
} else
|
||||
conflen = tls12_get_psigalgs(s, &conf);
|
||||
conflen = tls12_get_psigalgs(s, 0, &conf);
|
||||
if (s->options & SSL_OP_CIPHER_SERVER_PREFERENCE || is_suiteb) {
|
||||
pref = conf;
|
||||
preflen = conflen;
|
||||
|
||||
Reference in New Issue
Block a user