Ejemplo n.º 1
0
static void
test_md_generate(void *arg)
{
  routerinfo_t *ri;
  microdesc_t *md = NULL;
  (void)arg;

  ri = router_parse_entry_from_string(test_ri, NULL, 0, 0, NULL, NULL);
  tt_assert(ri);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 18);
  tt_str_op(md->body, OP_EQ, test_md_18);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 21);
  tt_str_op(md->body, OP_EQ, test_md_18);

  routerinfo_free(ri);
  ri = router_parse_entry_from_string(test_ri2, NULL, 0, 0, NULL, NULL);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 21);
  tt_str_op(md->body, OP_EQ, test_md2_21);
  tt_assert(ed25519_pubkey_eq(md->ed25519_identity_pkey,
                              &ri->cache_info.signing_key_cert->signing_key));

 done:
  microdesc_free(md);
  routerinfo_free(ri);
}
Ejemplo n.º 2
0
static void
test_md_generate(void *arg)
{
  routerinfo_t *ri;
  microdesc_t *md = NULL;
  (void)arg;

  ri = router_parse_entry_from_string(test_ri, NULL, 0, 0, NULL, NULL);
  tt_assert(ri);
  md = dirvote_create_microdescriptor(ri, 8);
  tt_str_op(md->body, OP_EQ, test_md_8);

  /* XXXX test family lines. */
  /* XXXX test method 14 for A lines. */
  /* XXXX test method 15 for P6 lines. */

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 16);
  tt_str_op(md->body, OP_EQ, test_md_16);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 18);
  tt_str_op(md->body, OP_EQ, test_md_18);

 done:
  microdesc_free(md);
  routerinfo_free(ri);
}
Ejemplo n.º 3
0
static void
test_md_generate(void *arg)
{
  routerinfo_t *ri;
  microdesc_t *md = NULL;
  (void)arg;

  ri = router_parse_entry_from_string(test_ri, NULL, 0, 0, NULL, NULL);
  tt_assert(ri);
  md = dirvote_create_microdescriptor(ri, 8);
  tt_str_op(md->body, OP_EQ, test_md_8);

  /* XXXX test family lines. */
  /* XXXX test method 14 for A lines. */
  /* XXXX test method 15 for P6 lines. */

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 16);
  tt_str_op(md->body, OP_EQ, test_md_16);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 18);
  tt_str_op(md->body, OP_EQ, test_md_18);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 21);
  tt_str_op(md->body, ==, test_md_18);

  routerinfo_free(ri);
  ri = router_parse_entry_from_string(test_ri2, NULL, 0, 0, NULL, NULL);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 18);
  tt_str_op(md->body, ==, test_md2_18);

  microdesc_free(md);
  md = NULL;
  md = dirvote_create_microdescriptor(ri, 21);
  tt_str_op(md->body, ==, test_md2_21);
  tt_assert(ed25519_pubkey_eq(md->ed25519_identity_pkey,
                              &ri->signing_key_cert->signing_key));

 done:
  microdesc_free(md);
  routerinfo_free(ri);
}