Repository navigation
soc: apple: sep: sep-key: cancel, and secrets released only with a touch - #1506
Merged
Merged
Conversation
Interface version 3 of /dev/sep-key. INFO's reserved word becomes
'features' (SEP_KEY_FEATURE_CANCEL, SEP_KEY_FEATURE_SEAL).
SEP_KEY_CANCEL ends a touch-gated call that is waiting for a finger; that
call returns ECANCELED. The wait checks the flag before each capture and
the verify and capture loops stop as soon as it is set, so a client that
gives up (a browser cancel, a security key daemon's own timeout) no longer
leaves the sensor armed for the rest of the minute.
SEP_KEY_SEAL encrypts up to 64 bytes to a biometric key's public point
with the ECIES scheme the trusted-key source already uses
(refkey_seal::ecies_seal); it needs no private key and no touch.
SEP_KEY_UNSEAL has the enclave decrypt such a blob with the key (op oecd)
under the same fresh, touch-satisfied credential context a SIGN uses: the
kernel opens the context, runs the match, decrypts and deletes the context
inside the one call. The key's access-control list constrains the decrypt
as it constrains the signature, so the secret is released only after a
match the enclave saw. Both refuse keys made without a biometric policy.
A FIDO authenticator uses this for hmac-secret, whose CredRandom must not
be computable on the host without the user.
The touch-gated job now carries the operation (sign or unseal) instead of
always signing. Self-test modes, all behind key_selftest=1:
20 one touch: sign, then sign again in the same, still open context
(does one match let the enclave do more than one operation?)
21 one touch: sign, then unseal in the same context
22 no finger: unseal with no context and with an unsatisfied one; both
must be refused, or the access-control list does not cover the decrypt
KUnit: the version 3 INFO and ioctl numbers, secret and seal bounds.
Assisted-by: LLM
Signed-off-by: Ryan Murray <ryan@aurorasilicon.org>
Contributor
Author
|
Hardware, M1 Pro (J316s), 7.3.0-aurora-fidohw1 = fleet59 + this branch, one-shot, no finger, Enforcing, 0 AVC:
|
Contributor
Author
|
Second Mac: Neo (J700, variant-5 key store), same kernel build, one-shot, no finger, Enforcing, 0 AVC: INFO v3 / features 0x3; SEAL refuses a non-biometric key; self-tests 1-4 refused (-8); self-test 22 UNSEAL with no / unsatisfied context refused (-8); biometry-current-set SIGN with no context refused. Identical to the M1 Pro. |
…he decrypt ACL The sep-key character device ran every ioctl under the shim's device lock. A touch-gated SIGN or UNSEAL sleeps in its ioctl for up to a minute waiting for a finger, so SEP_KEY_CANCEL from another file (and even a second open()) waited for that minute to end and never cancelled anything; every other /dev/sep-key caller stalled with it. Register /dev/sep-key with a concurrent mode of the shim: its ioctls run without the device lock, under a read hold of a lifetime rwsem that unregister takes for writing, so the context stays valid for a running ioctl and none starts after it is cleared. /dev/sep-bio and /dev/sep-bio-rearm keep the serialised mode. In the driver, touch-gated calls already serialise on catacomb_writer and CANCEL only sets a flag; a new key_bag_lock keeps one caller from unloading the identity bag under another caller's create, sign or decrypt. UNSEAL was refused by the enclave (status -8) even after a satisfied match: the biometric key's access-control list named sign, key agreement, derivation, attest and delete, but no entry for the ECIES decrypt, and the pre-match constraint evaluation always named the sign operation. Constrain the decrypt operation (UNSEAL_ACL_OP) with the same biometric credential and evaluate the constraint for the operation the job runs. Self-test 23 (no finger, key_selftest=1 only) makes throwaway keys whose lists leave one candidate operation free and unseals with no context, to show on hardware which list entry governs the decrypt. KUnit: apple_sep_bio_shim checks that a cancel from a second file reaches the driver while an ioctl sleeps, and that unregister waits for a running ioctl and later ioctls get -ENODEV. Assisted-by: LLM
…and context Self-test 24 makes five throwaway keys (no list, oecd free, no decrypt entry free, ock free, the plain list ock/odel/osgn/oa/okd) and runs a signature, a decrypt and a key exchange on each with no context, an unsatisfied context and a key-bag-secret context, logging every enclave status. It tells which entry governs the decrypt SEP_KEY_UNSEAL uses and whether a list-bearing key needs a credential context at all. Assisted-by: LLM Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…sep-key-v3 # Conflicts: # drivers/soc/apple/key.rs # include/uapi/linux/apple-sep.h
The enclave refuses its ECIES decrypt (oecd) for every ref-key that carries an access-control list, even when the list leaves oecd free; it decrypts only for keys with no list (self-test 24 on the M1 Pro: sign works with no or an unsatisfied context on every listed key, oecd only on the unlisted one). A biometric key's secret therefore never came back. Do what macOS does for Secure Enclave keys: the enclave computes the ECDH shared X of the blob's ephemeral point and the key (op ock, peer point under 'pub'), which the biometric list already constrains exactly as macOS writes it, and the kernel runs the X9.63 KDF and AES-256-GCM decrypt. The list goes back to macOS's shape (no oecd entry), the pre-match constraint check names ock for an unseal, and self-test 23 is replaced by self-test 24's rows for oecd, ock (no, unsatisfied and key-bag-secret contexts) and the SEP_KEY_UNSEAL path itself. KUnit apple_sep_ecies_open checks the open path with the generator as the recipient (the shared X is then the ephemeral's own X). Assisted-by: LLM Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Author
|
a7968d3: merged integration/aurora (per-user key bag), UNSEAL now uses the enclave key exchange.
|
RyanTheTide
marked this pull request as ready for review
November 11, 2026 09:32
This was referenced Nov 11, 2026
Merged
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.
/dev/sep-key interface version 3.
SEP_KEY_CANCELends a touch-gatedSIGN/UNSEALthat is waiting for a finger; that call returnsECANCELED. The verify and capture loops stop as soon as the flag is set.SEP_KEY_SEALencrypts up to 64 bytes to a biometric key's public point (the ECIES scheme the trusted-key source uses; no private key, no touch).SEP_KEY_UNSEALhas the enclave decrypt (opoecd) such a blob with the key under the same fresh, touch-satisfied credential context aSIGNuses, opened, matched and deleted inside the one call. Both refuse keys without a biometric policy.INFO.reservedbecomesfeatures(SEP_KEY_FEATURE_CANCEL,SEP_KEY_FEATURE_SEAL).Userspace: aurora-sep-userspace
fido/uses UNSEAL for FIDO hmac-secret (CredRandom released only after a match) and CANCEL for client cancels and timeouts.Tests