[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20250818211607.c8eb87fbac2f81774022b54b@uniroma2.it>
Date: Mon, 18 Aug 2025 21:16:07 +0200
From: Andrea Mayer <andrea.mayer@...roma2.it>
To: Eric Biggers <ebiggers@...nel.org>
Cc: netdev@...r.kernel.org, David Lebrun <dlebrun@...gle.com>,
stable@...r.kernel.org, stefano.salsano@...roma2.it,
Paolo Lungaroni
<paolo.lungaroni@...roma2.it>,
Andrea Mayer <andrea.mayer@...roma2.it>
Subject: Re: [PATCH net-next 1/3] ipv6: sr: Fix MAC comparison to be
constant-time
On Fri, 15 Aug 2025 20:11:34 -0700
Eric Biggers <ebiggers@...nel.org> wrote:
> To prevent timing attacks, MACs need to be compared in constant time.
> Use the appropriate helper function for this.
>
> Fixes: bf355b8d2c30 ("ipv6: sr: add core files for SR HMAC support")
> Cc: stable@...r.kernel.org
> Signed-off-by: Eric Biggers <ebiggers@...nel.org>
> ---
> net/ipv6/seg6_hmac.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
Hi Eric,
Thanks for the fix!
I believe it would be best to submit this fix separately from the current patch
set. Since this addresses a bug rather than an enhancement or cleanup, sending
it individually with the 'net' tag will help facilitate applying this patch to
the net tree.
Ciao,
Andrea
> diff --git a/net/ipv6/seg6_hmac.c b/net/ipv6/seg6_hmac.c
> index f78ecb6ad8383..5dae892bbc73b 100644
> --- a/net/ipv6/seg6_hmac.c
> +++ b/net/ipv6/seg6_hmac.c
> @@ -33,10 +33,11 @@
> #include <net/ip6_route.h>
> #include <net/addrconf.h>
> #include <net/xfrm.h>
>
> #include <crypto/hash.h>
> +#include <crypto/utils.h>
> #include <net/seg6.h>
> #include <net/genetlink.h>
> #include <net/seg6_hmac.h>
> #include <linux/random.h>
>
> @@ -278,11 +279,11 @@ bool seg6_hmac_validate_skb(struct sk_buff *skb)
> return false;
>
> if (seg6_hmac_compute(hinfo, srh, &ipv6_hdr(skb)->saddr, hmac_output))
> return false;
>
> - if (memcmp(hmac_output, tlv->hmac, SEG6_HMAC_FIELD_LEN) != 0)
> + if (crypto_memneq(hmac_output, tlv->hmac, SEG6_HMAC_FIELD_LEN))
> return false;
>
> return true;
> }
> EXPORT_SYMBOL(seg6_hmac_validate_skb);
> --
> 2.50.1
>
Powered by blists - more mailing lists