lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMj1kXGwS03zUBTGb7jmk1-6r+=a-HH+A-S9ZFTYRyJSzN0Xcg@mail.gmail.com>
Date:   Fri, 19 May 2023 10:54:11 +0200
From:   Ard Biesheuvel <ardb@...nel.org>
To:     Herbert Xu <herbert@...dor.apana.org.au>
Cc:     Dmitry Safonov <dima@...sta.com>,
        Linux Crypto Mailing List <linux-crypto@...r.kernel.org>,
        linux-kernel@...r.kernel.org, David Ahern <dsahern@...nel.org>,
        Eric Dumazet <edumazet@...gle.com>,
        Paolo Abeni <pabeni@...hat.com>,
        Jakub Kicinski <kuba@...nel.org>,
        "David S. Miller" <davem@...emloft.net>,
        Andy Lutomirski <luto@...capital.net>,
        Bob Gilligan <gilligan@...sta.com>,
        Dan Carpenter <error27@...il.com>,
        David Laight <David.Laight@...lab.com>,
        Dmitry Safonov <0x7f454c46@...il.com>,
        Eric Biggers <ebiggers@...nel.org>,
        "Eric W. Biederman" <ebiederm@...ssion.com>,
        Francesco Ruggeri <fruggeri05@...il.com>,
        Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
        Ivan Delalande <colona@...sta.com>,
        Leonard Crestez <cdleonard@...il.com>,
        Salam Noureddine <noureddine@...sta.com>,
        netdev@...r.kernel.org
Subject: Re: [PATCH 3/3] crypto: cmac - Add support for cloning

Hi Herbert,

On Fri, 19 May 2023 at 10:29, Herbert Xu <herbert@...dor.apana.org.au> wrote:
>
> Allow hmac to be cloned.  The underlying cipher needs to support
> cloning by not having a cra_init function (all implementations of
> aes that do not require a fallback can be cloned).
>
> Signed-off-by: Herbert Xu <herbert@...dor.apana.org.au>

Does this imply that the cmac-aes-ce and cmac-aes-neon implementations
for arm64 need a similar treatment?

> ---
>
>  crypto/cmac.c |   18 +++++++++++++++++-
>  1 file changed, 17 insertions(+), 1 deletion(-)
>
> diff --git a/crypto/cmac.c b/crypto/cmac.c
> index bcc6f19a4f64..fce6b0f58e88 100644
> --- a/crypto/cmac.c
> +++ b/crypto/cmac.c
> @@ -213,7 +213,22 @@ static int cmac_init_tfm(struct crypto_shash *tfm)
>         ctx->child = cipher;
>
>         return 0;
> -};
> +}
> +
> +static int cmac_clone_tfm(struct crypto_shash *tfm, struct crypto_shash *otfm)
> +{
> +       struct cmac_tfm_ctx *octx = crypto_shash_ctx(otfm);
> +       struct cmac_tfm_ctx *ctx = crypto_shash_ctx(tfm);
> +       struct crypto_cipher *cipher;
> +
> +       cipher = crypto_clone_cipher(octx->child);
> +       if (IS_ERR(cipher))
> +               return PTR_ERR(cipher);
> +
> +       ctx->child = cipher;
> +
> +       return 0;
> +}
>
>  static void cmac_exit_tfm(struct crypto_shash *tfm)
>  {
> @@ -280,6 +295,7 @@ static int cmac_create(struct crypto_template *tmpl, struct rtattr **tb)
>         inst->alg.final = crypto_cmac_digest_final;
>         inst->alg.setkey = crypto_cmac_digest_setkey;
>         inst->alg.init_tfm = cmac_init_tfm;
> +       inst->alg.clone_tfm = cmac_clone_tfm;
>         inst->alg.exit_tfm = cmac_exit_tfm;
>
>         inst->free = shash_free_singlespawn_instance;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ