linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ard Biesheuvel <ard.biesheuvel@linaro.org>
To: Eric Biggers <ebiggers@kernel.org>
Cc: linux-usb <linux-usb@vger.kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	"open list:HARDWARE RANDOM NUMBER GENERATOR CORE" 
	<linux-crypto@vger.kernel.org>,
	Herbert Xu <herbert@gondor.apana.org.au>
Subject: Re: [PATCH v3] wusb: switch to cbcmac transform
Date: Sun, 16 Jun 2019 08:52:32 +0200	[thread overview]
Message-ID: <CAKv+Gu_j_y3oSPy8JbTdNYVjzsSw72gM+UcC6+u_WBtw6opX2Q@mail.gmail.com> (raw)
In-Reply-To: <20190616012056.GA698@sol.localdomain>

On Sun, 16 Jun 2019 at 03:20, Eric Biggers <ebiggers@kernel.org> wrote:
>
> On Sat, Jun 15, 2019 at 11:17:45AM +0200, Ard Biesheuvel wrote:
> > The wusb code takes a very peculiar approach at implementing CBC-MAC,
> > by using plain CBC into a scratch buffer, and taking the output IV
> > as the MAC.
> >
> > We can clean up this code substantially by switching to the cbcmac
> > shash, as exposed by the CCM template. To ensure that the module is
> > loaded on demand, add the cbcmac template name as a module alias.
> >
> > Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> > ---
> > v3: - add missing #include to fix build error spotted by kbuild test robot
> > v2: - use finup()/digest() where possible, and process b0+b1 using a single
> >       call to update()
> >     - make 'stv_hsmic_hs' static const and remove comment regarding GCC 4.1
> >
> > NOTE: I don't have any hardware to test this, but the built-in selftest
> >       still passes.
> >
> >  crypto/ccm.c                  |   1 +
> >  drivers/usb/wusbcore/crypto.c | 169 +++++---------------
> >  2 files changed, 45 insertions(+), 125 deletions(-)
> >
>
> drivers/usb/wusbcore/Kconfig also needs to be updated:
>
> diff --git a/drivers/usb/wusbcore/Kconfig b/drivers/usb/wusbcore/Kconfig
> index 12e89189ca7d..2ec17d6af1f8 100644
> --- a/drivers/usb/wusbcore/Kconfig
> +++ b/drivers/usb/wusbcore/Kconfig
> @@ -6,9 +6,7 @@ config USB_WUSB
>         tristate "Enable Wireless USB extensions"
>         depends on UWB
>          select CRYPTO
> -        select CRYPTO_BLKCIPHER
> -        select CRYPTO_CBC
> -        select CRYPTO_MANAGER

We'll need this one, as it isn't implied by any of the other ones, and
cbcmac(aes) will be composed of the ccm template and the aes cipher on
all architectures except arm64.

> +        select CRYPTO_CCM
>          select CRYPTO_AES
>         help
>           Enable the host-side support for Wireless USB.
>
> > diff --git a/drivers/usb/wusbcore/crypto.c b/drivers/usb/wusbcore/crypto.c
> > index edb7263bff40..9ee66483ee54 100644
> > --- a/drivers/usb/wusbcore/crypto.c
> > +++ b/drivers/usb/wusbcore/crypto.c
>
> Other than that, this patch looks correct.  There are a massive number of things
> that need to be cleaned up in this code, but I guess we don't really care since
> as Greg said, this driver is planned to be removed anyway.  (It also seems the
> wireless USB specification is no longer available at usb.org.)  So I'm not going
> to bother being very picky...
>

Thanks Eric.

  reply	other threads:[~2019-06-16  6:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-06-15  9:17 [PATCH v3] wusb: switch to cbcmac transform Ard Biesheuvel
2019-06-16  1:20 ` Eric Biggers
2019-06-16  6:52   ` Ard Biesheuvel [this message]
2019-06-16  7:19     ` Eric Biggers
2019-06-16 18:25       ` Ard Biesheuvel

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAKv+Gu_j_y3oSPy8JbTdNYVjzsSw72gM+UcC6+u_WBtw6opX2Q@mail.gmail.com \
    --to=ard.biesheuvel@linaro.org \
    --cc=ebiggers@kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=herbert@gondor.apana.org.au \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).