diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/libssl/s3_lib.c | 5 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_ciphers.c | 5 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_lib.c | 5 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_locl.h | 10 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_seclevel.c | 45 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_sigalgs.c | 7 | ||||
| -rw-r--r-- | src/lib/libssl/ssl_tlsext.c | 6 |
7 files changed, 60 insertions, 23 deletions
diff --git a/src/lib/libssl/s3_lib.c b/src/lib/libssl/s3_lib.c index cfd50e66be..b6a2c26938 100644 --- a/src/lib/libssl/s3_lib.c +++ b/src/lib/libssl/s3_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: s3_lib.c,v 1.234 2022/07/02 16:00:12 tb Exp $ */ | 1 | /* $OpenBSD: s3_lib.c,v 1.235 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -2535,8 +2535,7 @@ ssl3_choose_cipher(SSL *s, STACK_OF(SSL_CIPHER) *clnt, | |||
| 2535 | !(c->algorithm_ssl & SSL_TLSV1_3)) | 2535 | !(c->algorithm_ssl & SSL_TLSV1_3)) |
| 2536 | continue; | 2536 | continue; |
| 2537 | 2537 | ||
| 2538 | if (!ssl_security(s, SSL_SECOP_CIPHER_SHARED, c->strength_bits, | 2538 | if (!ssl_security_shared_cipher(s, c)) |
| 2539 | 0, c)) | ||
| 2540 | continue; | 2539 | continue; |
| 2541 | 2540 | ||
| 2542 | ssl_set_cert_masks(cert, c); | 2541 | ssl_set_cert_masks(cert, c); |
diff --git a/src/lib/libssl/ssl_ciphers.c b/src/lib/libssl/ssl_ciphers.c index 99f23dff4b..f77f32ab7f 100644 --- a/src/lib/libssl/ssl_ciphers.c +++ b/src/lib/libssl/ssl_ciphers.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_ciphers.c,v 1.14 2022/06/29 08:38:01 tb Exp $ */ | 1 | /* $OpenBSD: ssl_ciphers.c,v 1.15 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2015-2017 Doug Hogan <doug@openbsd.org> | 3 | * Copyright (c) 2015-2017 Doug Hogan <doug@openbsd.org> |
| 4 | * Copyright (c) 2015-2018, 2020 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2015-2018, 2020 Joel Sing <jsing@openbsd.org> |
| @@ -70,8 +70,7 @@ ssl_cipher_list_to_bytes(SSL *s, STACK_OF(SSL_CIPHER) *ciphers, CBB *cbb) | |||
| 70 | if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers, | 70 | if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers, |
| 71 | max_vers)) | 71 | max_vers)) |
| 72 | continue; | 72 | continue; |
| 73 | if (!ssl_security(s, SSL_SECOP_CIPHER_CHECK, | 73 | if (!ssl_security_cipher_check(s, cipher)) |
| 74 | cipher->strength_bits, 0, cipher)) | ||
| 75 | continue; | 74 | continue; |
| 76 | if (!CBB_add_u16(cbb, ssl3_cipher_get_value(cipher))) | 75 | if (!CBB_add_u16(cbb, ssl3_cipher_get_value(cipher))) |
| 77 | return 0; | 76 | return 0; |
diff --git a/src/lib/libssl/ssl_lib.c b/src/lib/libssl/ssl_lib.c index 609bfb7e65..2cdcef444c 100644 --- a/src/lib/libssl/ssl_lib.c +++ b/src/lib/libssl/ssl_lib.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_lib.c,v 1.294 2022/06/29 20:04:28 tb Exp $ */ | 1 | /* $OpenBSD: ssl_lib.c,v 1.295 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1471,8 +1471,7 @@ SSL_get1_supported_ciphers(SSL *s) | |||
| 1471 | if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers, | 1471 | if (!ssl_cipher_allowed_in_tls_version_range(cipher, min_vers, |
| 1472 | max_vers)) | 1472 | max_vers)) |
| 1473 | continue; | 1473 | continue; |
| 1474 | if (!ssl_security(s, SSL_SECOP_CIPHER_SUPPORTED, | 1474 | if (!ssl_security_supported_cipher(s, cipher)) |
| 1475 | cipher->strength_bits, 0, cipher)) | ||
| 1476 | continue; | 1475 | continue; |
| 1477 | if (!sk_SSL_CIPHER_push(supported_ciphers, cipher)) | 1476 | if (!sk_SSL_CIPHER_push(supported_ciphers, cipher)) |
| 1478 | goto err; | 1477 | goto err; |
diff --git a/src/lib/libssl/ssl_locl.h b/src/lib/libssl/ssl_locl.h index a2ca99c02d..4f1862254b 100644 --- a/src/lib/libssl/ssl_locl.h +++ b/src/lib/libssl/ssl_locl.h | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_locl.h,v 1.410 2022/07/02 16:00:12 tb Exp $ */ | 1 | /* $OpenBSD: ssl_locl.h,v 1.411 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) | 2 | /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) |
| 3 | * All rights reserved. | 3 | * All rights reserved. |
| 4 | * | 4 | * |
| @@ -1296,11 +1296,13 @@ int ssl_security_default_cb(const SSL *ssl, const SSL_CTX *ctx, int op, | |||
| 1296 | int ssl_security_dummy_cb(const SSL *ssl, const SSL_CTX *ctx, int op, | 1296 | int ssl_security_dummy_cb(const SSL *ssl, const SSL_CTX *ctx, int op, |
| 1297 | int bits, int nid, void *other, void *ex_data); | 1297 | int bits, int nid, void *other, void *ex_data); |
| 1298 | 1298 | ||
| 1299 | int ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, | 1299 | int ssl_security_cipher_check(const SSL *ssl, SSL_CIPHER *cipher); |
| 1300 | void *other); | 1300 | int ssl_security_shared_cipher(const SSL *ssl, SSL_CIPHER *cipher); |
| 1301 | int ssl_security(const SSL *ssl, int op, int bits, int nid, void *other); | 1301 | int ssl_security_supported_cipher(const SSL *ssl, SSL_CIPHER *cipher); |
| 1302 | int ssl_ctx_security_dh(const SSL_CTX *ctx, DH *dh); | 1302 | int ssl_ctx_security_dh(const SSL_CTX *ctx, DH *dh); |
| 1303 | int ssl_security_dh(const SSL *ssl, DH *dh); | 1303 | int ssl_security_dh(const SSL *ssl, DH *dh); |
| 1304 | int ssl_security_sigalg_check(const SSL *ssl, const EVP_PKEY *pkey); | ||
| 1305 | int ssl_security_tickets(const SSL *ssl); | ||
| 1304 | int ssl_security_version(const SSL *ssl, int version); | 1306 | int ssl_security_version(const SSL *ssl, int version); |
| 1305 | int ssl_security_cert(const SSL_CTX *ctx, const SSL *ssl, X509 *x509, | 1307 | int ssl_security_cert(const SSL_CTX *ctx, const SSL *ssl, X509 *x509, |
| 1306 | int is_peer, int *out_error); | 1308 | int is_peer, int *out_error); |
diff --git a/src/lib/libssl/ssl_seclevel.c b/src/lib/libssl/ssl_seclevel.c index 2e0b74141f..bc06177b38 100644 --- a/src/lib/libssl/ssl_seclevel.c +++ b/src/lib/libssl/ssl_seclevel.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_seclevel.c,v 1.15 2022/07/02 16:00:12 tb Exp $ */ | 1 | /* $OpenBSD: ssl_seclevel.c,v 1.16 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2020 Theo Buehler <tb@openbsd.org> | 3 | * Copyright (c) 2020 Theo Buehler <tb@openbsd.org> |
| 4 | * | 4 | * |
| @@ -226,7 +226,7 @@ ssl_ctx_security(const SSL_CTX *ctx, int op, int bits, int nid, void *other) | |||
| 226 | ctx->internal->cert->security_ex_data); | 226 | ctx->internal->cert->security_ex_data); |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | int | 229 | static int |
| 230 | ssl_security(const SSL *ssl, int op, int bits, int nid, void *other) | 230 | ssl_security(const SSL *ssl, int op, int bits, int nid, void *other) |
| 231 | { | 231 | { |
| 232 | return ssl->cert->security_cb(ssl, NULL, op, bits, nid, other, | 232 | return ssl->cert->security_cb(ssl, NULL, op, bits, nid, other, |
| @@ -234,11 +234,52 @@ ssl_security(const SSL *ssl, int op, int bits, int nid, void *other) | |||
| 234 | } | 234 | } |
| 235 | 235 | ||
| 236 | int | 236 | int |
| 237 | ssl_security_sigalg_check(const SSL *ssl, const EVP_PKEY *pkey) | ||
| 238 | { | ||
| 239 | #if defined(LIBRESSL_HAS_SECURITY_LEVEL) | ||
| 240 | return ssl_security(ssl, SSL_SECOP_SIGALG_CHECK, | ||
| 241 | EVP_PKEY_security_bits(pkey), 0, NULL); | ||
| 242 | #else | ||
| 243 | return 1; | ||
| 244 | #endif | ||
| 245 | } | ||
| 246 | |||
| 247 | int | ||
| 248 | ssl_security_tickets(const SSL *ssl) | ||
| 249 | { | ||
| 250 | return ssl_security(ssl, SSL_SECOP_TICKET, 0, 0, NULL); | ||
| 251 | } | ||
| 252 | |||
| 253 | int | ||
| 237 | ssl_security_version(const SSL *ssl, int version) | 254 | ssl_security_version(const SSL *ssl, int version) |
| 238 | { | 255 | { |
| 239 | return ssl_security(ssl, SSL_SECOP_VERSION, 0, version, NULL); | 256 | return ssl_security(ssl, SSL_SECOP_VERSION, 0, version, NULL); |
| 240 | } | 257 | } |
| 241 | 258 | ||
| 259 | static int | ||
| 260 | ssl_security_cipher(const SSL *ssl, SSL_CIPHER *cipher, int secop) | ||
| 261 | { | ||
| 262 | return ssl_security(ssl, secop, cipher->strength_bits, 0, cipher); | ||
| 263 | } | ||
| 264 | |||
| 265 | int | ||
| 266 | ssl_security_cipher_check(const SSL *ssl, SSL_CIPHER *cipher) | ||
| 267 | { | ||
| 268 | return ssl_security_cipher(ssl, cipher, SSL_SECOP_CIPHER_CHECK); | ||
| 269 | } | ||
| 270 | |||
| 271 | int | ||
| 272 | ssl_security_shared_cipher(const SSL *ssl, SSL_CIPHER *cipher) | ||
| 273 | { | ||
| 274 | return ssl_security_cipher(ssl, cipher, SSL_SECOP_CIPHER_SHARED); | ||
| 275 | } | ||
| 276 | |||
| 277 | int | ||
| 278 | ssl_security_supported_cipher(const SSL *ssl, SSL_CIPHER *cipher) | ||
| 279 | { | ||
| 280 | return ssl_security_cipher(ssl, cipher, SSL_SECOP_CIPHER_SUPPORTED); | ||
| 281 | } | ||
| 282 | |||
| 242 | int | 283 | int |
| 243 | ssl_ctx_security_dh(const SSL_CTX *ctx, DH *dh) | 284 | ssl_ctx_security_dh(const SSL_CTX *ctx, DH *dh) |
| 244 | { | 285 | { |
diff --git a/src/lib/libssl/ssl_sigalgs.c b/src/lib/libssl/ssl_sigalgs.c index 754d76e72a..c3e07e5c65 100644 --- a/src/lib/libssl/ssl_sigalgs.c +++ b/src/lib/libssl/ssl_sigalgs.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_sigalgs.c,v 1.46 2022/07/02 16:00:12 tb Exp $ */ | 1 | /* $OpenBSD: ssl_sigalgs.c,v 1.47 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org> | 3 | * Copyright (c) 2018-2020 Bob Beck <beck@openbsd.org> |
| 4 | * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> | 4 | * Copyright (c) 2021 Joel Sing <jsing@openbsd.org> |
| @@ -307,11 +307,8 @@ ssl_sigalg_pkey_ok(SSL *s, const struct ssl_sigalg *sigalg, EVP_PKEY *pkey) | |||
| 307 | return 0; | 307 | return 0; |
| 308 | } | 308 | } |
| 309 | 309 | ||
| 310 | #if defined(LIBRESSL_HAS_SECURITY_LEVEL) | 310 | if (!ssl_security_sigalg_check(s, pkey)) |
| 311 | if (!ssl_security(s, SSL_SECOP_SIGALG_CHECK, | ||
| 312 | EVP_PKEY_security_bits(pkey), 0, NULL)) | ||
| 313 | return 0; | 311 | return 0; |
| 314 | #endif | ||
| 315 | 312 | ||
| 316 | if (s->s3->hs.negotiated_tls_version < TLS1_3_VERSION) | 313 | if (s->s3->hs.negotiated_tls_version < TLS1_3_VERSION) |
| 317 | return 1; | 314 | return 1; |
diff --git a/src/lib/libssl/ssl_tlsext.c b/src/lib/libssl/ssl_tlsext.c index 7457925572..fa1eef3587 100644 --- a/src/lib/libssl/ssl_tlsext.c +++ b/src/lib/libssl/ssl_tlsext.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_tlsext.c,v 1.118 2022/07/02 16:00:12 tb Exp $ */ | 1 | /* $OpenBSD: ssl_tlsext.c,v 1.119 2022/07/02 16:31:04 tb Exp $ */ |
| 2 | /* | 2 | /* |
| 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> | 3 | * Copyright (c) 2016, 2017, 2019 Joel Sing <jsing@openbsd.org> |
| 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> | 4 | * Copyright (c) 2017 Doug Hogan <doug@openbsd.org> |
| @@ -1126,7 +1126,7 @@ tlsext_sessionticket_client_needs(SSL *s, uint16_t msg_type) | |||
| 1126 | if ((SSL_get_options(s) & SSL_OP_NO_TICKET) != 0) | 1126 | if ((SSL_get_options(s) & SSL_OP_NO_TICKET) != 0) |
| 1127 | return 0; | 1127 | return 0; |
| 1128 | 1128 | ||
| 1129 | if (!ssl_security(s, SSL_SECOP_TICKET, 0, 0, NULL)) | 1129 | if (!ssl_security_tickets(s)) |
| 1130 | return 0; | 1130 | return 0; |
| 1131 | 1131 | ||
| 1132 | if (s->internal->new_session) | 1132 | if (s->internal->new_session) |
| @@ -1209,7 +1209,7 @@ tlsext_sessionticket_server_needs(SSL *s, uint16_t msg_type) | |||
| 1209 | { | 1209 | { |
| 1210 | return (s->internal->tlsext_ticket_expected && | 1210 | return (s->internal->tlsext_ticket_expected && |
| 1211 | !(SSL_get_options(s) & SSL_OP_NO_TICKET) && | 1211 | !(SSL_get_options(s) & SSL_OP_NO_TICKET) && |
| 1212 | ssl_security(s, SSL_SECOP_TICKET, 0, 0, NULL)); | 1212 | ssl_security_tickets(s)); |
| 1213 | } | 1213 | } |
| 1214 | 1214 | ||
| 1215 | int | 1215 | int |
