summaryrefslogtreecommitdiff
path: root/src/or/test.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2008-12-12 18:31:39 +0000
committerNick Mathewson <nickm@torproject.org>2008-12-12 18:31:39 +0000
commit69ce955484f69eb43dcdc60ecce182267255aabd (patch)
tree0dd0b4c1b35b754c7e63d7f713cdd9ef0acb5a98 /src/or/test.c
parent6c2dbc56bf185f8e36d6f597839ac960f4bb4fee (diff)
downloadtor-69ce955484f69eb43dcdc60ecce182267255aabd.tar.gz
tor-69ce955484f69eb43dcdc60ecce182267255aabd.zip
Add cross-certification to authority key certificates. Partial implementation of proposal 157.
svn:r17610
Diffstat (limited to 'src/or/test.c')
-rw-r--r--src/or/test.c21
1 files changed, 12 insertions, 9 deletions
diff --git a/src/or/test.c b/src/or/test.c
index 87d866a43f..6d3eba1963 100644
--- a/src/or/test.c
+++ b/src/or/test.c
@@ -3084,6 +3084,7 @@ test_v3_networkstatus(void)
/* Parse certificates and keys. */
cert1 = authority_cert_parse_from_string(AUTHORITY_CERT_1, NULL);
test_assert(cert1);
+ test_assert(cert1->is_cross_certified);
cert2 = authority_cert_parse_from_string(AUTHORITY_CERT_2, NULL);
test_assert(cert2);
cert3 = authority_cert_parse_from_string(AUTHORITY_CERT_3, NULL);
@@ -3360,15 +3361,15 @@ test_v3_networkstatus(void)
test_eq(4, smartlist_len(con->voters)); /*3 voters, 1 legacy key.*/
/* The voter id digests should be in this order. */
test_assert(memcmp(cert2->cache_info.identity_digest,
- cert3->cache_info.identity_digest,DIGEST_LEN)<0);
- test_assert(memcmp(cert3->cache_info.identity_digest,
cert1->cache_info.identity_digest,DIGEST_LEN)<0);
+ test_assert(memcmp(cert1->cache_info.identity_digest,
+ cert3->cache_info.identity_digest,DIGEST_LEN)<0);
test_same_voter(smartlist_get(con->voters, 1),
smartlist_get(v2->voters, 0));
test_same_voter(smartlist_get(con->voters, 2),
- smartlist_get(v3->voters, 0));
- test_same_voter(smartlist_get(con->voters, 3),
smartlist_get(v1->voters, 0));
+ test_same_voter(smartlist_get(con->voters, 3),
+ smartlist_get(v3->voters, 0));
test_assert(!con->cert);
test_eq(2, smartlist_len(con->routerstatus_list));
@@ -3412,20 +3413,22 @@ test_v3_networkstatus(void)
test_assert(rs->is_valid);
test_assert(!rs->is_named);
/* XXXX check version */
+ // x231
+ // x213
- /* Check signatures. the first voter is pseudo. The second one hasn't
- signed. The third one has signed: validate it. */
+ /* Check signatures. the first voter is a pseudo-entry with a legacy key.
+ * The second one hasn't signed. The fourth one has signed: validate it. */
voter = smartlist_get(con->voters, 1);
test_assert(!voter->signature);
test_assert(!voter->good_signature);
test_assert(!voter->bad_signature);
- voter = smartlist_get(con->voters, 2);
+ voter = smartlist_get(con->voters, 3);
test_assert(voter->signature);
test_assert(!voter->good_signature);
test_assert(!voter->bad_signature);
test_assert(!networkstatus_check_voter_signature(con,
- smartlist_get(con->voters, 2),
+ smartlist_get(con->voters, 3),
cert3));
test_assert(voter->signature);
test_assert(voter->good_signature);
@@ -3503,7 +3506,7 @@ test_v3_networkstatus(void)
smartlist_get(con->voters, 1),
cert2));
test_assert(!networkstatus_check_voter_signature(con,
- smartlist_get(con->voters, 3),
+ smartlist_get(con->voters, 2),
cert1));
}