Skip to content

Commit a086515

Browse files
committed
dpe: Resolve feedback items from #66
Fixes #86 * Adds maximum certificate size for ML-DSA * Adds a remaining field to GetCertificateChain to fix the corner case where GetCertificateChainResponse.size == the size of the certificate * Adds detail about ML-DSA private key derivation Signed-off-by: Zach Halvorsen <zhalvorsen@google.com>
1 parent 918b100 commit a086515

1 file changed

Lines changed: 55 additions & 36 deletions

File tree

specifications/dpe-irot-profile/spec.ocp

Lines changed: 55 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -204,6 +204,24 @@ in the command-specific "ABI" sections in @sec:abi-structure-definitions.
204204

205205
Full structure definitions are provided at the end of this document.
206206

207+
## Multi-part Operations
208+
209+
This profile supports multi-part operations for commands that return large
210+
amounts of data. This functionality is currently limited to the response data of
211+
`CertifyKey`, `GetCertificateChain`, and `DeriveContext` when exporting a CDI.
212+
This profile uses the `OP_HANDLE` field to indicate availability of additional data.
213+
Additionally, a `MORE_DATA` bitfield is used. The most significant bit of this field
214+
indicates that the response contains more data. There is also a bit dedicated to each
215+
output field that contains more data.
216+
217+
When an operation has more data to return, the `OP_HANDLE` in the response will
218+
be non-zero. To retrieve the remaining data, the caller SHALL issue a subsequent
219+
request with the `OP_HANDLE` set to the value received in the preceding
220+
response, while keeping all other input parameters identical to the initial
221+
request. The operation is complete when the returned `OP_HANDLE` is all zeros.
222+
The returned context handle will only be valid when all flags in the `MORE_DATA`
223+
field are zero.
224+
207225
## Supported Commands
208226

209227
This section describes commands supported by this profile.
@@ -499,18 +517,6 @@ The CDI derivation scheme “ocp.derive.kdf-cdi-384” is defined as follows:
499517
* Outputs
500518
* 48-byte key
501519

502-
### ocp.derive.kdf-cdi-512
503-
504-
The CDI derivation scheme “ocp.derive.kdf-cdi-512” is defined as follows:
505-
506-
* This derivation scheme SHALL use a cryptographically secure KDF or DRBG.
507-
* Inputs
508-
* CDI
509-
* `MEASUREMENT_DATA`
510-
* ASCII Bytes "DPE"
511-
* Outputs
512-
* 64-byte key
513-
514520
## CDI Export
515521

516522
### ocp.export-cdi.raw-256
@@ -525,12 +531,6 @@ The CDI export scheme "ocp.export-cdi.raw" is a raw 384-bit secret
525531

526532
To generate exported keypair, use asymmetric-derivation for the relevant profile.
527533

528-
### ocp.export-cdi.raw-512
529-
530-
The CDI export scheme "ocp.export-cdi.raw" is a raw 512-bit secret
531-
532-
To generate exported keypair, use asymmetric-derivation for the relevant profile.
533-
534534
## Key Derivation
535535

536536
* `LABEL`: LABEL parameter passed to Sign and CertifyKey
@@ -573,13 +573,19 @@ follows:
573573

574574
* The asymmetric key type is ML-DSA-87
575575
* Signature scheme is ML-DSA
576-
* This derivation scheme SHALL use a cryptographically secure KDF or DRBG.
576+
* This derivation scheme SHALL use the following sequence.
577+
* Use a cryptographically secure KDF or DRBG to derive 32-byte seed 𝜉 (xi).
577578
* Inputs
578579
* CDI
579580
* `LABEL`
580581
* ASCII Bytes "MLDSA"
581582
* Outputs
582-
* 64-byte key
583+
* 32-byte xi
584+
* Use ML-DSA.KeyGen_internal (Algorithm 6) to derive the private key [@{fips204}].
585+
* Inputs
586+
* 32-byte xi
587+
* Outputs
588+
* 4,896-byte key
583589

584590
### ocp.key-format.p384.raw
585591

@@ -852,7 +858,7 @@ The format “ocp.certificate.irot-eca.mldsa87” is defined as follows:
852858

853859
* SHALL follow all "Requirements for ECA Certificates" in @sec:eca-cert-requirements
854860
* For FWID hashAlg fields provided by DeriveContext, DPE SHALL use the
855-
SHA2-512 OID.
861+
SHA2-384 OID.
856862
* For the SubjectPublicKeyInfo field, DPE SHALL use the ML-DSA-87 OID.
857863
* For the Signature field, DPE SHALL use the ML-DSA-87 OID.
858864

@@ -886,7 +892,7 @@ The format “ocp.certificate.irot-eca.mldsa87” is defined as follows:
886892

887893
* SHALL follow all "Requirements for ECA Certificates" in @sec:eca-cert-requirements
888894
* For FWID hashAlg fields provided by DeriveContext, DPE SHALL use the
889-
SHA2-512 OID.
895+
SHA2-384 OID.
890896
* For the SubjectPublicKeyInfo field, DPE SHALL use the ML-DSA-87 OID.
891897
* For the Signature field, DPE SHALL use the ML-DSA-87 OID.
892898

@@ -920,7 +926,7 @@ The format “ocp.csr.irot-eca.mldsa87” is defined as follows:
920926

921927
* SHALL follow all "Requirements for CSRs" in @sec:csr-requirements
922928
* For FWID hashAlg fields provided by DeriveContext, DPE SHALL use the
923-
SHA2-512 OID.
929+
SHA2-384 OID.
924930
* For the SubjectPublicKeyInfo field, DPE SHALL use the ML-DSA-87 OID.
925931
* For the Signature of both the CMS message and the CertificationRequest, DPE SHALL
926932
use the ML-DSA-87 OID.
@@ -942,7 +948,7 @@ The format “ocp.csr.irot-eca.mldsa87” is defined as follows:
942948
+-------------------------------+------------------------------------------------------------------+
943949
| max-message-size | 6144 |
944950
+-------------------------------+------------------------------------------------------------------+
945-
| uses-multi-part-messages | False |
951+
| uses-multi-part-messages | True. See @sec:multi-part-operations for more information. |
946952
+-------------------------------+------------------------------------------------------------------+
947953
| supports-concurrent-operation | False |
948954
+-------------------------------+------------------------------------------------------------------+
@@ -1286,7 +1292,7 @@ The format “ocp.csr.irot-eca.mldsa87” is defined as follows:
12861292
+-------------------------------+------------------------------------------------------------------+
12871293
| ========================================= Derivation =========================================== |
12881294
+-------------------------------+------------------------------------------------------------------+
1289-
| dice-derivation | ocp.derive.kdf-cdi-512 |
1295+
| dice-derivation | ocp.derive.kdf-cdi-384 |
12901296
+-------------------------------+------------------------------------------------------------------+
12911297
| asymmetric-derivation | ocp.derive.kdf-asymmetric-mldsa87 |
12921298
+-------------------------------+------------------------------------------------------------------+
@@ -1306,7 +1312,7 @@ The format “ocp.csr.irot-eca.mldsa87” is defined as follows:
13061312
+-------------------------------+------------------------------------------------------------------+
13071313
| =========================================== Export ============================================= |
13081314
+-------------------------------+------------------------------------------------------------------+
1309-
| export-cdi-format | ocp.export-cdi.raw-512 |
1315+
| export-cdi-format | ocp.export-cdi.raw-384 |
13101316
+-------------------------------+------------------------------------------------------------------+
13111317

13121318
## ABI Structure Definitions {#sec:abi-structure-definitions}
@@ -1433,10 +1439,10 @@ Table: Profile-dependant ABI constants for `DPE_PROFILE_IROT_MLDSA87_SHA384`
14331439

14341440
**Name** | **Description** | **Value**
14351441
------------ | --------------------- | --------
1436-
`H` | Hash Size | 64
1442+
`H` | Hash Size | 48
14371443
`P` | Public Key Size | 2592
14381444
`S` | Signature Size | 4697
1439-
`C` | Certificate Size | TODO
1445+
`C` | Certificate Size | 17408
14401446

14411447
### Types
14421448

@@ -1548,6 +1554,7 @@ Table: `DERIVE_CONTEXT_INPUT_ARGS` struct
15481554
| 0x20 + H | `BYTES` | 31:0 | `INPUT_TYPE` | 4-byte measurement type field
15491555
| 0x24 + H | `U32` | 31:0 | `TARGET_LOCALITY` | Locality in which `NEW_CONTEXT_HANDLE` will be created if `CHANGE_LOCALITY` is set.
15501556
| 0x28 + H | `U32` | 31:0 | `INPUT_SVN` | SVN added to TCI node. Callers SHOULD set this field to `0` when SVN is unused.
1557+
| 0x2C + H | `BYTES` | 127:0 | `OP_HANDLE` | A handle if continuing a multi-part operation, otherwise 0.
15511558

15521559
Table: `DERIVE_CONTEXT_OUTPUT_ARGS` struct if `EXPORT_CDI` is **not** set
15531560

@@ -1569,8 +1576,12 @@ Table: `DERIVE_CONTEXT_OUTPUT_ARGS` struct if `EXPORT_CDI` is set
15691576
| 0x0C | `BYTES` | 127:0 | `NEW_CONTEXT_HANDLE` | The handle for the created child context, or rotated context in case RECURSIVE is set.
15701577
| 0x1C | `BYTES` | 127:0 | `PARENT_CONTEXT_HANDLE` | The handle for the parent context if `RETAIN_PARENT_CONTEXT` is set.
15711578
| 0x2C | `EXPORTED_CDI` | 255:0 | `EXPORTED_CDI` | If EXPORT_CDI is true, holds exported CDI. Else, value is ignored.
1572-
| 0x4C | `U32` | 31:0 | `CERTIFICATE_SIZE` | Number of bytes used in `NEW_CERTIFICATE`.
1573-
| 0x50 | `BYTES` | | `NEW_CERTIFICATE` | If CREATE_CERTIFICATE is set, holds the new ECA certificate. Else, value is ignored.
1579+
| 0x4C | `BITFIELD` | 31 | `MORE_DATA` | Whether more data is available in the response.
1580+
| | | 30 | `MORE_CERT` | More data is available in the `NEW_CERTIFICATE` field.
1581+
| | | 29:0 | `RESERVED` | Reserved.
1582+
| 0x50 | `BYTES` | 127:0 | `OP_HANDLE` | Contains a handle if more data remains in the certificate.
1583+
| 0x60 | `U32` | 31:0 | `CERTIFICATE_SIZE` | Number of bytes used in `NEW_CERTIFICATE`.
1584+
| 0x64 | `BYTES` | | `NEW_CERTIFICATE` | If CREATE_CERTIFICATE is set, holds the new ECA certificate. Else, value is ignored.
15741585

15751586
#### CertifyKey ABI
15761587

@@ -1585,6 +1596,7 @@ Table: `CERTIFY_KEY_INPUT_ARGS` struct
15851596
| 0x1C | `BITFIELD` | 31:0 | `RESERVED` | Reserved
15861597
| 0x20 | `U32` | 31:0 | `ADD_FORMAT` | Output format of `CERTIFICATE`
15871598
| 0x24 | `HASH` | | `LABEL` | Public digest used in key derivation.
1599+
| 0x24 + H | `BYTES` | 127:0 | `OP_HANDLE` | A handle if continuing a multi-part operation, otherwise 0.
15881600

15891601
Table: `CERTIFY_KEY_OUTPUT_ARGS` struct
15901602

@@ -1595,8 +1607,12 @@ Table: `CERTIFY_KEY_OUTPUT_ARGS` struct
15951607
| 0x08 | `U32` | 31:0 | `PROFILE` | One of `DPE_PROFILE_*`.
15961608
| 0x0C | `BYTES` | 127:0 | `NEW_CONTEXT_HANDLE` | Numeric handle referring to the updated context.
15971609
| 0x1C | `PUBKEY` | | `DERIVED_PUBLIC_KEY` | Derived public key. This is the same public key as the Subject of the returned certificate.
1598-
| 0x1C + P | `U32` | 31:0 | `CERTIFICATE_SIZE` | Number of bytes used in `CERTIFICATE_CHAIN`.
1599-
| 0x20 + P | `CERTIFICATE` | | `CERTIFICATE` | Returned leaf certificate.
1610+
| 0x1C + P | `BITFIELD` | 31 | `MORE_DATA` | Whether more data is available in the response.
1611+
| | | 30 | `MORE_CERT` | More data is available in the `CERTIFICATE` field.
1612+
| | | 29:0 | `RESERVED` | Reserved.
1613+
| 0x20 + P | `BYTES` | 127:0 | `OP_HANDLE` | Contains a handle if more data remains in the certificate.
1614+
| 0x30 + P | `U32` | 31:0 | `CERTIFICATE_SIZE` | Number of bytes used in `CERTIFICATE`.
1615+
| 0x34 + P | `CERTIFICATE` | | `CERTIFICATE` | Returned leaf certificate.
16001616

16011617
#### Sign ABI
16021618

@@ -1673,8 +1689,7 @@ Table: `GET_CERTIFICATE_CHAIN_INPUT_ARGS` struct
16731689
| 0x00 | `U32` | 31:0 | `MAGIC` | Magic number `DPE_COMMAND_MAGIC`.
16741690
| 0x04 | `U32` | 31:0 | `COMMAND_ID` | `DPE_COMMAND_GET_CERTIFICATE_CHAIN`.
16751691
| 0x08 | `U32` | 31:0 | `PROFILE` | One of `DPE_PROFILE_*`.
1676-
| 0x0C | `U32` | 31:0 | `OFFSET` | Offset of certificate chain to retrieve.
1677-
| 0x10 | `U32` | 31:0 | `SIZE` | Max number of bytes to return, starting at `OFFSET`.
1692+
| 0x0C | `BYTES` | 127:0 | `OP_HANDLE` | A handle if continuing a multi-part operation, otherwise 0.
16781693

16791694
Table: `GET_CERTIFICATE_CHAIN_OUTPUT_ARGS` struct
16801695

@@ -1683,5 +1698,9 @@ Table: `GET_CERTIFICATE_CHAIN_OUTPUT_ARGS` struct
16831698
| 0x00 | `U32` | 31:0 | `MAGIC` | Magic number `DPE_RESPONSE_MAGIC`.
16841699
| 0x04 | `U32` | 31:0 | `STATUS` | One of `DPE_STATUS_*`.
16851700
| 0x08 | `U32` | 31:0 | `PROFILE` | One of `DPE_PROFILE_*`.
1686-
| 0x0C | `U32` | 31:0 | `CERTIFICATE_SIZE` | Number of bytes used in `CERTIFICATE_CHAIN`. Can be smaller than requested if no bytes are left to read.
1687-
| 0x10 | `BYTES` | 16383:0 | `CERTIFICATE_CHAIN` | Returned certificate chain. This may be a partial certificate chain.
1701+
| 0x0C | `BITFIELD` | 31 | `MORE_DATA` | Whether more data is available in the response.
1702+
| | | 30 | `MORE_CERT_CHAIN` | More data is available in the `CERTIFICATE_CHAIN` field.
1703+
| | | 29:0 | `RESERVED` | Reserved.
1704+
| 0x10 | `BYTES` | 127:0 | `OP_HANDLE` | Contains a handle if more data remains in the certificate chain.
1705+
| 0x20 | `U32` | 31:0 | `CERTIFICATE_SIZE` | Number of bytes used in `CERTIFICATE_CHAIN`. Can be smaller than requested if no bytes are left to read.
1706+
| 0x24 | `BYTES` | | `CERTIFICATE_CHAIN` | Returned certificate chain. This may be a partial certificate chain.

0 commit comments

Comments
 (0)