Bodo Moeller wrote:
> 
> Ulf Moeller <[EMAIL PROTECTED]> in epsilon.openssl.dev:
> 
> >>   It is more convenient to have the range; also the previous
> >>   prototype was misleading because max was larger than
> >>   the actual maximum.)
> 
> > OK, so it would make sense to rename the variable in the prototype.
> > But it is a frequent operation to generate a random number in [0..n-1]
> > and [1..n-1] and the function should facilitate both.
> 
> BN_rand_range(min, max) (previous semantics) cannot be efficiently
> implemented for the general case without using an additional temporary
> variable range := max - min.  Only if 'min' is small, it makes sense
> to evaluate  BN_rand_range(0, max)  repeatedly until the result
> is >= min.
> 
> We could change BN_rand_range so that it always computes 'range' from
> 'min' and 'max'.  But this would mean unnecessary computational work
> since often 'min' *is* small.
> 

Erm I just noticed this. Are you using 'min' or 'max' as variable names?
I seem to recall that they may be macros on some systems which could
cause compilation problems.

Steve.
-- 
Dr Stephen N. Henson.   http://www.drh-consultancy.demon.co.uk/
Personal Email: [EMAIL PROTECTED] 
Senior crypto engineer, Celo Communications: http://www.celocom.com/
Core developer of the   OpenSSL project: http://www.openssl.org/
Business Email: [EMAIL PROTECTED] PGP key: via homepage.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to