From a042a42d45fe37bd30ccc76e5ce802950916f699 Mon Sep 17 00:00:00 2001 From: tb Date: Tue, 19 Jul 2022 18:55:12 +0000 Subject: [PATCH] Disallow MD5 and SHA-1 HMACs depending on the security level Ciphers using an MD5 HMAC are not allowed on security levels >= 1 and using a SHA-1 HMAC is disallowed on security levels >= 4. This disables RC4-MD5 by default. ok jsing --- lib/libssl/ssl_seclevel.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/lib/libssl/ssl_seclevel.c b/lib/libssl/ssl_seclevel.c index 4ccd9576899..957ebc7ca5a 100644 --- a/lib/libssl/ssl_seclevel.c +++ b/lib/libssl/ssl_seclevel.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ssl_seclevel.c,v 1.22 2022/07/07 17:08:28 tb Exp $ */ +/* $OpenBSD: ssl_seclevel.c,v 1.23 2022/07/19 18:55:12 tb Exp $ */ /* * Copyright (c) 2020 Theo Buehler * @@ -112,10 +112,13 @@ ssl_security_secop_cipher(const SSL_CTX *ctx, const SSL *ssl, int bits, if (cipher->algorithm_auth & SSL_aNULL) return 0; + if (cipher->algorithm_mac & SSL_MD5) + return 0; + if (security_level <= 1) return 1; - if (cipher->algorithm_enc == SSL_RC4) + if (cipher->algorithm_enc & SSL_RC4) return 0; if (security_level <= 2) @@ -126,6 +129,12 @@ ssl_security_secop_cipher(const SSL_CTX *ctx, const SSL *ssl, int bits, cipher->algorithm_ssl != SSL_TLSV1_3) return 0; + if (security_level <= 3) + return 1; + + if (cipher->algorithm_mac & SSL_SHA1) + return 0; + return 1; } -- 2.20.1