Repository navigation
soc: apple: sep: Touch ID and password keys under a user's bag - #1767
RyanTheTide wants to merge 2 commits into
Conversation
macOS lets a Secure Enclave key need both Touch ID and the device passcode (.biometry* | .and | .devicePasscode), or Touch ID alone. Under a user's own key bag /dev/sep-key only made .userPresence keys (Touch ID or the password) and keys with no list, so a site rule like "this bank needs my finger and my password" had nothing to map to. SEP_KEY_CREATE_USER now also takes, when INFO lists SEP_KEY_FEATURE_USER_POLICIES (it comes with the per-user bags): - SEP_KEY_CREATE_BIOMETRY_CURRENT_SET or _ANY: the biometric list the identity-bag keys already use, under the user's bag. The password calls refuse these keys. - one of those with SEP_KEY_CREATE_DEVICE_PASSCODE | SEP_KEY_CREATE_AND: the AND list. ock, okd and osgn each carry one flat constraint with the biometric clause (cbio), the user passcode clause (cup, true) and the required count (pkofn, 2). oa and odel stay free. This is the map the public flags builder writes; OR would be the same map with pkofn 1 and is not offered. An AND key is used through SEP_KEY_SIGN_PASSWORD / UNSEAL_PASSWORD. The call waits for a Touch ID match as a biometric key does; after the match the enclave verifies the bag's password into the same context (VERIFY_SECRET), and the one operation runs there. A refused password fails the call with EACCES and the operation never runs. The kernel holds the password only for the call and wipes it. SIGN and UNSEAL refuse an AND key with EINVAL before asking for a touch, since they carry no password. The enclave enforces the conjunction from the key's list. Self-test modes 13-15 check that: a match alone (13, needs a finger), the bag's password alone (14) and neither (15) must each be refused by the enclave, with the kernel's own refusal of SIGN bypassed. The production SIGN_PASSWORD call with a touch is the arm that signs. Version-2 handles carry the policy in their flags (HANDLE_BIOMETRY, HANDLE_BIOMETRY_ANY, new HANDLE_AND_PASSCODE); the decoder takes only the flag sets a policy makes. .devicePasscode alone stays reserved. KUnit: the policy table (accepted combinations, EOPNOTSUPP without the feature, malformed ones EINVAL), the AND list's exact bytes against the biometric list, and handle round trips with the password-call and SIGN gating for every policy. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
An AND call can fail on either credential. EACCES already means the Touch ID match failed (or Touch ID is locked out), so a password the enclave refuses after the match now returns ENOKEY. Userspace can then ask for the password again instead of for another touch. Assisted-by: LLM Signed-off-by: Ryan Murray <[email protected]>
|
Blockers: 2.
The rest looks consistent: the policy parser rejects half-ANDs and OR forms; the version-2 handle decoder accepts only the flag sets user_handle_flags() makes; check_password_handle() refuses biometric-only and plain keys; SIGN/UNSEAL refuse AND keys before a touch; and INFO advertises FEATURE_USER_POLICIES under the same Variant5 condition that CREATE_USER checks (:2650, :2732). HW row: on this head, Neo J700 and J616s, Touch ID enrolled, Assisted-by: LLM (Claude:Opus 5.5) |
|
Closing for now: the two-credential guarantee was never shown on hardware; it can come back with the self-test rows on the Neo and J616s. |
|
Reopened and kept as a draft; the comment above lists what it still needs before review. |
SEP_KEY_CREATE_USERgains the other macOS key policies under a user's own bag, behind a newINFO.featuresbitSEP_KEY_FEATURE_USER_POLICIES(set withFEATURE_PASSWORDon the variant-5 key store):SEP_KEY_CREATE_BIOMETRY_CURRENT_SET/_ANY: Touch ID only.SIGN_PASSWORDandUNSEAL_PASSWORDrefuse these keys.BIOMETRY_* | SEP_KEY_CREATE_DEVICE_PASSCODE | SEP_KEY_CREATE_AND(new bit0x10): Touch ID and the bag's password.ock,okdandosgneach carry one flat constraint{cbio, cup: true, pkofn: 2};oaandodelstay free.An AND key is used through
SIGN_PASSWORD/UNSEAL_PASSWORD. The call waits for a match like a biometric key; after the match the enclave verifies the bag's password into the same context (VERIFY_SECRET) and the one operation runs there. A refused password returnsENOKEY(EACCESstays a finger that did not match) and nothing runs.SIGN/UNSEALrefuse an AND key withEINVALbefore a touch.Self-test modes 13 (match only, needs a finger), 14 (password only) and 15 (neither) check that the enclave refuses each one-credential case on its own. The signing arm is the production
SIGN_PASSWORDcall.Tests: new KUnit cases for the policy table, the AND list bytes (compared against the biometric list) and v2 handle round trips with the password-call and
SIGNgating per policy.Hardware: not yet run. Rows to run on the Neo and J616s: modes 14 and 15 (no finger), then mode 13 and
SIGN_PASSWORD+ touch (finger), plus a wrong password + touch (ENOKEY).