mirror of
https://github.com/matter-labs/teepot.git
synced 2025-07-21 15:13:56 +02:00
refactor: replace custom Quote parsing with library version
- Removed custom `Quote` structure and parsing logic in `teepot/src/sgx/mod.rs`. - Updated references to use the library-provided `Quote` methods, such as `Quote::parse` and `get_report_data`. - Simplified code and reduced redundancy by leveraging existing library functionality.
This commit is contained in:
parent
9bd0e9c36e
commit
2118466a8a
2 changed files with 4 additions and 79 deletions
|
@ -31,7 +31,7 @@ pub use teepot::quote::{
|
|||
tcblevel::{parse_tcb_levels, EnumSet, TcbLevel},
|
||||
verify_quote_with_collateral, QuoteVerificationResult,
|
||||
};
|
||||
use teepot::{quote::Report, sgx::Quote};
|
||||
use teepot::quote::{Quote, Report};
|
||||
use tracing::{debug, error, info, trace, warn};
|
||||
use x509_cert::{
|
||||
der::{Decode as _, Encode as _},
|
||||
|
@ -174,17 +174,17 @@ impl TeeConnection {
|
|||
debug!("Failed to get collateral in certificate");
|
||||
}
|
||||
|
||||
let quote = Quote::try_from_bytes(quote_bytes).map_err(|e| {
|
||||
let quote = Quote::parse(quote_bytes).map_err(|e| {
|
||||
Error::General(format!("Failed get quote in certificate {e:?}"))
|
||||
})?;
|
||||
|
||||
if "e.report_body.reportdata[..32] != hash.as_slice() {
|
||||
if "e.get_report_data()[..32] != hash.as_slice() {
|
||||
error!("Report data mismatch");
|
||||
return Err(Error::General("Report data mismatch".to_string()));
|
||||
} else {
|
||||
info!(
|
||||
"Report data matches `{}`",
|
||||
hex::encode("e.report_body.reportdata[..32])
|
||||
hex::encode("e.get_report_data()[..32])
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue