Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
e3cc7b4
soc: apple: sep: sketch a password-secret user key bag (design draft)
RyanTheTide Nov 3, 2026
0659286
soc: apple: sep: encode captured user keybag operations
RyanTheTide Nov 4, 2026
8c6f003
soc: apple: sep: add /dev/sep-key for P-256 keys that stay in the SEP
RyanTheTide Nov 8, 2026
c66c75c
Merge integration/aurora into sepkey/sep-key-chardev
RyanTheTide Nov 8, 2026
ed3d647
soc: apple: sep: sep-key: Touch ID keys the enclave guards
RyanTheTide Nov 8, 2026
ac6c191
soc: apple: sep: sep-key: say how long a Touch ID signature waits
RyanTheTide Nov 8, 2026
50ba8b0
soc: apple: sep: sep-key: biometry-any keys; reserve the password pol…
RyanTheTide Nov 8, 2026
e10c42d
Merge branch 'sepkey/sep-key-chardev' into sepkey/userbag-keys
RyanTheTide Nov 8, 2026
c15306a
soc: apple: sep: userbag: serve key-bag ioctls on the re-arm node only
RyanTheTide Nov 8, 2026
55c5101
soc: apple: sep: userbag: log the replies the decoders refuse
RyanTheTide Nov 8, 2026
09752b7
soc: apple: sep: userbag: read DER replies as u32 0, then the dictionary
RyanTheTide Nov 8, 2026
ccdbdc4
soc: apple: sep: sep-key: self-test 7, a credential from another user…
RyanTheTide Nov 8, 2026
ff19f17
soc: apple: sep: sep-key: self-tests 8 and 9, keys under a user's bag
RyanTheTide Nov 8, 2026
1b83c8d
soc: apple: sep: sep-key: self-test 10, a locked user bag and its keys
RyanTheTide Nov 8, 2026
05df83b
soc: apple: sep: userbag: log the timer-fire answer the lock path ref…
RyanTheTide Nov 8, 2026
cc1836d
soc: apple: sep: userbag: read the grace-timer answer as the Neo give…
RyanTheTide Nov 8, 2026
9f5684c
soc: apple: sep: userbag: the grace-timer answer's last word is a cou…
RyanTheTide Nov 8, 2026
0ed09e8
soc: apple: sep: userbag: export and import a user's wrapped bag
RyanTheTide Nov 8, 2026
01cb48c
Merge branch 'integration/aurora' of https://github.com/aurora-silico…
RyanTheTide Nov 8, 2026
deedb0c
soc: apple: sep: userbag: move the key-bag ioctls to 0x30-0x36
RyanTheTide Nov 8, 2026
c6f8b8c
Merge branch 'sepkey/sep-key-chardev' of https://github.com/aurora-si…
RyanTheTide Nov 8, 2026
6177e64
soc: apple: sep: carry wrapped user bags up to 4 KiB
RyanTheTide Nov 9, 2026
cb12edf
soc: apple: sep: userbag: lock at once on logout and suspend
RyanTheTide Nov 10, 2026
5816d7d
Revert "soc: apple: sep: userbag: lock at once on logout and suspend"
RyanTheTide Nov 10, 2026
34ac189
soc: apple: sep: make explicit userbag locks immediate
RyanTheTide Nov 10, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions drivers/soc/apple/der.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ use kernel::prelude::*;
const TAG_SET: u8 = 0x31;
const TAG_SEQUENCE: u8 = 0x30;
const TAG_UTF8: u8 = 0x0c;
const TAG_BOOLEAN: u8 = 0x01;
pub(crate) const TAG_INTEGER: u8 = 0x02;
pub(crate) const TAG_OCTET_STRING: u8 = 0x04;

Expand Down Expand Up @@ -51,6 +52,8 @@ pub(crate) enum RefKeyValue<'a> {
Integer(u32),
Octets(&'a [u8]),
Der(&'a [u8]),
/// BOOLEAN, encoded as the key store writes it (true = 0x01).
Bool(bool),
}

/// Canonical DER `SET OF SEQUENCE`, members sorted by key — the shape the
Expand Down Expand Up @@ -85,6 +88,10 @@ pub(crate) fn encode_refkey_set(items: &[(&[u8], RefKeyValue<'_>)]) -> Result<KV
inner.extend_from_slice(b, GFP_KERNEL)?;
}
RefKeyValue::Der(d) => inner.extend_from_slice(d, GFP_KERNEL)?,
RefKeyValue::Bool(b) => {
put_header(&mut inner, TAG_BOOLEAN, 1)?;
inner.push(u8::from(*b), GFP_KERNEL)?;
}
}
let mut seq = KVec::new();
put_header(&mut seq, TAG_SEQUENCE, inner.len())?;
Expand Down Expand Up @@ -158,3 +165,29 @@ pub(crate) fn octet_string_body(tlv: &[u8]) -> Option<&[u8]> {
_ => None,
}
}

fn integer_value(tlv: &[u8]) -> Option<i64> {
let body = match take_tlv(tlv) {
Some((TAG_INTEGER, body, [])) if !body.is_empty() && body.len() <= 5 => body,
_ => return None,
};
// DER integers are minimal, signed, big-endian values.
if body.len() > 1
&& ((body[0] == 0 && body[1] & 0x80 == 0) || (body[0] == 0xff && body[1] & 0x80 != 0))
{
return None;
}
let mut value = if body[0] & 0x80 != 0 { -1i64 } else { 0 };
for byte in body {
value = (value << 8) | i64::from(*byte);
}
Some(value)
}

pub(crate) fn integer_u32(tlv: &[u8]) -> Option<u32> {
u32::try_from(integer_value(tlv)?).ok()
}

pub(crate) fn integer_i32(tlv: &[u8]) -> Option<i32> {
i32::try_from(integer_value(tlv)?).ok()
}
Loading
Loading