File tree Expand file tree Collapse file tree 3 files changed +49
-3
lines changed
Expand file tree Collapse file tree 3 files changed +49
-3
lines changed Original file line number Diff line number Diff line change @@ -54,5 +54,10 @@ rcgen = "0.14.5"
5454tempfile = " 3.23.0"
5555
5656[features ]
57- default = [" azure" ]
57+ default = [" azure" , " azure-v6-override" ]
58+
59+ # Adds support for Microsoft Azure attestation generation and verification
5860azure = [" tss-esapi" , " az-tdx-vtpm" ]
61+
62+ # Allows Azure's V6 instance outdated SEAM Loader
63+ azure-v6-override = [" azure" ]
Original file line number Diff line number Diff line change @@ -13,6 +13,9 @@ use x509_parser::prelude::*;
1313
1414use crate :: attestation:: { dcap:: verify_dcap_attestation, measurements:: MultiMeasurements } ;
1515
16+ #[ cfg( feature = "azure-v6-override" ) ]
17+ const AZURE_V6_BAD_FMSPC : & str = "90c06f000000" ;
18+
1619/// The attestation evidence payload that gets sent over the channel
1720#[ derive( Debug , Serialize , Deserialize ) ]
1821struct AttestationDocument {
@@ -245,6 +248,39 @@ impl RsaPubKey {
245248 }
246249}
247250
251+ #[ cfg( feature = "azure-v6-override" ) ]
252+ pub fn azure_v6_override ( collateral : & mut dcap_qvl:: QuoteCollateralV3 ) {
253+ use crate :: attestation:: tcb_info:: TcbInfo ;
254+
255+ let mut tcb_info: TcbInfo = serde_json:: from_str ( & collateral. tcb_info ) . unwrap ( ) ;
256+
257+ if tcb_info. fmspc == AZURE_V6_BAD_FMSPC {
258+ let tcb_levels = tcb_info
259+ . tcb_levels
260+ . into_iter ( )
261+ . map ( |mut tcb_level| {
262+ if & tcb_level. tcb_status == "UpToDate" {
263+ if tcb_level. tcb . sgx_components [ 7 ] . svn > 3 {
264+ tracing:: warn!(
265+ "Overriding tcb info to allow outdated Azure v6 SEAM loader"
266+ ) ;
267+ println ! ( "modifying!" ) ;
268+ tcb_level. tcb . sgx_components [ 7 ] . svn = 3 ;
269+ }
270+ tcb_level
271+ } else {
272+ tcb_level
273+ }
274+ } )
275+ . collect :: < Vec < _ > > ( ) ;
276+
277+ tcb_info. tcb_levels = tcb_levels;
278+
279+ let tcb_info_json = serde_json:: to_string ( & tcb_info) . unwrap ( ) ;
280+ collateral. tcb_info = tcb_info_json;
281+ }
282+ }
283+
248284#[ derive( Error , Debug ) ]
249285pub enum MaaError {
250286 #[ error( "Report: {0}" ) ]
Original file line number Diff line number Diff line change 11//! Data Center Attestation Primitives (DCAP) evidence generation and verification
2- use crate :: attestation:: { measurements:: MultiMeasurements , tcb_info :: TcbInfo , AttestationError } ;
2+ use crate :: attestation:: { measurements:: MultiMeasurements , AttestationError } ;
33
44use configfs_tsm:: QuoteGenerationError ;
55use dcap_qvl:: {
6- collateral:: { self , get_collateral_for_fmspc} ,
6+ collateral:: get_collateral_for_fmspc,
77 quote:: { Quote , Report } ,
88} ;
99use thiserror:: Error ;
@@ -32,6 +32,8 @@ pub async fn verify_dcap_attestation(
3232
3333 let ca = quote. ca ( ) ?;
3434 let fmspc = hex:: encode_upper ( quote. fmspc ( ) ?) ;
35+
36+ #[ allow( unused_mut) ]
3537 let mut collateral = get_collateral_for_fmspc (
3638 & pccs_url. clone ( ) . unwrap_or ( PCS_URL . to_string ( ) ) ,
3739 fmspc,
@@ -40,6 +42,9 @@ pub async fn verify_dcap_attestation(
4042 )
4143 . await ?;
4244
45+ #[ cfg( feature = "azure-v6-override" ) ]
46+ crate :: attestation:: azure:: azure_v6_override ( & mut collateral) ;
47+
4348 let _verified_report = dcap_qvl:: verify:: verify ( & input, & collateral, now) ?;
4449
4550 let measurements = MultiMeasurements :: from_dcap_qvl_quote ( & quote) ?;
You can’t perform that action at this time.
0 commit comments