Skip to content

Commit 091016a

Browse files
Ensure se050Ctx->used does not overflow in se050_hash_update.
Thanks to Arjuna Arya for the report. Fixes #9951.
1 parent a6195c3 commit 091016a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

wolfcrypt/src/port/nxp/se050_port.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,9 +266,11 @@ int se050_hash_copy(SE050_HASH_Context* src, SE050_HASH_Context* dst)
266266

267267
int se050_hash_update(SE050_HASH_Context* se050Ctx, const byte* data, word32 len)
268268
{
269-
byte* tmp = NULL;
269+
byte* tmp = NULL;
270+
word32 tmpSz = 0;
270271

271-
if (se050Ctx == NULL || (len > 0 && data == NULL)) {
272+
if (se050Ctx == NULL || (len > 0 && data == NULL) ||
273+
!WC_SAFE_SUM_WORD32(se050Ctx->used, len, tmpSz)) {
272274
return BAD_FUNC_ARG;
273275
}
274276

0 commit comments

Comments
 (0)