|
1 |
| -# LPC55 Debug Auth Credentials |
| 1 | +# LPC55 Debug Credential Certificates |
2 | 2 |
|
3 | 3 | We use the LPC55S69 as our root of trust (RoT).
|
4 | 4 | We manufacture systems such that access to the debug facilities in the RoT requires authentication.
|
5 |
| -This feature is described in §51.7 of the LPC55S6x User Manual (aka UM11126) Rev 1.8. |
| 5 | +Debug auth credential certificates (DCs) must be signed by one of the roots / trust anchors configured for a given platform. |
6 | 6 |
|
7 |
| -Debug auth credentials (DACs) must be signed by one of the roots / trust anchors configured for a given platform. |
8 |
| -DACs cannot be signed by an intermediate in the same PKI, only the root. |
9 |
| -Like the verified boot implementation on the LPC55S69, DACs are limited to RSA keys. |
10 |
| -DACs are not certificates, they are a binary structure specific to the NXP implementation. |
| 7 | +DCs aren't really certificates in the traditional x.509 / RFD 5280 sense. |
| 8 | +Instead they're a binary structure specific to the NXP implementation and described in §51.7 of the LPC55S6x User Manual (aka UM11126) Rev 1.8. |
| 9 | +DCs cannot be signed by an intermediate in the same PKI, only the root. |
| 10 | +Like the verified boot implementation on the LPC55S69, DCs are limited to RSA keys. |
11 | 11 |
|
12 |
| -## Producing DACs |
| 12 | +## Producing DCs |
13 | 13 |
|
14 |
| -The offline key store manages our root signing keys and since DACs must be signed by one of the roots, OKS must perform the signing. |
15 |
| -To provide OKS with the data / input required to sign a DAC we define a structure that we call a DAC signing request specification (DcsrSpec). |
| 14 | +The offline key store manages our root signing keys and since DCs must be signed by one of the roots, OKS must perform the signing. |
| 15 | +To provide OKS with the data / input required to sign a DC we define a structure that we call a DC signing request specification (DcsrSpec). |
16 | 16 |
|
17 | 17 | At the top level the DcsrSpec includes:
|
18 | 18 | - a debug credential signing request (DCSR)
|
19 |
| -- the label of the key managed by OKS that will sign the output DAC |
| 19 | +- the label of the key managed by OKS that will sign the output DC |
20 | 20 | - the labels of the keys (always 4 for production systems) managed by OKS that have been programmed into the RoT
|
21 | 21 |
|
22 | 22 | When processing a DcsrSpec OKS will use the labels that identify the trust anchors in the RoT to collect their certificates from the OKS CA metadata.
|
23 | 23 | OKS then gets the public key for the signer from this collection of certs.
|
24 | 24 | If this collection of certs does not contain the signer then OKS will reject the DcsrSpec as invalid.
|
25 |
| -The public key for the signer, the collection of trust anchors, and the DCSR are then used to create a binary structure that is signed by the key managed by OKS. |
26 |
| -The output is the DAC. |
| 25 | +The public key for the signer, the collection of trust anchors, and the DCSR are then used to create the DC structure that is signed by the key in OKS. |
| 26 | +The output is the signed DC. |
27 | 27 |
|
28 | 28 | Most of the hard work in this process is done by the [lpc55_support](https://github.com/oxidecomputer/lpc55_support) crate.
|
29 | 29 |
|
30 | 30 | ## Issuance Policy
|
31 | 31 |
|
32 | 32 | RFD 5280 defines policies that certificate authorities implement and abide by (at least that's what they're supposed to do).
|
33 |
| -DACs do not come with such guidelines but we do want to put some restrictions on their issuance. |
34 |
| -OKS is the policy enforcement point by virtue of hosting the trust anchors that must sign the DAC. |
| 33 | +DCs do not come with such requirements but we do put some restrictions on their issuance. |
| 34 | +OKS is our policy enforcement point by virtue of hosting the trust anchors that must sign the DCs. |
35 | 35 |
|
36 |
| -### One key, one DAC |
| 36 | +### One key, one DC |
37 | 37 |
|
38 |
| -If we're willing to issue more than one DAC for a given key we create a situation where we must trust the key holder. |
39 |
| -We would be trusting them to use each DAC in the appropriate context. |
40 |
| -One could then attack the key holder by attempting to confuse them into using the key in the wrong context. |
41 |
| -If the number of DACs we may issue is reasonably bounded (under some threshold) we can mitigate this threat by issuing only one DAC per signing key. |
| 38 | +If we're willing to issue more than one DC for a given key we create a situation where we must trust the key holder to use the right DC in the right context. |
| 39 | +One could then attack the key holder by confusing them into using a key in the wrong context. |
| 40 | +If the number of DCs we may issue is reasonably bounded (under some threshold) we can mitigate this threat by issuing only one DC per signing key. |
42 | 41 | For now we're below this threshold and assume that will remain a constant.
|
43 | 42 |
|
44 |
| -Implementing this policy when OKS is presented with a DAC to sign requires that we compare the public key from the request (DcsrSpec) to each previously issued DAC. |
45 |
| -This requires we iterate over all previously issued DACs. |
| 43 | +Implementing this policy when OKS is presented with a DC to sign requires that we compare the public key from the request (DcsrSpec) to each previously issued DC. |
46 | 44 | We don't need to be able to do this particularly quickly so setting up and maintaining a database that we can query is overkill.
|
47 | 45 | Instead we can use the file system much like the `openssl ca` command.
|
48 | 46 |
|
49 |
| -Reading back all past DACs from the file system could get expensive over time. |
50 |
| -To avoid this we need an identifier that we can put into the DAC file names such that we can enforce this policy by reading a directory entry. |
| 47 | +Reading back all past DCs from the file system could get expensive over time. |
| 48 | +To avoid this we need an identifier that we can put into the DC file names such that we can enforce this policy by reading the directory entry. |
51 | 49 | We can't put the full 4k RSA public key in the file name so we assign each a name that is the hex encoded sha256 digest.
|
52 |
| -We've been using the suffix `dc.bin` when exporting signed DACs and so we'll use that in this case as well. |
| 50 | +We've been using the suffix `dc.bin` when exporting signed DCs and so we'll append it to these file names as well. |
53 | 51 |
|
54 |
| -Before OKS signs a DAC it calculates the digest of the public key and then searches through the collection of previosly issued DAC files looking for a file name that begins with the same digest. |
55 |
| -If a match is found OKS will load this DAC and calculate the digest of the public key inside manually to verify. |
| 52 | +Before OKS signs a DC it calculates the digest of the public key and searches through the collection of previously issued DC files looking for one that begins with the same digest. |
| 53 | +If a match is found OKS will load this DC, verify the signature over it, then calculate the digest of the public key inside manually to verify. |
56 | 54 |
|
57 | 55 | ### Digest What
|
58 | 56 |
|
59 |
| -When calculating the digest of the public key from a DAC we need to be explicit about the bytes we're running through the hash function. |
60 |
| -For as long as we're using the LPC55 for our RoT these keys will always be RSA keys. |
61 |
| -The `DebugCredentialSigningRequest` structure from the `lpc55_support` crate packages the public key in a format specific to RSA. |
62 |
| -RSA keys are just two integers so we could run them both through the digest `update` function effectively concatenating them into a single digest. |
| 57 | +When calculating the digest of the public key from a DC we need to be explicit about the bytes we're running through the hash function. |
| 58 | +The `DebugCredentialSigningRequest` structure from the `lpc55_support` crate provides the RSA key as the modulus and exponent concatenated. |
| 59 | +Unfortunately this format isn't understood by tools like `openssl`. |
63 | 60 |
|
64 | 61 | While we'll be generating these digests in OKS, we want to enable external verification.
|
65 | 62 | Doing this verification requires generating these digests from public keys obtained elsewhere and likely in other (standardized) formats.
|
|
0 commit comments