Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-10-16 Thread H. Peter Anvin
On 10/16/2012 08:53 AM, Theodore Ts'o wrote: > > ... and it looks like include/linux/log2.h already has a definition > for ilog2() which should definitely work for all versions of gcc, so > we could do this instead: > > #define shiftbits(w) (ilog2((w)) + 5) > > /* x^128 + x^103 + x^76 + x

Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-10-16 Thread Theodore Ts'o
On Mon, Oct 15, 2012 at 09:45:23PM -0700, H. Peter Anvin wrote: > > Or we could compute poolwords (and poolbits, and poolbytes) from it, > since shifts generally are cheap. I don't strongly care, whatever your > preference is. We are already calculating poolbits from poolwords: #define POOLBITS

Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-10-15 Thread H. Peter Anvin
On 10/15/2012 09:08 PM, Theodore Ts'o wrote: > On Sat, Sep 29, 2012 at 12:47:04PM -0700, H. Peter Anvin wrote: >>> -static struct poolinfo { >>> +static const struct poolinfo { >>> + int poolshift; /* log2(POOLBITS) */ >>> int poolwords; >>> int tap1, tap2, tap3, tap4, tap5; > >

Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-10-15 Thread Theodore Ts'o
On Sat, Sep 29, 2012 at 12:47:04PM -0700, H. Peter Anvin wrote: > >-static struct poolinfo { > >+static const struct poolinfo { > >+int poolshift; /* log2(POOLBITS) */ > > int poolwords; > > int tap1, tap2, tap3, tap4, tap5; Poolshift is duplicated information; it's just log2(

Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-09-29 Thread H. Peter Anvin
Ping on this patch? -hpa On 08/13/2012 10:26 AM, H. Peter Anvin wrote: From: "H. Peter Anvin" When we write entropy into a non-empty pool, we currently don't account at all for the fact that we will probabilistically overwrite some of the entropy in that pool. This means that unless

Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-08-15 Thread H. Peter Anvin
On 08/15/2012 12:30 PM, Matt Mackall wrote: > On Mon, 2012-08-13 at 10:26 -0700, H. Peter Anvin wrote: >> From: "H. Peter Anvin" >> >> When we write entropy into a non-empty pool, we currently don't >> account at all for the fact that we will probabilistically overwrite >> some of the entropy in t

Re: [PATCH RFC] random: Account for entropy loss due to overwrites

2012-08-15 Thread Matt Mackall
On Mon, 2012-08-13 at 10:26 -0700, H. Peter Anvin wrote: > From: "H. Peter Anvin" > > When we write entropy into a non-empty pool, we currently don't > account at all for the fact that we will probabilistically overwrite > some of the entropy in that pool. Technically, no, nothing is overwritten

[PATCH RFC] random: Account for entropy loss due to overwrites

2012-08-13 Thread H. Peter Anvin
From: "H. Peter Anvin" When we write entropy into a non-empty pool, we currently don't account at all for the fact that we will probabilistically overwrite some of the entropy in that pool. This means that unless the pool is fully empty, we are currently *guaranteed* to overestimate the amount o