summaryrefslogtreecommitdiff
path: root/src/lib/libcrypto/dh/dh_lib.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/libcrypto/dh/dh_lib.c')
-rw-r--r--src/lib/libcrypto/dh/dh_lib.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/src/lib/libcrypto/dh/dh_lib.c b/src/lib/libcrypto/dh/dh_lib.c
index 5a54ca88da..31857727e2 100644
--- a/src/lib/libcrypto/dh/dh_lib.c
+++ b/src/lib/libcrypto/dh/dh_lib.c
@@ -1,4 +1,4 @@
1/* $OpenBSD: dh_lib.c,v 1.23 2018/02/17 13:47:36 tb Exp $ */ 1/* $OpenBSD: dh_lib.c,v 1.24 2018/02/18 12:51:31 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 *
@@ -251,6 +251,28 @@ DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g)
251 *g = dh->g; 251 *g = dh->g;
252} 252}
253 253
254int
255DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g)
256{
257 if ((dh->p == NULL && p == NULL) || (dh->g == NULL && g == NULL))
258 return 0;
259
260 if (p != NULL) {
261 BN_free(dh->p);
262 dh->p = p;
263 }
264 if (q != NULL) {
265 BN_free(dh->q);
266 dh->q = q;
267 }
268 if (g != NULL) {
269 BN_free(dh->g);
270 dh->g = g;
271 }
272
273 return 1;
274}
275
254void 276void
255DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) 277DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key)
256{ 278{