Add DSA_bits and DH_bits. More OpenSSL compatibility functions. Change-Id: I8e9429fcbc3e285f4c4ad9bdf4c1d9d3c73c3064 Reviewed-on: https://boringssl-review.googlesource.com/c/boringssl/+/53925 Commit-Queue: David Benjamin <davidben@google.com> Auto-Submit: David Benjamin <davidben@google.com> Reviewed-by: Adam Langley <agl@google.com> Commit-Queue: Adam Langley <agl@google.com>
diff --git a/crypto/dsa/dsa.c b/crypto/dsa/dsa.c index 8e77ea3..b8e4653 100644 --- a/crypto/dsa/dsa.c +++ b/crypto/dsa/dsa.c
@@ -130,6 +130,8 @@ return 1; } +unsigned DSA_bits(const DSA *dsa) { return BN_num_bits(dsa->p); } + const BIGNUM *DSA_get0_pub_key(const DSA *dsa) { return dsa->pub_key; } const BIGNUM *DSA_get0_priv_key(const DSA *dsa) { return dsa->priv_key; }
diff --git a/crypto/fipsmodule/dh/dh.c b/crypto/fipsmodule/dh/dh.c index 8b04117..31eaff4 100644 --- a/crypto/fipsmodule/dh/dh.c +++ b/crypto/fipsmodule/dh/dh.c
@@ -111,6 +111,8 @@ OPENSSL_free(dh); } +unsigned DH_bits(const DH *dh) { return BN_num_bits(dh->p); } + const BIGNUM *DH_get0_pub_key(const DH *dh) { return dh->pub_key; } const BIGNUM *DH_get0_priv_key(const DH *dh) { return dh->priv_key; }
diff --git a/include/openssl/dh.h b/include/openssl/dh.h index 21c9623..20f2827 100644 --- a/include/openssl/dh.h +++ b/include/openssl/dh.h
@@ -89,6 +89,9 @@ // Properties. +// DH_bits returns the size of |dh|'s group modulus, in bits. +OPENSSL_EXPORT unsigned DH_bits(const DH *dh); + // DH_get0_pub_key returns |dh|'s public key. OPENSSL_EXPORT const BIGNUM *DH_get0_pub_key(const DH *dh);
diff --git a/include/openssl/dsa.h b/include/openssl/dsa.h index e6ddce6..7f10e54 100644 --- a/include/openssl/dsa.h +++ b/include/openssl/dsa.h
@@ -94,6 +94,9 @@ // Properties. +// DSA_bits returns the size of |dsa|'s group modulus, in bits. +OPENSSL_EXPORT unsigned DSA_bits(const DSA *dsa); + // DSA_get0_pub_key returns |dsa|'s public key. OPENSSL_EXPORT const BIGNUM *DSA_get0_pub_key(const DSA *dsa);