summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dh/dh_lib.c')
-rw-r--r--src/lib/libcrypto/dh/dh_lib.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c
index d4d0c9dda3..35a22d1ec8 100644
--- a/src/lib/libcrypto/dh/dh_lib.c
+++ b/src/lib/libcrypto/dh/dh_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_lib.c,v 1.36 2022/01/07 09:27:13 tb Exp $ */ 1/* $OpenBSD: dh_lib.c,v 1.37 2022/06/27 12:31:38 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 *
@@ -245,6 +245,19 @@ DH_bits(const DH *dh)
245 return BN_num_bits(dh->p); 245 return BN_num_bits(dh->p);
246} 246}
247 247
248int
249DH_security_bits(const DH *dh)
250{
251 int N = -1;
252
253 if (dh->q != NULL)
254 N = BN_num_bits(dh->q);
255 else if (dh->length > 0)
256 N = dh->length;
257
258 return BN_security_bits(BN_num_bits(dh->p), N);
259}
260
248ENGINE * 261ENGINE *
249DH_get0_engine(DH *dh) 262DH_get0_engine(DH *dh)
250{ 263{