Index | Thread | Search

From:
Janne Johansson <icepic.dz@gmail.com>
Subject:
Re: mtrng(4): MediaTek random number generator
To:
James Hastings <moosetek4@gmail.com>
Cc:
tech@openbsd.org
Date:
Wed, 12 Feb 2025 19:03:53 +0100

Download raw body.

Thread
Den tis 11 feb. 2025 kl 10:40 skrev James Hastings <moosetek4@gmail.com>:
>
> Add support for the 32-bit random number generator on MediaTek SoCs.

> +       if ((sta & RNG_READY) == RNG_READY)
> +               enqueue_randomness(bus_space_read_4(sc->sc_iot,
> +                   sc->sc_ioh, RNG_DATA));
> +
> +       timeout_add_sec(&sc->sc_to, 1);
> +}

I don't know how expensive this operation is, but on the old VIA C3/C7
cpus, they would kick off one such enqueue every 10 ms:
(the very end of
https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/i386/i386/via.c?rev=1.50&content-type=text/x-cvsweb-markup
)
and the same goes for octeon built-in RNG,
(end of https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/arch/octeon/dev/octrng.c?rev=1.10&content-type=text/x-cvsweb-markup
)

Looking at other rngs it seems to be a mix of 10ms or 1s, just
wondering what the criteria is for choosing either.

-- 
May the most significant bit of your life be positive.