I wanted to see how this would behave on my APUs.  One gave 0000000,
another ffffffff consistently.  But then I had this diff in my tree
and I rebuilt for my workstation.  That has

cpu0: AMD Ryzen 9 7950X 16-Core Processor, 4500.00 MHz, 19-61-02
...
ccp0 at pci21 dev 0 function 2 "AMD 17h/90h Crypto" rev 0x00

and it too gives:

ccp: rng ffffffff
ccp: rng ffffffff
ccp: rng ffffffff
ccp: rng ffffffff

Is anyone else seeing non-random output from ccp(4) on non-APU
systems?

Paul

On Wed, Apr 19, 2023 at 05:18:11PM +0200, Christian Weisgerber wrote:
| Christian Weisgerber:
| 
| > ccp(4) attaches, so presumably it is used as a source of entropy.
| > Whether the hardware actually provides random output, I don't know.
| 
| I built a kernel with an instrumented driver.  Unfortunately, no
| entropy is provided:
| 
| ccp: rng 00000000
| ccp: rng 00000000
| ccp: rng 00000000
| ccp: rng 00000000
| ccp: rng 00000000
| 
| This is with the lastest firmware:
| bios0: vendor coreboot version "v4.19.0.1" date 01/31/2023
| 
| 
| Index: dev/ic/ccp.c
| ===================================================================
| RCS file: /cvs/src/sys/dev/ic/ccp.c,v
| retrieving revision 1.3
| diff -u -p -r1.3 ccp.c
| --- dev/ic/ccp.c      29 May 2020 04:42:25 -0000      1.3
| +++ dev/ic/ccp.c      19 Apr 2023 15:12:17 -0000
| @@ -56,6 +56,7 @@ ccp_rng(void *arg)
|       trng = bus_space_read_4(sc->sc_iot, sc->sc_ioh, CCP_REG_TRNG);
|       if (trng != 0)
|               enqueue_randomness(trng);
| +     printf("ccp: rng %08x\n", trng);
|  
| -     timeout_add_msec(&sc->sc_tick, 100);
| +     timeout_add_msec(&sc->sc_tick, 5000);
|  }
| -- 
| Christian "naddy" Weisgerber                          [email protected]
| 

-- 
>++++++++[<++++++++++>-]<+++++++.>+++[<------>-]<.>+++[<+
+++++++++++>-]<.>++[<------------>-]<+.--------------.[-]
                 http://www.weirdnet.nl/                 

Reply via email to