Hi Jean-Marc,

----- Original Message -----
From: "Jean-Marc Desperrier" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, 02 March, 2001 16:39
Subject: Re: What to do when there is no /dev/random ??
[...]
> I suggest the content of the stack on any architecture where there are
> asynchronous interrupts that will store content in your local stack.
> Easiest portable way to access it is to read the content of uninitialised
> variables.

Good idea. Didn't think of that one. Thanks!



> Easy to implement and not so bad if properly done (do not read a value
that is
> set by the preceeding function call, do not read a value that is too far
to be
> overwritten by asynchronous interrupts).

Hm, have to think about 'properly doing' this, though.

I guess something like this should be a reasonable start:


static void RAND_collect_from_stack(void)
{
    char buffer_to_catch_interrupt_data[256+1];

    /* OK, prevent compiler from nagging about 'uninitialized variable' */
    interrupt_data[sizeof(buf)-1] = 0;

    /*
        We don't know exactly what went on before function-call-wise,
        so we just take in the whole load.
     */
    /*
       Embedded OpenSSL: no more floating point operations!
        Use fixed point instead: dot is between bit 7&8: 1.0 == (1 << 8)
     */
    RAND_add(buffer_to_catch_interrupt_data, sizeof(buf)-1, 1 /* 0.0039
*/ );
}





Groetjes/Greetinx,

  Ger

----------------------------------------------------------------------------
--
Ger Hobbelt a.k.a. Insh_Allah                     mailto:[EMAIL PROTECTED]
----------------------------------------------------------------------------
--
  Peter Pan can fly when he thinks his Happy Thought.
  I want to fly too.
  My Happy Thought is... one part Prozac and one part LSD...
  Wow! Awesome, dude!


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [EMAIL PROTECTED]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to