Issue is fixed. FYI- As I am working on pre-boot, no OS is present. Which was resulting in no seeding. RAND_seed() has been called before using RAND_bytes().
Here is the code snippet. static const char rnd_seed[] = "string to make the random number generator think it has entropy"; RAND_seed(rnd_seed, sizeof rnd_seed); On Tue, Aug 13, 2013 at 6:16 PM, baban devkate <baban...@gmail.com> wrote: > > FYI - > > RAND_bytes(buf, bytes) receives correct parameters as bytes=256 for > SHA256. > > > int RAND_bytes(unsigned char *buf, int num) > { > const RAND_METHOD *meth = RAND_get_rand_method(); > if (meth && meth->bytes) > { > Print(L" control is here\n");/////<---controll is here > return meth->bytes(buf,num); > } > Print(L" RAND_bytes fails\n"); > > return(-1); > } > > > On Tue, Aug 13, 2013 at 3:35 PM, baban devkate <baban...@gmail.com> wrote: > >> Hello, >> >> RAND_bytes() will use the proper OS-provided RNG e.g. /dev/urandom or >> /dev/randomon Linux and CryptGenRandom() on Windows. >> >> I want to know how it works in Pre-boot environement? >> >> In pre-boot environment, if RAND_bytes() returns zero then what does it >> mean? >> >> Is it because PRNG is not properly seeded? If yes, how to resolve it? >> >> >> ~Baban >> > >