4
%% Copyright Ericsson AB 2005-2011. All Rights Reserved.
6
%% The contents of this file are subject to the Erlang Public License,
7
%% Version 1.1, (the "License"); you may not use this file except in
8
%% compliance with the License. You should have received a copy of the
9
%% Erlang Public License along with this software. If not, it can be
10
%% retrieved online at http://www.erlang.org/.
12
%% Software distributed under the License is distributed on an "AS IS"
13
%% basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
14
%% the License for the specific language governing rights and limitations
21
-module(old_ssl_protocol_SUITE).
23
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
24
init_per_group/2,end_per_group/2,
25
init_per_testcase/2, end_per_testcase/2,
26
sslv2/1, sslv3/1, tlsv1/1, sslv2_sslv3/1,
27
sslv2_tlsv1/1, sslv3_tlsv1/1, sslv2_sslv3_tlsv1/1]).
29
-import(ssl_test_MACHINE, [mk_ssl_cert_opts/1, test_one_listener/7,
31
-include_lib("test_server/include/test_server.hrl").
32
-include("ssl_test_MACHINE.hrl").
35
init_per_testcase(_Case, Config) ->
36
WatchDog = test_server:timetrap(?DEFAULT_TIMEOUT),
37
[{watchdog, WatchDog}| Config].
39
end_per_testcase(_Case, Config) ->
40
WatchDog = ?config(watchdog, Config),
41
test_server:timetrap_cancel(WatchDog).
43
suite() -> [{ct_hooks,[ts_install_cth]}].
46
[sslv2, sslv3, tlsv1, sslv2_sslv3, sslv2_tlsv1,
47
sslv3_tlsv1, sslv2_sslv3_tlsv1].
52
init_per_group(_GroupName, Config) ->
55
end_per_group(_GroupName, Config) ->
59
init_per_suite(doc) ->
60
"Want to se what Config contains.";
61
init_per_suite(suite) ->
63
init_per_suite(Config) ->
64
io:format("Config: ~p~n", [Config]),
66
%% Check if SSL exists. If this case fails, all other cases are skipped
67
case catch crypto:start() of
69
application:start(public_key),
72
{error, {already_started, _}} -> ssl:stop();
73
Error -> ?t:fail({failed_starting_ssl,Error})
77
{skip,"Could not start crypto"}
81
"This test case has no other purpose than closing the conf case.";
82
end_per_suite(suite) ->
84
end_per_suite(Config) ->
91
"Client has no cert. Nor the client, nor the server is verifying its "
92
"peer. Server closes, client waits for close. "
93
"Client and server choose SSLv2.";
96
sslv2(Config) when list(Config) ->
97
do_run_test(Config, [sslv2]).
100
"Client has no cert. Nor the client, nor the server is verifying its "
101
"peer. Server closes, client waits for close. "
102
"Client and server choose SSLv3.";
105
sslv3(Config) when list(Config) ->
106
do_run_test(Config, [sslv3]).
109
"Client has no cert. Nor the client, nor the server is verifying its "
110
"peer. Server closes, client waits for close. "
111
"Client and server choose TLSv1.";
114
tlsv1(Config) when list(Config) ->
115
do_run_test(Config, [tlsv1]).
118
"Client has no cert. Nor the client, nor the server is verifying its "
119
"peer. Server closes, client waits for close. "
120
"Client and server choose between SSLv2 and SSLv3.";
121
sslv2_sslv3(suite) ->
123
sslv2_sslv3(Config) when list(Config) ->
124
do_run_test(Config, [sslv2, sslv3]).
127
"Client has no cert. Nor the client, nor the server is verifying its "
128
"peer. Server closes, client waits for close. "
129
"Client and server choose between SSLv2 and TLSv1.";
130
sslv2_tlsv1(suite) ->
132
sslv2_tlsv1(Config) when list(Config) ->
133
do_run_test(Config, [sslv2, tlsv1]).
136
"Client has no cert. Nor the client, nor the server is verifying its "
137
"peer. Server closes, client waits for close. "
138
"Client and server choose between SSLv3 and TLSv1.";
139
sslv3_tlsv1(suite) ->
141
sslv3_tlsv1(Config) when list(Config) ->
142
do_run_test(Config, [sslv3, tlsv1]).
144
sslv2_sslv3_tlsv1(doc) ->
145
"Client has no cert. Nor the client, nor the server is verifying its "
146
"peer. Server closes, client waits for close. "
147
"Client and server choose between SSLv2, SSLv3, and TLSv1.";
148
sslv2_sslv3_tlsv1(suite) ->
150
sslv2_sslv3_tlsv1(Config) when list(Config) ->
151
do_run_test(Config, [sslv2, sslv3, tlsv1]).
155
do_run_test(Config0, Protocols) ->
156
process_flag(trap_exit, true),
158
Timeout = 40000, NConns = 1,
161
?line {ok, {_, SsslOpts0}} = mk_ssl_cert_opts(Config0),
162
?line SsslOpts = [{verify, 0}, {depth, 2} | SsslOpts0],
164
?line {ok, Host} = inet:gethostname(),
166
LCmds = [{sockopts, [{backlog, NConns}]},
171
ACmds = [{timeout, Timeout},
176
CCmds = [{timeout, Timeout},
177
{connect, {Host, LPort}},
181
Config1 = [{env, [{protocol_version, Protocols}]} | Config0],
182
?line test_one_listener(NConns, LCmds, ACmds, CCmds, Timeout,