aboutsummaryrefslogtreecommitdiff
path: root/src/test
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2020-04-13 14:14:41 -0400
committerNick Mathewson <nickm@torproject.org>2020-04-13 14:14:41 -0400
commite22a8d9c956f838138a7e5bc0714b1bb99f0e2a5 (patch)
tree158c80ae7e12fbb09e8bbff3f0ae5eb4a7691a46 /src/test
parent80031db32abebaf4d0a91c01db258fcdbd54a471 (diff)
parent55cb6c3fcdbeac31a88bcc62c0dbe5ded4605176 (diff)
downloadtor-e22a8d9c956f838138a7e5bc0714b1bb99f0e2a5.tar.gz
tor-e22a8d9c956f838138a7e5bc0714b1bb99f0e2a5.zip
Merge branch 'maint-0.4.3'
Diffstat (limited to 'src/test')
-rw-r--r--src/test/test_hs_client.c4
-rw-r--r--src/test/test_hs_control.c14
2 files changed, 18 insertions, 0 deletions
diff --git a/src/test/test_hs_client.c b/src/test/test_hs_client.c
index 0cd9e71fda..ae5cc5ed84 100644
--- a/src/test/test_hs_client.c
+++ b/src/test/test_hs_client.c
@@ -733,6 +733,10 @@ test_parse_auth_file_content(void *arg)
/* Bigger key than it should be */
tt_assert(!parse_auth_file_content("xx:descriptor:x25519:"
"vjqea4jbhwwc4hto7ekyvqfbeodghbaq6nxi45hz4wr3qvhqv3yqa"));
+ /* All-zeroes key */
+ tt_assert(!parse_auth_file_content("xx:descriptor:x25519:"
+ "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"));
+
done:
tor_free(auth);
}
diff --git a/src/test/test_hs_control.c b/src/test/test_hs_control.c
index 9277711d2a..8ba9f1173c 100644
--- a/src/test/test_hs_control.c
+++ b/src/test/test_hs_control.c
@@ -467,6 +467,20 @@ test_hs_control_bad_onion_client_auth_add(void *arg)
cp1 = buf_get_contents(TO_CONN(&conn)->outbuf, &sz);
tt_str_op(cp1, OP_EQ, "512 Failed to decode x25519 private key\r\n");
+ tor_free(cp1);
+ tor_free(args);
+
+ /* Register with an all zero client key */
+ args = tor_strdup("jt4grrjwzyz3pjkylwfau5xnjaj23vxmhskqaeyfhrfylelw4hvxcuyd "
+ "x25519:AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA=");
+ retval = handle_control_command(&conn, (uint32_t) strlen(args), args);
+ tt_int_op(retval, OP_EQ, 0);
+
+ /* Check contents */
+ cp1 = buf_get_contents(TO_CONN(&conn)->outbuf, &sz);
+ tt_str_op(cp1, OP_EQ, "553 Invalid private key \"AAAAAAAAAAAAAAAAAAAA"
+ "AAAAAAAAAAAAAAAAAAAAAAA=\"\r\n");
+
client_auths = get_hs_client_auths_map();
tt_assert(!client_auths);