Re: [PATCH] libceph: Use HMAC-SHA256 library instead of crypto_shash

Ilya Dryomov
2025-09-08T09:32:46Z

On Thu, Sep 4, 2025 at 7:26 PM Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Thu, Sep 04, 2025 at 12:24:08PM +0200, Ilya Dryomov wrote:
> > > - if (con->v2.hmac_tfm) {
> > > - crypto_free_shash(con->v2.hmac_tfm);
> > > - con->v2.hmac_tfm = NULL;
> > > - }
> > > + memzero_explicit(&con->v2.hmac_key, sizeof(con->v2.hmac_key));
> > > + con->v2.hmac_key_set = false;
> >
> > Hi Eric,
> >
> > Since we have hmac_key_set anyway, could the call to memzero_explicit()
> > be conditioned on it?
>
> If you want. It's less code to just do it unconditionally.

Double checking the surrounding code, the only case where hmac_key_set
would remain false is auth_none protocol (i.e. no authentication at the
Ceph level at all). This is extremely rare, so I'm leaving the patch
as is.

Thanks,

Ilya