From c1a2c1f7b29576b7b230c3efb68226f5d61efb6a Mon Sep 17 00:00:00 2001 From: jordan Date: Thu, 16 Jul 2026 12:16:05 -0500 Subject: [PATCH] esp: use wc_ConstantCompare. --- src/wolfesp.c | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/src/wolfesp.c b/src/wolfesp.c index c95e70e8..f44d2317 100644 --- a/src/wolfesp.c +++ b/src/wolfesp.c @@ -640,20 +640,6 @@ esp_calc_icv_hmac(uint8_t * hash, const wolfIP_esp_sa * esp_sa, return err; } -/* From wolfcrypt misc.c */ -static int -esp_const_memcmp(const uint8_t * vec_a, const uint8_t * vec_b, uint32_t len) -{ - uint32_t i = 0; - int sum = 0; - - for (i = 0; i < len; i++) { - sum |= vec_a[i] ^ vec_b[i]; - } - - return sum; -} - /** * Get the encryption length for an ESP payload. * */ @@ -1225,7 +1211,7 @@ esp_check_icv_hmac(const wolfIP_esp_sa * esp_sa, uint8_t * esp_data, icv = esp_data + esp_len - esp_sa->icv_len; /* compare the first N bits depending on truncation type. */ - rc = esp_const_memcmp(icv, hash, esp_sa->icv_len); + rc = wc_ConstantCompare(icv, hash, esp_sa->icv_len); if (rc) { rc = -1; }