@@ -22,6 +22,7 @@ const MSSIM: &str = "mssim";
2222const SWTPM : & str = "swtpm" ;
2323const TABRMD : & str = "tabrmd" ;
2424const LIBTPMS : & str = "libtpms" ;
25+ const TBS : & str = "tbs" ;
2526
2627/// TCTI Context created via a TCTI Loader Library.
2728/// Wrapper around the TSS2_TCTI_CONTEXT structure.
@@ -148,6 +149,10 @@ pub enum TctiNameConf {
148149 ///
149150 /// For more information about configuration, see [this page](https://www.mankier.com/3/Tss2_Tcti_Tabrmd_Init)
150151 Tabrmd ( TabrmdConfig ) ,
152+ /// Connect to the tpm using the Trusted Platform Module (TPM) Base Services (TBS) on Windows.
153+ ///
154+ /// For more information about TBS, see [this page](https://learn.microsoft.com/en-us/windows/win32/tbs/about-tbs)
155+ Tbs ,
151156}
152157
153158impl TctiNameConf {
@@ -180,6 +185,7 @@ impl TryFrom<TctiNameConf> for CString {
180185 TctiNameConf :: Swtpm ( ..) => SWTPM ,
181186 TctiNameConf :: Tabrmd ( ..) => TABRMD ,
182187 TctiNameConf :: LibTpms { .. } => LIBTPMS ,
188+ TctiNameConf :: Tbs => TBS ,
183189 } ;
184190
185191 let tcti_conf = match tcti {
@@ -213,6 +219,7 @@ impl TryFrom<TctiNameConf> for CString {
213219 TctiNameConf :: LibTpms { state } => {
214220 state. map ( |s| s. display ( ) . to_string ( ) ) . unwrap_or_default ( )
215221 }
222+ TctiNameConf :: Tbs => String :: new ( ) ,
216223 } ;
217224
218225 if tcti_conf. is_empty ( ) {
@@ -265,6 +272,10 @@ impl FromStr for TctiNameConf {
265272 } ) ;
266273 }
267274
275+ if config_str. trim ( ) == TBS {
276+ return Ok ( TctiNameConf :: Tbs ) ;
277+ }
278+
268279 Err ( Error :: WrapperError ( WrapperErrorKind :: InvalidParam ) )
269280 }
270281}
@@ -356,6 +367,10 @@ fn validate_from_str_tcti() {
356367
357368 let tcti = TctiNameConf :: from_str ( "libtpms" ) . unwrap ( ) ;
358369 assert_eq ! ( tcti, TctiNameConf :: LibTpms { state: None } ) ;
370+
371+ let tcti_tbs = TctiNameConf :: from_str ( "tbs" )
372+ . expect ( "It should be possible to convert the string 'tbs' into a TctiNameConf object." ) ;
373+ assert_eq ! ( tcti_tbs, TctiNameConf :: Tbs ) ;
359374}
360375
361376/// Configuration for a Device TCTI context
0 commit comments