diff options
author | Nick Mathewson <nickm@torproject.org> | 2016-12-05 12:55:52 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2016-12-08 16:48:01 -0500 |
commit | 937aef48eeae4b81528de3e04b39047d0f826d9b (patch) | |
tree | f17242b74d5a121b7a5fda3fcb2b6404165bb3d1 /src/common | |
parent | a7cae7f8f7075da1856c619d141b54c56bfc5f31 (diff) | |
download | tor-937aef48eeae4b81528de3e04b39047d0f826d9b.tar.gz tor-937aef48eeae4b81528de3e04b39047d0f826d9b.zip |
Add an ed25519_copy; use it in a couple of places dgoulet suggested.
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/crypto_ed25519.c | 12 | ||||
-rw-r--r-- | src/common/crypto_ed25519.h | 3 |
2 files changed, 15 insertions, 0 deletions
diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c index 809ad12478..b7c8311475 100644 --- a/src/common/crypto_ed25519.c +++ b/src/common/crypto_ed25519.c @@ -628,6 +628,18 @@ ed25519_pubkey_eq(const ed25519_public_key_t *key1, return tor_memeq(key1->pubkey, key2->pubkey, ED25519_PUBKEY_LEN); } +/** + * Set <b>dest</b> to contain the same key as <b>src</b>. + */ +void +ed25519_pubkey_copy(ed25519_public_key_t *dest, + const ed25519_public_key_t *src) +{ + tor_assert(dest); + tor_assert(src); + memcpy(dest, src, sizeof(ed25519_public_key_t)); +} + /** Check whether the given Ed25519 implementation seems to be working. * If so, return 0; otherwise return -1. */ static int diff --git a/src/common/crypto_ed25519.h b/src/common/crypto_ed25519.h index 5d63d90d13..929b2b51dd 100644 --- a/src/common/crypto_ed25519.h +++ b/src/common/crypto_ed25519.h @@ -121,6 +121,9 @@ void ed25519_keypair_free(ed25519_keypair_t *kp); int ed25519_pubkey_eq(const ed25519_public_key_t *key1, const ed25519_public_key_t *key2); +void ed25519_pubkey_copy(ed25519_public_key_t *dest, + const ed25519_public_key_t *src); + void ed25519_set_impl_params(int use_donna); void ed25519_init(void); |