File tree Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Expand file tree Collapse file tree 2 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,11 @@ def write_tls_handshake_defragmentation_test(
6464 tc .requirements .append ('skip_next_test' )
6565
6666 if version is not None :
67- their_args += ' -tls1_ ' + str ( version .value )
67+ their_args += ' ' + version .openssl_option ( )
6868 # Emit a version requirement, because we're forcing the version via
6969 # OpenSSL, not via Mbed TLS, and the automatic depdendencies in
7070 # ssl-opt.sh only handle forcing the version via Mbed TLS.
71- tc .requirements .append ('requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_' +
72- str (version .value ))
71+ tc .requirements .append (version .requires_command ())
7372 if side == Side .SERVER and version == Version .TLS12 and \
7473 length is not None and \
7574 length <= TLS12_CLIENT_HELLO_ASSUMED_MAX_LENGTH :
Original file line number Diff line number Diff line change @@ -80,5 +80,22 @@ class Side(enum.Enum):
8080 SERVER = 1
8181
8282class Version (enum .Enum ):
83+ """TLS protocol version.
84+
85+ This class doesn't know about DTLS yet.
86+ """
87+
8388 TLS12 = 2
8489 TLS13 = 3
90+
91+ def force_version (self ) -> str :
92+ """Argument to pass to ssl_client2 or ssl_server2 to force this version."""
93+ return f'force_version=tls1{ self .value } '
94+
95+ def openssl_option (self ) -> str :
96+ """Option to pass to openssl s_client or openssl s_server to select this version."""
97+ return f'-tls1_{ self .value } '
98+
99+ def requires_command (self ) -> str :
100+ """Command to require this protocol version in an ssl-opt.sh test case."""
101+ return 'requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_' + str (self .value )
You can’t perform that action at this time.
0 commit comments