[Magisk] pndwal:
Some OnePlus models are only affected when unlocked. See scenario 2) below...

Confusion about this may occur because the TEE OS and TAs (generally Google's Trusty OS w/ Trusty kernel along with Google TAs or trusted applications, but OEMs are free to implement others) themselves are not actually broken, but configuration of components implemented by OEMs (eg TA 'assets'/secrets) can be. So TEE (trusted execution environment) as a whole may not be broken, but since components implemented within the TEE like Keymaster can usually not be fixed after leaving the factory* unlike the Android Rich OS w/ Linux kernel (REE, Rich Operating System Execution Environment) itself, these are permanently affected and TEE may be said to be 'broken'.

View attachment 6115981

Trusty application overview

*Note: Devices launched with A13+ may now be able to be fixed remotely (repaired on the fly) using Remote Key Provisioning for Upgrading Android Attestation. Also, OEMs/ODMs are no longer provisioning attestation private keys directly to devices in the factory, so no longer need manage 'secrets' for attestation in shop... Google servers now issue keys/certificates... See: https://xdaforums.com/t/module-play-integrity-fix-safetynet-fix.4607985/post-89184994

Clearly, there are many levels of 'breakage' that can affect TEE. Eg:

1) in some OnePlus devices the OEM has supplied a Keymaster implementation where hardware key backed attestation (HKA) is broken even when B/L is locked. In these cases, when a call to the hardware KeyStore is made an exception (error) causes an on-device fallback to 'basic' attestation measurements and, since Google doesn't enforce a serverside HARDWARE_BACKED evaluationType for such 'broken TEE' device (ie. exempts them), ctsProfileMatch and DEVICE_INTEGRITY requirements can still be met. STRONG_INTEGRITY is not met however.

2) in other OnePlus devices, HKA works when B/L is locked and STRONG_INTEGRITY is met for stock/locked users, but unlocking B/L breaks it. (Re-locking restores working HKA.) Unlocked devices can meet DEVICE_INTEGRITY with basic (SW) attestation but may need to spoof 'print' (prop/field set) to bypass serverside HARDWARE_BACKED evaluationType enforcement as Google might still deem the device HKA compliant (since it works in stock/locked state).

3) Some devices (eg several Asus Rog Phone models) erroneously supply basic measurements for AVB state even when a call to the hardware KeyStore succeeds! (Should use hardware key pair extension data, but clearly just uses basic data.) This means that unlocked devices can meet STRONG_INTEGRITY if ROM or some module simply hides root and sets sensitive props to non-suspicious values. (PIF's fallback to basic-only attestation trigger, fake keystore registration, must be absent.) In these cases Google can revoke keys for STRONG but surprisingly seems to have avoided doing that! (Guessing keys are not fine-grained, and HKA is broken where keys are revoked meaning that DEVICE_INTEGRITY would also be lost on stock/locked devices with this approach.); Turns out they simply disable STRONG on a per-ROM basis (use fingerprint and/or other basic identifiers?) and older ROMS still allow STRONG both when locked/stock and (with hiding mentioned above) when unlocked.

Further to broken keymaster implementations, there are vast differences in how OEMs implement other TEE TAs etc, eg decryption for Widevine/DRM...

On Google (Pixel) and many other devices, DRM HD decoding (which is done in TEE) continues to work with B/L unlocked but it's different for many OnePlus, RealMe and other devices. On some, this (ie L1 security certification for HD stream decoding) breaks when B/L is unlocked and is restored when re-locked. On others, keys are revoked and it's either permanently broken or, in some cases with support, until keys are restored (eg by an app customised using user supplied unique device numbers before being provided by service department) even if re-locked. And some OEMs further (strangely) make DRM security dependant on meeting DEVICE_INTEGRITY or BASIC_INTEGRITY.

Hope the general introduction to TEE helps! 🤠 PW