mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-12-06 19:41:15 +01:00
Chop another ~93 RSA key generations out of the unit tests
We have a mock for our RSA key generation function, so we now wire it to pk_generate(). This covers all the cases that were not using pk_generate() before -- all ~93 of them.
This commit is contained in:
@@ -984,6 +984,20 @@ crypto_pk_dup_key(crypto_pk_t *env)
|
||||
return env;
|
||||
}
|
||||
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
/** For testing: replace dest with src. (Dest must have a refcount
|
||||
* of 1) */
|
||||
void
|
||||
crypto_pk_assign_(crypto_pk_t *dest, const crypto_pk_t *src)
|
||||
{
|
||||
tor_assert(dest);
|
||||
tor_assert(dest->refs == 1);
|
||||
tor_assert(src);
|
||||
RSA_free(dest->key);
|
||||
dest->key = RSAPrivateKey_dup(src->key);
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Make a real honest-to-goodness copy of <b>env</b>, and return it.
|
||||
* Returns NULL on failure. */
|
||||
crypto_pk_t *
|
||||
|
||||
@@ -326,5 +326,9 @@ extern int break_strongest_rng_fallback;
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef TOR_UNIT_TESTS
|
||||
void crypto_pk_assign_(crypto_pk_t *dest, const crypto_pk_t *src);
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
Reference in New Issue
Block a user