MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / decode

Method decode

cc-eventlog/src/tcg.rs:266–278  ·  view source on GitHub ↗
(input: &mut I)

Source from the content-addressed store, hash-verified

264
265impl scale::Decode for TcgDigest {
266 fn decode<I: scale::Input>(input: &mut I) -> Result<Self, scale::Error> {
267 let algo_id = u16::decode(input)?;
268 let digest_size =
269 alg_id_to_digest_size(algo_id).ok_or(scale::Error::from("Unsupported algorithm ID"))?;
270 let mut digest_data = vec![0; digest_size as usize];
271 input
272 .read(&mut digest_data)
273 .map_err(|_| scale::Error::from("failed to read digest_data"))?;
274 Ok(TcgDigest {
275 algo_id,
276 hash: digest_data,
277 })
278 }
279}
280
281impl TcgEventLog {

Callers

nothing calls this directly

Calls 3

decodeFunction · 0.85
alg_id_to_digest_sizeFunction · 0.85
parse_spec_id_event_logFunction · 0.85

Tested by

no test coverage detected