Skip to content

Commit e497d28

Browse files
authored
Merge pull request #9223 from kareem-wolfssl/zd20543_4
Fix non constant compare of TLS 1.3 binder, check for negative dst_len in wc_XChaCha20Poly1305_crypt_oneshot.
2 parents 4ca5c31 + 7afcf20 commit e497d28

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/tls13.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6201,7 +6201,8 @@ static int DoPreSharedKeys(WOLFSSL* ssl, const byte* input, word32 inputSz,
62016201
if (ret != 0)
62026202
return ret;
62036203
if (binderLen != current->binderLen ||
6204-
XMEMCMP(binder, current->binder, binderLen) != 0) {
6204+
ConstantCompare(binder, current->binder,
6205+
binderLen) != 0) {
62056206
WOLFSSL_ERROR_VERBOSE(BAD_BINDER);
62066207
return BAD_BINDER;
62076208
}

wolfcrypt/src/chacha20_poly1305.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ static WC_INLINE int wc_XChaCha20Poly1305_crypt_oneshot(
401401
goto out;
402402
}
403403

404-
if ((long int)dst_space < dst_len) {
404+
if (dst_len <= 0 || (long int)dst_space < dst_len) {
405405
ret = BUFFER_E;
406406
goto out;
407407
}

0 commit comments

Comments
 (0)