Skip to content

Commit 93944d2

Browse files
authored
Merge pull request #9482 from anhu/move_the_sigalg_check
Need to move sigalg check down because it does not consider hybrids.
2 parents e30e9b7 + a765bbd commit 93944d2

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
@@ -10230,18 +10230,6 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
1023010230
ERROR_OUT(BUFFER_ERROR, exit_dcv);
1023110231
}
1023210232

10233-
validSigAlgo = 0;
10234-
for (i = 0; i < suites->hashSigAlgoSz; i += 2) {
10235-
if ((suites->hashSigAlgo[i + 0] == input[args->idx + 0]) &&
10236-
(suites->hashSigAlgo[i + 1] == input[args->idx + 1])) {
10237-
validSigAlgo = 1;
10238-
break;
10239-
}
10240-
}
10241-
if (!validSigAlgo) {
10242-
ERROR_OUT(INVALID_PARAMETER, exit_dcv);
10243-
}
10244-
1024510233
#ifdef WOLFSSL_DUAL_ALG_CERTS
1024610234
if (ssl->peerSigSpec == NULL) {
1024710235
/* The peer did not respond. We didn't send CKS or they don't
@@ -10258,6 +10246,18 @@ static int DoTls13CertificateVerify(WOLFSSL* ssl, byte* input,
1025810246
*ssl->sigSpec == WOLFSSL_CKS_SIGSPEC_NATIVE ||
1025910247
*ssl->sigSpec == WOLFSSL_CKS_SIGSPEC_ALTERNATIVE) {
1026010248
#endif /* WOLFSSL_DUAL_ALG_CERTS */
10249+
validSigAlgo = 0;
10250+
for (i = 0; i < suites->hashSigAlgoSz; i += 2) {
10251+
if ((suites->hashSigAlgo[i + 0] == input[args->idx + 0]) &&
10252+
(suites->hashSigAlgo[i + 1] == input[args->idx + 1])) {
10253+
validSigAlgo = 1;
10254+
break;
10255+
}
10256+
}
10257+
if (!validSigAlgo) {
10258+
ERROR_OUT(INVALID_PARAMETER, exit_dcv);
10259+
}
10260+
1026110261
ret = DecodeTls13SigAlg(input + args->idx,
1026210262
&ssl->options.peerHashAlgo, &ssl->options.peerSigAlgo);
1026310263
#ifdef WOLFSSL_DUAL_ALG_CERTS

0 commit comments

Comments
 (0)