diff --git a/.devcontainer/Dockerfile b/.devcontainer/Dockerfile index 119333d8..1ebb2dcf 100644 --- a/.devcontainer/Dockerfile +++ b/.devcontainer/Dockerfile @@ -49,4 +49,6 @@ USER $USERNAME RUN wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh || true # Install rust -RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y \ No newline at end of file +RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + +RUN echo "[ -f /opt/intel/sgxsdk/environment ] && . /opt/intel/sgxsdk/environment" >> ~/.zshenv \ No newline at end of file diff --git a/dcap/types/src/quote3.rs b/dcap/types/src/quote3.rs index e76be14c..45b2749a 100644 --- a/dcap/types/src/quote3.rs +++ b/dcap/types/src/quote3.rs @@ -319,6 +319,18 @@ impl<'de> Deserialize<'de> for Quote3<&'de [u8]> { } } +#[cfg(feature = "alloc")] +impl<'de> Deserialize<'de> for Quote3> { + fn deserialize(deserializer: D) -> core::result::Result + where + D: Deserializer<'de>, + { + deserializer + .deserialize_bytes(Quote3Visitor) + .map(|q| q.into()) + } +} + /// Signature Data #[derive(Clone, Debug, Eq, PartialEq)] pub struct SignatureData<'a> { @@ -1144,4 +1156,17 @@ mod test { assert_eq!(quote, new_quote); } + + #[cfg(feature = "alloc")] + #[test] + fn quote_vec_version_can_be_serialized_and_deserialized() { + let hw_quote = include_bytes!("../data/tests/hw_quote.dat").to_vec(); + let quote = Quote3::try_from(hw_quote).expect("Failed to parse quote"); + + let bytes = serde_cbor::to_vec("e).expect("Failed to serialize quote"); + let new_quote: Quote3> = + serde_cbor::from_slice(&bytes).expect("Failed to deserialize qutoe"); + + assert_eq!(quote, new_quote); + } }