Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
testing_common.c: avoid side-effects of tor_assert
Loading branch information
Showing
1 changed file
with
5 additions
and
2 deletions .
+5
−2
src/test/testing_common.c
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -165,18 +165,21 @@ static crypto_pk_t *pregen_keys[5] = {NULL, NULL, NULL, NULL, NULL};
crypto_pk_t *
pk_generate(int idx)
{
int res;
#ifdef CACHE_GENERATED_KEYS
tor_assert (idx < N_PREGEN_KEYS);
if (! pregen_keys[idx]) {
pregen_keys[idx] = crypto_pk_new ();
tor_assert (!crypto_pk_generate_key (pregen_keys[idx]));
res = crypto_pk_generate_key (pregen_keys[idx]);
tor_assert (!res);
}
return crypto_pk_dup_key (pregen_keys[idx]);
#else
crypto_pk_t *result;
(void ) idx;
result = crypto_pk_new ();
tor_assert (!crypto_pk_generate_key (result));
res = crypto_pk_generate_key (result);
tor_assert (!res);
return result;
#endif
}
Toggle all file notes
Toggle all file annotations