From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 50D0D48866 for ; Mon, 29 Sep 2025 18:32:44 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4148B406B4; Mon, 29 Sep 2025 18:32:44 +0200 (CEST) Received: from mail-qv1-f44.google.com (mail-qv1-f44.google.com [209.85.219.44]) by mails.dpdk.org (Postfix) with ESMTP id 8C0EA4064E for ; Mon, 29 Sep 2025 18:32:41 +0200 (CEST) Received: by mail-qv1-f44.google.com with SMTP id 6a1803df08f44-79a7d439efbso39760476d6.0 for ; Mon, 29 Sep 2025 09:32:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1759163561; x=1759768361; darn=dpdk.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:from:to:cc:subject:date :message-id:reply-to; bh=UhEifHwuPy7KqMiJEobyFfKosv3tFBcaWfKVaD0PruA=; b=wjue8KsCHNvL2HzJmhpLMQ12xjP5vXS2ylKjY8Icgi0PdytfMbmgGWBIyDF6Go4pQD Kd5Dn/ujLjP38OE/uR0A9FpZwshbVeKN2ayK12kNhCsjIBWGJYqT8+4tDpkftHWfMfly VaFGfieNjIJgRSF/wjcSot1zmftwuep8lAs0lEbb97tmg7iqq4CFtS6ZyFESmyTqlHr3 Fh0UZ+KZ+lksPcCFmFfm/blVoLqCEqsBNnLwSR4MZ9VUD0V/Rlr3+iW2AMB6hxSj6fty aLJ03yIA0CafliGSwk7PyFkTfa40h2kIUPX5bMJNFh/9IUakhCNOiknQx33jL2YNHSxT 83oA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759163561; x=1759768361; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:subject:cc:to:from:date:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=UhEifHwuPy7KqMiJEobyFfKosv3tFBcaWfKVaD0PruA=; b=BotgvMRwt6ajHFfG/dNQSETqA658+4czJc+rpQsUjvLiME1sKzbBOLgUP/ddGFI4bv znliA6rljVB3pYqutS7nnrYMfkD3MW7Ih1NnuM95y++EE01py6QmQb/2KJn4SeNezEqN VNM/b7VlLNXZi5bHVRokPe+BE0flp3ZDs7uO1NXbboYyDMpH6yia/BucP55Ew0FBKRhh 55PmqV1vEjkH2XKuoi1KqzqCgXqwDwCqBUhtscx3VnQbDfk4wgb+QZVOMhnrUs7XA0r2 Win3DbUzrK+5+LnTFbIMcCjz2ypkojLlvTR1dDTl6vzjHF3pPEV1y9Mt52Tp2B/5LNjQ YK6Q== X-Forwarded-Encrypted: i=1; AJvYcCXng+tK0IjwQ0vN7jNxTB9W+t9fjPzLp4hrcZwMxsJUQsIAKtqwBsQa33Sal870h+ZnwKRvo4o=@dpdk.org X-Gm-Message-State: AOJu0YyQ+5BMZfhwT71d7goeYMu1Y+1svfigo8NAiqmAiyDK/4jYMwhF VnqaHfIuvoB2ePsbiiX6lQ0gTq1p3RAN9c68UWfuotp5nil0Ovr5FJpwmUCWVv5y6Ps= X-Gm-Gg: ASbGncuTw69fMQCHIhgX7AOomlCRAQi9JLaGu4J/WAtfOkGRd+DI7AMQHUIVC5q5wph IawUbEjW9JhpqcGdvs3tn/HlVg6vjhX3N368uD7I1nh+6hNIt/ikIFlQR+CeB7yEKmVnUvJEi2E oBtalcTkhJ7PBLvj88SUO7k0vgyzrLD8n+iDG81cJ7w0s6zDdxzb+dPL6AxuuMj0xX6pEca6a8u v2vS117dFijgl4MZn0+tAf5aIYcHpl246rBK+lrbGSLwqlnWnqAt+0Ew+gp574coPhXDO/pKPZD hDisOGq4dH1Sz5azXCTTc+UD/FPSb1JIO/iAOJKI7fqWsbVsEj7zMizw7vstWMfwJk/YBJw+JZS CL5iogmHyvysIHt3zvhcNZ3axFARSisSG2tUZCvIHrccp2RpiYvD3ImP6jsg8ie0gxxYLRPQge3 E= X-Google-Smtp-Source: AGHT+IFxRCb79Tc9E47vdZyBB9B+aFWUAQhdRSrg75GsHo5K8swd4YNvd1T/eE7VttwNQku827Vm7A== X-Received: by 2002:a05:6214:268e:b0:823:f922:8f10 with SMTP id 6a1803df08f44-823f9229040mr163536056d6.30.1759163560690; Mon, 29 Sep 2025 09:32:40 -0700 (PDT) Received: from hermes.local (204-195-96-226.wavecable.com. [204.195.96.226]) by smtp.gmail.com with ESMTPSA id 6a1803df08f44-80166781d27sm79646666d6.45.2025.09.29.09.32.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Sep 2025 09:32:40 -0700 (PDT) Date: Mon, 29 Sep 2025 09:32:36 -0700 From: Stephen Hemminger To: Kai Ji Cc: dev@dpdk.org, gakhil@marvell.com, konstantin.ananyev@huawei.com, bruce.richardson@intel.com, thomas@monjalon.net, mb@smartsharesystems.com, stable@dpdk.org Subject: Re: [dpdk-dev v4 1/2] eal: Add mem equal and non-equal to prevent timing attacks memcmp. Message-ID: <20250929093236.37fe5460@hermes.local> In-Reply-To: <20250929145049.153078-1-kai.ji@intel.com> References: <20250926160209.56496-1-kai.ji@intel.com> <20250929145049.153078-1-kai.ji@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org On Mon, 29 Sep 2025 14:50:48 +0000 Kai Ji wrote: > diff --git a/lib/eal/include/rte_memory.h b/lib/eal/include/rte_memory.h > index dcc0e69cfe..bbdef8e939 100644 > --- a/lib/eal/include/rte_memory.h > +++ b/lib/eal/include/rte_memory.h > @@ -746,6 +746,74 @@ __rte_experimental > void > rte_memzero_explicit(void *dst, size_t sz); > > +/** > + * @warning > + * @b EXPERIMENTAL: this API may change without prior notice. > + * > + * Constant-time memory inequality comparison. > + * > + * This function compares two memory regions in constant time, making it > + * resistant to timing side-channel attacks. The execution time depends only > + * on the length parameter, not on the actual data values being compared. > + * > + * This is particularly important for cryptographic operations where timing > + * differences could leak information about secret keys, passwords, or other > + * sensitive data. > + * > + * @param a > + * Pointer to the first memory region to compare > + * @param b > + * Pointer to the second memory region to compare > + * @param n > + * Number of bytes to compare > + * @return > + * false if the memory regions are identical, true if they differ > + */ > +__rte_experimental > +static inline bool > +rte_memneq_consttime(const void *a, const void *b, size_t n) NAK Please change to match BSD equivalent function (ie not not equal)