From f9e550341281b0d344f7a5e7ac2ace79f88a3184 Mon Sep 17 00:00:00 2001 From: Matt Caswell Date: Mon, 21 Mar 2016 15:32:40 +0000 Subject: Fix no-sock Misc fixes for no-sock Reviewed-by: Richard Levitte --- test/dtlsv1listentest.c | 15 +++++++++++---- test/recipes/70-test_sslcertstatus.t | 3 +++ test/recipes/70-test_sslextension.t | 3 +++ test/recipes/70-test_sslsessiontick.t | 3 +++ test/recipes/70-test_sslskewith0p.t | 3 +++ test/recipes/70-test_sslvertol.t | 3 +++ test/recipes/70-test_tlsextms.t | 3 +++ test/recipes/80-test_ssl.t | 4 ++-- test/recipes/90-test_networking.t | 3 +++ test/ssltest.c | 21 +++++++++++++++++---- 10 files changed, 51 insertions(+), 10 deletions(-) (limited to 'test') diff --git a/test/dtlsv1listentest.c b/test/dtlsv1listentest.c index 6eef1b5e4e..6eb2e5ccfb 100644 --- a/test/dtlsv1listentest.c +++ b/test/dtlsv1listentest.c @@ -65,6 +65,8 @@ #endif #include "e_os.h" +#ifndef OPENSSL_NO_SOCK + /* Just a ClientHello without a cookie */ static const unsigned char clienthello_nocookie[] = { 0x16, /* Handshake */ @@ -339,7 +341,7 @@ static struct { } }; -#define COOKIE_LEN 20 +# define COOKIE_LEN 20 static int cookie_gen(SSL *ssl, unsigned char *cookie, unsigned int *cookie_len) { @@ -368,9 +370,11 @@ static int cookie_verify(SSL *ssl, const unsigned char *cookie, return 1; } +#endif int main(void) { +#ifndef OPENSSL_NO_SOCK SSL_CTX *ctx = NULL; SSL *ssl = NULL; BIO *outbio = NULL; @@ -459,9 +463,12 @@ int main(void) SSL_CTX_free(ctx); BIO_free(inbio); OPENSSL_free(peer); -#ifndef OPENSSL_NO_CRYPTO_MDEBUG +# ifndef OPENSSL_NO_CRYPTO_MDEBUG CRYPTO_mem_leaks_fp(stderr); -#endif +# endif return success ? 0 : 1; +#else + printf("DTLSv1_listen() is not supported by this build - skipping\n"); + return 0; +#endif } - diff --git a/test/recipes/70-test_sslcertstatus.t b/test/recipes/70-test_sslcertstatus.t index 37265ed07a..48014e2af3 100755 --- a/test/recipes/70-test_sslcertstatus.t +++ b/test/recipes/70-test_sslcertstatus.t @@ -66,6 +66,9 @@ plan skip_all => "TLSProxy isn't usable on $^O" plan skip_all => "$test_name needs the dynamic engine feature enabled" if disabled("engine") || disabled("dynamic-engine"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&certstatus_filter, diff --git a/test/recipes/70-test_sslextension.t b/test/recipes/70-test_sslextension.t index 1641daa344..92c6762ffc 100755 --- a/test/recipes/70-test_sslextension.t +++ b/test/recipes/70-test_sslextension.t @@ -66,6 +66,9 @@ plan skip_all => "TLSProxy isn't usable on $^O" plan skip_all => "$test_name needs the dynamic engine feature enabled" if disabled("engine") || disabled("dynamic-engine"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&extension_filter, diff --git a/test/recipes/70-test_sslsessiontick.t b/test/recipes/70-test_sslsessiontick.t index caab77745e..704573881c 100755 --- a/test/recipes/70-test_sslsessiontick.t +++ b/test/recipes/70-test_sslsessiontick.t @@ -67,6 +67,9 @@ plan skip_all => "TLSProxy isn't usable on $^O" plan skip_all => "$test_name needs the dynamic engine feature enabled" if disabled("engine") || disabled("dynamic-engine"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; sub checkmessages($$$$$$); diff --git a/test/recipes/70-test_sslskewith0p.t b/test/recipes/70-test_sslskewith0p.t index b0cc9ffb59..0bed4bffbb 100755 --- a/test/recipes/70-test_sslskewith0p.t +++ b/test/recipes/70-test_sslskewith0p.t @@ -69,6 +69,9 @@ plan skip_all => "$test_name needs the dynamic engine feature enabled" plan skip_all => "dh is not supported by this OpenSSL build" if disabled("dh"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&ske_0_p_filter, diff --git a/test/recipes/70-test_sslvertol.t b/test/recipes/70-test_sslvertol.t index 0795733fb9..a3285a67dd 100755 --- a/test/recipes/70-test_sslvertol.t +++ b/test/recipes/70-test_sslvertol.t @@ -66,6 +66,9 @@ plan skip_all => "TLSProxy isn't usable on $^O" plan skip_all => "$test_name needs the dynamic engine feature enabled" if disabled("engine") || disabled("dynamic-engine"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( \&vers_tolerance_filter, diff --git a/test/recipes/70-test_tlsextms.t b/test/recipes/70-test_tlsextms.t index bc3b787800..5c41a908a2 100644 --- a/test/recipes/70-test_tlsextms.t +++ b/test/recipes/70-test_tlsextms.t @@ -67,6 +67,9 @@ plan skip_all => "TLSProxy isn't usable on $^O" plan skip_all => "$test_name needs the dynamic engine feature enabled" if disabled("engine") || disabled("dynamic-engine"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; sub checkmessages($$$$$); diff --git a/test/recipes/80-test_ssl.t b/test/recipes/80-test_ssl.t index da32fac6c7..f1ffe9a01c 100644 --- a/test/recipes/80-test_ssl.t +++ b/test/recipes/80-test_ssl.t @@ -435,14 +435,14 @@ sub testssl { SKIP: { skip "No IPv4 available on this machine", 1 - unless have_IPv4(); + unless !disabled("sock") && have_IPv4(); ok(run(test([@ssltest, "-ipv4", @extra])), 'test TLS via IPv4'); } SKIP: { skip "No IPv6 available on this machine", 1 - unless have_IPv6(); + unless !disabled("sock") && have_IPv6(); ok(run(test([@ssltest, "-ipv6", @extra])), 'test TLS via IPv6'); } diff --git a/test/recipes/90-test_networking.t b/test/recipes/90-test_networking.t index 5d876ca51c..408d89af6a 100644 --- a/test/recipes/90-test_networking.t +++ b/test/recipes/90-test_networking.t @@ -66,6 +66,9 @@ plan skip_all => "TLSProxy isn't usable on $^O" plan skip_all => "$test_name needs the dynamic engine feature enabled" if disabled("engine") || disabled("dynamic-engine"); +plan skip_all => "$test_name needs the sock feature enabled" + if disabled("sock"); + $ENV{OPENSSL_ia32cap} = '~0x200000200000000'; my $proxy = TLSProxy::Proxy->new( diff --git a/test/ssltest.c b/test/ssltest.c index cf9f060086..a2dd4454ad 100644 --- a/test/ssltest.c +++ b/test/ssltest.c @@ -1234,11 +1234,15 @@ int main(int argc, char *argv[]) CAfile = *(++argv); } else if (strcmp(*argv, "-bio_pair") == 0) { bio_type = BIO_PAIR; - } else if (strcmp(*argv, "-ipv4") == 0) { + } +#ifndef OPENSSL_NO_SOCK + else if (strcmp(*argv, "-ipv4") == 0) { bio_type = BIO_IPV4; } else if (strcmp(*argv, "-ipv6") == 0) { bio_type = BIO_IPV6; - } else if (strcmp(*argv, "-f") == 0) { + } +#endif + else if (strcmp(*argv, "-f") == 0) { force = 1; } else if (strcmp(*argv, "-time") == 0) { print_time = 1; @@ -1857,6 +1861,7 @@ int main(int argc, char *argv[]) case BIO_PAIR: ret = doit_biopair(s_ssl, c_ssl, bytes, &s_time, &c_time); break; +#ifndef OPENSSL_NO_SOCK case BIO_IPV4: ret = doit_localhost(s_ssl, c_ssl, BIO_FAMILY_IPV4, bytes, &s_time, &c_time); @@ -1865,6 +1870,12 @@ int main(int argc, char *argv[]) ret = doit_localhost(s_ssl, c_ssl, BIO_FAMILY_IPV6, bytes, &s_time, &c_time); break; +#else + case BIO_IPV4: + case BIO_IPV6: + ret = 1; + goto err; +#endif } if (ret) break; } @@ -1931,6 +1942,7 @@ int main(int argc, char *argv[]) EXIT(ret); } +#ifndef OPENSSL_NO_SOCK int doit_localhost(SSL *s_ssl, SSL *c_ssl, int family, long count, clock_t *s_time, clock_t *c_time) { @@ -2170,12 +2182,12 @@ int doit_localhost(SSL *s_ssl, SSL *c_ssl, int family, long count, if (verbose) print_details(c_ssl, "DONE via TCP connect: "); -#ifndef OPENSSL_NO_NEXTPROTONEG +# ifndef OPENSSL_NO_NEXTPROTONEG if (verify_npn(c_ssl, s_ssl) < 0) { ret = 1; goto end; } -#endif +# endif if (verify_serverinfo() < 0) { fprintf(stderr, "Server info verify error\n"); ret = 1; @@ -2215,6 +2227,7 @@ int doit_localhost(SSL *s_ssl, SSL *c_ssl, int family, long count, return ret; } +#endif int doit_biopair(SSL *s_ssl, SSL *c_ssl, long count, clock_t *s_time, clock_t *c_time) -- cgit v1.2.1