Merge pull request #737 from betrusted-io/sec-ci

More fixes for security CI environment
This commit is contained in:
bunnie 2025-11-22 13:50:39 +08:00 committed by GitHub
commit 04031a2315
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 14 additions and 6 deletions

View file

@ -79,6 +79,7 @@ dabao-selftest = [
]
ci-security = []
spim-tests = []
redteam = ["bao1x-hal/redteam"]
verilator-only = []
default = ["bao1x-usb", "ci-security"]
default = ["bao1x-usb"]

View file

@ -99,6 +99,9 @@ pub fn early_init() {
bao1x_hal::board::setup_kb_pins(&iox);
bao1x_hal::board::setup_oled_power_pin(&iox);
bao1x_hal::board::setup_trng_power_pin(&iox);
// make sure SE0 is cleared
let (port, pin) = bao1x_hal::board::setup_usb_pins(&iox);
iox.set_gpio_pin(port, pin, IoxValue::High);
}
#[cfg(feature = "board-dabao")]
{

View file

@ -60,10 +60,13 @@ pub fn get_descriptor_request(this: &mut CorigineUsb, value: u16, _index: usize,
ep0_buf[..4].copy_from_slice(&[4, USB_DT_STRING, 9, 4]);
4
} else {
let owc = bao1x_hal::acram::OneWayCounter::new();
let slot_mgr = bao1x_hal::acram::SlotManager::new();
let sn = bao1x_hal::usb::derive_usb_serial_number(&owc, &slot_mgr);
let s = match id {
1 => MANUFACTURER,
2 => PRODUCT,
_ => SERIAL,
_ => &sn,
};
let slen = 2 + s.len() * 2;
ep0_buf[0] = slen as u8;

View file

@ -132,9 +132,10 @@ struct DeviceDescriptor {
const VENDOR_ID: u16 = 0x1209;
const PRODUCT_ID: u16 = 0x3613; // this needs to change! this is the Precursor product ID.
const MANUFACTURER: &'static str = "Baochip";
const PRODUCT: &'static str = "Dabao";
// no seriously, do this
const SERIAL: &'static str = "TODO";
#[cfg(feature = "board-baosec")]
const PRODUCT: &'static str = "Baosec-Baremetal";
#[cfg(not(feature = "board-baosec"))]
const PRODUCT: &'static str = "Dabao-Baremetal";
impl DeviceDescriptor {
pub fn default_usb_acm() -> Self {

View file

@ -697,7 +697,7 @@ fn main() -> Result<(), Box<dyn std::error::Error>> {
(bao1x_api::LOADER_START + sigblock_size + STATICS_LEN) as u32,
)?;
builder.add_loader_feature("alt-boot1");
builder.add_loader_feature("force-dabao");
// builder.add_loader_feature("force-dabao");
builder
.set_baremetal(true)
.target_baremetal_bao1x("bao1x-alt-boot1")