Skip to content

Commit 4536a6e

Browse files
labbottLaura Abbott
and
Laura Abbott
authored
Allow for more RoT/SP image variants in the TUF repo (#6867)
It's useful to be able to package extra images for other use cases (e.g. manufacturing) in the same TUF repo. Allow this by making a few adjustments - Require all SP images to have a unique `name` instead of a unique `board`. We will still select by `board` via wicketd meaning the actual runtime behavior should still be the same. - Add an extra check for the RoT to make sure the board name in the caboose matches the image selection at run time. This lets us package an `oxide-rot-1` and `oxide-rot-1-selfsigned` signed with the same keys in the same repository. We only allow one board name per signing key. - The RoT bootloader does not need this type of flexibility so ensure we only allow one entry per signing key. The same restrictions for versions still apply. Co-authored-by: Laura Abbott <[email protected]>
1 parent 9d2bc78 commit 4536a6e

File tree

4 files changed

+559
-104
lines changed

4 files changed

+559
-104
lines changed

tufaceous-lib/src/assemble/manifest.rs

Lines changed: 13 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -93,12 +93,9 @@ impl ArtifactManifest {
9393
ArtifactSource::File(base_dir.join(path))
9494
}
9595
DeserializedArtifactSource::Fake { size } => {
96-
let fake_data = FakeDataAttributes::new(
97-
&data.name,
98-
kind,
99-
&data.version,
100-
)
101-
.make_data(size as usize);
96+
let fake_data =
97+
FakeDataAttributes::new(kind, &data.version)
98+
.make_data(size as usize);
10299
ArtifactSource::Memory(fake_data.into())
103100
}
104101
DeserializedArtifactSource::CompositeHost {
@@ -128,19 +125,11 @@ impl ArtifactManifest {
128125
mtime_source,
129126
)?;
130127
phase_1.with_entry(
131-
FakeDataAttributes::new(
132-
"fake-phase-1",
133-
kind,
134-
&data.version,
135-
),
128+
FakeDataAttributes::new(kind, &data.version),
136129
|entry| builder.append_phase_1(entry),
137130
)?;
138131
phase_2.with_entry(
139-
FakeDataAttributes::new(
140-
"fake-phase-2",
141-
kind,
142-
&data.version,
143-
),
132+
FakeDataAttributes::new(kind, &data.version),
144133
|entry| builder.append_phase_2(entry),
145134
)?;
146135
ArtifactSource::Memory(builder.finish()?.into())
@@ -173,19 +162,11 @@ impl ArtifactManifest {
173162
mtime_source,
174163
)?;
175164
archive_a.with_entry(
176-
FakeDataAttributes::new(
177-
"fake-rot-archive-a",
178-
kind,
179-
&data.version,
180-
),
165+
FakeDataAttributes::new(kind, &data.version),
181166
|entry| builder.append_archive_a(entry),
182167
)?;
183168
archive_b.with_entry(
184-
FakeDataAttributes::new(
185-
"fake-rot-archive-b",
186-
kind,
187-
&data.version,
188-
),
169+
FakeDataAttributes::new(kind, &data.version),
189170
|entry| builder.append_archive_b(entry),
190171
)?;
191172
ArtifactSource::Memory(builder.finish()?.into())
@@ -261,18 +242,13 @@ impl ArtifactManifest {
261242

262243
#[derive(Debug)]
263244
struct FakeDataAttributes<'a> {
264-
name: &'a str,
265245
kind: KnownArtifactKind,
266246
version: &'a SemverVersion,
267247
}
268248

269249
impl<'a> FakeDataAttributes<'a> {
270-
fn new(
271-
name: &'a str,
272-
kind: KnownArtifactKind,
273-
version: &'a SemverVersion,
274-
) -> Self {
275-
Self { name, kind, version }
250+
fn new(kind: KnownArtifactKind, version: &'a SemverVersion) -> Self {
251+
Self { kind, version }
276252
}
277253

278254
fn make_data(&self, size: usize) -> Vec<u8> {
@@ -298,12 +274,14 @@ impl<'a> FakeDataAttributes<'a> {
298274
};
299275

300276
// For our purposes sign = board represents what we want for the RoT
301-
// and we don't care about the SP at this point
277+
// and we don't care about the sign value for the SP
278+
// We now have an assumption that board == name for our production
279+
// images
302280
let caboose = CabooseBuilder::default()
303281
.git_commit("this-is-fake-data")
304282
.board(board)
305283
.version(self.version.to_string())
306-
.name(self.name)
284+
.name(board)
307285
.sign(board)
308286
.build();
309287

0 commit comments

Comments
 (0)