aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2012-09-17 10:34:08 -0400
committerNick Mathewson <nickm@torproject.org>2012-09-17 11:04:56 -0400
commit757b3b259eba27881a8b5616ba45d42798c1ade8 (patch)
treecbd56b1f6e95bbf79dce9bdfe0b02eba0dd63fac /src
parentcd884c764b2e8c5b1127829706de59a71b362b4c (diff)
downloadtor-757b3b259eba27881a8b5616ba45d42798c1ade8.tar
tor-757b3b259eba27881a8b5616ba45d42798c1ade8.tar.gz
Add unit test for crypto_pk_cmp_keys and NULL
Diffstat (limited to 'src')
-rw-r--r--src/test/test_crypto.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/test_crypto.c b/src/test/test_crypto.c
index 7f4347a41..fd983de00 100644
--- a/src/test/test_crypto.c
+++ b/src/test/test_crypto.c
@@ -427,6 +427,11 @@ test_crypto_pk(void)
test_assert(! crypto_pk_read_public_key_from_string(pk2, encoded, size));
test_eq(0, crypto_pk_cmp_keys(pk1, pk2));
+ /* comparison between keys and NULL */
+ tt_int_op(crypto_pk_cmp_keys(NULL, pk1), <, 0);
+ tt_int_op(crypto_pk_cmp_keys(NULL, NULL), ==, 0);
+ tt_int_op(crypto_pk_cmp_keys(pk1, NULL), >, 0);
+
test_eq(128, crypto_pk_keysize(pk1));
test_eq(1024, crypto_pk_num_bits(pk1));
test_eq(128, crypto_pk_keysize(pk2));