Skip to content

Add ADAC 1.1 serialization, validation, and CLI support#9

Open
mathias-arm wants to merge 10 commits into
mainfrom
adac-1.1
Open

Add ADAC 1.1 serialization, validation, and CLI support#9
mathias-arm wants to merge 10 commits into
mainfrom
adac-1.1

Conversation

@mathias-arm
Copy link
Copy Markdown
Collaborator

This PR adds ADAC 1.1 support and tightens encoding, validation, and CLI verification behavior. The main changes are:

  • Add ADAC 1.1 certificate policy support and TLV flags, including critical-extension handling and TLV padding validation.
  • Replace implicit layout assumptions with explicit ADAC serialization/deserialization helpers for certificate headers, token headers, and TLV headers.
  • Add encoding diagnostics for certificates, certificate chains, tokens, and TLV sequences, with contextual issue reporting.
  • Centralize certificate-chain and token validation so CLI verification and library callers share consistent semantic checks.
  • Add adac-cli verify --strict for stricter local diagnostics, including requiring token validation to terminate at a leaf certificate and rejecting unknown/unprocessed critical extensions.
  • Add structured extension syntax for certificate/token creation, including token soc_id extension support.
  • Gate deterministic RSA-PSS signing behind the hazmat-deterministic feature.
  • Move larger adac-cli command tests into integration tests and add shell coverage for CLI/offline flows.

- Parse and validate certificate policies from configuration file, allowing nonzero values only for ADAC 1.1 certificates.
- Emit policies from online and offline certificate signing flows.
- Report the effective policy bitmask during verification when it is nonzero.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Add explicit little-endian serialization and deserialization helpers for certificate, token, and TLV headers.
- Centralize validation of header versions, reserved fields, crypto consistency, and ADAC 1.0 policy constraints.
- Keep the old packed-layout path temporarily behind the serialization feature boundary.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Remove the native packed-layout serialization fallback and the associated feature gating.
- Route certificate, token, and TLV encoding through the explicit serialization helpers unconditionally.
- Rename serialized-size constants to the simpler SIZE form.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Replace the public deterministic constructor with an explicitly named test-only constructor.
- Gate deterministic signing behind hazmat-deterministic so normal consumers cannot accidentally enable deterministic RSA-PSS signing.
- Enable the hazmat feature only for tests that require byte-for-byte stable signatures.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Update TLV headers to include ADAC 1.1 flags, including the critical-extension flag.
- Add shared TLV sequence parsing that advances over padded values and rejects nonzero padding.
- Use the shared parser for certificate-chain decoding so TLV padding and alignment rules are applied consistently.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Add encoding validators for TLV sequences, certificate chains, individual certificates, and tokens.
- Report all detectable encoding issues with byte offsets and context instead of failing at the first parse error.
- Cover malformed TLVs, invalid padding, token header issues, and nested certificate/token extension encodings.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Introduce a reusable chain validator that tracks certificate order, role constraints, signatures, and effective chain constraints.
- Rework adac-cli verify and verify_chain to use the shared validation logic.
- Add token validation through the same validator so token permissions are combined with the effective certificate-chain constraints.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Split adac-cli command implementation into a library-backed binary so command functions can be tested from integration tests.
- Move most command-level tests out of module unit tests and into adac-cli/tests.
- Add shared integration-test scaffolding for certificate chains, token signing, offline signing, and verify diagnostics.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Add verify --strict to enable stricter diagnostic checks for token validation and critical extensions.
- Reject ADAC 1.0 artifacts that carry ADAC 1.1 TLV flags and reject unknown TLV flag bits.
- Distinguish token signature verification from full token validation when the certificate chain is invalid.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
- Add structured extension syntax for certificate and token config, while retaining legacy base16 TLV input.
- Support critical token soc_id extensions and fold them into effective verification output.
- Add CLI shell coverage for effective constraints, token SoC ID extensions, and offline token signing.

Signed-off-by: Mathias Brossard <mathias.brossard@arm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant