diff options
Diffstat (limited to 'src/test/test_crypto.c')
-rw-r--r-- | src/test/test_crypto.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c index dd9a3765f6..e981eac602 100644 --- a/src/test/test_crypto.c +++ b/src/test/test_crypto.c @@ -58,7 +58,6 @@ test_crypto_dh(void *arg) tt_int_op(s1len,OP_EQ, s2len); tt_mem_op(s1,OP_EQ, s2, s1len); - /* test dh_dup; make sure it works the same. */ dh1_dup = crypto_dh_dup(dh1); s1len = crypto_dh_compute_secret(LOG_WARN, dh1_dup, p2, DH_BYTES, s1, 50); @@ -132,6 +131,19 @@ test_crypto_dh(void *arg) tt_int_op(-1, OP_EQ, s1len); } + { + /* provoke an error in the openssl DH_compute_key function; make sure we + * survive. */ + tt_assert(! crypto_dh_get_public(dh1, p1, DH_BYTES)); + + crypto_dh_free(dh2); + dh2= crypto_dh_new(DH_TYPE_CIRCUIT); /* no private key set */ + s1len = crypto_dh_compute_secret(LOG_WARN, dh2, + p1, DH_BYTES, + s1, 50); + tt_int_op(s1len, OP_EQ, -1); + } + done: crypto_dh_free(dh1); crypto_dh_free(dh2); |