Skip to content

Commit 7c28604

Browse files
committed
Rename 'unhashed' data tile to 'auxiliary'
1 parent 81b9085 commit 7c28604

File tree

4 files changed

+51
-48
lines changed

4 files changed

+51
-48
lines changed

crates/generic_log_worker/src/ctlog.rs

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -420,19 +420,19 @@ impl SequenceState {
420420
},
421421
);
422422

423-
// Fetch and store the right-most unhashed tile, if configured.
424-
if let Some(path_elem) = L::Pending::UNHASHED_TILE_PATH {
425-
let unhashed_tile = level0_tile.with_data_path(path_elem);
426-
let unhashed_tile_bytes = object
427-
.fetch(&unhashed_tile.path())
423+
// Fetch and store the right-most auxiliary tile, if configured.
424+
if let Some(path_elem) = L::Pending::AUX_TILE_PATH {
425+
let aux_tile = level0_tile.with_data_path(path_elem);
426+
let aux_tile_bytes = object
427+
.fetch(&aux_tile.path())
428428
.await?
429-
.ok_or(anyhow!("no unhashed tile in object storage"))?;
429+
.ok_or(anyhow!("no auxiliary tile in object storage"))?;
430430

431431
edge_tiles.insert(
432432
UNHASHED_TILE_LEVEL_KEY,
433433
TileWithBytes {
434-
tile: unhashed_tile,
435-
b: unhashed_tile_bytes,
434+
tile: aux_tile,
435+
b: aux_tile_bytes,
436436
},
437437
);
438438
}
@@ -636,12 +636,12 @@ async fn sequence_entries<L: LogEntry>(
636636
}
637637
}
638638

639-
// Load the current partial unhashed tile, if configured.
640-
let mut unhashed_tile = Vec::new();
641-
if L::Pending::UNHASHED_TILE_PATH.is_some() {
639+
// Load the current partial auxiliary tile, if configured.
640+
let mut aux_tile = Vec::new();
641+
if L::Pending::AUX_TILE_PATH.is_some() {
642642
if let Some(t) = edge_tiles.get(&UNHASHED_TILE_LEVEL_KEY) {
643643
if t.tile.width() < TlogTile::FULL_WIDTH {
644-
unhashed_tile.clone_from(&t.b);
644+
aux_tile.clone_from(&t.b);
645645
}
646646
}
647647
}
@@ -657,9 +657,9 @@ async fn sequence_entries<L: LogEntry>(
657657
cache_metadata.push((entry.lookup_key(), metadata));
658658
sequenced_metadata.push((sender, metadata));
659659

660-
// Write to the unhashed tile, if configured.
661-
if L::Pending::UNHASHED_TILE_PATH.is_some() {
662-
unhashed_tile.extend(entry.unhashed_entry());
660+
// Write to the auxiliary tile, if configured.
661+
if L::Pending::AUX_TILE_PATH.is_some() {
662+
aux_tile.extend(entry.aux_entry());
663663
}
664664

665665
let sequenced_entry = L::new(entry, metadata);
@@ -702,7 +702,7 @@ async fn sequence_entries<L: LogEntry>(
702702
&mut edge_tiles,
703703
&mut tile_uploads,
704704
std::mem::take(&mut data_tile),
705-
std::mem::take(&mut unhashed_tile),
705+
std::mem::take(&mut aux_tile),
706706
);
707707
}
708708
}
@@ -718,7 +718,7 @@ async fn sequence_entries<L: LogEntry>(
718718
&mut edge_tiles,
719719
&mut tile_uploads,
720720
std::mem::take(&mut data_tile),
721-
std::mem::take(&mut unhashed_tile),
721+
std::mem::take(&mut aux_tile),
722722
);
723723
}
724724

@@ -870,14 +870,14 @@ async fn sequence_entries<L: LogEntry>(
870870
Ok(())
871871
}
872872

873-
// Stage a data tile, and if configured an unhashed tile.
873+
// Stage a data tile, and if configured an auxiliary tile.
874874
// This is used as a helper function for [`sequence_entries`].
875875
fn stage_data_tile<L: LogEntry>(
876876
n: u64,
877877
edge_tiles: &mut HashMap<u8, TileWithBytes>,
878878
tile_uploads: &mut Vec<UploadAction>,
879879
data_tile: Vec<u8>,
880-
unhashed_tile: Vec<u8>,
880+
aux_tile: Vec<u8>,
881881
) {
882882
let tile = TlogTile::from_index(tlog_tiles::stored_hash_index(0, n - 1))
883883
.with_data_path(L::Pending::DATA_TILE_PATH);
@@ -893,19 +893,19 @@ fn stage_data_tile<L: LogEntry>(
893893
data: data_tile,
894894
opts: OPTS_DATA_TILE.clone(),
895895
});
896-
if let Some(path_elem) = L::Pending::UNHASHED_TILE_PATH {
896+
if let Some(path_elem) = L::Pending::AUX_TILE_PATH {
897897
let tile =
898898
TlogTile::from_index(tlog_tiles::stored_hash_index(0, n - 1)).with_data_path(path_elem);
899899
edge_tiles.insert(
900900
UNHASHED_TILE_LEVEL_KEY,
901901
TileWithBytes {
902902
tile,
903-
b: unhashed_tile.clone(),
903+
b: aux_tile.clone(),
904904
},
905905
);
906906
tile_uploads.push(UploadAction {
907907
key: tile.path(),
908-
data: unhashed_tile,
908+
data: aux_tile,
909909
opts: OPTS_DATA_TILE.clone(),
910910
});
911911
}

crates/mtc_api/src/lib.rs

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,10 @@ impl PendingLogEntry for MtcPendingLogEntry {
5656
const DATA_TILE_PATH: PathElem = TlogTilesPendingLogEntry::DATA_TILE_PATH;
5757

5858
/// MTC publishes unauthenticated bootstrap data at 'bootstrap'.
59-
const UNHASHED_TILE_PATH: Option<PathElem> = Some(PathElem::Custom("bootstrap"));
59+
const AUX_TILE_PATH: Option<PathElem> = Some(PathElem::Custom("bootstrap"));
6060

6161
/// Returns the serialized bootstrap data.
62-
fn unhashed_entry(&self) -> &[u8] {
62+
fn aux_entry(&self) -> &[u8] {
6363
&self.bootstrap
6464
}
6565

@@ -280,20 +280,22 @@ pub fn validate_chain(
280280
None => return Err(MtcError::EmptyChain),
281281
};
282282

283-
if validity.not_after.to_unix_duration().gt(&leaf
284-
.tbs_certificate
285-
.validity
286-
.not_after
287-
.to_unix_duration())
288-
{
289-
validity.not_after = leaf.tbs_certificate.validity.not_after;
290-
}
291-
292283
// TODO actually validate chain
293-
let _chain = iter
284+
let chain = iter
294285
.map(|x| Certificate::from_der(x))
295286
.collect::<Result<Vec<Certificate>, der::Error>>()?;
296287

288+
for cert in std::iter::once(&leaf).chain(&chain) {
289+
if validity.not_after.to_unix_duration().gt(&cert
290+
.tbs_certificate
291+
.validity
292+
.not_after
293+
.to_unix_duration())
294+
{
295+
validity.not_after = cert.tbs_certificate.validity.not_after;
296+
}
297+
}
298+
297299
let mut bootstrap = Vec::new();
298300
bootstrap.write_length_prefixed(&raw_chain[0], 3)?;
299301
bootstrap.write_length_prefixed(

crates/static_ct_api/src/static_ct.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,12 +163,12 @@ impl PendingLogEntry for StaticCTPendingLogEntry {
163163
/// The data tile path in static-ct-api is 'data'.
164164
const DATA_TILE_PATH: PathElem = PathElem::Data;
165165

166-
/// No unhashed data published in static-ct-api. (Rather, the unhashed
167-
/// `chain_fingerprints` is included in the data tile directly.)
168-
const UNHASHED_TILE_PATH: Option<PathElem> = None;
166+
/// No auxiliary data tile published in static-ct-api. (Rather, the
167+
/// auxiliary `chain_fingerprints` is included in the data tile directly.)
168+
const AUX_TILE_PATH: Option<PathElem> = None;
169169

170170
/// Unused in static-ct-api.
171-
fn unhashed_entry(&self) -> &[u8] {
171+
fn aux_entry(&self) -> &[u8] {
172172
unimplemented!()
173173
}
174174

crates/tlog_tiles/src/entries.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,15 @@ pub trait PendingLogEntry: core::fmt::Debug + Clone + Serialize + DeserializeOwn
2626
/// The path to write data tiles in the object store, which is 'entries' for tlog-tiles.
2727
const DATA_TILE_PATH: PathElem;
2828

29-
/// If configured, the path to write unhashed data associated with the entry
30-
/// to the object store. This is unused in tlog-tiles and static-ct-api, but
31-
/// is used for publishing 'bootstrap' certificiate chains in MTC.
32-
const UNHASHED_TILE_PATH: Option<PathElem>;
29+
/// If configured, the path to write auxiliary data associated with the
30+
/// entry to the object store. This is unused in tlog-tiles and
31+
/// static-ct-api, but is used for publishing 'bootstrap' certificiate
32+
/// chains in MTC.
33+
const AUX_TILE_PATH: Option<PathElem>;
3334

34-
/// Returns the unhashed data for this entry, if configured. It is an error
35-
/// to call this function if `UNHASHED_PATH` is not specified.
36-
fn unhashed_entry(&self) -> &[u8];
35+
/// Returns the auxiliary data for this entry, if configured. It is an error
36+
/// to call this function if [`AUX_TILE_PATH`] is not specified.
37+
fn aux_entry(&self) -> &[u8];
3738

3839
/// The lookup key belonging to this pending log entry.
3940
fn lookup_key(&self) -> LookupKey;
@@ -121,11 +122,11 @@ impl PendingLogEntry for TlogTilesPendingLogEntry {
121122
/// The data tile path in tlog-tiles is 'entries'.
122123
const DATA_TILE_PATH: PathElem = PathElem::Entries;
123124

124-
/// No unhashed data published in tlog-tiles.
125-
const UNHASHED_TILE_PATH: Option<PathElem> = None;
125+
/// No auxiliary data tile published in tlog-tiles.
126+
const AUX_TILE_PATH: Option<PathElem> = None;
126127

127128
/// Unused in tlog-tiles.
128-
fn unhashed_entry(&self) -> &[u8] {
129+
fn aux_entry(&self) -> &[u8] {
129130
unimplemented!()
130131
}
131132

0 commit comments

Comments
 (0)