RNG question

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

RNG question

Peter J. Philipp-3
Hi,

I had considered doing some programming in visual studio on windows and I
really miss the easy arc4random*() routines there.

Out of boredom I started looking at /sys/dev/rnd.c and have a question now.
Before twisting the pool, enqueue_randomness() has a component of time if
I'm not misreading.  Why is this done?

Thanks!
-peter

Reply | Threaded
Open this post in threaded view
|

Re: RNG question

Remco
On 30-07-19 09:51, Peter J. Philipp wrote:
> Hi,
>
> I had considered doing some programming in visual studio on windows and I
> really miss the easy arc4random*() routines there.
>

You may be able to get the arc4ramdon interface on systems other than
OpenBSD by extracting the necessary files from:
- src/lib/libc/crypt/
- src/lib/libcrypto/arc4random/

This appears to work fine on Linux, I haven't tried it on Windows.

Reply | Threaded
Open this post in threaded view
|

Re: RNG question

Theo de Raadt-2
In reply to this post by Peter J. Philipp-3
Peter J. Philipp <[hidden email]> wrote:

> Before twisting the pool, enqueue_randomness() has a component of time if
> I'm not misreading.  Why is this done?

That is a low-grade question.

Reply | Threaded
Open this post in threaded view
|

Re: RNG question

Peter J. Philipp-3
On Tue, Jul 30, 2019 at 06:11:15AM -0600, Theo de Raadt wrote:
> Peter J. Philipp <[hidden email]> wrote:
>
> > Before twisting the pool, enqueue_randomness() has a component of time if
> > I'm not misreading.  Why is this done?
>
> That is a low-grade question.

OK I retract it then.  Don't worry about it.

Regards,
-peter

Reply | Threaded
Open this post in threaded view
|

Re: RNG question

Roderick

On Tue, 30 Jul 2019, Peter J. Philipp wrote:

> On Tue, Jul 30, 2019 at 06:11:15AM -0600, Theo de Raadt wrote:
>> Peter J. Philipp <[hidden email]> wrote:
>>>[...]
>>> I'm not misreading.  Why is this done?
>>
>> That is a low-grade question.
>
> OK I retract it then.  Don't worry about it.

You cannot retract it. Impossible.

Rod.

Reply | Threaded
Open this post in threaded view
|

Re: RNG question

Brent Cook
In reply to this post by Remco


> On Jul 30, 2019, at 5:15 AM, Remco <[hidden email]> wrote:
>
> On 30-07-19 09:51, Peter J. Philipp wrote:
>> Hi,
>> I had considered doing some programming in visual studio on windows and I
>> really miss the easy arc4random*() routines there.
>
> You may be able to get the arc4ramdon interface on systems other than OpenBSD by extracting the necessary files from:
> - src/lib/libc/crypt/
> - src/lib/libcrypto/arc4random/
>
> This appears to work fine on Linux, I haven't tried it on Windows.
>

Correct, these were built to be easily reusable within other projects. The LibreSSL Windows port uses these as well.

https://github.com/libressl-portable/portable/blob/master/crypto/CMakeLists.txt#L889 <https://github.com/libressl-portable/portable/blob/master/crypto/CMakeLists.txt#L889>

 - Brent