Skip to content

Commit a765bbd

Browse files
committed
Need to move sigalg check down because it does not consider hybrids.
1 parent 59f4fa5 commit a765bbd

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

src/tls13.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10215,18 +10215,6 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
1021510215
ERROR_OUT(BUFFER_ERROR, exit_dcv);
1021610216
}
1021710217

10218-
validSigAlgo = 0;
10219-
for (i = 0; i < suites->hashSigAlgoSz; i += 2) {
10220-
if ((suites->hashSigAlgo[i + 0] == input[args->idx + 0]) &&
10221-
(suites->hashSigAlgo[i + 1] == input[args->idx + 1])) {
10222-
validSigAlgo = 1;
10223-
break;
10224-
}
10225-
}
10226-
if (!validSigAlgo) {
10227-
ERROR_OUT(INVALID_PARAMETER, exit_dcv);
10228-
}
10229-
1023010218
#ifdef WOLFSSL_DUAL_ALG_CERTS
1023110219
if (ssl->peerSigSpec == NULL) {
1023210220
/* The peer did not respond. We didn't send CKS or they don't
@@ -10243,6 +10231,18 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
1024310231
*ssl->sigSpec == WOLFSSL_CKS_SIGSPEC_NATIVE ||
1024410232
*ssl->sigSpec == WOLFSSL_CKS_SIGSPEC_ALTERNATIVE) {
1024510233
#endif /* WOLFSSL_DUAL_ALG_CERTS */
10234+
validSigAlgo = 0;
10235+
for (i = 0; i < suites->hashSigAlgoSz; i += 2) {
10236+
if ((suites->hashSigAlgo[i + 0] == input[args->idx + 0]) &&
10237+
(suites->hashSigAlgo[i + 1] == input[args->idx + 1])) {
10238+
validSigAlgo = 1;
10239+
break;
10240+
}
10241+
}
10242+
if (!validSigAlgo) {
10243+
ERROR_OUT(INVALID_PARAMETER, exit_dcv);
10244+
}
10245+
1024610246
ret = DecodeTls13SigAlg(input + args->idx,
1024710247
&ssl->options.peerHashAlgo, &ssl->options.peerSigAlgo);
1024810248
#ifdef WOLFSSL_DUAL_ALG_CERTS

0 commit comments

Comments
 (0)