modus
Menu
On this page

The entry tpm

The TPM service: the device service of the TPM of the machine. It seals 32 secret bytes to the values of PCR 7 and PCR 11, and unseals them only while those PCRs hold the same values.

What it is for. The boot program measures the system description into PCR 11 before the kernel starts, and the firmware measures the state of Secure Boot into PCR 7. A key that this service sealed opens again only on the same system, with the same state of Secure Boot: an older system, a changed system, or a copy of the disk on another machine opens nothing. The process unlock seals the machine key with it (Principals, "The machine key sealed by the TPM"), and the keys of a named principal and the machine key under a machine passphrase, with an authorization value from the passphrase whose wrong tries the TPM counts .

Start: the root service starts it at boot, before unlock, only when the boot program measured the system into the TPM. No line of the console starts it.

Grants, as the root service gives them: the page of the registers of the CRB interface of the TPM, the TPM ring and the TPM region (modus:contract/tpm_service), and the measure ring, which only the root service writes. Nothing else: no store, no window, no ring to the root service.

The commands of the TPM. The service builds each one itself (modus:tpm2): a client sends Seal, Unseal, Pin_Read or Pin_Write (the TPM pins of the record of the machine key and of the file of a principal, pins.odin), never a raw command, so no client extends a PCR or clears the TPM. On the measure ring the root service sends Measure_Start_Policy before each start policy runs: the service extends PCR 12, twice at most in one start . Each request makes the storage key from the owner hierarchy, uses it, and flushes it, with its session: the TPM keeps no object of the system between two requests.

The lockout hierarchy. At its start it writes the count limits of the TPM on the log. Before the first request with an authorization value, it sets a random lockout authorization value, which nobody keeps, when the TPM has an empty one: then no system resets the count of the wrong passphrases of a named principal or of the machine .

What a reader sees. No window. The log has "tpm: ok, the CRB interface at 0xFED40000, ...", the count limits, a line on the lockout authorization value at the first use of a passphrase, then one line for each request: "tpm: sealed 32 bytes to PCR 7 and PCR 11 ...", "tpm: unsealed 32 bytes ...", or "tpm: the TPM refuses the unseal: PCR 7 and PCR 11 do not hold the values of the seal ...".

What it does not protect. The secret crosses the interface of the TPM in clear: no session encrypts the parameters. A software TPM on the host sees each secret anyway.

See: The machine key sealed by the TPM, and the recovery key in the repository, Principals, The start policy: The measure of the start policy in the repository, The keys of a named principal sealed by the TPM, and their recovery key in the repository

tpm module with an entry

Hash
15fd900862a27c306ed330104d246d3f33632ea9420d8ec61a9f03506c20746f
Size
122880 bytes
Exports
0
Imports
0
Imported by
0
License
MIT

The TPM service: the device service of the TPM of the machine

FactValue
KindModules with an entry
Sourcesrc/modules/system/tpm
Boot imageyes: in the boot image, 122880 bytes in this build
Build settingsnone: the defaults of the source
Importsnone
Imported bynone

Neighbours

It imports no module, and no module imports it. The module graph shows it with the other modules that have no edge.

Exports

ExportWhat it does
entry()The entry: it maps the registers and checks the interface, then serves the ring until the machine stops

entry

entry()

The entry: it maps the registers and checks the interface, then serves the ring until the machine stops.

The stop: with no ring, no region, no registers, an interface that is not CRB, or a buffer that is not in the page of the registers, it writes the reason at the level error and stops with Failed. The client then receives no answer, and runs as on a machine with no TPM.

Form
The entry of the module: one parameter, an address, fixed by the contract.
Source
src/modules/system/tpm/main.odin:723

Read from the source of the module, as the build reads it to describe the exports (tools/modustool/build/describe.odin).

What the root service gives it

WhatValueAs the root service says
GrantsThe registers of the TPM, and the ring and the region that unlock receives (tpm_service_start).
Other terms of its start grant setnone
Budget that it asks for
  • working memory pages 16
  • pages of its threads 72
  • pages of the pictures of its window 0
  • pages of the module and its imports from the files of the build
  • processes 1
  • threads 1
One thread serves the ring, one request at a time. Its working memory holds the ring, the region of its client and the buffers of one TPM command and its answer, each at most one page.

The start grant set is read from start_grant_sets in src/modules/system/root/start_grant_sets.odin. The stated budget is read from the constant MODULE_BUDGET of the source of the module (its line); the build adds the counted parts and writes the sum in the module (tools/modustool/build/budget_count.odin); the root service accepts it up to the largest budget of a process, and adds the limits of processor time and of log records (src/modules/system/root/budgets.odin).