From: "Pádraig Brady" <P@draigBrady.com>
To: "Theodore Ts'o" <tytso@mit.edu>,
"Lasse Kärkkäinen" <ljkarkk2@cc.hut.fi>,
linux-kernel@vger.kernel.org
Subject: Re: urandom is too slow
Date: Tue, 30 Oct 2012 20:56:56 +0000 [thread overview]
Message-ID: <50903F18.10004@draigBrady.com> (raw)
In-Reply-To: <20121030185403.GA5044@thunk.org>
On 10/30/2012 06:54 PM, Theodore Ts'o wrote:
> On Tue, Oct 30, 2012 at 04:55:22PM +0200, Lasse Kärkkäinen wrote:
>> Apparently there has been little or no development on urandom even
>> though the device is in widespread use for disk shredding and such
>> use. The device emits data at rather slow rate of 19 MB/s even on
>> modern hardware where other software-based PRNGs could do far
>> better. An even better option seems to be utilizing AES for
>> encrypting zeroes, using a random key, allowing for rates up to 500
>> MB/s with hardware that has AES-NI instructions.
>>
>> Why is urandom so slow and why isn't AES hardware acceleration utilized?
>
> If you can use a software-based PRNG, you should use one in userspace.
> The intended use of urandom is for cryptographic purposes (i.e.,
> generating random session keys, long-term public keys, etc.). If you
> just want to wipe a disk, you shouldn't be using /dev/urandom for that
> purpose.
For the record, shred uses a user space PRNG for speed
for the last 3 years or so, rather than using /dev/urandom:
http://git.sv.gnu.org/gitweb/?p=coreutils.git;a=commit;h=af5723c7
$ shred-old -v -n3 t
shred-old: t: pass 1/3 (random)...
shred-old: t: pass 1/3 (random)...8.3MiB/1000MiB 0%
shred-old: t: pass 1/3 (random)...17MiB/1000MiB 1%
shred-old: t: pass 1/3 (random)...32MiB/1000MiB 3%
...
$ time shred-new -v t
shred-new: t: pass 1/3 (random)...
shred-new: t: pass 1/3 (random)...116MiB/1000MiB 11%
shred-new: t: pass 1/3 (random)...216MiB/1000MiB 21%
shred-new: t: pass 1/3 (random)...340MiB/1000MiB 34%
...
cheers,
Pádraig.
next prev parent reply other threads:[~2012-10-30 20:57 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-30 14:55 urandom is too slow Lasse Kärkkäinen
2012-10-30 18:54 ` Theodore Ts'o
2012-10-30 20:56 ` Pádraig Brady [this message]
2012-10-30 21:38 ` Alan Cox
2012-11-02 1:10 ` Lasse Kärkkäinen
2012-11-02 19:56 ` Theodore Ts'o
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=50903F18.10004@draigBrady.com \
--to=p@draigbrady.com \
--cc=linux-kernel@vger.kernel.org \
--cc=ljkarkk2@cc.hut.fi \
--cc=tytso@mit.edu \
/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