Address comments about python syntax
CustomizedGitHooks: yes Change-Id: I5c4d39789df802d0b839061ce8c59ad241917d0b Signed-off-by: XiaokangQian <xiaokang.qian@arm.com>
This commit is contained in:
parent
b1847a234e
commit
fb1a3fe7f3
3 changed files with 683 additions and 662 deletions
File diff suppressed because it is too large
Load diff
|
@ -183,7 +183,7 @@ class OpenSSLServ(OpenSSLBase):
|
|||
"""
|
||||
|
||||
def cmd(self):
|
||||
ret = super().cmd()
|
||||
ret = self.pre_cmd() + super().cmd()
|
||||
ret += ['-accept $SRV_PORT']
|
||||
|
||||
ret += ['-num_tickets 0 -no_resume_ephemeral -no_cache']
|
||||
|
@ -197,7 +197,7 @@ class OpenSSLServ(OpenSSLBase):
|
|||
return ['-c "HTTP/1.0 200 ok"']
|
||||
|
||||
def pre_cmd(self):
|
||||
return '$O_NEXT_SRV_NO_CERT'
|
||||
return ['$O_NEXT_SRV_NO_CERT']
|
||||
|
||||
|
||||
class GnuTLSBase(TLSProgram):
|
||||
|
@ -313,15 +313,13 @@ class GnuTLSServ(GnuTLSBase):
|
|||
return ['-c "HTTP/1.0 200 OK"']
|
||||
|
||||
def cmd(self):
|
||||
ret = super().cmd()
|
||||
ret += ['--http',
|
||||
'--disable-client-cert', '--debug=4']
|
||||
ret = self.pre_cmd() + super().cmd()
|
||||
|
||||
ret = ' '.join(ret)
|
||||
return ret
|
||||
|
||||
def pre_cmd(self):
|
||||
return '$G_NEXT_SRV_NO_CERT'
|
||||
return ['$G_NEXT_SRV_NO_CERT'] + ['--http', '--disable-client-cert', '--debug=4']
|
||||
|
||||
|
||||
class MbedTLSBase(TLSProgram):
|
||||
|
@ -338,8 +336,7 @@ class MbedTLSBase(TLSProgram):
|
|||
|
||||
def cmd(self):
|
||||
super().cmd()
|
||||
ret = ['server_addr=127.0.0.1', 'server_port=$SRV_PORT',
|
||||
'debug_level=4']
|
||||
ret = ['server_addr=127.0.0.1', 'server_port=$SRV_PORT', 'debug_level=4']
|
||||
ret += ['ca_file={cafile}'.format(
|
||||
cafile=CERTIFICATES[self._cert_sig_algs[0]].cafile)]
|
||||
|
||||
|
@ -356,7 +353,6 @@ class MbedTLSBase(TLSProgram):
|
|||
named_groups = ','.join(self._named_groups)
|
||||
ret += ["curves={named_groups}".format(named_groups=named_groups)]
|
||||
|
||||
#ret = ' '.join(ret)
|
||||
return ret
|
||||
|
||||
def pre_checks(self):
|
||||
|
@ -382,7 +378,7 @@ class MbedTLSServ(MbedTLSBase):
|
|||
"""
|
||||
|
||||
def cmd(self):
|
||||
ret = super().cmd()
|
||||
ret = self.pre_cmd() + super().cmd()
|
||||
ret += ['force_version=tls13']
|
||||
for _, cert, key in map(lambda sig_alg: CERTIFICATES[sig_alg], self._cert_sig_algs):
|
||||
ret += ['crt_file={cert} key_file={key}'.format(cert=cert, key=key)]
|
||||
|
@ -393,7 +389,7 @@ class MbedTLSServ(MbedTLSBase):
|
|||
|
||||
def pre_checks(self):
|
||||
ret = ['requires_config_enabled MBEDTLS_DEBUG_C',
|
||||
'requires_config_enabled MBEDTLS_SSL_CLI_C',
|
||||
'requires_config_enabled MBEDTLS_SSL_SRV_C',
|
||||
'requires_config_enabled MBEDTLS_SSL_PROTO_TLS1_3']
|
||||
|
||||
if self._compat_mode:
|
||||
|
@ -425,7 +421,7 @@ class MbedTLSServ(MbedTLSBase):
|
|||
return ['-s "{}"'.format(i) for i in check_strings]
|
||||
|
||||
def pre_cmd(self):
|
||||
return '$P_SRV_NO_CERT'
|
||||
return ['$P_SRV_NO_CERT']
|
||||
|
||||
|
||||
class OpenSSLCli(OpenSSLBase):
|
||||
|
@ -434,7 +430,7 @@ class OpenSSLCli(OpenSSLBase):
|
|||
"""
|
||||
|
||||
def cmd(self):
|
||||
ret = super().cmd()
|
||||
ret = self.pre_cmd() + super().cmd()
|
||||
|
||||
ret += ['-CAfile {cafile}'.format(
|
||||
cafile=CERTIFICATES[self._cert_sig_algs[0]].cafile)]
|
||||
|
@ -448,7 +444,7 @@ class OpenSSLCli(OpenSSLBase):
|
|||
return ['-s "HTTP/1.0 200 OK"']
|
||||
|
||||
def pre_cmd(self):
|
||||
return '$O_NEXT_CLI_NO_CERT'
|
||||
return ['$O_NEXT_CLI_NO_CERT']
|
||||
|
||||
|
||||
class GnuTLSCli(GnuTLSBase):
|
||||
|
@ -465,9 +461,7 @@ class GnuTLSCli(GnuTLSBase):
|
|||
return ['-c "HTTP/1.0 200 OK"']
|
||||
|
||||
def cmd(self):
|
||||
ret = super().cmd()
|
||||
ret += ['--debug=4']
|
||||
ret += ['localhost', '-p $SRV_PORT', '--single-key-share']
|
||||
ret = self.pre_cmd() + super().cmd()
|
||||
ret += ['--x509cafile {cafile}'.format(
|
||||
cafile=CERTIFICATES[self._cert_sig_algs[0]].cafile)]
|
||||
|
||||
|
@ -475,7 +469,7 @@ class GnuTLSCli(GnuTLSBase):
|
|||
return ret
|
||||
|
||||
def pre_cmd(self):
|
||||
return '$G_NEXT_CLI_NO_CERT'
|
||||
return ['$G_NEXT_CLI_NO_CERT'] + ['--debug=4', 'localhost', '-p $SRV_PORT', '--single-key-share']
|
||||
|
||||
|
||||
class MbedTLSCli(MbedTLSBase):
|
||||
|
@ -484,13 +478,13 @@ class MbedTLSCli(MbedTLSBase):
|
|||
"""
|
||||
|
||||
def cmd(self):
|
||||
ret = super().cmd()
|
||||
ret = self.pre_cmd() + super().cmd()
|
||||
|
||||
ret = ' '.join(ret)
|
||||
return ret
|
||||
|
||||
def pre_cmd(self):
|
||||
return '$P_CLI'
|
||||
return ['$P_CLI']
|
||||
|
||||
def pre_checks(self):
|
||||
ret = ['requires_config_enabled MBEDTLS_DEBUG_C',
|
||||
|
@ -546,8 +540,8 @@ def generate_compat_test(client=None, server=None, cipher=None, named_group=None
|
|||
signature_algorithm=sig_alg,
|
||||
cert_sig_alg=sig_alg)
|
||||
|
||||
cmd = ['run_test "{}"'.format(name), '"{} {}"'.format(server_object.pre_cmd(),
|
||||
server_object.cmd()), '"{} {}"'.format(client_object.pre_cmd(), client_object.cmd()), '0']
|
||||
cmd = ['run_test "{}"'.format(name), '"{}"'.format(
|
||||
server_object.cmd()), '"{}"'.format(client_object.cmd()), '0']
|
||||
cmd += server_object.post_checks()
|
||||
cmd += client_object.post_checks()
|
||||
cmd += ['-C "received HelloRetryRequest message"']
|
||||
|
@ -572,8 +566,8 @@ def generate_hrr_compat_test(client=None, server=None,
|
|||
cert_sig_alg=cert_sig_alg)
|
||||
client_object.add_named_groups(server_named_group)
|
||||
|
||||
cmd = ['run_test "{}"'.format(name), '"{} {}"'.format(server_object.pre_cmd(),
|
||||
server_object.cmd()), '"{} {}"'.format(client_object.pre_cmd(), client_object.cmd()), '0']
|
||||
cmd = ['run_test "{}"'.format(name), '"{}"'.format(
|
||||
server_object.cmd()), '"{}"'.format(client_object.cmd()), '0']
|
||||
cmd += server_object.post_checks()
|
||||
cmd += client_object.post_checks()
|
||||
cmd += ['-c "received HelloRetryRequest message"']
|
||||
|
@ -601,8 +595,8 @@ def generate_server_hrr_compat_test(client=None, server=None,
|
|||
cert_sig_alg=cert_sig_alg)
|
||||
client_object.add_named_groups(server_named_group)
|
||||
|
||||
cmd = ['run_test "{}"'.format(name), '"{} {}"'.format(server_object.pre_cmd(),
|
||||
server_object.cmd()), '"{} {}"'.format(client_object.pre_cmd(), client_object.cmd()), '0']
|
||||
cmd = ['run_test "{}"'.format(name), '"{}"'.format(
|
||||
server_object.cmd()), '"{}"'.format(client_object.cmd()), '0']
|
||||
cmd += server_object.post_checks()
|
||||
cmd += client_object.post_checks()
|
||||
cmd += ['-s "HRR selected_group: {:s}"'.format(server_named_group)]
|
||||
|
@ -694,7 +688,7 @@ def main():
|
|||
CIPHER_SUITE_IANA_VALUE.keys(),
|
||||
NAMED_GROUP_IANA_VALUE.keys(),
|
||||
SIG_ALG_IANA_VALUE.keys()):
|
||||
if(server == 'mbedTLS' or client == 'mbedTLS'):
|
||||
if server == 'mbedTLS' or client == 'mbedTLS':
|
||||
yield generate_compat_test(client=client, server=server,
|
||||
cipher=cipher, named_group=named_group,
|
||||
sig_alg=sig_alg)
|
||||
|
@ -706,8 +700,7 @@ def main():
|
|||
SERVER_CLASSES.keys(),
|
||||
NAMED_GROUP_IANA_VALUE.keys(),
|
||||
NAMED_GROUP_IANA_VALUE.keys()):
|
||||
if(client == 'mbedTLS'):
|
||||
if client_named_group != server_named_group:
|
||||
if client == 'mbedTLS' and client_named_group != server_named_group:
|
||||
yield generate_hrr_compat_test(client=client, server=server,
|
||||
client_named_group=client_named_group,
|
||||
server_named_group=server_named_group,
|
||||
|
@ -718,8 +711,7 @@ def main():
|
|||
SERVER_CLASSES.keys(),
|
||||
NAMED_GROUP_IANA_VALUE.keys(),
|
||||
NAMED_GROUP_IANA_VALUE.keys()):
|
||||
if(server == 'mbedTLS'):
|
||||
if client_named_group != server_named_group:
|
||||
if server == 'mbedTLS' and client_named_group != server_named_group:
|
||||
yield generate_server_hrr_compat_test(client=client, server=server,
|
||||
client_named_group=client_named_group,
|
||||
server_named_group=server_named_group,
|
||||
|
|
|
@ -103,6 +103,7 @@ if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then
|
|||
G_NEXT_CLI_NO_CERT="echo 'GET / HTTP/1.0' | $GNUTLS_NEXT_CLI"
|
||||
else
|
||||
G_NEXT_CLI=false
|
||||
G_NEXT_CLI_NO_CERT=false
|
||||
fi
|
||||
|
||||
TESTS=0
|
||||
|
@ -1568,6 +1569,7 @@ fi
|
|||
|
||||
if [ -n "${GNUTLS_NEXT_CLI:-}" ]; then
|
||||
G_NEXT_CLI="$G_NEXT_CLI -p +SRV_PORT"
|
||||
G_NEXT_CLI_NO_CERT="$G_NEXT_CLI_NO_CERT"
|
||||
fi
|
||||
|
||||
# Allow SHA-1, because many of our test certificates use it
|
||||
|
|
Loading…
Reference in a new issue