Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding to_bytes and from_bytes for AttestationReport
Serde serializes and deserializes enums by manually appending 4 tag bytes at the start and end of the byte stream it generates. This causes issues when deserializing reports that are raw bytes and results in reports that are offset by 4 bytes. Since some users might implement their own methods for handling reports, we want to ensure that, regardless of the enum interface, they always receive the raw bytes of the attestation report when serializing/deserializing. By implementing manual serialization, we bypassed the 4-byte tag issue. However, we couldn't find a reliable method to deserialize raw bytes directly into an enum. Instead, we recommend using TryFrom<&[u8]>. To simplify this, we added two helper functions, to_bytes and from_bytes, making the process more straightforward and user-friendly. Recommendation: Use these helper functions instead of Serde’s serialize and deserialize when working with the enum. Raw report structures work fine. Signed-off-by: DGonzalezVillal <[email protected]>
- Loading branch information