Skip to content

Commit

Permalink
Merge pull request #524 from anta5010/ts_context
Browse files Browse the repository at this point in the history
Use as_ptr for TS service name
  • Loading branch information
ionut-arm authored Sep 17, 2021
2 parents 06de5c9 + 0ba435b commit 5e7cea6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions src/providers/trusted_service/context/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,10 @@ impl Context {

info!("Obtaining a crypto Trusted Service context.");
let mut status = 0;
let service_context = unsafe {
service_locator_query(
CString::new("sn:trustedfirmware.org:crypto:0")
.unwrap()
.into_raw(),
&mut status,
)
};
let service_name = CString::new("sn:trustedfirmware.org:crypto:0").unwrap();
let service_context = unsafe { service_locator_query(service_name.as_ptr(), &mut status) };
if service_context.is_null() {
error!("Locating crypto Trusted Service failed, status: {}", status);
return Err(io::Error::new(
io::ErrorKind::Other,
"Failed to obtain a Trusted Service context",
Expand Down
2 changes: 1 addition & 1 deletion src/utils/service_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ unsafe fn get_provider(
}
#[cfg(feature = "trusted-service-provider")]
ProviderConfig::TrustedService { .. } => {
info!("Creating a TPM Provider.");
info!("Creating a Trusted Service Provider.");
Ok(Some(Arc::new(
TrustedServiceProviderBuilder::new()
.with_key_info_store(kim_factory.build_client(ProviderId::TrustedService))
Expand Down

0 comments on commit 5e7cea6

Please sign in to comment.