From a840beb98ef7820dc4c2d7d770ba5ae24084db2a Mon Sep 17 00:00:00 2001 From: bunnie Date: Tue, 3 Feb 2026 18:33:33 +0800 Subject: [PATCH] loosen check on key tag The original check on public key tag was "if the tag doesn't match one of four approved tags erase secrets". With third party images, third parties can pick their own tags - so as-writ this would constrain third parties to have to use the same tags as baochip, which is too restrictive. Change the check to explicitly trigger erasure if and only if the tag is "dev ". Note there are plenty of other checks around as well so this is not the sole check, thus I think loosening this permission is good for keeping hygiene between third party firmwwares and baochips own firmwares. --- libs/bao1x-hal/src/sigcheck.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/libs/bao1x-hal/src/sigcheck.rs b/libs/bao1x-hal/src/sigcheck.rs index 5f8599aa5..3f26fe778 100644 --- a/libs/bao1x-hal/src/sigcheck.rs +++ b/libs/bao1x-hal/src/sigcheck.rs @@ -5,7 +5,6 @@ use alloc::vec::Vec; use bao1x_api::REVOCATION_DUPE_DISTANCE; use bao1x_api::bollard; use bao1x_api::pubkeys::DEVELOPER_KEY_SLOT; -use bao1x_api::pubkeys::KEYSLOT_INITIAL_TAGS; use bao1x_api::pubkeys::SecurityConfiguration; use bao1x_api::signatures::*; #[cfg(not(feature = "std"))] @@ -485,9 +484,8 @@ pub fn hardened_erase_policy( } bollard!(die_no_std, 4); csprng.random_delay(); - // if the tag isn't one of the first 3 "blessed" tags, assume developer mode. This is - // a supplemental check, so we don't harden it. - if !KEYSLOT_INITIAL_TAGS[..3].contains(&&tag) { + // if the tag is the developer tag, erase the keys. + if &tag == b"dev " { erase_secrets(&mut Some(csprng))?; } bollard!(die_no_std, 4); @@ -515,9 +513,8 @@ pub fn hardened_erase_policy( } bollard!(die_no_std, 4); csprng.random_delay(); - // if the tag isn't one of the first 3 "blessed" tags, assume developer mode. This is - // a supplemental check, so we don't harden it. - if !KEYSLOT_INITIAL_TAGS[..3].contains(&&tag) { + // if the tag is the developer tag, erase the keys. + if &tag == b"dev " { erase_secrets(&mut Some(csprng))?; } bollard!(die_no_std, 4);