Skip to content

Commit 7c217fa

Browse files
emateryTHS-on
andauthored
Add EK Certificate Chain support (#116)
* Add EK Certificat Chain support Signed-off-by: Eugen Matery <[email protected]> * Added proposed changes Signed-off-by: Eugen Matery <[email protected]> * Update 1552_ek_certificate_chain.md Co-authored-by: Thore Sommer <[email protected]> Signed-off-by: Eugen Matery <[email protected]> * Update 1552_ek_certificate_chain.md Co-authored-by: Thore Sommer <[email protected]> Signed-off-by: Eugen Matery <[email protected]> --------- Signed-off-by: Eugen Matery <[email protected]> Co-authored-by: Thore Sommer <[email protected]>
1 parent 394bdf0 commit 7c217fa

File tree

1 file changed

+147
-0
lines changed

1 file changed

+147
-0
lines changed

1552_ek_certificate_chain.md

+147
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
# enhancement-1552: EK Certificate Chain support
2+
3+
<!-- toc -->
4+
- [Release Signoff Checklist](#release-signoff-checklist)
5+
- [Summary](#summary)
6+
- [Motivation](#motivation)
7+
- [Goals](#goals)
8+
- [Non-Goals](#non-goals)
9+
- [Proposal](#proposal)
10+
- [User Stories (optional)](#user-stories-optional)
11+
- [Story 1](#story-1)
12+
- [Story 2](#story-2)
13+
- [Notes/Constraints/Caveats (optional)](#notesconstraintscaveats-optional)
14+
- [Risks and Mitigations](#risks-and-mitigations)
15+
- [Design Details](#design-details)
16+
- [Test Plan](#test-plan)
17+
- [Upgrade / Downgrade Strategy](#upgrade--downgrade-strategy)
18+
- [Drawbacks](#drawbacks)
19+
- [Alternatives](#alternatives)
20+
- [Infrastructure Needed (optional)](#infrastructure-needed-optional)
21+
<!-- /toc -->
22+
23+
## Release Signoff Checklist
24+
25+
- [ ] Enhancement issue in release milestone, which links to pull request in [keylime/enhancements]
26+
- [ ] Core members have approved the issue with the label `implementable`
27+
- [ ] Design details are appropriately documented
28+
- [ ] Test plan is in place
29+
- [ ] User-facing documentation has been created in [keylime/keylime-docs]
30+
31+
## Summary
32+
33+
**Issues:**
34+
* rust-keylime, [#859](https://github.com/keylime/rust-keylime/issues/859)
35+
* keylime, [#1552](https://github.com/keylime/keylime/issues/1552)
36+
37+
Add support for EK certificates that are signed by intermediate certificates.
38+
The current setup can only verify EK certificates that are signed by a certificate that
39+
was added to the `tpm_cert_store`. The current setup does not support the verification of
40+
a chain.
41+
42+
New [intel chips](https://community.intel.com/t5/Processors/How-to-verify-an-Intel-PTT-endorsement-key-certificate/td-p/1603153/page/2) (starting 11th core gen) are certified using the intel ODCA (On Die Certificate Authority). The certificate chain is as follows:
43+
44+
| tpm_cert_store | TPM | TPM | TPM |
45+
|:--------------:|:---:|:---:|:---:|
46+
|Root CA | Intermediate | Intermediate | EK |
47+
|On Die CSME P_MCC 00001881 Issuing CA| CSME MCC ROM CA | CSME MCC SVN01 Kernel CA | CSME MCC PTT 01SVN |
48+
49+
This is also defined by the [TCG EK specification](https://trustedcomputinggroup.org/wp-content/uploads/TCG-EK-Credential-Profile-V-2.5-R2_published.pdf) (Chapter 2.2.1.5.2)
50+
51+
The current setup only allows to verify the EK cert against the `tpm_cert_store`.
52+
As the EK certificate is signed by intermediate certificates, which are unique to device,
53+
it is not possible to verify the EK certificate against the `tpm_cert_store`. The EK
54+
must be verified against the EK Certificate Chain, till the top level certificate
55+
from the chain can be verified against the `tpm_cert_store`.
56+
57+
## Motivation
58+
59+
Add support for intel firmware TPMs and possibly other TPMs that provide an EK certificate chain,
60+
or setups that also depend on a certificate chain that must work offline or without any other
61+
access to the chain.
62+
63+
### Goals
64+
65+
* Verify EK certificates that are not signed directly by a root ca, but require the verification of a chain.
66+
67+
### Non-Goals
68+
69+
* Implementing a generic interface to provide the content of any NV-Index.
70+
71+
## Proposal
72+
73+
* keylime_agent: update `ekcert` field to use PEM format, so multiple certificates can be stored in the field and a marker exists that shows the start and end of each certificate.
74+
* keylime registrar, store `ekcert` in database, as it is already done.
75+
* keylime tenant, verify chain in `ekcert`. Use "top" certificate from chain to verifiy against `tpm_cert_store`. In case of a single certificate the check of the chain is immediately finished as there is no certificate "above" and the `ekcert` is the "top" certificate that will be verified against the `tpm_cert_store`.
76+
77+
78+
### User Stories
79+
80+
#### Story 1
81+
Users will be able to use keylime with intel firmware TPMs (11th gen core and onwards),
82+
or any other TPM that stores an EK certificate that is signed by a chain that is stored
83+
in the TPM.
84+
85+
86+
### Risks and Mitigations
87+
88+
#### Registrar/Tenant could be become incompatible with older database
89+
* Update existing database values for `ekcert` to PEM format.
90+
91+
#### Additional memory will be required to store the chain in the database.
92+
* If the feature can't be used, due to missing certificates in the TPM, the memory footprint will stay around the same.
93+
94+
## Design Details
95+
First some words from TCG EK documentations:
96+
97+
```txt
98+
TPM NV MAY contain all certificates of the EK Certificate Chain except the Root CA certificate. The
99+
EK Certificate Chain MUST be stored as X.509 DER encoded certificates. If the chain consists of
100+
more than one certificate, or if multiple chains exist, they MUST be stored in NV as a concatenated
101+
sequence. The TPM manufacturer MAY provision certificate chains using the following list of indices:
102+
103+
0x01c00100 - 0x01c001ff
104+
105+
Revision 2 January 26, 2022 Published Page 15 of 60
106+
The NV indices MUST be populated starting with index 0x01c00100 through index 0x01c001ff. There
107+
is no requirement to store the certificates in any particular order whatsoever. If a concatenated
108+
certificate chain does not fit in a single index, the chain MUST overflow to the next numerically larger
109+
index in the list of NV Indices. If the storage space in a single index is insufficient to store the entire
110+
certificate, the certificate MAY overflow into the next numerically larger index in the list of NV Indices.
111+
```
112+
113+
The feature requires changes in the rust-keylime agent and in the keylime servers registrar and tenant. The certificate chain must and can be only provided by the keylime-agent.
114+
115+
The keylime-agent must do the following:
116+
* get all available NV-Index-Handles in the defined range (`0X01C00100 - 0X01C001FF`)
117+
* read the chain from the NV-Index-Handles
118+
* Theoretically the certificates can be in any order. This would require an option to make a sorting possible in the agent. As it does not make really sense to store the chain in an unsorted order i would postpone any implementation till this case really exists.
119+
* Only a subset of the NV-Index-Handles may be required. This would require an option to filter/set the required handles. I would also wait for implementation till a real case exists for that.
120+
* as the certificate chain is stored in DER format, first the certificates must be separated
121+
* transform der DER certificates into PEM format.
122+
* send the chain to the keylime server
123+
124+
The certificate chain should be transformed and sorted by the keylime-agent to keep the work
125+
away from the server and provide a generic server implementation that does not need to behave
126+
a certain way (sort/filter the chain) depending on the client.
127+
128+
The keylime registrar only needs to store the certificate chain in the database.
129+
130+
The keylime tenant must detect the presence of an EK Certificate Chain and verify the
131+
EK Cert against the chain, and finally the top level certificate against the `tpm_cert_store`.
132+
133+
The flow can be kept mostly as it is in `check_ek`. In case of multiple certs in `ekcert` , the ek must be verified against the provided chain and in case of a success the ek will be replaced by the top level certificate from the chain. Afterwards the flow can be kept as it was.
134+
135+
See provided implementation:
136+
* rust-keylime: https://github.com/ematery/rust-keylime/commit/ff448ec9f68a50b89685f8f4f3e6777d8c80ef1b
137+
* keylime: https://github.com/ematery/keylime/commit/772f6808510d797d7cecd3347215fa835a583868
138+
139+
### Test Plan
140+
141+
### Upgrade / Downgrade Strategy
142+
143+
### Dependencie requirements
144+
145+
## Drawbacks
146+
147+
## Alternatives

0 commit comments

Comments
 (0)