Skip to content

Commit bbe4771

Browse files
committed
TLS 1.2 CertificateVerify: req sig alg to have been in CR
The signature algorithm specified in CertificateVerify must have been in the CertificateRequest. Add check. The cipher suite test cases, when client auth and RSA are built-in and use the default client certificate and use the ECDHE-ECDSA-* cipher suites, no longer work. The client certificate must be ECC when the cipher suite is ECDHE-ECDSA. Don't run them in that build case.
1 parent babc5d3 commit bbe4771

File tree

2 files changed

+30
-1
lines changed

2 files changed

+30
-1
lines changed

src/internal.c

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38568,10 +38568,19 @@ static int DoSessionTicket(WOLFSSL* ssl, const byte* input, word32* inOutIdx,
3856838568
case TLS_ASYNC_BUILD:
3856938569
{
3857038570
if (IsAtLeastTLSv1_2(ssl)) {
38571-
if ((args->idx - args->begin) + ENUM_LEN + ENUM_LEN > size) {
38571+
if ((args->idx - args->begin) + ENUM_LEN + ENUM_LEN >
38572+
size) {
3857238573
ERROR_OUT(BUFFER_ERROR, exit_dcv);
3857338574
}
3857438575

38576+
/* Check if hashSigAlgo in CertificateVerify is supported
38577+
* in our ssl->suites or ssl->ctx->suites. */
38578+
if (!SupportedHashSigAlgo(ssl, &input[args->idx])) {
38579+
WOLFSSL_MSG("Signature algorithm was not in "
38580+
"CertificateRequest");
38581+
ERROR_OUT(INVALID_PARAMETER, exit_dcv);
38582+
}
38583+
3857538584
DecodeSigAlg(&input[args->idx], &ssl->options.peerHashAlgo,
3857638585
&ssl->options.peerSigAlgo);
3857738586
args->idx += 2;

tests/suites.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -358,6 +358,20 @@ static int IsNoClientCert(const char* line)
358358
}
359359
#endif
360360

361+
#if (defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448)) && \
362+
!defined(NO_RSA) && !defined(NO_CERTS) && !defined(WOLFSSL_NO_CLIENT_AUTH)
363+
static int IsEcdsaCipherSuiteDefRsaCert(const char* line)
364+
{
365+
int found;
366+
367+
found = (strstr(line, "ECDHE-ECDSA") != NULL);
368+
found &= (strstr(line, "-c ") == NULL);
369+
found &= (strstr(line, "-x") == NULL);
370+
371+
return found;
372+
}
373+
#endif
374+
361375
static int execute_test_case(int svr_argc, char** svr_argv,
362376
int cli_argc, char** cli_argv,
363377
int addNoVerify, int addNonBlocking,
@@ -618,6 +632,12 @@ static int execute_test_case(int svr_argc, char** svr_argv,
618632
#endif
619633
return NOT_BUILT_IN;
620634
}
635+
#endif
636+
#if (defined(HAVE_ECC) || defined(HAVE_ED25519) || defined(HAVE_ED448)) && \
637+
!defined(NO_RSA) && !defined(NO_CERTS) && !defined(WOLFSSL_NO_CLIENT_AUTH)
638+
if (IsEcdsaCipherSuiteDefRsaCert(commandLine)) {
639+
return NOT_BUILT_IN;
640+
}
621641
#endif
622642
printf("trying client command line[%d]: %s\n", tests, commandLine);
623643
tests++;

0 commit comments

Comments
 (0)