diff options
author | Nick Mathewson <nickm@torproject.org> | 2015-11-10 10:40:31 -0500 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2015-11-10 10:40:31 -0500 |
commit | 0a3eed5f204dc9759e5001c7cf2bb448015d6891 (patch) | |
tree | ed07216a1fae8ac2774e10b12f681715d2d4ff75 /src/test/test_tortls.c | |
parent | 0d5a439292a7837033afb733221b1f3b1f641b5f (diff) | |
parent | 05c34b3330349bbb1311e2366e7593993f1de6d7 (diff) | |
download | tor-0a3eed5f204dc9759e5001c7cf2bb448015d6891.tar.gz tor-0a3eed5f204dc9759e5001c7cf2bb448015d6891.zip |
Merge branch 'bug17549'
Diffstat (limited to 'src/test/test_tortls.c')
-rw-r--r-- | src/test/test_tortls.c | 24 |
1 files changed, 13 insertions, 11 deletions
diff --git a/src/test/test_tortls.c b/src/test/test_tortls.c index fd3d50cf7e..dceecf49ab 100644 --- a/src/test/test_tortls.c +++ b/src/test/test_tortls.c @@ -56,6 +56,9 @@ extern tor_tls_context_t *client_tls_context; #if OPENSSL_VERSION_NUMBER >= OPENSSL_V_SERIES(1,1,0) \ && !defined(LIBRESSL_VERSION_NUMBER) #define OPENSSL_OPAQUE +#define SSL_STATE_STR "before SSL initialization" +#else +#define SSL_STATE_STR "before/accept initialization" #endif #ifndef OPENSSL_OPAQUE @@ -131,7 +134,6 @@ test_tortls_tor_tls_new(void *data) MOCK(tor_tls_cert_matches_key, mock_tls_cert_matches_key); crypto_pk_t *key1 = NULL, *key2 = NULL; SSL_METHOD *method = NULL; - SSL_CTX *ctx = NULL; key1 = pk_generate(2); key2 = pk_generate(3); @@ -149,7 +151,7 @@ test_tortls_tor_tls_new(void *data) #ifndef OPENSSL_OPAQUE method = give_me_a_test_method(); - ctx = SSL_CTX_new(method); + SSL_CTX *ctx = SSL_CTX_new(method); method->num_ciphers = fake_num_ciphers; client_tls_context->ctx = ctx; tls = tor_tls_new(-1, 0); @@ -237,35 +239,35 @@ test_tortls_get_state_description(void *ignored) tls->ssl = SSL_new(ctx); tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in HANDSHAKE"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in HANDSHAKE"); tls->state = TOR_TLS_ST_OPEN; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in OPEN"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in OPEN"); tls->state = TOR_TLS_ST_GOTCLOSE; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in GOTCLOSE"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in GOTCLOSE"); tls->state = TOR_TLS_ST_SENTCLOSE; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in SENTCLOSE"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in SENTCLOSE"); tls->state = TOR_TLS_ST_CLOSED; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in CLOSED"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in CLOSED"); tls->state = TOR_TLS_ST_RENEGOTIATE; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in RENEGOTIATE"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in RENEGOTIATE"); tls->state = TOR_TLS_ST_BUFFEREVENT; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR); tls->state = 7; tor_tls_get_state_description(tls, buf, 200); - tt_str_op(buf, OP_EQ, "before/accept initialization in unknown TLS state"); + tt_str_op(buf, OP_EQ, SSL_STATE_STR " in unknown TLS state"); done: SSL_CTX_free(ctx); @@ -414,7 +416,7 @@ test_tortls_log_one_error(void *ignored) tor_tls_log_one_error(tls, 0, LOG_WARN, 0, NULL); tt_int_op(mock_saved_log_number(), OP_EQ, 1); tt_str_op(mock_saved_log_at(0), OP_EQ, "TLS error with 127.hello: (null)" - " (in (null):(null):before/accept initialization)\n"); + " (in (null):(null):" SSL_STATE_STR ")\n"); done: teardown_capture_of_logs(previous_log); |