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.
This commit is contained in:
bunnie 2026-02-03 18:33:33 +08:00
parent 33b35fb054
commit a840beb98e
No known key found for this signature in database

View file

@ -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);