Skip to content

Commit 5e7cea6

Browse files
authored
Merge pull request #524 from anta5010/ts_context
Use as_ptr for TS service name
2 parents 06de5c9 + 0ba435b commit 5e7cea6

File tree

2 files changed

+4
-9
lines changed

2 files changed

+4
-9
lines changed

src/providers/trusted_service/context/mod.rs

+3-8
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,10 @@ impl Context {
7474

7575
info!("Obtaining a crypto Trusted Service context.");
7676
let mut status = 0;
77-
let service_context = unsafe {
78-
service_locator_query(
79-
CString::new("sn:trustedfirmware.org:crypto:0")
80-
.unwrap()
81-
.into_raw(),
82-
&mut status,
83-
)
84-
};
77+
let service_name = CString::new("sn:trustedfirmware.org:crypto:0").unwrap();
78+
let service_context = unsafe { service_locator_query(service_name.as_ptr(), &mut status) };
8579
if service_context.is_null() {
80+
error!("Locating crypto Trusted Service failed, status: {}", status);
8681
return Err(io::Error::new(
8782
io::ErrorKind::Other,
8883
"Failed to obtain a Trusted Service context",

src/utils/service_builder.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@ unsafe fn get_provider(
370370
}
371371
#[cfg(feature = "trusted-service-provider")]
372372
ProviderConfig::TrustedService { .. } => {
373-
info!("Creating a TPM Provider.");
373+
info!("Creating a Trusted Service Provider.");
374374
Ok(Some(Arc::new(
375375
TrustedServiceProviderBuilder::new()
376376
.with_key_info_store(kim_factory.build_client(ProviderId::TrustedService))

0 commit comments

Comments
 (0)