Skip to content

Commit f262f6a

Browse files
committed
Add EK Certificate Chain support
1 parent fbde7c6 commit f262f6a

File tree

1 file changed

+155
-0
lines changed

1 file changed

+155
-0
lines changed

1552_ek_certificate_chain.md

+155
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,155 @@
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, send `ek_ca_chain` to registrar
74+
* keylime registrar, store `ek_ca_chain` in database
75+
* keylime tenant, verify `ekcert` against `ek_ca_chain` and `ek_ca_chain` against `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 database to new scheme, only a single key is added to the registar db 'ek_ca_chain'
90+
91+
#### Registrar/Tenant could become incompatible with older Agent
92+
* Make 'ek_ca_chain' optional
93+
94+
#### Additional memory will be required to store the chain in the database.
95+
* If the feature can't be used, due to missing certificates in the TPM, the memory footprint will stay around the same.
96+
97+
#### Providing big chains as attack
98+
* Limit the amount of allowed chain size
99+
* Use mTLS to only allow verified clients access
100+
101+
102+
## Design Details
103+
First some words from TCG EK documentations:
104+
105+
```txt
106+
TPM NV MAY contain all certificates of the EK Certificate Chain except the Root CA certificate. The
107+
EK Certificate Chain MUST be stored as X.509 DER encoded certificates. If the chain consists of
108+
more than one certificate, or if multiple chains exist, they MUST be stored in NV as a concatenated
109+
sequence. The TPM manufacturer MAY provision certificate chains using the following list of indices:
110+
111+
0x01c00100 - 0x01c001ff
112+
113+
Revision 2 January 26, 2022 Published Page 15 of 60
114+
The NV indices MUST be populated starting with index 0x01c00100 through index 0x01c001ff. There
115+
is no requirement to store the certificates in any particular order whatsoever. If a concatenated
116+
certificate chain does not fit in a single index, the chain MUST overflow to the next numerically larger
117+
index in the list of NV Indices. If the storage space in a single index is insufficient to store the entire
118+
certificate, the certificate MAY overflow into the next numerically larger index in the list of NV Indices.
119+
```
120+
121+
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.
122+
123+
The keylime-agent must do the following:
124+
* get all available NV-Index-Handles in the defined range (`0X01C00100 - 0X01C001FF`)
125+
* read the chain from the NV-Index-Handles
126+
* 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.
127+
* 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.
128+
* as the certificate chain is stored in DER format, first the certificates must be separated
129+
* transform der DER certificates into PEM format.
130+
* send the chain to the keylime server
131+
132+
The certificate chain should be transformed and sorted by the keylime-agent to keep the work
133+
away from the server and provide a generic server implementation that does not need to behave
134+
a certain way (sort/filter the chain) depending on the client.
135+
136+
The keylime registrar only needs to store the certificate chain in the database.
137+
138+
The keylime tenant must detect the presence of an EK Certificate Chain and verify the
139+
EK Cert against the chain, and finally the top level certificate against the `tpm_cert_store`.
140+
141+
The flow can be kept mostly as it is in `check_ek`. In case of a present ek_ca_chain, 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.
142+
143+
See provided implementation:
144+
* rust-keylime: https://github.com/ematery/rust-keylime/commit/ff448ec9f68a50b89685f8f4f3e6777d8c80ef1b
145+
* keylime: https://github.com/ematery/keylime/commit/772f6808510d797d7cecd3347215fa835a583868
146+
147+
### Test Plan
148+
149+
### Upgrade / Downgrade Strategy
150+
151+
### Dependencie requirements
152+
153+
## Drawbacks
154+
155+
## Alternatives

0 commit comments

Comments
 (0)