diff options
Diffstat (limited to 'crypto/openssl/test/sslcorrupttest.c')
| -rw-r--r-- | crypto/openssl/test/sslcorrupttest.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/crypto/openssl/test/sslcorrupttest.c b/crypto/openssl/test/sslcorrupttest.c index 50c3bf7eebae..dedb8c1029d8 100644 --- a/crypto/openssl/test/sslcorrupttest.c +++ b/crypto/openssl/test/sslcorrupttest.c @@ -44,7 +44,7 @@ static int tls_corrupt_write(BIO *bio, const char *in, int inl) if (!TEST_ptr(copy = OPENSSL_memdup(in, inl))) return 0; /* corrupt last bit of application data */ - copy[inl-1] ^= 1; + copy[inl - 1] ^= 1; ret = BIO_write(next, copy, inl); OPENSSL_free(copy); } else { @@ -100,7 +100,7 @@ static int tls_corrupt_free(BIO *bio) return 1; } -#define BIO_TYPE_CUSTOM_FILTER (0x80 | BIO_TYPE_FILTER) +#define BIO_TYPE_CUSTOM_FILTER (0x80 | BIO_TYPE_FILTER) static BIO_METHOD *method_tls_corrupt = NULL; @@ -109,7 +109,7 @@ static const BIO_METHOD *bio_f_tls_corrupt_filter(void) { if (method_tls_corrupt == NULL) { method_tls_corrupt = BIO_meth_new(BIO_TYPE_CUSTOM_FILTER, - "TLS corrupt filter"); + "TLS corrupt filter"); if (method_tls_corrupt == NULL || !BIO_meth_set_write(method_tls_corrupt, tls_corrupt_write) || !BIO_meth_set_read(method_tls_corrupt, tls_corrupt_read) @@ -145,8 +145,8 @@ static int setup_cipher_list(void) int i, j, numciphers = 0; if (!TEST_ptr(ctx = SSL_CTX_new(TLS_server_method())) - || !TEST_ptr(ssl = SSL_new(ctx)) - || !TEST_ptr(sk_ciphers = SSL_get1_supported_ciphers(ssl))) + || !TEST_ptr(ssl = SSL_new(ctx)) + || !TEST_ptr(sk_ciphers = SSL_get1_supported_ciphers(ssl))) goto err; /* @@ -154,8 +154,7 @@ static int setup_cipher_list(void) * so that some of the allocated space will be wasted, but the loss * is deemed acceptable... */ - cipher_list = OPENSSL_malloc(sk_SSL_CIPHER_num(sk_ciphers) * - sizeof(cipher_list[0])); + cipher_list = OPENSSL_malloc(sk_SSL_CIPHER_num(sk_ciphers) * sizeof(cipher_list[0])); if (!TEST_ptr(cipher_list)) goto err; @@ -195,17 +194,17 @@ static int test_ssl_corrupt(int testidx) TEST_info("Starting #%d, %s", testidx, cipher_list[testidx]); if (!TEST_true(create_ssl_ctx_pair(NULL, TLS_server_method(), - TLS_client_method(), - TLS1_VERSION, 0, - &sctx, &cctx, cert, privkey))) + TLS_client_method(), + TLS1_VERSION, 0, + &sctx, &cctx, cert, privkey))) return 0; if (!TEST_true(SSL_CTX_set_dh_auto(sctx, 1)) - || !TEST_true(SSL_CTX_set_cipher_list(cctx, cipher_list[testidx])) - || !TEST_true(SSL_CTX_set_ciphersuites(cctx, "")) - || !TEST_ptr(ciphers = SSL_CTX_get_ciphers(cctx)) - || !TEST_int_eq(sk_SSL_CIPHER_num(ciphers), 1) - || !TEST_ptr(currcipher = sk_SSL_CIPHER_value(ciphers, 0))) + || !TEST_true(SSL_CTX_set_cipher_list(cctx, cipher_list[testidx])) + || !TEST_true(SSL_CTX_set_ciphersuites(cctx, "")) + || !TEST_ptr(ciphers = SSL_CTX_get_ciphers(cctx)) + || !TEST_int_eq(sk_SSL_CIPHER_num(ciphers), 1) + || !TEST_ptr(currcipher = sk_SSL_CIPHER_value(ciphers, 0))) goto end; /* @@ -220,7 +219,7 @@ static int test_ssl_corrupt(int testidx) /* BIO is freed by create_ssl_connection on error */ if (!TEST_true(create_ssl_objects(sctx, cctx, &server, &client, NULL, - c_to_s_fbio))) + c_to_s_fbio))) goto end; if (!TEST_true(create_ssl_connection(server, client, SSL_ERROR_NONE))) @@ -244,7 +243,7 @@ static int test_ssl_corrupt(int testidx) } while (ERR_GET_REASON(err) != SSL_R_DECRYPTION_FAILED_OR_BAD_RECORD_MAC); testresult = 1; - end: +end: SSL_free(server); SSL_free(client); SSL_CTX_free(sctx); @@ -264,7 +263,7 @@ int setup_tests(void) } if (!TEST_ptr(cert = test_get_argument(0)) - || !TEST_ptr(privkey = test_get_argument(1))) + || !TEST_ptr(privkey = test_get_argument(1))) return 0; n = setup_cipher_list(); |
