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: <CAKywueTvdNwnzwmMj+0qigZ24EZeksO0--t5mqwXN4r5a4C70g@mail.gmail.com>
Date:   Mon, 8 May 2017 13:56:03 -0700
From:   Pavel Shilovsky <pshilovsky@...ba.org>
To:     Gilad Ben-Yossef <gilad@...yossef.com>
Cc:     Herbert Xu <herbert@...dor.apana.org.au>,
        "David S. Miller" <davem@...emloft.net>,
        Jonathan Corbet <corbet@....net>,
        David Howells <dhowells@...hat.com>,
        Alasdair Kergon <agk@...hat.com>,
        Mike Snitzer <snitzer@...hat.com>, dm-devel@...hat.com,
        Shaohua Li <shli@...nel.org>, Steve French <sfrench@...ba.org>,
        "Theodore Y. Ts'o" <tytso@....edu>,
        Jaegeuk Kim <jaegeuk@...nel.org>,
        Mimi Zohar <zohar@...ux.vnet.ibm.com>,
        Dmitry Kasatkin <dmitry.kasatkin@...il.com>,
        James Morris <james.l.morris@...cle.com>,
        "Serge E. Hallyn" <serge@...lyn.com>,
        Ofir Drang <ofir.drang@....com>,
        Gilad Ben-Yossef <gilad.benyossef@....com>,
        linux-crypto@...r.kernel.org, linux-doc@...r.kernel.org,
        Kernel Mailing List <linux-kernel@...r.kernel.org>,
        keyrings@...r.kernel.org, linux-raid@...r.kernel.org,
        linux-cifs <linux-cifs@...r.kernel.org>,
        samba-technical <samba-technical@...ts.samba.org>,
        linux-fsdevel <linux-fsdevel@...r.kernel.org>,
        linux-ima-devel@...ts.sourceforge.net,
        linux-ima-user@...ts.sourceforge.net,
        linux-security-module@...r.kernel.org
Subject: Re: [RFC 08/10] cifs: move to generic async completion

2017-05-06 5:59 GMT-07:00 Gilad Ben-Yossef <gilad@...yossef.com>:
> cifs starts an async. crypto op and waits for their completion.
> Move it over to generic code doing the same.
>
> Signed-off-by: Gilad Ben-Yossef <gilad@...yossef.com>
> ---
>  fs/cifs/smb2ops.c | 30 ++++--------------------------
>  1 file changed, 4 insertions(+), 26 deletions(-)
>
> diff --git a/fs/cifs/smb2ops.c b/fs/cifs/smb2ops.c
> index 152e37f..cee7bb3 100644
> --- a/fs/cifs/smb2ops.c
> +++ b/fs/cifs/smb2ops.c
> @@ -1706,22 +1706,6 @@ init_sg(struct smb_rqst *rqst, u8 *sign)
>         return sg;
>  }
>
> -struct cifs_crypt_result {
> -       int err;
> -       struct completion completion;
> -};
> -
> -static void cifs_crypt_complete(struct crypto_async_request *req, int err)
> -{
> -       struct cifs_crypt_result *res = req->data;
> -
> -       if (err == -EINPROGRESS)
> -               return;
> -
> -       res->err = err;
> -       complete(&res->completion);
> -}
> -
>  static int
>  smb2_get_enc_key(struct TCP_Server_Info *server, __u64 ses_id, int enc, u8 *key)
>  {
> @@ -1762,12 +1746,10 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc)
>         struct aead_request *req;
>         char *iv;
>         unsigned int iv_len;
> -       struct cifs_crypt_result result = {0, };
> +       DECLARE_CRYPTO_WAIT(wait);
>         struct crypto_aead *tfm;
>         unsigned int crypt_len = le32_to_cpu(tr_hdr->OriginalMessageSize);
>
> -       init_completion(&result.completion);
> -
>         rc = smb2_get_enc_key(server, tr_hdr->SessionId, enc, key);
>         if (rc) {
>                 cifs_dbg(VFS, "%s: Could not get %scryption key\n", __func__,
> @@ -1825,14 +1807,10 @@ crypt_message(struct TCP_Server_Info *server, struct smb_rqst *rqst, int enc)
>         aead_request_set_ad(req, assoc_data_len);
>
>         aead_request_set_callback(req, CRYPTO_TFM_REQ_MAY_BACKLOG,
> -                                 cifs_crypt_complete, &result);
> +                                 crypto_req_done, &wait);
>
> -       rc = enc ? crypto_aead_encrypt(req) : crypto_aead_decrypt(req);
> -
> -       if (rc == -EINPROGRESS || rc == -EBUSY) {
> -               wait_for_completion(&result.completion);
> -               rc = result.err;
> -       }
> +       rc = crypto_wait_req(enc ? crypto_aead_encrypt(req)
> +                               : crypto_aead_decrypt(req), &wait);
>
>         if (!rc && enc)
>                 memcpy(&tr_hdr->Signature, sign, SMB2_SIGNATURE_SIZE);
> --
> 2.1.4
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-cifs" in
> the body of a message to majordomo@...r.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

Acked-by: Pavel Shilovsky <pshilov@...rosoft.com>

Best regards,
Pavel Shilovsky

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ