#Test 1: Default sig algs should succeed
$proxy->start() or plan skip_all => "Unable to start up Proxy for tests";
-plan tests => 21;
+plan tests => 22;
ok(TLSProxy::Message->success, "Default sigalgs");
my $testtype;
SKIP: {
- skip "TLSv1.3 disabled", 5 if disabled("tls1_3");
+ skip "TLSv1.3 disabled", 6 if disabled("tls1_3");
$proxy->filter(\&sigalgs_filter);
$testtype = PSS_ONLY_SIG_ALGS;
$proxy->start();
ok(TLSProxy::Message->success, "PSS only sigalgs in TLSv1.3");
+
+ #Test 7: Modify the CertificateVerify sigalg from rsa_pss_rsae_sha256 to
+ # rsa_pss_pss_sha256. This should fail because the public key OID
+ # in the certificate is rsaEncryption and not rsassaPss
+ $proxy->filter(\&modify_cert_verify_sigalg);
+ $proxy->clear();
+ $proxy->start();
+ ok(TLSProxy::Message->fail,
+ "Mismatch between CertVerify sigalg and public key OID");
}
SKIP: {
skip "EC or TLSv1.3 disabled", 1
if disabled("tls1_3") || disabled("ec");
- #Test 7: Sending a valid sig algs list but not including a sig type that
+ #Test 8: Sending a valid sig algs list but not including a sig type that
# matches the certificate should fail in TLSv1.3.
$proxy->clear();
$proxy->clientflags("-sigalgs ECDSA+SHA256");
skip "EC, TLSv1.3 or TLSv1.2 disabled", 1
if disabled("tls1_2") || disabled("tls1_3") || disabled("ec");
- #Test 8: Sending a full list of TLSv1.3 sig algs but negotiating TLSv1.2
+ #Test 9: Sending a full list of TLSv1.3 sig algs but negotiating TLSv1.2
# should succeed
$proxy->clear();
$proxy->serverflags("-no_tls1_3");
$proxy->filter(\&sigalgs_filter);
- #Test 9: Sending no sig algs extension in TLSv1.2 should succeed
+ #Test 10: Sending no sig algs extension in TLSv1.2 should succeed
$proxy->clear();
$testtype = NO_SIG_ALGS_EXT;
$proxy->clientflags("-no_tls1_3");
$proxy->start();
ok(TLSProxy::Message->success, "No TLSv1.2 sigalgs");
- #Test 10: Sending an empty sig algs extension in TLSv1.2 should fail
+ #Test 11: Sending an empty sig algs extension in TLSv1.2 should fail
$proxy->clear();
$testtype = EMPTY_SIG_ALGS_EXT;
$proxy->clientflags("-no_tls1_3");
$proxy->start();
ok(TLSProxy::Message->fail, "Empty TLSv1.2 sigalgs");
- #Test 11: Sending a list with no recognised sig algs in TLSv1.2 should fail
+ #Test 12: Sending a list with no recognised sig algs in TLSv1.2 should fail
$proxy->clear();
$testtype = NO_KNOWN_SIG_ALGS;
$proxy->clientflags("-no_tls1_3");
$proxy->start();
ok(TLSProxy::Message->fail, "No known TLSv1.3 sigalgs");
- #Test 12: Sending a sig algs list without pss for an RSA cert in TLSv1.2
+ #Test 13: Sending a sig algs list without pss for an RSA cert in TLSv1.2
# should succeed
$proxy->clear();
$testtype = NO_PSS_SIG_ALGS;
$proxy->start();
ok(TLSProxy::Message->success, "No PSS TLSv1.2 sigalgs");
- #Test 13: Sending only TLSv1.3 PSS sig algs in TLSv1.2 should succeed
+ #Test 14: Sending only TLSv1.3 PSS sig algs in TLSv1.2 should succeed
$proxy->clear();
$testtype = PSS_ONLY_SIG_ALGS;
$proxy->serverflags("-no_tls1_3");
$proxy->start();
ok(TLSProxy::Message->success, "PSS only sigalgs in TLSv1.2");
- #Test 14: Responding with a sig alg we did not send in TLSv1.2 should fail
+ #Test 15: Responding with a sig alg we did not send in TLSv1.2 should fail
# We send rsa_pkcs1_sha256 and respond with rsa_pss_rsae_sha256
# TODO(TLS1.3): Add a similar test to the TLSv1.3 section above
# when we have an API capable of configuring the TLSv1.3 sig algs
$proxy->start();
ok(TLSProxy::Message->fail, "Sigalg we did not send in TLSv1.2");
- #Test 15: Sending a valid sig algs list but not including a sig type that
+ #Test 16: Sending a valid sig algs list but not including a sig type that
# matches the certificate should fail in TLSv1.2
$proxy->clear();
$proxy->clientflags("-no_tls1_3 -sigalgs ECDSA+SHA256");
ok(TLSProxy::Message->fail, "No matching TLSv1.2 sigalgs");
$proxy->filter(\&sigalgs_filter);
- #Test 16: No sig algs extension, ECDSA cert, TLSv1.2 should succeed
+ #Test 17: No sig algs extension, ECDSA cert, TLSv1.2 should succeed
$proxy->clear();
$testtype = NO_SIG_ALGS_EXT;
$proxy->clientflags("-no_tls1_3");
my ($dsa_status, $sha1_status, $sha224_status);
SKIP: {
skip "TLSv1.3 disabled", 2 if disabled("tls1_3") || disabled("dsa");
- #Test 17: signature_algorithms with 1.3-only ClientHello
+ #Test 18: signature_algorithms with 1.3-only ClientHello
$testtype = PURE_SIGALGS;
$dsa_status = $sha1_status = $sha224_status = 0;
$proxy->clear();
ok($dsa_status && $sha1_status && $sha224_status,
"DSA/SHA2 sigalg sent for 1.3-only ClientHello");
- #Test 18: signature_algorithms with backwards compatible ClientHello
+ #Test 19: signature_algorithms with backwards compatible ClientHello
SKIP: {
skip "TLSv1.2 disabled", 1 if disabled("tls1_2");
$testtype = COMPAT_SIGALGS;
SKIP: {
skip "TLSv1.3 disabled", 3 if disabled("tls1_3");
- #Test 19: Insert signature_algorithms_cert that match normal sigalgs
+ #Test 20: Insert signature_algorithms_cert that match normal sigalgs
$testtype = SIGALGS_CERT_ALL;
$proxy->clear();
$proxy->filter(\&modify_sigalgs_cert_filter);
$proxy->start();
ok(TLSProxy::Message->success, "sigalgs_cert in TLSv1.3");
- #Test 19: Insert signature_algorithms_cert that forces PKCS#1 cert
+ #Test 21: Insert signature_algorithms_cert that forces PKCS#1 cert
$testtype = SIGALGS_CERT_PKCS;
$proxy->clear();
$proxy->filter(\&modify_sigalgs_cert_filter);
$proxy->start();
ok(TLSProxy::Message->success, "sigalgs_cert in TLSv1.3 with PKCS#1 cert");
- #Test 19: Insert signature_algorithms_cert that fails
+ #Test 22: Insert signature_algorithms_cert that fails
$testtype = SIGALGS_CERT_INVALID;
$proxy->clear();
$proxy->filter(\&modify_sigalgs_cert_filter);
}
}
}
+
+sub modify_cert_verify_sigalg
+{
+ my $proxy = shift;
+
+ # We're only interested in the CertificateVerify
+ if ($proxy->flight != 1) {
+ return;
+ }
+
+ foreach my $message (@{$proxy->message_list}) {
+ if ($message->mt == TLSProxy::Message::MT_CERTIFICATE_VERIFY) {
+ $message->sigalg(TLSProxy::Message::SIG_ALG_RSA_PSS_PSS_SHA256);
+ $message->repack();
+ }
+ }
+}