summaryrefslogtreecommitdiff
path: root/src/or
diff options
context:
space:
mode:
Diffstat (limited to 'src/or')
-rw-r--r--src/or/router.c8
-rw-r--r--src/or/test.c8
2 files changed, 12 insertions, 4 deletions
diff --git a/src/or/router.c b/src/or/router.c
index 37172c17ba..8211d68197 100644
--- a/src/or/router.c
+++ b/src/or/router.c
@@ -75,8 +75,8 @@ get_onion_key(void)
return onionkey;
}
-/** Store a copy of the current onion key into *<b>key</b>, and a copy
- * of the most recent onion key into *<b>last</b>.
+/** Store a full copy of the current onion key into *<b>key</b>, and a full
+ * copy of the most recent onion key into *<b>last</b>.
*/
void
dup_onion_keys(crypto_pk_env_t **key, crypto_pk_env_t **last)
@@ -85,9 +85,9 @@ dup_onion_keys(crypto_pk_env_t **key, crypto_pk_env_t **last)
tor_assert(last);
tor_mutex_acquire(key_lock);
tor_assert(onionkey);
- *key = crypto_pk_dup_key(onionkey);
+ *key = crypto_pk_copy_full(onionkey);
if (lastonionkey)
- *last = crypto_pk_dup_key(lastonionkey);
+ *last = crypto_pk_copy_full(lastonionkey);
else
*last = NULL;
tor_mutex_release(key_lock);
diff --git a/src/or/test.c b/src/or/test.c
index 050217c3a7..bac59b7834 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -740,6 +740,14 @@ test_crypto_pk(void)
test_memeq(data1,data3,j);
}
}
+
+ /* Try copy_full */
+ crypto_free_pk_env(pk2);
+ pk2 = crypto_pk_copy_full(pk1);
+ test_assert(pk2 != NULL);
+ test_neq_ptr(pk1, pk2);
+ test_assert(crypto_pk_cmp_keys(pk1,pk2) == 0);
+
done:
if (pk1)
crypto_free_pk_env(pk1);