@@ -4,17 +4,20 @@ use anyhow::bail;
44
55#[ derive( Clone , Debug ) ]
66pub struct QuoteV4 {
7- pub header : QuoteHeader , // [48 bytes]
8- // Header of Quote data structure.
9- // This field is transparent (the user knows its internal structure).
10- // Rest of the Quote data structure can be treated as opaque (hidden from the user).
11- pub quote_body : QuoteBody , // May either contain a SGX Enclave Report (384 bytes) or TD10 Report (584 bytes)
12- pub signature_len : u32 , // [4 bytes]
13- // Size of the Quote Signature Data structure in bytes.
14- pub signature : QuoteSignatureDataV4 , // [variable bytes]
7+ /// Header of Quote data structure.
8+ /// This field is transparent (the user knows its internal structure).
9+ /// Rest of the Quote data structure can be treated as opaque (hidden from the user).
10+ pub header : QuoteHeader ,
11+ /// May either contain a SGX Enclave Report (384 bytes) or TD10 Report (584 bytes)
12+ pub quote_body : QuoteBody ,
13+ /// Size of the Quote Signature Data structure in bytes.
14+ pub signature_len : u32 ,
15+ /// Quote Signature Data
16+ pub signature : QuoteSignatureDataV4 ,
1517}
1618
1719impl QuoteV4 {
20+ /// Parse a byte slice into a `QuoteV4` structure.
1821 pub fn from_bytes ( raw_bytes : & [ u8 ] ) -> Result < Self > {
1922 let header = QuoteHeader :: from_bytes ( & raw_bytes[ 0 ..48 ] ) ;
2023 let quote_body;
@@ -55,17 +58,17 @@ impl QuoteV4 {
5558
5659#[ derive( Clone , Debug ) ]
5760pub struct QuoteSignatureDataV4 {
58- pub quote_signature : [ u8 ; 64 ] , // [64 bytes]
59- // ECDSA signature, the r component followed by the s component, 2 x 32 bytes.
60- // Public part of the Attestation Key generated by the Quoting Enclave.
61- pub ecdsa_attestation_key : [ u8 ; 64 ] , // [64 bytes]
62- // EC KT-I Public Key, the x-coordinate followed by the y-coordinate (on the RFC 6090 P-256 curve), 2 x 32 bytes.
63- // Public part of the Attestation Key generated by the Quoting Enclave.
64- pub qe_cert_data : CertData , // [variable bytes]
65- // QE Cert Data
61+ /// ECDSA signature, the r component followed by the s component, 2 x 32 bytes.
62+ pub quote_signature : [ u8 ; 64 ] ,
63+ /// Public part of the Attestation Key generated by the Quoting Enclave.
64+ /// EC KT-I Public Key, the x-coordinate followed by the y-coordinate (on the RFC 6090 P-256 curve), 2 x 32 bytes.
65+ pub ecdsa_attestation_key : [ u8 ; 64 ] ,
66+ /// QE Cert Data
67+ pub qe_cert_data : CertData ,
6668}
6769
6870impl QuoteSignatureDataV4 {
71+ /// Parse a byte slice into a `QuoteSignatureDataV4` structure.
6972 pub fn from_bytes ( raw_bytes : & [ u8 ] ) -> Self {
7073 let mut quote_signature = [ 0 ; 64 ] ;
7174 quote_signature. copy_from_slice ( & raw_bytes[ 0 ..64 ] ) ;
0 commit comments