From b18f533cf06188607d444daa50974a6fc836f82d Mon Sep 17 00:00:00 2001 From: Nick Mathewson Date: Wed, 23 Dec 2015 09:16:26 -0500 Subject: Always test both ed25519 backends. Part of #16794 --- src/common/crypto_ed25519.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) (limited to 'src/common/crypto_ed25519.c') 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 seckey_out. If * extra_strong, take the RNG inputs directly from the operating -- cgit v1.2.3-54-g00ecf