From fa34a807ea885934f65ce1aa4899138836157e6a Mon Sep 17 00:00:00 2001 From: tb <> Date: Mon, 27 Jun 2022 12:28:46 +0000 Subject: Prepare to provide DSA_security_bits() ok beck jsing --- src/lib/libcrypto/dsa/dsa.h | 5 ++++- src/lib/libcrypto/dsa/dsa_lib.c | 11 ++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') 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 @@ -/* $OpenBSD: dsa.h,v 1.35 2022/01/14 08:27:23 tb Exp $ */ +/* $OpenBSD: dsa.h,v 1.36 2022/06/27 12:28:46 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -151,6 +151,9 @@ int DSA_get_ex_new_index(long argl, void *argp, CRYPTO_EX_new *new_func, CRYPTO_EX_dup *dup_func, CRYPTO_EX_free *free_func); int DSA_set_ex_data(DSA *d, int idx, void *arg); void *DSA_get_ex_data(DSA *d, int idx); +#ifdef LIBRESSL_INTERNAL +int DSA_security_bits(const DSA *d); +#endif DSA *d2i_DSAPublicKey(DSA **a, const unsigned char **pp, long length); int 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 @@ -/* $OpenBSD: dsa_lib.c,v 1.34 2022/01/14 08:29:06 tb Exp $ */ +/* $OpenBSD: dsa_lib.c,v 1.35 2022/06/27 12:28:46 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -260,6 +260,15 @@ DSA_get_ex_data(DSA *d, int idx) return CRYPTO_get_ex_data(&d->ex_data, idx); } +int +DSA_security_bits(const DSA *d) +{ + if (d->p == NULL || d->q == NULL) + return -1; + + return BN_security_bits(BN_num_bits(d->p), BN_num_bits(d->q)); +} + #ifndef OPENSSL_NO_DH DH * DSA_dup_DH(const DSA *r) -- cgit v1.2.3-55-g6feb