diff options
Diffstat (limited to 'src/lib/libcrypto/dh/dh_lib.c')
-rw-r--r-- | src/lib/libcrypto/dh/dh_lib.c | 15 |
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 | ||
248 | int | ||
249 | DH_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 | |||
248 | ENGINE * | 261 | ENGINE * |
249 | DH_get0_engine(DH *dh) | 262 | DH_get0_engine(DH *dh) |
250 | { | 263 | { |