From: Eric Biggers <ebiggers@kernel.org>
To: Gilad Ben-Yossef <gilad@benyossef.com>
Cc: Herbert Xu <herbert@gondor.apana.org.au>,
"David S. Miller" <davem@davemloft.net>,
Ofir Drang <ofir.drang@arm.com>,
Corentin Labbe <clabbe.montjoie@gmail.com>,
stable@vger.kernel.org, linux-crypto@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] crypto: drbg: fix crypto api abuse
Date: Wed, 23 Feb 2022 17:47:23 -0800 [thread overview]
Message-ID: <Yhbjq3cVsMVUQLio@sol.localdomain> (raw)
In-Reply-To: <20220223080400.139367-1-gilad@benyossef.com>
On Wed, Feb 23, 2022 at 10:04:00AM +0200, Gilad Ben-Yossef wrote:
> the drbg code was binding the same buffer to two different
> scatter gather lists and submitting those as source and
> destination to a crypto api operation, thus potentially
> causing HW crypto drivers to perform overlapping DMA
> mappings which are not aware it is the same buffer.
>
> This can have serious consequences of data corruption of
> internal DRBG buffers and wrong RNG output.
>
> Fix this by reusing the same scatter gatther list for both
> src and dst.
>
> Signed-off-by: Gilad Ben-Yossef <gilad@benyossef.com>
> Reported-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Tested-by: Corentin Labbe <clabbe.montjoie@gmail.com>
> Tested-on: r8a7795-salvator-x
> Tested-on: xilinx-zc706
> Fixes: 43490e8046b5d ("crypto: drbg - in-place cipher operation for CTR")
> Cc: stable@vger.kernel.org
Where is it documented and tested that the API doesn't allow this?
I wasn't aware of this case; it sounds perfectly allowed to me.
There might be a lot of other users who do this, not just drbg.c.
- Eric
next prev parent reply other threads:[~2022-02-24 1:47 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 8:04 [PATCH] crypto: drbg: fix crypto api abuse Gilad Ben-Yossef
2022-02-24 1:47 ` Eric Biggers [this message]
2022-02-24 1:53 ` Eric Biggers
2022-02-24 7:07 ` Gilad Ben-Yossef
2022-02-24 19:04 ` Eric Biggers
2022-02-27 10:12 ` Gilad Ben-Yossef
2022-02-28 9:09 ` Gilad Ben-Yossef
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=Yhbjq3cVsMVUQLio@sol.localdomain \
--to=ebiggers@kernel.org \
--cc=clabbe.montjoie@gmail.com \
--cc=davem@davemloft.net \
--cc=gilad@benyossef.com \
--cc=herbert@gondor.apana.org.au \
--cc=linux-crypto@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ofir.drang@arm.com \
--cc=stable@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