From: Ido Schimmel <idosch@idosch.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: Kuniyuki Iwashima <kuniyu@google.com>,
andrea.mayer@uniroma2.it, dlebrun@google.com,
netdev@vger.kernel.org, Minhong He <heminhong@kylinos.cn>
Subject: Re: [PATCH net-next 2/3] ipv6: sr: Use HMAC-SHA1 and HMAC-SHA256 library functions
Date: Sun, 17 Aug 2025 19:58:00 +0300 [thread overview]
Message-ID: <aKIKGI72EklLRfwO@shredder> (raw)
In-Reply-To: <20250816072639.GA291962@sol>
On Sat, Aug 16, 2025 at 12:26:39AM -0700, Eric Biggers wrote:
> On Sat, Aug 16, 2025 at 07:01:28AM +0000, Kuniyuki Iwashima wrote:
> > From: Eric Biggers <ebiggers@kernel.org>
> > Date: Fri, 15 Aug 2025 20:11:35 -0700
> > > @@ -106,79 +95,17 @@ static struct sr6_tlv_hmac *seg6_get_tlv_hmac(struct ipv6_sr_hdr *srh)
> > > return NULL;
> > >
> > > return tlv;
> > > }
> > >
> > > -static struct seg6_hmac_algo *__hmac_get_algo(u8 alg_id)
> > > -{
> > > - struct seg6_hmac_algo *algo;
> > > - int i, alg_count;
> > > -
> > > - alg_count = ARRAY_SIZE(hmac_algos);
> > > - for (i = 0; i < alg_count; i++) {
> > > - algo = &hmac_algos[i];
> > > - if (algo->alg_id == alg_id)
> > > - return algo;
> > > - }
> > > -
> > > - return NULL;
> > > -}
> >
> > This chunk will cause build failure when net.git is merged
> > to net-next due to the patch below. You may want to respin
> > the series after this lands to net-next.
> >
> > https://lore.kernel.org/netdev/20250815063845.85426-1-heminhong@kylinos.cn/
>
> Thanks for pointing that out. I hadn't seen that patch. Patch 3 in my
> series actually fixes the exact same problem, though in my patch it's
> more of a side effect of preparing the HMAC key rather than the main
> point of the patch. If that patch lands first, I'll rebase my series.
>
> We do need to decide whether the algorithm ID validation and key
> preparation should be done in seg6_hmac_info_add() as in that patch, or
> in seg6_genl_sethmac() as in my patch. seg6_hmac_info_add() is fine I
> guess, but let me know if you have a preference.
FWIW, I think that as you have it now is fine given the other parameters
are also validated in seg6_genl_sethmac(). Exposing __hmac_get_algo()
seemed wrong to me so I suggested either moving the check to
seg6_hmac_info_add() or exposing something like 'bool
seg6_hmac_algo_is_valid(u8 alg_id)' which internally calls
__hmac_get_algo().
next prev parent reply other threads:[~2025-08-17 16:58 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-16 3:11 [PATCH net-next 0/3] ipv6: sr: HMAC fix and cleanups Eric Biggers
2025-08-16 3:11 ` [PATCH net-next 1/3] ipv6: sr: Fix MAC comparison to be constant-time Eric Biggers
2025-08-18 19:16 ` Andrea Mayer
2025-08-18 19:38 ` Eric Biggers
2025-08-18 20:30 ` Eric Biggers
2025-08-16 3:11 ` [PATCH net-next 2/3] ipv6: sr: Use HMAC-SHA1 and HMAC-SHA256 library functions Eric Biggers
2025-08-16 7:01 ` Kuniyuki Iwashima
2025-08-16 7:26 ` Eric Biggers
2025-08-17 16:58 ` Ido Schimmel [this message]
2025-08-16 3:11 ` [PATCH net-next 3/3] ipv6: sr: Prepare HMAC key ahead of time Eric Biggers
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=aKIKGI72EklLRfwO@shredder \
--to=idosch@idosch.org \
--cc=andrea.mayer@uniroma2.it \
--cc=dlebrun@google.com \
--cc=ebiggers@kernel.org \
--cc=heminhong@kylinos.cn \
--cc=kuniyu@google.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).