-/* $OpenBSD: ssl_seclevel.c,v 1.2 2022/06/28 20:44:49 tb Exp $ */
+/* $OpenBSD: ssl_seclevel.c,v 1.3 2022/06/28 20:49:16 tb Exp $ */
/*
* Copyright (c) 2020 Theo Buehler <tb@openbsd.org>
*
return security_level < 3;
}
+static int
+ssl_security_secop_tmp_dh(const SSL_CTX *ctx, const SSL *ssl, int bits)
+{
+ int security_level, minimum_bits;
+
+ if (!ssl_security_level_and_minimum_bits(ctx, ssl, &security_level,
+ &minimum_bits))
+ return 0;
+
+ /* Disallow DHE keys weaker than 1024 bits even at security level 0. */
+ if (security_level <= 0 && bits < 80)
+ return 0;
+
+ return bits >= minimum_bits;
+}
+
static int
ssl_security_secop_default(const SSL_CTX *ctx, const SSL *ssl, int bits)
{
return ssl_security_secop_compression(ctx, ssl);
case SSL_SECOP_TICKET:
return ssl_security_secop_tickets(ctx, ssl);
+ case SSL_SECOP_TMP_DH:
+ return ssl_security_secop_tmp_dh(ctx, ssl, bits);
default:
return ssl_security_secop_default(ctx, ssl, bits);
}