diff options
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 1 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh.h | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/dh/dh_lib.c | 24 |
3 files changed, 26 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index 79b2e946dc..ab4c8593d7 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -751,6 +751,7 @@ DH_get_ex_data | |||
751 | DH_get_ex_new_index | 751 | DH_get_ex_new_index |
752 | DH_new | 752 | DH_new |
753 | DH_new_method | 753 | DH_new_method |
754 | DH_set0_pqg | ||
754 | DH_set_default_method | 755 | DH_set_default_method |
755 | DH_set_ex_data | 756 | DH_set_ex_data |
756 | DH_set_method | 757 | DH_set_method |
diff --git a/src/lib/libcrypto/dh/dh.h b/src/lib/libcrypto/dh/dh.h index 61c7d6c873..e5daa2cbdd 100644 --- a/src/lib/libcrypto/dh/dh.h +++ b/src/lib/libcrypto/dh/dh.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dh.h,v 1.19 2018/02/17 13:47:36 tb Exp $ */ | 1 | /* $OpenBSD: dh.h,v 1.20 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 | * |
@@ -190,6 +190,7 @@ void *DH_get_ex_data(DH *d, int idx); | |||
190 | 190 | ||
191 | void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, | 191 | void DH_get0_pqg(const DH *dh, const BIGNUM **p, const BIGNUM **q, |
192 | const BIGNUM **g); | 192 | const BIGNUM **g); |
193 | int DH_set0_pqg(DH *dh, BIGNUM *p, BIGNUM *q, BIGNUM *g); | ||
193 | void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); | 194 | void DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key); |
194 | 195 | ||
195 | /* Deprecated version */ | 196 | /* Deprecated version */ |
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 | ||
254 | int | ||
255 | DH_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 | |||
254 | void | 276 | void |
255 | DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) | 277 | DH_get0_key(const DH *dh, const BIGNUM **pub_key, const BIGNUM **priv_key) |
256 | { | 278 | { |