Re: [PATCH 03/13] crypto: x86/sha - yield FPU context during long loops

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Jan 13, 2023 at 07:35:07PM +0000, Elliott, Robert (Servers) wrote:
>
> pkcs_digest() uses shash like this:
>         /* Allocate the hashing algorithm we're going to need and find out how
>          * big the hash operational data will be.
>          */
>         tfm = crypto_alloc_shash(sinfo->sig->hash_algo, 0, 0);
>         if (IS_ERR(tfm))
>                 return (PTR_ERR(tfm) == -ENOENT) ? -ENOPKG : PTR_ERR(tfm);
> 
>         desc_size = crypto_shash_descsize(tfm) + sizeof(*desc);
>         sig->digest_size = crypto_shash_digestsize(tfm);
> 
>         ret = -ENOMEM;
>         sig->digest = kmalloc(sig->digest_size, GFP_KERNEL);
>         if (!sig->digest)
>                 goto error_no_desc;
> 
>         desc = kzalloc(desc_size, GFP_KERNEL);
>         if (!desc)
>                 goto error_no_desc;
> 
>         desc->tfm   = tfm;
> 
>         /* Digest the message [RFC2315 9.3] */
>         ret = crypto_shash_digest(desc, pkcs7->data, pkcs7->data_len,
>                                   sig->digest);
>         if (ret < 0)
>                 goto error;
>         pr_devel("MsgDigest = [%*ph]\n", 8, sig->digest);

As this path is sleepable, the conversion should be fairly trivial
with crypto_wait_req.

Cheers,
-- 
Email: Herbert Xu <herbert@xxxxxxxxxxxxxxxxxxx>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt



[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]
  Powered by Linux