Skip to content

Commit 33bb79b

Browse files
committed
Implement epoch-based rollback protection in LPC55 update_server
1 parent 26ccf19 commit 33bb79b

File tree

10 files changed

+519
-85
lines changed

10 files changed

+519
-85
lines changed

Cargo.lock

+283-23
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

+6-2
Original file line numberDiff line numberDiff line change
@@ -117,11 +117,15 @@ zip = { version = "0.6", default-features = false, features = ["bzip2"] }
117117
# Oxide forks and repos
118118
attest-data = { git = "https://github.com/oxidecomputer/dice-util", default-features = false, version = "0.1.0" }
119119
dice-mfg-msgs = { git = "https://github.com/oxidecomputer/dice-util", default-features = false, version = "0.2.1" }
120-
gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["smoltcp"] }
120+
#gateway-messages = { git = "https://github.com/oxidecomputer/management-gateway-service", default-features = false, features = ["smoltcp"] }
121+
# XXX fix before push
122+
gateway-messages = { path = "/home/stoltz/Oxide/src/mgs/epoch/gateway-messages", default-features = false, features = ["smoltcp"] }
121123
gimlet-inspector-protocol = { git = "https://github.com/oxidecomputer/gimlet-inspector-protocol", version = "0.1.0" }
122124
hif = { git = "https://github.com/oxidecomputer/hif", default-features = false }
123125
humpty = { git = "https://github.com/oxidecomputer/humpty", default-features = false, version = "0.1.3" }
124-
hubtools = { git = "https://github.com/oxidecomputer/hubtools", default-features = false, version = "0.4.1" }
126+
#hubtools = { git = "https://github.com/oxidecomputer/hubtools", default-features = false, version = "0.4.1" }
127+
# XXX fix before push
128+
hubtools = { git = "https://github.com/oxidecomputer/hubtools", default-features = false, branch = "epoch", version = "0.4.7" }
125129
idol = { git = "https://github.com/oxidecomputer/idolatry.git", default-features = false }
126130
idol-runtime = { git = "https://github.com/oxidecomputer/idolatry.git", default-features = false }
127131
lpc55_sign = { git = "https://github.com/oxidecomputer/lpc55_support", default-features = false }

app/gimlet/base.toml

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ chip = "../../chips/stm32h7"
33
memory = "memory-large.toml"
44
stacksize = 896
55
fwid = true
6+
epoch = 0
67

78
[kernel]
89
name = "gimlet"

app/lpc55xpresso/app.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ start = true
4848
[tasks.update_server]
4949
name = "lpc55-update-server"
5050
priority = 3
51-
max-sizes = {flash = 27008, ram = 16704}
51+
max-sizes = {flash = 30368, ram = 16704}
5252
stacksize = 8192
5353
start = true
5454
sections = {bootstate = "usbsram"}

app/oxide-rot-1/app-dev.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ start = true
4949
[tasks.update_server]
5050
name = "lpc55-update-server"
5151
priority = 3
52-
max-sizes = {flash = 27904, ram = 17344, usbsram = 4096}
52+
max-sizes = {flash = 30368, ram = 17344, usbsram = 4096}
5353
# TODO: Size this appropriately
5454
stacksize = 8192
5555
start = true

build/xtask/src/dist.rs

+7-2
Original file line numberDiff line numberDiff line change
@@ -611,7 +611,7 @@ pub fn package(
611611
// The Git hash is included in the default caboose under the key
612612
// `GITC`, so we don't include it in the pseudo-version.
613613
archive
614-
.write_default_caboose(None)
614+
.write_default_caboose(None, None)
615615
.context("writing caboose into archive")?;
616616
archive.overwrite().context("overwriting archive")?;
617617
}
@@ -621,8 +621,13 @@ pub fn package(
621621
if let Some(signing) = &cfg.toml.signing {
622622
let mut archive = hubtools::RawHubrisArchive::load(&archive_name)
623623
.context("loading archive with hubtools")?;
624+
let priv_key_rel_path = signing
625+
.certs
626+
.private_key
627+
.clone()
628+
.context("missing private key path")?;
624629
let private_key = lpc55_sign::cert::read_rsa_private_key(
625-
&cfg.app_src_dir.join(&signing.certs.private_key),
630+
&cfg.app_src_dir.join(priv_key_rel_path),
626631
)
627632
.with_context(|| {
628633
format!(

drv/lpc55-update-api/src/lib.rs

+10
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,16 @@ impl From<RotSlot> for SlotId {
242242
}
243243
}
244244

245+
impl SlotId {
246+
pub fn other(&self) -> SlotId {
247+
if *self == SlotId::A {
248+
SlotId::B
249+
} else {
250+
SlotId::A
251+
}
252+
}
253+
}
254+
245255
impl TryFrom<u16> for SlotId {
246256
type Error = ();
247257
fn try_from(i: u16) -> Result<Self, Self::Error> {

0 commit comments

Comments
 (0)