summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortb <>2022-06-27 12:28:46 +0000
committertb <>2022-06-27 12:28:46 +0000
commitfa34a807ea885934f65ce1aa4899138836157e6a (patch)
treea5a1104cbb00e1c9faa57415ebae55c0bd46b291
parent16ca0c8007a31f667a8d7d21c1be44ec46656b42 (diff)
downloadopenbsd-fa34a807ea885934f65ce1aa4899138836157e6a.tar.gz
openbsd-fa34a807ea885934f65ce1aa4899138836157e6a.tar.bz2
openbsd-fa34a807ea885934f65ce1aa4899138836157e6a.zip
Prepare to provide DSA_security_bits()
ok beck jsing
-rw-r--r--src/lib/libcrypto/dsa/dsa.h5
-rw-r--r--src/lib/libcrypto/dsa/dsa_lib.c11
2 files changed, 14 insertions, 2 deletions
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h
index 4fafce382d..2ee27d775f 100644
--- a/src/lib/libcrypto/dsa/dsa.h
+++ b/src/lib/libcrypto/dsa/dsa.h
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa.h,v 1.35 2022/01/14 08:27:23 tb Exp $ */ 1/* $OpenBSD: dsa.h,v 1.36 2022/06/27 12:28:46 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 *
@@ -151,6 +151,9 @@ int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func,
151 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); 151 CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func);
152int DSA_set_ex_data(DSA *d, int idx, void *arg); 152int DSA_set_ex_data(DSA *d, int idx, void *arg);
153void *DSA_get_ex_data(DSA *d, int idx); 153void *DSA_get_ex_data(DSA *d, int idx);
154#ifdef LIBRESSL_INTERNAL
155int DSA_security_bits(const DSA *d);
156#endif
154 157
155DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); 158DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length);
156int i2d_DSAPublicKey(const DSA *a, unsigned char **pp); 159int i2d_DSAPublicKey(const DSA *a, unsigned char **pp);
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c
index 1369c6f745..949722b734 100644
--- a/src/lib/libcrypto/dsa/dsa_lib.c
+++ b/src/lib/libcrypto/dsa/dsa_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dsa_lib.c,v 1.34 2022/01/14 08:29:06 tb Exp $ */ 1/* $OpenBSD: dsa_lib.c,v 1.35 2022/06/27 12:28:46 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 *
@@ -260,6 +260,15 @@ DSA_get_ex_data(DSA *d, int idx)
260 return CRYPTO_get_ex_data(&d->ex_data, idx); 260 return CRYPTO_get_ex_data(&d->ex_data, idx);
261} 261}
262 262
263int
264DSA_security_bits(const DSA *d)
265{
266 if (d->p == NULL || d->q == NULL)
267 return -1;
268
269 return BN_security_bits(BN_num_bits(d->p), BN_num_bits(d->q));
270}
271
263#ifndef OPENSSL_NO_DH 272#ifndef OPENSSL_NO_DH
264DH * 273DH *
265DSA_dup_DH(const DSA *r) 274DSA_dup_DH(const DSA *r)