Page MenuHomeFreeBSD

tpm: Harvest entropy from TPM 1.2 devices
Needs ReviewPublic

Authored by kbowling on Fri, Aug 28, 12:43 AM.

Details

Reviewers
markj
kevans
seuros
andrew
manu
Group Reviewers
csprng
Summary
The TPM 2.0 driver periodically contributes TPM-generated random bytes
to the kernel entropy pool, but the TPM 1.2 driver does not.

Issue TPM_GetRandom every ten seconds and submit successful responses
as RANDOM_PURE_TPM.  Keep each exchange under the TPM transaction lock.
Defer harvesting while the character device is open or a command is
pending so the task cannot consume a user response.  Drain the task for
suspend and detach, rearming it after resume or a failed suspend.

Document the expanded scope of RANDOM_ENABLE_TPM and update the kernel
configuration comments that described it as TPM 2.0-only.

Validated on a STMicroelectronics TPM 1.2 TIS device.  DTrace observed
periodic entropy submissions; a raw GetRandom response remained intact
while the device was held open across a harvest interval; and module
unload/reload deregistered and restored the entropy source cleanly.

MFC after:      2 weeks

Diff Detail

Lint
Lint Skipped
Unit
Tests Skipped