From b86fb16a7f2ecb74d2fd9c11640ea10f44a18497 Mon Sep 17 00:00:00 2001 From: tb <> Date: Wed, 5 Jan 2022 20:30:16 +0000 Subject: Prepare to provide DH_get0_{p,q,g,{priv,pub}_key}() These are accessors that allow getting one specific DH member. They are less error prone than the current getters DH_get0_{pqg,key}(). They are used by many ports and will also be used in base for this reason. Who can remember whether the pub_key or the priv_key goes first in DH_get0_key()? ok inoguchi jsing --- src/lib/libcrypto/dh/dh_lib.c | 32 +++++++++++++++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) (limited to 'src/lib/libcrypto/dh/dh_lib.c') diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c index a66ed1f5bf..58f01b6e6a 100644 --- a/src/lib/libcrypto/dh/dh_lib.c +++ b/src/lib/libcrypto/dh/dh_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dh_lib.c,v 1.33 2021/11/23 09:53:45 tb Exp $ */ +/* $OpenBSD: dh_lib.c,v 1.34 2022/01/05 20:30:16 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -307,6 +307,36 @@ DH_set0_key(DH *dh, BIGNUM *pub_key, BIGNUM *priv_key) return 1; } +const BIGNUM * +DH_get0_p(const DH *dh) +{ + return dh->p; +} + +const BIGNUM * +DH_get0_q(const DH *dh) +{ + return dh->q; +} + +const BIGNUM * +DH_get0_g(const DH *dh) +{ + return dh->g; +} + +const BIGNUM * +DH_get0_priv_key(const DH *dh) +{ + return dh->priv_key; +} + +const BIGNUM * +DH_get0_pub_key(const DH *dh) +{ + return dh->pub_key; +} + void DH_clear_flags(DH *dh, int flags) { -- cgit v1.2.3-55-g6feb