I did see that but I think I misunderstood, so ...
I still am not sure then how I would accomplish the following:
1.) Take a seed and the known output of the PRNG with that seed.
2.) Seed the PRNG with the seed and get a RAND
3.) See if that RAND in step 2 I sthe same as the one in Step 1

The below always produces two different random numbers:

#include <openssl/ssl.h> 
#include <openssl/err.h> 
#include <openssl/rand.h>

RAND_cleanup();

unsigned char buf1[8];
unsigned char buf2[8];

unsigned char prng_seed[8] =
        { 0x6b, 0xa3, 0x4f, 0x07, 0xe4, 0x2a, 0xb0, 0xc };
RAND_seed( prng_seed, sizeof(prng_seed) );

RAND_pseudo_bytes( buf1, sizeof(buf1) );
RAND_pseudo_bytes( buf2, sizeof(buf2) );

//bu1 never equals buf2

RAND_cleanup();


-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Brian Candler
Sent: Friday, March 03, 2006 2:33 PM
To: OpenSSLGRT
Cc: openssl-users@openssl.org
Subject: Re: Another RAND question...

On Fri, Mar 03, 2006 at 02:02:46PM -0500, OpenSSLGRT wrote:
>    When calling RAND_pseudo_bytes is it correct that the PRNG will not
>    give the same result even though I have the same seed (I thought if I
>    had the same seed I could get the same results each time)?

>From 'man RAND_seed'

       RAND_add() mixes the num bytes at buf into the PRNG state.
...
       RAND_seed() is equivalent to RAND_add() when num == entropy.
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]



______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
User Support Mailing List                    openssl-users@openssl.org
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to