diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-12-23 09:16:26 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-12-23 09:16:26 -0500 |
commit | b18f533cf06188607d444daa50974a6fc836f82d (patch) | |
tree | fe13799da98f1e1ad366c95718f8f05f381fe31b /src/common/crypto_ed25519.c | |
parent | 9a901aaa01eb3c362cc84836b54307b32f44295b (diff) | |
download | tor-b18f533cf06188607d444daa50974a6fc836f82d.tar.gz tor-b18f533cf06188607d444daa50974a6fc836f82d.zip |
Always test both ed25519 backends.
Part of #16794
Diffstat (limited to 'src/common/crypto_ed25519.c')
-rw-r--r-- | src/common/crypto_ed25519.c | 22 |
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 |