diff options
| author | jsing <> | 2021-02-07 15:26:32 +0000 |
|---|---|---|
| committer | jsing <> | 2021-02-07 15:26:32 +0000 |
| commit | 47c1b962cd395a4d7c4ae96396ddc86dc0cb4aa7 (patch) | |
| tree | ea023a4f428381ff72f5edc2aec4d7c062671aff /src/lib/libssl/ssl_ciph.c | |
| parent | cd637ddd633829db55ee42ccf627164fcba056b6 (diff) | |
| download | openbsd-47c1b962cd395a4d7c4ae96396ddc86dc0cb4aa7.tar.gz openbsd-47c1b962cd395a4d7c4ae96396ddc86dc0cb4aa7.tar.bz2 openbsd-47c1b962cd395a4d7c4ae96396ddc86dc0cb4aa7.zip | |
Absorb ssl3_get_algorithm2() into ssl_get_handshake_evp_md().
The mess that is ssl_get_algorithm2() only exists to upgrade the handshake
MAC of a pre-TLSv1.2 cipher suite to SHA256 when used with TLSv1.2. We can
readily do this in ssl_get_handshake_evp_md(), which is far more readable.
ok tb@
Diffstat (limited to 'src/lib/libssl/ssl_ciph.c')
| -rw-r--r-- | src/lib/libssl/ssl_ciph.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/libssl/ssl_ciph.c b/src/lib/libssl/ssl_ciph.c index fd576cee7b..1ffd90dc16 100644 --- a/src/lib/libssl/ssl_ciph.c +++ b/src/lib/libssl/ssl_ciph.c | |||
| @@ -1,4 +1,4 @@ | |||
| 1 | /* $OpenBSD: ssl_ciph.c,v 1.119 2020/09/13 16:49:05 jsing Exp $ */ | 1 | /* $OpenBSD: ssl_ciph.c,v 1.120 2021/02/07 15:26:32 jsing 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 | * |
| @@ -559,9 +559,21 @@ ssl_cipher_get_evp_aead(const SSL_SESSION *ss, const EVP_AEAD **aead) | |||
| 559 | int | 559 | int |
| 560 | ssl_get_handshake_evp_md(SSL *s, const EVP_MD **md) | 560 | ssl_get_handshake_evp_md(SSL *s, const EVP_MD **md) |
| 561 | { | 561 | { |
| 562 | unsigned long handshake_mac; | ||
| 563 | |||
| 562 | *md = NULL; | 564 | *md = NULL; |
| 563 | 565 | ||
| 564 | switch (ssl_get_algorithm2(s) & SSL_HANDSHAKE_MAC_MASK) { | 566 | if (S3I(s)->hs.new_cipher == NULL) |
| 567 | return 0; | ||
| 568 | |||
| 569 | handshake_mac = S3I(s)->hs.new_cipher->algorithm2 & | ||
| 570 | SSL_HANDSHAKE_MAC_MASK; | ||
| 571 | |||
| 572 | /* For TLSv1.2 we upgrade the default MD5+SHA1 MAC to SHA256. */ | ||
| 573 | if (SSL_USE_SHA256_PRF(s) && handshake_mac == SSL_HANDSHAKE_MAC_DEFAULT) | ||
| 574 | handshake_mac = SSL_HANDSHAKE_MAC_SHA256; | ||
| 575 | |||
| 576 | switch (handshake_mac) { | ||
| 565 | case SSL_HANDSHAKE_MAC_DEFAULT: | 577 | case SSL_HANDSHAKE_MAC_DEFAULT: |
| 566 | *md = EVP_md5_sha1(); | 578 | *md = EVP_md5_sha1(); |
| 567 | return 1; | 579 | return 1; |
