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]
Date:   Fri, 27 Jan 2023 18:27:03 +0800
From:   Herbert Xu <herbert@...dor.apana.org.au>
To:     David Howells <dhowells@...hat.com>
Cc:     smfrench@...il.com, dhowells@...hat.com, viro@...iv.linux.org.uk,
        nspmangalore@...il.com, rohiths.msft@...il.com, tom@...pey.com,
        metze@...ba.org, hch@...radead.org, willy@...radead.org,
        jlayton@...nel.org, linux-cifs@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        sfrench@...ba.org, linux-crypto@...r.kernel.org
Subject: Re: [RFC 06/13] cifs: Add a function to Hash the contents of an
 iterator

David Howells <dhowells@...hat.com> wrote:
>
> diff --git a/fs/cifs/cifsencrypt.c b/fs/cifs/cifsencrypt.c
> index cbc18b4a9cb2..7be589aeb520 100644
> --- a/fs/cifs/cifsencrypt.c
> +++ b/fs/cifs/cifsencrypt.c
> @@ -24,6 +24,150 @@
> #include "../smbfs_common/arc4.h"
> #include <crypto/aead.h>
> 
> +/*
> + * Hash data from a BVEC-type iterator.
> + */
> +static int cifs_shash_bvec(const struct iov_iter *iter, ssize_t maxsize,
> +                          struct shash_desc *shash)
> +{
> +       const struct bio_vec *bv = iter->bvec;
> +       unsigned long start = iter->iov_offset;
> +       unsigned int i;
> +       void *p;
> +       int ret;
> +
> +       for (i = 0; i < iter->nr_segs; i++) {
> +               size_t off, len;
> +
> +               len = bv[i].bv_len;
> +               if (start >= len) {
> +                       start -= len;
> +                       continue;
> +               }
> +
> +               len = min_t(size_t, maxsize, len - start);
> +               off = bv[i].bv_offset + start;
> +
> +               p = kmap_local_page(bv[i].bv_page);
> +               ret = crypto_shash_update(shash, p + off, len);

Please convert this to ahash.  The whole point of shash is to
process *small* amounts of data that is not on an SG list.

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ