diff options
author | Tom van der Woerdt <info@tvdw.eu> | 2015-03-08 19:20:56 +0100 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-03-09 11:10:58 -0400 |
commit | d39ede7f202b931506c1126b63665eaed4676abf (patch) | |
tree | 663717183276a144ca670863b6210972d5a2f5f9 /src/test | |
parent | a7f75b2056b8bdf59d064268c53a10ac46972380 (diff) | |
download | tor-d39ede7f202b931506c1126b63665eaed4676abf.tar.gz tor-d39ede7f202b931506c1126b63665eaed4676abf.zip |
testing_common.c: avoid side-effects of tor_assert
Diffstat (limited to 'src/test')
-rw-r--r-- | src/test/testing_common.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/test/testing_common.c b/src/test/testing_common.c index d7d6dacee6..403c83bdd2 100644 --- a/src/test/testing_common.c +++ b/src/test/testing_common.c @@ -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 } |