Skip to content

Commit 77048b4

Browse files
authored
api/rust: align api interface of event logs replay (#116)
Signed-off-by: Xiaocheng Dong <[email protected]>
1 parent fe5bfea commit 77048b4

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

common/rust/cctrusted_base/src/api.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use crate::api_data::Algorithm;
22
use crate::api_data::*;
3+
use crate::eventlog::EventLogs;
34
use crate::tcg::EventLogEntry;
45
use crate::tcg::TcgDigest;
56
use core::result::Result;
@@ -120,7 +121,9 @@ pub trait CCTrustedApi {
120121
*/
121122
fn replay_cc_eventlog(
122123
eventlogs: Vec<EventLogEntry>,
123-
) -> Result<Vec<ReplayResult>, anyhow::Error>;
124+
) -> Result<Vec<ReplayResult>, anyhow::Error> {
125+
EventLogs::replay(eventlogs)
126+
}
124127
}
125128

126129
/***

common/rust/cctrusted_base/src/eventlog.rs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -509,10 +509,7 @@ impl EventLogs {
509509
1: { 12: <measurement_replayed>},
510510
]
511511
*/
512-
pub fn replay(
513-
eventlogs: Vec<EventLogEntry>,
514-
imr_idx_max: u32,
515-
) -> Result<Vec<ReplayResult>, anyhow::Error> {
512+
pub fn replay(eventlogs: Vec<EventLogEntry>) -> Result<Vec<ReplayResult>, anyhow::Error> {
516513
let mut replay_results: Vec<ReplayResult> = Vec::new();
517514

518515
for event_log in eventlogs {
@@ -522,9 +519,6 @@ impl EventLogs {
522519
continue;
523520
}
524521
let imr_index = tcg_imr_event.imr_index;
525-
if imr_index > imr_idx_max {
526-
return Err(anyhow!("imr_index {} out of range", imr_index));
527-
}
528522
for digest in tcg_imr_event.digests {
529523
let algo_id = digest.algo_id;
530524
let hash = digest.hash;

0 commit comments

Comments
 (0)