More check-spaces fixes

This commit is contained in:
Nick Mathewson 2015-06-01 10:56:54 -04:00
parent fcc01d7caf
commit 3028507e96

View File

@ -349,44 +349,54 @@ CERTS_FAIL(already_authenticated,
CERTS_FAIL(empty, d->cell->payload_len = 0) CERTS_FAIL(empty, d->cell->payload_len = 0)
CERTS_FAIL(bad_circid, d->cell->circ_id = 1) CERTS_FAIL(bad_circid, d->cell->circ_id = 1)
CERTS_FAIL(truncated_1, d->cell->payload[0] = 5) CERTS_FAIL(truncated_1, d->cell->payload[0] = 5)
CERTS_FAIL(truncated_2, { CERTS_FAIL(truncated_2,
{
d->cell->payload_len = 4; d->cell->payload_len = 4;
memcpy(d->cell->payload, "\x01\x01\x00\x05", 4);}) memcpy(d->cell->payload, "\x01\x01\x00\x05", 4);
CERTS_FAIL(truncated_3, { })
CERTS_FAIL(truncated_3,
{
d->cell->payload_len = 7; d->cell->payload_len = 7;
memcpy(d->cell->payload, "\x01\x01\x00\x05""abc", 7);}) memcpy(d->cell->payload, "\x01\x01\x00\x05""abc", 7);
})
#define REENCODE() do { \ #define REENCODE() do { \
ssize_t n = certs_cell_encode(d->cell->payload, 4096, d->ccell); \ ssize_t n = certs_cell_encode(d->cell->payload, 4096, d->ccell); \
tt_int_op(n, >, 0); \ tt_int_op(n, >, 0); \
d->cell->payload_len = n; \ d->cell->payload_len = n; \
} while (0) } while (0)
CERTS_FAIL(not_x509, { CERTS_FAIL(not_x509,
{
certs_cell_cert_setlen_body(certs_cell_get_certs(d->ccell, 0), 3); certs_cell_cert_setlen_body(certs_cell_get_certs(d->ccell, 0), 3);
certs_cell_get_certs(d->ccell, 0)->cert_len = 3; certs_cell_get_certs(d->ccell, 0)->cert_len = 3;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(both_link, { CERTS_FAIL(both_link,
{
certs_cell_get_certs(d->ccell, 0)->cert_type = 1; certs_cell_get_certs(d->ccell, 0)->cert_type = 1;
certs_cell_get_certs(d->ccell, 1)->cert_type = 1; certs_cell_get_certs(d->ccell, 1)->cert_type = 1;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(both_id_rsa, { CERTS_FAIL(both_id_rsa,
{
certs_cell_get_certs(d->ccell, 0)->cert_type = 2; certs_cell_get_certs(d->ccell, 0)->cert_type = 2;
certs_cell_get_certs(d->ccell, 1)->cert_type = 2; certs_cell_get_certs(d->ccell, 1)->cert_type = 2;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(both_auth, { CERTS_FAIL(both_auth,
{
certs_cell_get_certs(d->ccell, 0)->cert_type = 3; certs_cell_get_certs(d->ccell, 0)->cert_type = 3;
certs_cell_get_certs(d->ccell, 1)->cert_type = 3; certs_cell_get_certs(d->ccell, 1)->cert_type = 3;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(wrong_labels_1, { CERTS_FAIL(wrong_labels_1,
{
certs_cell_get_certs(d->ccell, 0)->cert_type = 2; certs_cell_get_certs(d->ccell, 0)->cert_type = 2;
certs_cell_get_certs(d->ccell, 1)->cert_type = 1; certs_cell_get_certs(d->ccell, 1)->cert_type = 1;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(wrong_labels_2, { CERTS_FAIL(wrong_labels_2,
{
const tor_x509_cert_t *a; const tor_x509_cert_t *a;
const tor_x509_cert_t *b; const tor_x509_cert_t *b;
const uint8_t *enca; const uint8_t *enca;
@ -399,15 +409,18 @@ CERTS_FAIL(wrong_labels_2, {
certs_cell_get_certs(d->ccell, 1)->cert_len = lena; certs_cell_get_certs(d->ccell, 1)->cert_len = lena;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(wrong_labels_3, { CERTS_FAIL(wrong_labels_3,
{
certs_cell_get_certs(d->ccell, 0)->cert_type = 2; certs_cell_get_certs(d->ccell, 0)->cert_type = 2;
certs_cell_get_certs(d->ccell, 1)->cert_type = 3; certs_cell_get_certs(d->ccell, 1)->cert_type = 3;
REENCODE(); REENCODE();
}) })
CERTS_FAIL(server_missing_certs, { CERTS_FAIL(server_missing_certs,
{
d->c->handshake_state->started_here = 0; d->c->handshake_state->started_here = 0;
}) })
CERTS_FAIL(server_wrong_labels_1, { CERTS_FAIL(server_wrong_labels_1,
{
d->c->handshake_state->started_here = 0; d->c->handshake_state->started_here = 0;
certs_cell_get_certs(d->ccell, 0)->cert_type = 2; certs_cell_get_certs(d->ccell, 0)->cert_type = 2;
certs_cell_get_certs(d->ccell, 1)->cert_type = 3; certs_cell_get_certs(d->ccell, 1)->cert_type = 3;