diff options
author | tb <> | 2018-02-18 12:50:58 +0000 |
---|---|---|
committer | tb <> | 2018-02-18 12:50:58 +0000 |
commit | 2a27603f6a635b8a02be8bda599074b176b80ef1 (patch) | |
tree | 9b14e108d8ba5079d1e4a1b596ca47a3161c7ac3 /src | |
parent | fa6725b9ce9568ca287e1b6dab2f3ac79ad18bb5 (diff) | |
download | openbsd-2a27603f6a635b8a02be8bda599074b176b80ef1.tar.gz openbsd-2a27603f6a635b8a02be8bda599074b176b80ef1.tar.bz2 openbsd-2a27603f6a635b8a02be8bda599074b176b80ef1.zip |
Provide DSA_set0_pqg.
ok jsing
Diffstat (limited to 'src')
-rw-r--r-- | src/lib/libcrypto/Symbols.list | 1 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa.h | 3 | ||||
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_lib.c | 25 |
3 files changed, 27 insertions, 2 deletions
diff --git a/src/lib/libcrypto/Symbols.list b/src/lib/libcrypto/Symbols.list index aeafb88492..79b2e946dc 100644 --- a/src/lib/libcrypto/Symbols.list +++ b/src/lib/libcrypto/Symbols.list | |||
@@ -795,6 +795,7 @@ DSA_new | |||
795 | DSA_new_method | 795 | DSA_new_method |
796 | DSA_print | 796 | DSA_print |
797 | DSA_print_fp | 797 | DSA_print_fp |
798 | DSA_set0_pqg | ||
798 | DSA_set_default_method | 799 | DSA_set_default_method |
799 | DSA_set_ex_data | 800 | DSA_set_ex_data |
800 | DSA_set_method | 801 | DSA_set_method |
diff --git a/src/lib/libcrypto/dsa/dsa.h b/src/lib/libcrypto/dsa/dsa.h index 608c15df6b..21e5baa235 100644 --- a/src/lib/libcrypto/dsa/dsa.h +++ b/src/lib/libcrypto/dsa/dsa.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa.h,v 1.24 2018/02/17 14:35:40 jsing Exp $ */ | 1 | /* $OpenBSD: dsa.h,v 1.25 2018/02/18 12:50:58 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 | * |
@@ -259,6 +259,7 @@ DH *DSA_dup_DH(const DSA *r); | |||
259 | 259 | ||
260 | void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, | 260 | void DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, |
261 | const BIGNUM **g); | 261 | const BIGNUM **g); |
262 | int DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g); | ||
262 | void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key); | 263 | void DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key); |
263 | 264 | ||
264 | #define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ | 265 | #define EVP_PKEY_CTX_set_dsa_paramgen_bits(ctx, nbits) \ |
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index ae9155c9f8..2dec8567f5 100644 --- a/src/lib/libcrypto/dsa/dsa_lib.c +++ b/src/lib/libcrypto/dsa/dsa_lib.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* $OpenBSD: dsa_lib.c,v 1.24 2018/02/17 13:47:36 tb Exp $ */ | 1 | /* $OpenBSD: dsa_lib.c,v 1.25 2018/02/18 12:50:58 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 | * |
@@ -315,6 +315,29 @@ DSA_get0_pqg(const DSA *d, const BIGNUM **p, const BIGNUM **q, const BIGNUM **g) | |||
315 | *g = d->g; | 315 | *g = d->g; |
316 | } | 316 | } |
317 | 317 | ||
318 | int | ||
319 | DSA_set0_pqg(DSA *d, BIGNUM *p, BIGNUM *q, BIGNUM *g) | ||
320 | { | ||
321 | if ((d->p == NULL && p == NULL) || (d->q == NULL && q == NULL) || | ||
322 | (d->g == NULL && g == NULL)) | ||
323 | return 0; | ||
324 | |||
325 | if (p != NULL) { | ||
326 | BN_free(d->p); | ||
327 | d->p = p; | ||
328 | } | ||
329 | if (q != NULL) { | ||
330 | BN_free(d->q); | ||
331 | d->q = q; | ||
332 | } | ||
333 | if (g != NULL) { | ||
334 | BN_free(d->g); | ||
335 | d->g = g; | ||
336 | } | ||
337 | |||
338 | return 1; | ||
339 | } | ||
340 | |||
318 | void | 341 | void |
319 | DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) | 342 | DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) |
320 | { | 343 | { |