Skip to content

Commit ae8468f

Browse files
committed
fix: correct u64 error sentinel width and XMALLOC/XFREE pairing
1 parent b135d5c commit ae8468f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

kernel-src/wolfcrypt_glue.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ static __always_inline bool wc_AesGcm_crypt_sg_inplace(struct scatterlist *src,
312312
if (miter_needs_stop)
313313
sg_miter_stop(&miter);
314314

315-
free(aes);
315+
XFREE(aes, NULL, DYNAMIC_TYPE_TMP_BUFFER);
316316

317317
WC_DEBUG_PR_IF_NEG(ret);
318318

@@ -447,7 +447,7 @@ static __always_inline bool wc_AesGcm_crypt_sg_inplace(struct scatterlist *src,
447447
else
448448
wc_ForceZero(buf, src_len + WC_AES_BLOCK_SIZE);
449449
}
450-
free(buf);
450+
XFREE(buf, NULL, DYNAMIC_TYPE_TMP_BUFFER);
451451
}
452452

453453
out:
@@ -456,7 +456,7 @@ static __always_inline bool wc_AesGcm_crypt_sg_inplace(struct scatterlist *src,
456456

457457
out_aes_uninited:
458458

459-
free(aes);
459+
XFREE(aes, NULL, DYNAMIC_TYPE_TMP_BUFFER);
460460

461461
wc_ForceZero(full_nonce, sizeof full_nonce);
462462

kernel-src/wolfcrypt_glue.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ static inline int wc_sha256_oneshot2(byte *out, const byte *message1, const size
145145
static inline u64 wc_u64_keyed_hash(const byte *key, const size_t key_len, const byte *message, const size_t message_len) {
146146
u64 ret[WC_SHA256_DIGEST_SIZE / sizeof(u64)];
147147
if (wc_sha256_oneshot2((byte *)ret, key, key_len, message, message_len) < 0)
148-
return ~0UL;
148+
return ~(u64)0;
149149
else
150150
return ret[0];
151151
}

0 commit comments

Comments
 (0)