<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"> P {margin-top:0;margin-bottom:0;} </style>
</head>
<body dir="ltr">
<div style="font-family: "IntelOne Text"; font-size: 10pt; color: rgb(0, 0, 0);" class="elementToProof">
What needed to get it merged within RC1 window ? </div>
<div id="appendonsend"></div>
<div><br>
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<hr style="display: inline-block; width: 98%;">
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<b>From:</b> Morten Brørup <mb@smartsharesystems.com><br>
<b>Sent:</b> Friday, October 03, 2025 08:35<br>
<b>To:</b> Ji, Kai <kai.ji@intel.com>; dev@dpdk.org <dev@dpdk.org><br>
<b>Cc:</b> gakhil@marvell.com <gakhil@marvell.com>; konstantin.ananyev@huawei.com <konstantin.ananyev@huawei.com>; Richardson, Bruce <bruce.richardson@intel.com>; thomas@monjalon.net <thomas@monjalon.net>; stephen@networkplumber.org <stephen@networkplumber.org><br>
<b>Subject:</b> RE: [dpdk-dev v6 1/2] eal: introduce rte_memeq_timingsafe() based on FreeBSD API
</div>
<div style="font-family: Calibri, Arial, Helvetica, sans-serif; font-size: 12pt; color: rgb(0, 0, 0);">
<br>
</div>
<div style="font-size: 11pt;" class="elementToProof">> From: Kai Ji [<a class="OWAAutoLink" id="OWAbfe2d5fa-ad9e-6741-9051-c245f7672a14" href="mailto:kai.ji@intel.com">mailto:kai.ji@intel.com</a>]<br>
> Sent: Thursday, 2 October 2025 17.32<br>
><br>
> Bugzilla ID: 1773<br>
> <a data-auth="NotApplicable" class="OWAAutoLink" id="OWA022adc35-d234-0bf2-3791-e24a374476c1" href="https://bugs.dpdk.org/show_bug.cgi?id=1773">
https://bugs.dpdk.org/show_bug.cgi?id=1773</a><br>
><br>
> Signed-off-by: Kai Ji <kai.ji@intel.com><br>
> ---<br>
> lib/eal/include/rte_memory.h | 38 ++++++++++++++++++++++++++++++++++++<br>
> 1 file changed, 38 insertions(+)<br>
><br>
> diff --git a/lib/eal/include/rte_memory.h<br>
> b/lib/eal/include/rte_memory.h<br>
> index dcc0e69cfe..2d24e091af 100644<br>
> --- a/lib/eal/include/rte_memory.h<br>
> +++ b/lib/eal/include/rte_memory.h<br>
> @@ -746,6 +746,44 @@ __rte_experimental<br>
> void<br>
> rte_memzero_explicit(void *dst, size_t sz);<br>
><br>
> +/**<br>
> + * @warning<br>
> + * @b EXPERIMENTAL: this API may change without prior notice.<br>
> + *<br>
> + * Timing-safe memory equality comparison.<br>
> + *<br>
> + * This function compares two memory regions in constant time, making<br>
> it<br>
> + * resistant to timing side-channel attacks. The execution time<br>
> depends only<br>
> + * on the length parameter, not on the actual data values being<br>
> compared.<br>
> + *<br>
> + * This is particularly important for cryptographic operations where<br>
> timing<br>
> + * differences could leak information about secret keys, passwords, or<br>
> other<br>
> + * sensitive data.<br>
> + *<br>
> + * @param a<br>
> + * Pointer to the first memory region to compare<br>
> + * @param b<br>
> + * Pointer to the second memory region to compare<br>
> + * @param n<br>
> + * Number of bytes to compare<br>
> + * @return<br>
> + * true if the memory regions are identical, false if they differ<br>
> + */<br>
> +__rte_experimental<br>
> +static inline bool<br>
> +rte_memeq_timingsafe(const void *a, const void *b, size_t n)<br>
> +{<br>
> + const volatile uint8_t *pa = (const volatile uint8_t *)a;<br>
> + const volatile uint8_t *pb = (const volatile uint8_t *)b;<br>
> + uint8_t result = 0;<br>
> + size_t i;<br>
> +<br>
> + for (i = 0; i < n; i++)<br>
> + result |= pa[i] ^ pb[i];<br>
> +<br>
> + return result == UINT8_C(0);<br>
> +}<br>
> +<br>
> #ifdef __cplusplus<br>
> }<br>
> #endif<br>
> --<br>
> 2.34.1<br>
<br>
Reviewed-by: Morten Brørup <mb@smartsharesystems.com><br>
<br>
</div>
</body>
</html>