summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_lib.c
diff options
context:
space:
mode:
authortb <>2022-06-27 12:31:38 +0000
committertb <>2022-06-27 12:31:38 +0000
commit1f814fdc3f1d1d90cbcbff70c5aadcf9da362c34 (patch)
tree931e6b745022209240526123ee6e1211a6334fdc /src/lib/libcrypto/dh/dh_lib.c
parent480c1f602005c8b8ae31165e5edd93ad31443164 (diff)
downloadopenbsd-1f814fdc3f1d1d90cbcbff70c5aadcf9da362c34.tar.gz
openbsd-1f814fdc3f1d1d90cbcbff70c5aadcf9da362c34.tar.bz2
openbsd-1f814fdc3f1d1d90cbcbff70c5aadcf9da362c34.zip
Prepare to provide DH_security_bits()
ok beck jsing
Diffstat (limited to '')
-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{