[dice] Create libdiced_open_dice[_nostd] to reuse dice in nostd
Test: atest diced_utils_test diced_sample_inputs_test \
diced_test diced_vendor_test
Bug: 267575445
Change-Id: I3cf1b818938a6b1496657f9391424f2a351148fe
diff --git a/diced/src/utils.rs b/diced/src/utils.rs
index da39f8f..05702ad 100644
--- a/diced/src/utils.rs
+++ b/diced/src/utils.rs
@@ -19,7 +19,7 @@
Mode::Mode as BinderMode,
};
use anyhow::{Context, Result};
-use dice::{ContextImpl, DiceMode};
+use dice::{ContextImpl, DiceMode, Hash, Hidden};
use diced_open_dice_cbor as dice;
use keystore2_crypto::ZVec;
use std::convert::TryInto;
@@ -47,7 +47,7 @@
}
impl dice::InputValues for InputValues<'_> {
- fn code_hash(&self) -> &[u8; dice::HASH_SIZE] {
+ fn code_hash(&self) -> &Hash {
&self.0.codeHash
}
@@ -55,7 +55,7 @@
dice::Config::Descriptor(self.0.config.desc.as_slice())
}
- fn authority_hash(&self) -> &[u8; dice::HASH_SIZE] {
+ fn authority_hash(&self) -> &Hash {
&self.0.authorityHash
}
@@ -73,7 +73,7 @@
}
}
- fn hidden(&self) -> &[u8; dice::HIDDEN_SIZE] {
+ fn hidden(&self) -> &Hidden {
// If `self` was created using try_from the length was checked and this cannot panic.
&self.0.hidden
}