enrollz_tpm20_hmac - openconfig/featureprofiles GitHub Wiki
This document outlines the functional network tests (FNTs) for the TPM 2.0 HMAC-based enrollment flow mainly for devices that lack a pre-provisioned Initial Device Identifier (IDevID) certificate (but supports all TPM 2.0 devices). This workflow uses a Hash-based Message Authentication Code (HMAC) challenge-response mechanism to securely verify the device's identity. The process provisions an owner Initial Attestation Key (oIAK) and an owner IDevID (oIDevID) after establishing a chain of trust from the Endorsement Key (EK) or Platform Primary Key (PPK), to the Initial Attestation Key (IAK), and finally to the IDevID.
The primary objective is to test the device's ability to correctly handle the enrollment sequence, including cryptographic operations, request validation, and error handling.
The test validates that the device correctly implements the server-driven TPM enrollment workflow. The following test cases cover both the successful enrollment path and various failure scenarios from the device's perspective.
| ID | Case | Expected Result |
|---|---|---|
| enrollz-1.1 | Successful enrollment for a device that has an EK cert stored in the RoT database. | The device successfully completes the enrollment, obtains oIAK and oIDevID certs, and updates the SSL profile to use the new oIDevID cert. |
| enrollz-1.2 | Successful enrollment for a device that has a PPK public key stored in the RoT database. | The device successfully completes the enrollment, obtains oIAK and oIDevID certs, and updates the SSL profile to use the new oIDevID cert. |
| enrollz-1.3 | Enrollz service presents an invalid client certificate. | The device rejects the mTLS connection, resulting in a gRPC connection failure. |
| enrollz-1.4 | GetControlCardVendorIDRequest with missing control_card_selection. | The device returns an invalid request error. |
| enrollz-1.5 | GetControlCardVendorIDRequest with invalid control_card_selection. | The device returns an invalid request error. |
| enrollz-1.6 | ChallengeRequest with missing control_card_selection. | The device returns an invalid request error. |
| enrollz-1.7 | ChallengeRequest with invalid control_card_selection. | The device returns an invalid request error. |
| enrollz-1.8 | ChallengeRequest with invalid key type KEY_UNSPECIFIED. | The device returns an invalid request error. |
| enrollz-1.9 | ChallengeRequest with an empty hmac_pub_key in HMACChallenge. | The device returns an invalid request error. |
| enrollz-1.10 | ChallengeRequest with an empty duplicate field in HMACChallenge. | The device returns an invalid request error. |
| enrollz-1.11 | ChallengeRequest with an empty in_sym_seed field in HMACChallenge. | The device returns an invalid request error. |
| enrollz-1.12 | ChallengeRequest with a malformed hmac_pub_key in HMACChallenge. | The device's TPM fails to import the HMAC key, and the device returns an invalid request error. |
| enrollz-1.13 | ChallengeRequest with a malformed duplicate in HMACChallenge. | The device's TPM fails to import the HMAC key, and the device returns an invalid request error. |
| enrollz-1.14 | ChallengeRequest with a malformed in_sym_seed in HMACChallenge. | The device's TPM fails to import the HMAC key, and the device returns an invalid request error. |
| enrollz-1.15 | ChallengeRequest with correct key type KEY_EK but the challenge HMAC is wrapped with an invalid EK. | The device returns an invalid request error. |
| enrollz-1.16 | ChallengeRequest with correct key type KEY_PPK but the challenge HMAC is wrapped with an invalid PPK. | The device returns an invalid request error. |
| enrollz-1.17 | GetIdevidCsrRequest with missing control_card_selection. | The device returns an invalid request error. |
| enrollz-1.18 | GetIdevidCsrRequest with invalid control_card_selection. | The device returns an invalid request error. |
| enrollz-1.19 | GetIdevidCsrRequest with invalid key type KEY_UNSPECIFIED. | The device returns an invalid request error. |
| enrollz-1.20 | GetIdevidCsrRequest with an unsupported KeyTemplate. | The device returns a GetIdevidCsrResponse with status as STATUS_UNSUPPORTED. |
| enrollz-1.21 | RotateOIakCert with an invalid control card. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.22 | RotateOIakCert with a populated oidevid_cert but a missing ssl_profile_id. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.23 | RotateOIakCert with a malformed oIAK certificate. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.24 | RotateOIakCert with a oIAK having a mismatched underlying IAK public key. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.25 | RotateOIakCert with a valid oIAK certificate chain but an invalid signature. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.26 | RotateOIakCert with a malformed oIDevID certificate. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.27 | RotateOIakCert with a oIDevID having a mismatched underlying IDevID public key. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.28 | RotateOIakCert with a valid oIDevID certificate chain but an invalid signature. | The device rejects the entire transaction, rolls back any changes, and returns an invalid request error. No certificates are updated on any control card. |
| enrollz-1.29 | RotateOIakCert with valid oIAK and oIDevID for active control card, and only a valid oIAK for the standby control card. | The device successfully completes the enrollment, obtains oIAK and oIDevID certs, and updates the SSL profile to use the new oIDevID ce |
| enrollz-1.30 | Reboot after successful enrollment. | The device comes up successfully and can establish an mTLS connection using the oIDevID certificate. All certificates (oIAK, oIDevID) are persistent. |
| enrollz-1.31 | Reboot after GetIdevidCsr and restart enrollment. | The device successfully completes the enrollment, obtains oIAK and oIDevID certs, and updates the SSL profile to use the new oIDevID cert. |
- Initiate an mTLS connection from the test client (acting as Enrollz) to the device.
- Call
GetControlCardVendorIDfor the active control card with a validControlCardSelection. - Verify the
GetControlCardVendorIDResponsecontains the correctControlCardVendorIdfor the selected card. - Using the serial number from the response, fetch the corresponding EK or PPK public key from a test database (simulating the RoT database).
- Generate a restricted HMAC key, wrap it using the EK/PPK public key, and send it as a challenge to the device in a
ChallengeRPC. - Upon receiving the
ChallengeResponsefrom the device, verify the HMAC signature (iak_certify_info_signature) over the IAK certify info (iak_certify_info) using the generated HMAC key. - Call
VerifyIAKKeyto validate the received IAK public key. This includes:- Verify that the IAK public area (
iak_pub) has attributes specified in Template H-0 for AKs. - Verify that the
magicfield iniak_certify_infois the expected TPM Generated Value (0xff544347). - Compute the IAK name and verify that it matches the
namefield iniak_certify_info. - Verify that in the
iak_certify_info, thenameandqualifiedNamefields are not identical.
- Verify that the IAK public area (
- Call
GetIdevidCsrwith a supportedKeyTemplate(currently only KEY_TEMPLATE_ECC_NIST_P384) . - Upon receiving the
GetIdevidCsrResponse, callVerifyIdevidKeyto validate the IDevID and CSR. This includes:- Parsing the TCG-CSR-IDEVID contents
csr_contents. - Verifying the signature (
signCertifyInfoSignature) of IDevID certify info (signCertifyInfo) using IAK pub key. - Verify the
signCertifyInfocontains the following:- The
magicfield is the expected TPM Generated Value. - The computed IDevID name matches the
namefield. - The
nameandqualifiedNamefields are not identical.
- The
- Verifying the IDevID public key attributes against the template provided.
- Verifying the CSR's signature (
idevid_signature_csr) using the IDevID public key.
- Parsing the TCG-CSR-IDEVID contents
- Repeat steps 2-9 for the standby control card.
- Generate owner-signed oIAK and oIDevID certificates for both control cards.
- Call
RotateOIakCertto install the newly generated owner-signed oIAK and oIDevID certificates for both control cards. The request must use theupdatesfield to specify the certificates. Verify the device returns a successful response.
paths:
rpcs:
gnmi:
gNMI.Subscribe:{}