[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: random number generator missing after upgrade



Dan Ritter wrote:
> OK, either boot to the old kernel and look for an rng kernel
> module,

The only loaded module with "rng" in its name is "rng_core". That one
is present in both kernels, but four TPM-related modules are absent
from Linux 6.1:

# uname -v
#1 SMP Debian 5.10.179-3 (2023-07-27)
# lsmod | egrep -i 'rng|tpm'
tpm_crb                20480  0
tpm_tis                16384  0
tpm_tis_core           28672  1 tpm_tis
tpm                    73728  3 tpm_tis,tpm_crb,tpm_tis_core
rng_core               16384  3 ccp,tpm

# uname -v
#1 SMP PREEMPT_DYNAMIC Debian 6.1.38-3 (2023-08-07)
# lsmod | egrep -i 'rng|tpm'
rng_core               20480  1 ccp

And yet /dev/tpm0 exists in both kernels, but disappears when I
physically remove the TPM, so the TPM is recognized to some degree even
without those modules.

Those four TPM-related modules are also present as files under
/lib/modules in Linux 5.10, but absent in Linux 6.1. The corresponding
source files still exist in the source tree. Have they been disabled in
Debian 12? Have they been moved to some "extra modules" package that I
haven't found? Or are they just not modules because they're statically
built-in?

> or identify the rng hardware a little better

As I wrote in my first email, it seems to be an Infineon SLB 9665TT2.0.
It says "SLB9665TT20" on the chip package.

These characters are also written on the package. They mean nothing to
me, but maybe they can be used to identify the hardware better:
G1946KIV
51ZA947148IA1
(It's extremely difficult to tell I from 1 though.)

> and look
> for it in the kernel sources at https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/drivers/char/hw_random

In that directory I don't see anything that looks relevant.

The identifier "tpm-rng-0" comes from tpm_add_hwrng in
drivers/char/tpm/tpm-chip.c, which is still there:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/drivers/char/tpm/tpm-chip.c?h=v6.1&id=830b3c68c1fb1e9176028d02ef86f3cf76aa2476#n517

Other functions in the same source file create /dev/tpm0, and it looks
like the random number generator should get registered together with
the TPM. It's conditional on CONFIG_HW_RANDOM_TPM. Where can I check
the value of that option?

Björn Persson

Attachment: pgp_8K3xCQA6P.pgp
Description: OpenPGP digital signatur


Reply to: