Skip to content

Commit 28c5f59

Browse files
iokilljarkkojs
authored andcommitted
docs: trusted-encrypted: add DCP as new trust source
Update the documentation for trusted and encrypted KEYS with DCP as new trust source: - Describe security properties of DCP trust source - Describe key usage - Document blob format Co-developed-by: Richard Weinberger <[email protected]> Signed-off-by: Richard Weinberger <[email protected]> Co-developed-by: David Oberhollenzer <[email protected]> Signed-off-by: David Oberhollenzer <[email protected]> Signed-off-by: David Gstir <[email protected]> Reviewed-by: Jarkko Sakkinen <[email protected]> Reviewed-by: Bagas Sanjaya <[email protected]> Signed-off-by: Jarkko Sakkinen <[email protected]>
1 parent b85b253 commit 28c5f59

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed

Documentation/security/keys/trusted-encrypted.rst

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ safe.
4242
randomly generated and fused into each SoC at manufacturing time.
4343
Otherwise, a common fixed test key is used instead.
4444

45+
(4) DCP (Data Co-Processor: crypto accelerator of various i.MX SoCs)
46+
47+
Rooted to a one-time programmable key (OTP) that is generally burnt
48+
in the on-chip fuses and is accessible to the DCP encryption engine only.
49+
DCP provides two keys that can be used as root of trust: the OTP key
50+
and the UNIQUE key. Default is to use the UNIQUE key, but selecting
51+
the OTP key can be done via a module parameter (dcp_use_otp_key).
52+
4553
* Execution isolation
4654

4755
(1) TPM
@@ -57,6 +65,12 @@ safe.
5765

5866
Fixed set of operations running in isolated execution environment.
5967

68+
(4) DCP
69+
70+
Fixed set of cryptographic operations running in isolated execution
71+
environment. Only basic blob key encryption is executed there.
72+
The actual key sealing/unsealing is done on main processor/kernel space.
73+
6074
* Optional binding to platform integrity state
6175

6276
(1) TPM
@@ -79,6 +93,11 @@ safe.
7993
Relies on the High Assurance Boot (HAB) mechanism of NXP SoCs
8094
for platform integrity.
8195

96+
(4) DCP
97+
98+
Relies on Secure/Trusted boot process (called HAB by vendor) for
99+
platform integrity.
100+
82101
* Interfaces and APIs
83102

84103
(1) TPM
@@ -94,6 +113,11 @@ safe.
94113

95114
Interface is specific to silicon vendor.
96115

116+
(4) DCP
117+
118+
Vendor-specific API that is implemented as part of the DCP crypto driver in
119+
``drivers/crypto/mxs-dcp.c``.
120+
97121
* Threat model
98122

99123
The strength and appropriateness of a particular trust source for a given
@@ -129,6 +153,13 @@ selected trust source:
129153
CAAM HWRNG, enable CRYPTO_DEV_FSL_CAAM_RNG_API and ensure the device
130154
is probed.
131155

156+
* DCP (Data Co-Processor: crypto accelerator of various i.MX SoCs)
157+
158+
The DCP hardware device itself does not provide a dedicated RNG interface,
159+
so the kernel default RNG is used. SoCs with DCP like the i.MX6ULL do have
160+
a dedicated hardware RNG that is independent from DCP which can be enabled
161+
to back the kernel RNG.
162+
132163
Users may override this by specifying ``trusted.rng=kernel`` on the kernel
133164
command-line to override the used RNG with the kernel's random number pool.
134165

@@ -231,6 +262,19 @@ Usage::
231262
CAAM-specific format. The key length for new keys is always in bytes.
232263
Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
233264

265+
Trusted Keys usage: DCP
266+
-----------------------
267+
268+
Usage::
269+
270+
keyctl add trusted name "new keylen" ring
271+
keyctl add trusted name "load hex_blob" ring
272+
keyctl print keyid
273+
274+
"keyctl print" returns an ASCII hex copy of the sealed key, which is in format
275+
specific to this DCP key-blob implementation. The key length for new keys is
276+
always in bytes. Trusted Keys can be 32 - 128 bytes (256 - 1024 bits).
277+
234278
Encrypted Keys usage
235279
--------------------
236280

@@ -426,3 +470,12 @@ string length.
426470
privkey is the binary representation of TPM2B_PUBLIC excluding the
427471
initial TPM2B header which can be reconstructed from the ASN.1 octed
428472
string length.
473+
474+
DCP Blob Format
475+
---------------
476+
477+
.. kernel-doc:: security/keys/trusted-keys/trusted_dcp.c
478+
:doc: dcp blob format
479+
480+
.. kernel-doc:: security/keys/trusted-keys/trusted_dcp.c
481+
:identifiers: struct dcp_blob_fmt

security/keys/trusted-keys/trusted_dcp.c

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,25 @@
1919
#define DCP_BLOB_VERSION 1
2020
#define DCP_BLOB_AUTHLEN 16
2121

22+
/**
23+
* DOC: dcp blob format
24+
*
25+
* The Data Co-Processor (DCP) provides hardware-bound AES keys using its
26+
* AES encryption engine only. It does not provide direct key sealing/unsealing.
27+
* To make DCP hardware encryption keys usable as trust source, we define
28+
* our own custom format that uses a hardware-bound key to secure the sealing
29+
* key stored in the key blob.
30+
*
31+
* Whenever a new trusted key using DCP is generated, we generate a random 128-bit
32+
* blob encryption key (BEK) and 128-bit nonce. The BEK and nonce are used to
33+
* encrypt the trusted key payload using AES-128-GCM.
34+
*
35+
* The BEK itself is encrypted using the hardware-bound key using the DCP's AES
36+
* encryption engine with AES-128-ECB. The encrypted BEK, generated nonce,
37+
* BEK-encrypted payload and authentication tag make up the blob format together
38+
* with a version number, payload length and authentication tag.
39+
*/
40+
2241
/**
2342
* struct dcp_blob_fmt - DCP BLOB format.
2443
*

0 commit comments

Comments
 (0)