ta/pta: qcom: pas: authenticate PIL firmware signatures and device bindings - #7937
Open
zelvam95 wants to merge 8 commits into
Open
ta/pta: qcom: pas: authenticate PIL firmware signatures and device bindings#7937zelvam95 wants to merge 8 commits into
zelvam95 wants to merge 8 commits into
Conversation
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
from
August 19, 2026 01:37
3e84f40 to
7f8ce54
Compare
Contributor
|
How about making this a draft, since it still depends on other PRs to be merged? |
zelvam95
marked this pull request as draft
August 19, 2026 07:52
Contributor
Author
Sorry, missed to mark as draft. Have moved this PR to draft. |
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
from
August 19, 2026 10:02
7f8ce54 to
ab96976
Compare
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
15 times, most recently
from
August 20, 2026 14:07
80b23ff to
8d6ed6b
Compare
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
from
August 21, 2026 07:35
8d6ed6b to
d4e9a92
Compare
zelvam95
marked this pull request as ready for review
August 21, 2026 07:35
ldts
reviewed
Aug 24, 2026
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
2 times, most recently
from
August 24, 2026 16:19
2aba9ee to
b5a1a83
Compare
ldts
reviewed
Aug 25, 2026
ldts
reviewed
Aug 25, 2026
ldts
reviewed
Aug 25, 2026
ldts
reviewed
Aug 25, 2026
ldts
reviewed
Aug 25, 2026
ldts
reviewed
Aug 25, 2026
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
3 times, most recently
from
August 26, 2026 19:48
962a72c to
c93180a
Compare
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
from
August 26, 2026 20:15
c93180a to
c83efce
Compare
Contributor
Author
|
@ldts / @harshaldev27 / @kishorebatta-ossqcom, Have addressed the earlier comments. Let me know if you have any other feedback. |
|
Reviewed core/drivers/qcom/qfprom/* files. Reviewed-by: Kishore Batta kishore.batta@oss.qualcomm.com |
zelvam95
commented
Aug 27, 2026
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
2 times, most recently
from
August 28, 2026 07:39
e9ae1d0 to
0f8045e
Compare
Signature authentication will trust the carveout more heavily than hash-only verification does, and its TA-side policy will need the same PAS IDs core code already uses, so put both in place before the rest of the series builds on them. The carveout base and size come from the REE, so the range must be proven non-secure memory before it is mapped for hashing, and the REE writes it outside this mapping's coherency domain, so hashing could otherwise see a stale cached copy. Also reject an ELF with inconsistent header geometry, so segment collection cannot run on a malformed image. PAS authentication verifies the firmware contents. TOCTOU protection for the carveout is expected to come from the kernel/HYP MMU/SMMU configuration, which controls isolation between non-secure masters. Move the PAS_ID_* constants out of the core-only pas_data.h and into the shared pta_qcom_pas.h interface header, so the TA-side policy code added later in this series references the same values instead of a second, duplicated set. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com>
The secure-boot fuse accessors need per-target register offsets, masks and layout to operate. Keep the Lemans values as driver platform data so a future target only needs its own register layout, not a copy of the reader code. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com> Reviewed-by: Kishore Batta <kishore.batta@oss.qualcomm.com>
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
from
August 28, 2026 08:30
0f8045e to
1d4aac4
Compare
Signature authentication has to bind an image to the device it runs on, which requires the OEM root-of-trust anchor and enable state, the device identity, and the EKU enforcement fuse. They are gated on CFG_QCOM_FUSE_PTA so a target without the fuse PTA carries none of this code. No caller reads them yet. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com> Reviewed-by: Kishore Batta <kishore.batta@oss.qualcomm.com>
The secure-boot fuse readers live in the OP-TEE core, but the PAS TA that needs them runs in user space. Expose them through a pseudo-TA restricted to a REE_KERNEL-only login domain, so the TA can obtain fuse-backed values without a driver dependency of its own. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com>
…rser Signature authentication binds an image to its device using fields in the OEM metadata block. Decode the block into typed values, including anti-rollback and secondary SW ID fields for follow-on checks, so the authentication backend never re-parses the raw block. Metadata version and root_cert_sel are readable on their own, because each selects the hash size the full parse needs as input. The OEM-signed region masks out the QC-controlled fields, so the signature covers exactly what the OEM signed. Replace the hash-segment parser's raw byte-offset macros and untyped u32 reads with a typed MBN header struct, since the decoder above and the parser's other callers all dereference the same fields and byte-offset arithmetic is easy to get wrong on review. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com>
The signature-authentication path makes several fuse reads per image, so hold one fuse-PTA session per TA session rather than opening one per read, matching how the TA already holds its PAS PTA session. The helper applies no policy and fails closed: a read failure propagates instead of substituting a default, so an untrustworthy fuse value aborts authentication rather than silently weakening it. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com>
Segment-hash verification proves an image matches its own digest table; it cannot prove who signed it or that it is permitted on this device, so establish provenance before the peripheral leaves reset. The fuse read selecting this path fails closed: an error means secure boot enabled, so a transient failure cannot downgrade a fused board to hash-only verification. UIE-encrypted and QC-countersigned images are refused, as neither is implemented here, and the chain is limited to one ECDSA P-384 root. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com>
…cation Signature authentication reads fuses at runtime, so CFG_QCOM_PAS_AUTH alone is not enough: the fuse PTA and the qfprom driver behind it must come up with it too. Fold the existing fuse-provisioning enable into the same block so it and the new fuse-PTA consumer share one QFPROM enable and cannot drift apart. Signed-off-by: Selvam Sathappan Periakaruppan <speriaka@qti.qualcomm.com> Assisted-by: Claude:sonnet-5 Reviewed-by: Sachin Grover <sgrover@qti.qualcomm.com>
zelvam95
force-pushed
the
feature/optee-pas-sig-auth
branch
from
August 30, 2026 13:27
1d4aac4 to
d9fa3df
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on PR #7885 (yet to be merged) - which added segment-hash
verification. Segment hashing proves an image matches its own digest table,
but not that the image was signed by a trusted party or is permitted on this
device. On a fused secure-boot Lemans device this PR establishes the image's
provenance at INIT_IMAGE, before the REE loads any segment:
OEM certificate chain, signature, and SW/HW device bindings, all anchored to
hardware fuses. Enabled under the same
CFG_QCOM_PAS_AUTHknob asPR #7885.
Devices whose secure-boot fuse is unblown skip signature authentication and
rely on PR #7885's segment-hash verification alone; segment re-hashing at
AUTH_AND_RESET runs on every device regardless.
Design
Authentication forks on a single fuse read of the secure-boot state and
root-of-trust anchor, and that read fails closed: a fuse-PTA error is
treated as secure-boot enabled, so a transient glitch can never downgrade a
secure-booted board to hash-only verification.
The crypto runs in the
qcom_pasuser-TA (mbedTLS-backed cert-chain andsignature verification); fuses are reached through a dedicated fuse PTA so the
TA needs no direct driver dependency. UIE-encrypted and QTI-countersigned
images are refused outright — neither decryption nor countersignature
verification is implemented here.
sequenceDiagram participant REE as REE (Linux) participant TA as qcom_pas TA participant FPTA as fuse PTA participant PTA as PAS PTA Note over REE,PTA: INIT_IMAGE - signature authentication (secure-boot devices) REE->>TA: INIT_IMAGE(pas_id, metadata_blob) TA->>PTA: PTA_QCOM_PAS_INIT_IMAGE PTA-->>TA: TEE_SUCCESS TA->>TA: pas_auth_save_metadata()<br/>TEE-private copy keyed by pas_id TA->>FPTA: read secure-boot state + root-of-trust anchor FPTA-->>TA: secboot_on, anchor<br/>(read error is treated as secboot_on) alt secure boot enabled TA->>TA: pas_mbn_parse() extracts hash_table TA->>FPTA: read device id fuses FPTA-->>TA: fuse values TA->>TA: verify cert chain vs fused anchor TA->>TA: verify signature over OEM-signed region TA->>TA: enforce SW/HW bindings else secure boot disabled TA->>TA: pas_mbn_parse() extracts hash_table<br/>(no signature auth) end TA-->>REE: TEE_SUCCESS (or TEE_ERROR_SECURITY on any failure) Note over REE,PTA: MEM_SETUP + REE segment load (unchanged from PR 19) Note over REE,PTA: AUTH_AND_RESET - segment hash verification + release REE->>TA: AUTH_AND_RESET(pas_id, fw_base, fw_size) TA->>PTA: PTA_QCOM_PAS_VERIFY_IMAGE with metadata and hash_table PTA->>PTA: re-hash each PT_LOAD segment vs hash_table entry PTA-->>TA: TEE_SUCCESS TA->>PTA: PTA_QCOM_PAS_AUTH_AND_RESET PTA-->>TA: TEE_SUCCESS peripheral released from reset TA-->>REE: TEE_SUCCESSTesting
PLATFORM=qcom-lemans CFG_QCOM_PAS_AUTH=y CFG_WERROR=y; checkpatchclean across the series.
cert-chain break, and SW/HW-binding mismatch are each rejected and the
peripheral stays in reset;
enforced.