Skip to content

Commit a875ffe

Browse files
authored
Merge pull request #9899 from julek-wolfssl/fenrir/16
Replace `XMEMCMP` with `ConstantCompare` when validating secure renegotiation (SCR) verify data
2 parents 68e085d + 479de5a commit a875ffe

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

src/tls.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6047,7 +6047,7 @@ static int TLSX_SecureRenegotiation_Parse(WOLFSSL* ssl, const byte* input,
60476047
input++; /* get past size */
60486048

60496049
/* validate client verify data */
6050-
if (XMEMCMP(input,
6050+
if (ConstantCompare(input,
60516051
ssl->secure_renegotiation->client_verify_data,
60526052
TLS_FINISHED_SZ) == 0) {
60536053
WOLFSSL_MSG("SCR client verify data match");
@@ -6072,15 +6072,16 @@ static int TLSX_SecureRenegotiation_Parse(WOLFSSL* ssl, const byte* input,
60726072
}
60736073
else if (*input == 2 * TLS_FINISHED_SZ &&
60746074
length == 2 * TLS_FINISHED_SZ + OPAQUE8_LEN) {
6075+
int cmpRes = 0;
60756076
input++; /* get past size */
6076-
6077+
cmpRes |= ConstantCompare(input,
6078+
ssl->secure_renegotiation->client_verify_data,
6079+
TLS_FINISHED_SZ);
6080+
cmpRes |= ConstantCompare(input + TLS_FINISHED_SZ,
6081+
ssl->secure_renegotiation->server_verify_data,
6082+
TLS_FINISHED_SZ);
60776083
/* validate client and server verify data */
6078-
if (XMEMCMP(input,
6079-
ssl->secure_renegotiation->client_verify_data,
6080-
TLS_FINISHED_SZ) == 0 &&
6081-
XMEMCMP(input + TLS_FINISHED_SZ,
6082-
ssl->secure_renegotiation->server_verify_data,
6083-
TLS_FINISHED_SZ) == 0) {
6084+
if (cmpRes == 0) {
60846085
WOLFSSL_MSG("SCR client and server verify data match");
60856086
ret = 0; /* verified */
60866087
}

0 commit comments

Comments
 (0)