@@ -195,6 +195,17 @@ impl Fabric {
195
195
}
196
196
}
197
197
198
+ fn rm_store ( & self , index : usize , psm : & MutexGuard < Psm > ) {
199
+ psm. rm ( fb_key ! ( index, ST_RCA ) ) ;
200
+ psm. rm ( fb_key ! ( index, ST_ICA ) ) ;
201
+ psm. rm ( fb_key ! ( index, ST_NOC ) ) ;
202
+ psm. rm ( fb_key ! ( index, ST_IPK ) ) ;
203
+ psm. rm ( fb_key ! ( index, ST_LBL ) ) ;
204
+ psm. rm ( fb_key ! ( index, ST_PBKEY ) ) ;
205
+ psm. rm ( fb_key ! ( index, ST_PRKEY ) ) ;
206
+ psm. rm ( fb_key ! ( index, ST_VID ) ) ;
207
+ }
208
+
198
209
fn store ( & self , index : usize , psm : & MutexGuard < Psm > ) -> Result < ( ) , Error > {
199
210
let mut key = [ 0u8 ; MAX_CERT_TLV_LEN ] ;
200
211
let len = self . root_ca . as_tlv ( & mut key) ?;
@@ -335,6 +346,19 @@ impl FabricMgr {
335
346
Ok ( index as u8 )
336
347
}
337
348
349
+ pub fn remove ( & self , fab_idx : u8 ) -> Result < ( ) , Error > {
350
+ let fab_idx = fab_idx as usize ;
351
+ let mut mgr = self . inner . write ( ) . unwrap ( ) ;
352
+ let psm = self . psm . lock ( ) . unwrap ( ) ;
353
+ if let Some ( f) = & mgr. fabrics [ fab_idx] {
354
+ f. rm_store ( fab_idx, & psm) ;
355
+ mgr. fabrics [ fab_idx] = None ;
356
+ Ok ( ( ) )
357
+ } else {
358
+ Err ( Error :: NotFound )
359
+ }
360
+ }
361
+
338
362
pub fn match_dest_id ( & self , random : & [ u8 ] , target : & [ u8 ] ) -> Result < usize , Error > {
339
363
let mgr = self . inner . read ( ) ?;
340
364
for i in 0 ..MAX_SUPPORTED_FABRICS {
0 commit comments