summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-07-19 18:55:12 +0000
committertb <>2022-07-19 18:55:12 +0000
commita08ce8ba6bb13ef3943576ef6efd2b8484474ac7 (patch)
tree81b9fa47a505821fe321c62f8290868598c1140e
parenta08917f0b598c424668ec68318b26d410fcf8990 (diff)
downloadopenbsd-a08ce8ba6bb13ef3943576ef6efd2b8484474ac7.tar.gz
openbsd-a08ce8ba6bb13ef3943576ef6efd2b8484474ac7.tar.bz2
openbsd-a08ce8ba6bb13ef3943576ef6efd2b8484474ac7.zip
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
-rw-r--r--src/lib/libssl/ssl_seclevel.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/lib/libssl/ssl_seclevel.c b/src/lib/libssl/ssl_seclevel.c
index 4ccd957689..957ebc7ca5 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.22 2022/07/07 17:08:28 tb Exp $ */ 1/* $OpenBSD: ssl_seclevel.c,v 1.23 2022/07/19 18:55:12 tb Exp $ */
2/* 2/*
3 * Copyright (c) 2020 Theo Buehler <tb@openbsd.org> 3 * Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
4 * 4 *
@@ -112,10 +112,13 @@ ssl_security_secop_cipher(const SSL_CTX *ctx, const SSL *ssl, int bits,
112 if (cipher->algorithm_auth & SSL_aNULL) 112 if (cipher->algorithm_auth & SSL_aNULL)
113 return 0; 113 return 0;
114 114
115 if (cipher->algorithm_mac & SSL_MD5)
116 return 0;
117
115 if (security_level <= 1) 118 if (security_level <= 1)
116 return 1; 119 return 1;
117 120
118 if (cipher->algorithm_enc == SSL_RC4) 121 if (cipher->algorithm_enc & SSL_RC4)
119 return 0; 122 return 0;
120 123
121 if (security_level <= 2) 124 if (security_level <= 2)
@@ -126,6 +129,12 @@ ssl_security_secop_cipher(const SSL_CTX *ctx, const SSL *ssl, int bits,
126 cipher->algorithm_ssl != SSL_TLSV1_3) 129 cipher->algorithm_ssl != SSL_TLSV1_3)
127 return 0; 130 return 0;
128 131
132 if (security_level <= 3)
133 return 1;
134
135 if (cipher->algorithm_mac & SSL_SHA1)
136 return 0;
137
129 return 1; 138 return 1;
130} 139}
131 140