Skip site navigation (1) Skip section navigation (2)

Re: [HACKERS] Query cancel and OOB data

From: ocie(at)paracel(dot)com
To: tgl(at)sss(dot)pgh(dot)pa(dot)us (Tom Lane)
Cc: maillist(at)candle(dot)pha(dot)pa(dot)us, byronn(at)insightdist(dot)com, hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Query cancel and OOB data
Date: 1998-05-26 21:00:57
Message-ID: (view raw, whole thread or download thread mbox)
Lists: pgsql-hackers
Tom Lane wrote:
> Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us> writes:
> > I was trying to avoid the
> > 'magic cookie' solution for a few reasons:
> > 	1) generating a random secret codes can be slow (I may be wrong)
> Not really.  A typical system rand() subroutine is a multiply and an
> add.  For the moment I'd recommend generating an 8-byte random key with
> something like
> 	for (i=0; i<8; i++)
> 		key[i] = rand() & 0xFF;
> which isn't going to take enough time to notice.
> The above isn't cryptographically secure (which means that a person who
> receives a "random" key generated this way might be able to predict the
> next one you generate).  But it will do to get the protocol debugged,
> and we can improve it later.  I have Schneier's "Applied Cryptography"
> and will study its chapter on secure random number generators.

A neat feature of linux is that it has a kernel random number
generator which is fed random data from interrupt times.  The only
drawback is that this is sort of a "pool", so whn the pool is full,
drawing 8 bytes from it is not a problem, but when the pool is
drained, it can take some time to generate more data.  At any rate, it
might be a good starting point for a postgres random number generator
-- sample usage of shared memory and perform a hash on this.  From
"applied cryptography":

"In effect, the system degrades gracefully from perfect to practical
randomness when the demand exceeds the supply.  In this case it
becomes theoretically possible .. to determine a previous or
subsequent result.  But this requires inverting MD5, which is
computationally infeasible"

applied cryptography, 2nd eddition, p427.

This is sort of what we want.  As random as the key can be, but able
to generate a pseudo-random key if we're short on time.


In response to


pgsql-hackers by date

Next:From: Brett McCormickDate: 1998-05-26 21:11:18
Subject: Re: [HACKERS] Query cancel and OOB data
Previous:From: Peter T MountDate: 1998-05-26 21:00:23
Subject: Re: [HACKERS] error messages not only English

Privacy Policy | About PostgreSQL
Copyright © 1996-2017 The PostgreSQL Global Development Group