diff options
author | tb <> | 2018-02-18 14:58:12 +0000 |
---|---|---|
committer | tb <> | 2018-02-18 14:58:12 +0000 |
commit | 1b561f846b060aedbadbe38a4aef0bb347dbf2e0 (patch) | |
tree | 2f49be312f3f68a1760dd001d14bafc0a40e6123 /src/lib/libcrypto/dsa/dsa_lib.c | |
parent | 629e6de4bc68d390bb4829a7656219e3e0efeb4a (diff) | |
download | openbsd-1b561f846b060aedbadbe38a4aef0bb347dbf2e0.tar.gz openbsd-1b561f846b060aedbadbe38a4aef0bb347dbf2e0.tar.bz2 openbsd-1b561f846b060aedbadbe38a4aef0bb347dbf2e0.zip |
Provide {DH,DSA}_set0_key(). Requested by sthen.
ok jsing
Diffstat (limited to 'src/lib/libcrypto/dsa/dsa_lib.c')
-rw-r--r-- | src/lib/libcrypto/dsa/dsa_lib.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/src/lib/libcrypto/dsa/dsa_lib.c b/src/lib/libcrypto/dsa/dsa_lib.c index 2dec8567f5..772c939d31 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.25 2018/02/18 12:50:58 tb Exp $ */ | 1 | /* $OpenBSD: dsa_lib.c,v 1.26 2018/02/18 14:58:12 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 | * |
@@ -346,3 +346,21 @@ DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) | |||
346 | if (priv_key != NULL) | 346 | if (priv_key != NULL) |
347 | *priv_key = d->priv_key; | 347 | *priv_key = d->priv_key; |
348 | } | 348 | } |
349 | |||
350 | int | ||
351 | DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) | ||
352 | { | ||
353 | if (d->pub_key == NULL && pub_key == NULL) | ||
354 | return 0; | ||
355 | |||
356 | if (pub_key != NULL) { | ||
357 | BN_free(d->pub_key); | ||
358 | d->pub_key = pub_key; | ||
359 | } | ||
360 | if (priv_key != NULL) { | ||
361 | BN_free(d->priv_key); | ||
362 | d->priv_key = priv_key; | ||
363 | } | ||
364 | |||
365 | return 1; | ||
366 | } | ||