aboutsummaryrefslogtreecommitdiff
path: root/src/common/crypto_ed25519.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2016-01-08 14:54:51 -0800
committerNick Mathewson <nickm@torproject.org>2016-01-08 14:54:51 -0800
commita1019b82c1e26f0fb925bfc9ae55d213be579a90 (patch)
tree4a595469fef3f11f37aa733f155d5206e6af7e0d /src/common/crypto_ed25519.c
parent4c10a9c445e825886c658d67f5e44fdae37ffea3 (diff)
parent63658598250a906346d260c70678700e22c0fe01 (diff)
downloadtor-a1019b82c1e26f0fb925bfc9ae55d213be579a90.tar.gz
tor-a1019b82c1e26f0fb925bfc9ae55d213be579a90.zip
Merge remote-tracking branch 'public/feature16794_more'
Diffstat (limited to 'src/common/crypto_ed25519.c')
-rw-r--r--src/common/crypto_ed25519.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/common/crypto_ed25519.c b/src/common/crypto_ed25519.c
index 41ec486f0a..9df665f66a 100644
--- a/src/common/crypto_ed25519.c
+++ b/src/common/crypto_ed25519.c
@@ -96,6 +96,28 @@ get_ed_impl(void)
return ed25519_impl;
}
+#ifdef TOR_UNIT_TESTS
+static const ed25519_impl_t *saved_ed25519_impl = NULL;
+void
+crypto_ed25519_testing_force_impl(const char *name)
+{
+ tor_assert(saved_ed25519_impl == NULL);
+ saved_ed25519_impl = ed25519_impl;
+ if (! strcmp(name, "donna")) {
+ ed25519_impl = &impl_donna;
+ } else {
+ tor_assert(!strcmp(name, "ref10"));
+ ed25519_impl = &impl_ref10;
+ }
+}
+void
+crypto_ed25519_testing_restore_impl(void)
+{
+ ed25519_impl = saved_ed25519_impl;
+ saved_ed25519_impl = NULL;
+}
+#endif
+
/**
* Initialize a new ed25519 secret key in <b>seckey_out</b>. If
* <b>extra_strong</b>, take the RNG inputs directly from the operating