Latest update.
This commit is contained in:
+52
-42
@@ -46,10 +46,10 @@ index 6724ccf2d2..81a5538977 100644
|
||||
/*
|
||||
* As of OpenSSL 1.0.0, ssl_create_cipher_list() in ssl/ssl_ciph.c always
|
||||
diff --git a/include/openssl/sslerr.h b/include/openssl/sslerr.h
|
||||
index a50a075b42..e9abb98d4f 100644
|
||||
index 3d6850dea3..a3ab4b925f 100644
|
||||
--- a/include/openssl/sslerr.h
|
||||
+++ b/include/openssl/sslerr.h
|
||||
@@ -596,6 +596,8 @@ int ERR_load_SSL_strings(void);
|
||||
@@ -600,6 +600,8 @@ int ERR_load_SSL_strings(void);
|
||||
# define SSL_R_MISSING_SUPPORTED_GROUPS_EXTENSION 209
|
||||
# define SSL_R_MISSING_TMP_DH_KEY 171
|
||||
# define SSL_R_MISSING_TMP_ECDH_KEY 311
|
||||
@@ -58,7 +58,7 @@ index a50a075b42..e9abb98d4f 100644
|
||||
# define SSL_R_MIXED_HANDSHAKE_AND_NON_HANDSHAKE_DATA 293
|
||||
# define SSL_R_NOT_ON_RECORD_BOUNDARY 182
|
||||
# define SSL_R_NOT_REPLACING_CERTIFICATE 289
|
||||
@@ -727,9 +729,11 @@ int ERR_load_SSL_strings(void);
|
||||
@@ -731,9 +733,11 @@ int ERR_load_SSL_strings(void);
|
||||
# define SSL_R_UNABLE_TO_FIND_PUBLIC_KEY_PARAMETERS 239
|
||||
# define SSL_R_UNABLE_TO_LOAD_SSL3_MD5_ROUTINES 242
|
||||
# define SSL_R_UNABLE_TO_LOAD_SSL3_SHA1_ROUTINES 243
|
||||
@@ -71,7 +71,7 @@ index a50a075b42..e9abb98d4f 100644
|
||||
# define SSL_R_UNINITIALIZED 276
|
||||
# define SSL_R_UNKNOWN_ALERT_TYPE 246
|
||||
diff --git a/ssl/s3_lib.c b/ssl/s3_lib.c
|
||||
index d7dbf99954..7abac4dda1 100644
|
||||
index 066bf47221..517eda6630 100644
|
||||
--- a/ssl/s3_lib.c
|
||||
+++ b/ssl/s3_lib.c
|
||||
@@ -167,7 +167,7 @@ static SSL_CIPHER ssl3_ciphers[] = {
|
||||
@@ -101,7 +101,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
DTLS1_BAD_VER, DTLS1_2_VERSION,
|
||||
SSL_HIGH | SSL_FIPS,
|
||||
SSL_HANDSHAKE_MAC_DEFAULT | TLS1_PRF,
|
||||
@@ -4123,6 +4123,17 @@ int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt, size_t *len)
|
||||
@@ -4124,6 +4124,17 @@ int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt, size_t *len)
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -119,7 +119,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
/*
|
||||
* ssl3_choose_cipher - choose a cipher from those offered by the client
|
||||
* @s: SSL connection
|
||||
@@ -4132,16 +4143,24 @@ int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt, size_t *len)
|
||||
@@ -4133,16 +4144,24 @@ int ssl3_put_cipher_by_char(const SSL_CIPHER *c, WPACKET *pkt, size_t *len)
|
||||
* Returns the selected cipher or NULL when no common ciphers.
|
||||
*/
|
||||
const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -150,7 +150,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
|
||||
/* Let's see which ciphers we can support */
|
||||
|
||||
@@ -4168,54 +4187,13 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -4169,54 +4188,13 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
#endif
|
||||
|
||||
/* SUITE-B takes precedence over server preference and ChaCha priortiy */
|
||||
@@ -208,7 +208,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
allow = srvr;
|
||||
}
|
||||
|
||||
@@ -4246,14 +4224,16 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -4247,14 +4225,16 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
for (i = 0; i < sk_SSL_CIPHER_num(prio); i++) {
|
||||
c = sk_SSL_CIPHER_value(prio, i);
|
||||
|
||||
@@ -227,7 +227,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
|
||||
/*
|
||||
* Since TLS 1.3 ciphersuites can be used with any auth or
|
||||
@@ -4275,10 +4255,10 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -4276,10 +4256,10 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
#ifndef OPENSSL_NO_PSK
|
||||
/* with PSK there must be server callback set */
|
||||
if ((alg_k & SSL_PSK) && s->psk_server_callback == NULL)
|
||||
@@ -240,7 +240,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
#ifdef CIPHER_DEBUG
|
||||
fprintf(stderr, "%d:[%08lX:%08lX:%08lX:%08lX]%p:%s\n", ok, alg_k,
|
||||
alg_a, mask_k, mask_a, (void *)c, c->name);
|
||||
@@ -4295,6 +4275,14 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -4296,6 +4276,14 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
|
||||
if (!ok)
|
||||
continue;
|
||||
@@ -255,7 +255,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
}
|
||||
ii = sk_SSL_CIPHER_find(allow, c);
|
||||
if (ii >= 0) {
|
||||
@@ -4302,14 +4290,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -4303,14 +4291,7 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
if (!ssl_security(s, SSL_SECOP_CIPHER_SHARED,
|
||||
c->strength_bits, 0, (void *)c))
|
||||
continue;
|
||||
@@ -271,7 +271,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
if (prefer_sha256) {
|
||||
const SSL_CIPHER *tmp = sk_SSL_CIPHER_value(allow, ii);
|
||||
|
||||
@@ -4321,13 +4302,38 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
@@ -4322,13 +4303,38 @@ const SSL_CIPHER *ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt,
|
||||
ret = tmp;
|
||||
continue;
|
||||
}
|
||||
@@ -315,7 +315,7 @@ index d7dbf99954..7abac4dda1 100644
|
||||
}
|
||||
|
||||
diff --git a/ssl/ssl_ciph.c b/ssl/ssl_ciph.c
|
||||
index b60d67aa0d..4607b776de 100644
|
||||
index 27a1b2ec68..dffc0623b6 100644
|
||||
--- a/ssl/ssl_ciph.c
|
||||
+++ b/ssl/ssl_ciph.c
|
||||
@@ -192,6 +192,7 @@ typedef struct cipher_order_st {
|
||||
@@ -501,25 +501,35 @@ index b60d67aa0d..4607b776de 100644
|
||||
return retval;
|
||||
}
|
||||
|
||||
@@ -1379,7 +1437,7 @@ int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str)
|
||||
@@ -1377,8 +1435,8 @@ int SSL_CTX_set_ciphersuites(SSL_CTX *ctx, const char *str)
|
||||
{
|
||||
int ret = set_ciphersuites(&(ctx->tls13_ciphersuites), str);
|
||||
|
||||
if (ret && ctx->cipher_list != NULL) {
|
||||
/* We already have a cipher_list, so we need to update it */
|
||||
- if (ret && ctx->cipher_list != NULL)
|
||||
- return update_cipher_list(&ctx->cipher_list, &ctx->cipher_list_by_id,
|
||||
+ if (ret && ctx->cipher_list->ciphers != NULL)
|
||||
+ return update_cipher_list(&ctx->cipher_list->ciphers, &ctx->cipher_list_by_id,
|
||||
ctx->tls13_ciphersuites);
|
||||
|
||||
return ret;
|
||||
@@ -1389,12 +1447,12 @@ int SSL_set_ciphersuites(SSL *s, const char *str)
|
||||
STACK_OF(SSL_CIPHER) *cipher_list;
|
||||
int ret = set_ciphersuites(&(s->tls13_ciphersuites), str);
|
||||
|
||||
- if (s->cipher_list == NULL) {
|
||||
+ if (s->cipher_list->ciphers == NULL) {
|
||||
if ((cipher_list = SSL_get_ciphers(s)) != NULL)
|
||||
- s->cipher_list = sk_SSL_CIPHER_dup(cipher_list);
|
||||
+ s->cipher_list->ciphers = sk_SSL_CIPHER_dup(cipher_list);
|
||||
}
|
||||
|
||||
@@ -1392,7 +1450,7 @@ int SSL_set_ciphersuites(SSL *s, const char *str)
|
||||
|
||||
if (ret && s->cipher_list != NULL) {
|
||||
/* We already have a cipher_list, so we need to update it */
|
||||
- if (ret && s->cipher_list != NULL)
|
||||
- return update_cipher_list(&s->cipher_list, &s->cipher_list_by_id,
|
||||
+ if (ret && s->cipher_list->ciphers != NULL)
|
||||
+ return update_cipher_list(&s->cipher_list->ciphers, &s->cipher_list_by_id,
|
||||
s->tls13_ciphersuites);
|
||||
}
|
||||
|
||||
@@ -1401,17 +1459,20 @@ int SSL_set_ciphersuites(SSL *s, const char *str)
|
||||
return ret;
|
||||
@@ -1402,17 +1460,20 @@ int SSL_set_ciphersuites(SSL *s, const char *str)
|
||||
|
||||
STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
STACK_OF(SSL_CIPHER) *tls13_ciphersuites,
|
||||
@@ -544,7 +554,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
|
||||
/*
|
||||
* Return with error if nothing to do.
|
||||
@@ -1460,16 +1521,16 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1461,16 +1522,16 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
* preference).
|
||||
*/
|
||||
ssl_cipher_apply_rule(0, SSL_kECDHE, SSL_aECDSA, 0, 0, 0, 0, CIPHER_ADD,
|
||||
@@ -568,7 +578,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
&head, &tail);
|
||||
|
||||
/*
|
||||
@@ -1478,13 +1539,13 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1479,13 +1540,13 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
* strength.
|
||||
*/
|
||||
ssl_cipher_apply_rule(0, 0, 0, SSL_AES ^ SSL_AESGCM, 0, 0, 0, CIPHER_ADD,
|
||||
@@ -585,7 +595,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
&tail);
|
||||
|
||||
/*
|
||||
@@ -1492,16 +1553,16 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1493,16 +1554,16 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
* disabled. (For applications that allow them, they aren't too bad, but
|
||||
* we prefer authenticated ciphers.)
|
||||
*/
|
||||
@@ -606,7 +616,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
&tail);
|
||||
|
||||
/*
|
||||
@@ -1517,7 +1578,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1518,7 +1579,7 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
* Partially overrule strength sort to prefer TLS 1.2 ciphers/PRFs.
|
||||
* TODO(openssl-team): is there an easier way to accomplish all this?
|
||||
*/
|
||||
@@ -615,7 +625,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
&head, &tail);
|
||||
|
||||
/*
|
||||
@@ -1533,15 +1594,15 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1534,15 +1595,15 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
* Because we now bump ciphers to the top of the list, we proceed in
|
||||
* reverse order of preference.
|
||||
*/
|
||||
@@ -635,7 +645,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
|
||||
/*
|
||||
* We also need cipher aliases for selecting based on the rule_str.
|
||||
@@ -1555,9 +1616,8 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1556,9 +1617,8 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
num_of_alias_max = num_of_ciphers + num_of_group_aliases + 1;
|
||||
ca_list = OPENSSL_malloc(sizeof(*ca_list) * num_of_alias_max);
|
||||
if (ca_list == NULL) {
|
||||
@@ -646,7 +656,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
}
|
||||
ssl_cipher_collect_aliases(ca_list, num_of_group_aliases,
|
||||
disabled_mkey, disabled_auth, disabled_enc,
|
||||
@@ -1582,27 +1642,35 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1583,27 +1643,35 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
|
||||
OPENSSL_free(ca_list); /* Not needed anymore */
|
||||
|
||||
@@ -694,7 +704,7 @@ index b60d67aa0d..4607b776de 100644
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -1611,26 +1679,50 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
@@ -1612,26 +1680,50 @@ STACK_OF(SSL_CIPHER) *ssl_create_cipher_list(const SSL_METHOD *ssl_method,
|
||||
*/
|
||||
for (curr = head; curr != NULL; curr = curr->next) {
|
||||
if (curr->active) {
|
||||
@@ -787,10 +797,10 @@ index 4b12ed1485..cd1a95d1d2 100644
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNINITIALIZED), "uninitialized"},
|
||||
{ERR_PACK(ERR_LIB_SSL, 0, SSL_R_UNKNOWN_ALERT_TYPE), "unknown alert type"},
|
||||
diff --git a/ssl/ssl_lib.c b/ssl/ssl_lib.c
|
||||
index 40ab87480d..78fcb80035 100644
|
||||
index ac820cf9fe..141308584c 100644
|
||||
--- a/ssl/ssl_lib.c
|
||||
+++ b/ssl/ssl_lib.c
|
||||
@@ -1117,6 +1117,71 @@ int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm)
|
||||
@@ -1122,6 +1122,71 @@ int SSL_set1_param(SSL *ssl, X509_VERIFY_PARAM *vpm)
|
||||
return X509_VERIFY_PARAM_set1(ssl->param, vpm);
|
||||
}
|
||||
|
||||
@@ -862,7 +872,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
X509_VERIFY_PARAM *SSL_CTX_get0_param(SSL_CTX *ctx)
|
||||
{
|
||||
return ctx->param;
|
||||
@@ -1157,7 +1222,8 @@ void SSL_free(SSL *s)
|
||||
@@ -1162,7 +1227,8 @@ void SSL_free(SSL *s)
|
||||
BUF_MEM_free(s->init_buf);
|
||||
|
||||
/* add extra stuff */
|
||||
@@ -872,7 +882,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
sk_SSL_CIPHER_free(s->cipher_list_by_id);
|
||||
sk_SSL_CIPHER_free(s->tls13_ciphersuites);
|
||||
sk_SSL_CIPHER_free(s->peer_ciphers);
|
||||
@@ -2430,9 +2496,9 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s)
|
||||
@@ -2436,9 +2502,9 @@ STACK_OF(SSL_CIPHER) *SSL_get_ciphers(const SSL *s)
|
||||
{
|
||||
if (s != NULL) {
|
||||
if (s->cipher_list != NULL) {
|
||||
@@ -884,7 +894,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
@@ -2506,8 +2572,8 @@ const char *SSL_get_cipher_list(const SSL *s, int n)
|
||||
@@ -2512,8 +2578,8 @@ const char *SSL_get_cipher_list(const SSL *s, int n)
|
||||
* preference */
|
||||
STACK_OF(SSL_CIPHER) *SSL_CTX_get_ciphers(const SSL_CTX *ctx)
|
||||
{
|
||||
@@ -895,7 +905,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@@ -2957,7 +3023,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
|
||||
@@ -2963,7 +3029,7 @@ SSL_CTX *SSL_CTX_new(const SSL_METHOD *meth)
|
||||
ret->tls13_ciphersuites,
|
||||
&ret->cipher_list, &ret->cipher_list_by_id,
|
||||
SSL_DEFAULT_CIPHER_LIST, ret->cert)
|
||||
@@ -904,7 +914,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
SSLerr(SSL_F_SSL_CTX_NEW, SSL_R_LIBRARY_HAS_NO_CIPHERS);
|
||||
goto err2;
|
||||
}
|
||||
@@ -3133,7 +3199,7 @@ void SSL_CTX_free(SSL_CTX *a)
|
||||
@@ -3139,7 +3205,7 @@ void SSL_CTX_free(SSL_CTX *a)
|
||||
#ifndef OPENSSL_NO_CT
|
||||
CTLOG_STORE_free(a->ctlog_store);
|
||||
#endif
|
||||
@@ -913,7 +923,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
sk_SSL_CIPHER_free(a->cipher_list_by_id);
|
||||
sk_SSL_CIPHER_free(a->tls13_ciphersuites);
|
||||
ssl_cert_free(a->cert);
|
||||
@@ -3811,13 +3877,15 @@ SSL *SSL_dup(SSL *s)
|
||||
@@ -3817,13 +3883,15 @@ SSL *SSL_dup(SSL *s)
|
||||
|
||||
/* dup the cipher_list and cipher_list_by_id stacks */
|
||||
if (s->cipher_list != NULL) {
|
||||
@@ -934,7 +944,7 @@ index 40ab87480d..78fcb80035 100644
|
||||
/* Dup the client_CA list */
|
||||
if (!dup_ca_names(&ret->ca_names, s->ca_names)
|
||||
diff --git a/ssl/ssl_locl.h b/ssl/ssl_locl.h
|
||||
index fa0f6d018c..3ffc46efd9 100644
|
||||
index 25875c9f6d..23a6093580 100644
|
||||
--- a/ssl/ssl_locl.h
|
||||
+++ b/ssl/ssl_locl.h
|
||||
@@ -733,9 +733,46 @@ typedef struct ssl_ctx_ext_secure_st {
|
||||
@@ -1027,7 +1037,7 @@ index fa0f6d018c..3ffc46efd9 100644
|
||||
__owur int ssl3_new(SSL *s);
|
||||
void ssl3_free(SSL *s);
|
||||
diff --git a/ssl/statem/statem_srvr.c b/ssl/statem/statem_srvr.c
|
||||
index e7e95c74e7..543d00b1d0 100644
|
||||
index 8cf9c40d15..46391a7f05 100644
|
||||
--- a/ssl/statem/statem_srvr.c
|
||||
+++ b/ssl/statem/statem_srvr.c
|
||||
@@ -1748,7 +1748,7 @@ static int tls_early_post_process_client_hello(SSL *s)
|
||||
@@ -1060,7 +1070,7 @@ index e7e95c74e7..543d00b1d0 100644
|
||||
sk_SSL_CIPHER_free(s->cipher_list_by_id);
|
||||
s->cipher_list_by_id = sk_SSL_CIPHER_dup(s->peer_ciphers);
|
||||
}
|
||||
@@ -2253,7 +2254,7 @@ WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
|
||||
@@ -2251,7 +2252,7 @@ WORK_STATE tls_post_process_client_hello(SSL *s, WORK_STATE wst)
|
||||
/* In TLSv1.3 we selected the ciphersuite before resumption */
|
||||
if (!SSL_IS_TLS13(s)) {
|
||||
cipher =
|
||||
|
||||
Reference in New Issue
Block a user