From: Richard Levitte Date: Sat, 29 Feb 2020 07:57:34 +0000 (+0100) Subject: DH: add internal dh_get_method() X-Git-Tag: openssl-3.0.0-alpha1~301 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=c518117b99bc4aad62990e8a31b7bc1dae06d16c;p=oweals%2Fopenssl.git DH: add internal dh_get_method() This should have been publically present a long time ago, to be consistent with the RSA, DSA and EC_KEY APIs. However, since we've now deprecated that kind of function for the other key types, there's no point in adding a public function, but we still need it internally. Reviewed-by: Tomas Mraz (Merged from https://github.com/openssl/openssl/pull/11193) --- diff --git a/crypto/dh/dh_lib.c b/crypto/dh/dh_lib.c index 29152dca4d..7666e77d39 100644 --- a/crypto/dh/dh_lib.c +++ b/crypto/dh/dh_lib.c @@ -45,6 +45,11 @@ int DH_set_method(DH *dh, const DH_METHOD *meth) return 1; } +const DH_METHOD *dh_get_method(const DH *dh) +{ + return dh->meth; +} + DH *DH_new(void) { return dh_new_intern(NULL, NULL); diff --git a/include/crypto/dh.h b/include/crypto/dh.h index 3af3c5222e..7c7cebdc16 100644 --- a/include/crypto/dh.h +++ b/include/crypto/dh.h @@ -23,3 +23,5 @@ int dh_get0_nid(const DH *dh); int dh_check_pub_key_partial(const DH *dh, const BIGNUM *pub_key, int *ret); int dh_check_priv_key(const DH *dh, const BIGNUM *priv_key, int *ret); int dh_check_pairwise(DH *dh); + +const DH_METHOD *dh_get_method(const DH *dh);