diff options
author | 2018-02-18 14:58:12 +0000 | |
---|---|---|
committer | 2018-02-18 14:58:12 +0000 | |
commit | 1cdc303d4b8c1495368c126c56f78cf047e8c7d5 (patch) | |
tree | 01d2bf95b81de194db3808d1a1399c026a0af40e /lib/libcrypto/dsa/dsa_lib.c | |
parent | Inline hw_{get,set}curcpu() to streamline the machine code. (diff) | |
download | wireguard-openbsd-1cdc303d4b8c1495368c126c56f78cf047e8c7d5.tar.xz wireguard-openbsd-1cdc303d4b8c1495368c126c56f78cf047e8c7d5.zip |
Provide {DH,DSA}_set0_key(). Requested by sthen.
ok jsing
Diffstat (limited to 'lib/libcrypto/dsa/dsa_lib.c')
-rw-r--r-- | lib/libcrypto/dsa/dsa_lib.c | 20 |
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/libcrypto/dsa/dsa_lib.c b/lib/libcrypto/dsa/dsa_lib.c index 2dec8567f5d..772c939d314 100644 --- a/lib/libcrypto/dsa/dsa_lib.c +++ b/lib/libcrypto/dsa/dsa_lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dsa_lib.c,v 1.25 2018/02/18 12:50:58 tb Exp $ */ +/* $OpenBSD: dsa_lib.c,v 1.26 2018/02/18 14:58:12 tb Exp $ */ /* Copyright (C) 1995-1998 Eric Young (eay@cryptsoft.com) * All rights reserved. * @@ -346,3 +346,21 @@ DSA_get0_key(const DSA *d, const BIGNUM **pub_key, const BIGNUM **priv_key) if (priv_key != NULL) *priv_key = d->priv_key; } + +int +DSA_set0_key(DSA *d, BIGNUM *pub_key, BIGNUM *priv_key) +{ + if (d->pub_key == NULL && pub_key == NULL) + return 0; + + if (pub_key != NULL) { + BN_free(d->pub_key); + d->pub_key = pub_key; + } + if (priv_key != NULL) { + BN_free(d->priv_key); + d->priv_key = priv_key; + } + + return 1; +} |