Skip to content

Commit

Permalink
Remove required configure call
Browse files Browse the repository at this point in the history
  • Loading branch information
sosthene-nitrokey committed May 28, 2024
1 parent ef569d2 commit fd3d732
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 16 deletions.
2 changes: 0 additions & 2 deletions src/core_api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2982,8 +2982,6 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> Se050Backend<Twi, D> {
request: &Request,
resources: &mut ServiceResources<P>,
) -> Result<trussed::Reply, Error> {
self.configure()?;

// FIXME: Have a real implementation from trussed
let mut backend_path = core_ctx.path.clone();
backend_path.push(&PathBuf::from(BACKEND_DIR));
Expand Down
7 changes: 0 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,6 @@ pub struct Se050Backend<Twi, D> {
metadata_location: Location,
hw_key: HardwareKey,
ns: Namespace,
configured: bool,
layout: FilesystemLayout,
}

Expand All @@ -147,7 +146,6 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> Se050Backend<Twi, D> {
Some(k) => HardwareKey::Raw(k),
},
ns,
configured: false,
layout,
}
}
Expand Down Expand Up @@ -188,9 +186,6 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> Se050Backend<Twi, D> {
const REQUIRED_CURVES: [CurveInitializer; 2] =
[PRIME256V1_INITIALIZER, SECP521R1_INITIALIZER];
self.enable()?;
if self.configured {
return Ok(());
}
let buf = &mut [0; 1024];
let configured_curves = self
.se
Expand All @@ -207,8 +202,6 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> Se050Backend<Twi, D> {
})?;
}
}
self.configured = true;

Ok(())
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/manage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,6 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> ExtensionImpl<Se050ManageExtension> for Se0
request: &<Se050ManageExtension as Extension>::Request,
_resources: &mut ServiceResources<P>,
) -> Result<<Se050ManageExtension as Extension>::Reply, Error> {
self.configure().map_err(|err| {
debug!("Failed to enable for management: {err:?}");
err
})?;

debug!("Runnig manage request: {request:?}");
match request {
Se050ManageRequest::Info(InfoRequest) => {
Expand Down
2 changes: 1 addition & 1 deletion src/staging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> ExtensionImpl<ManageExtension> for Se050Bac
debug!("Failed to factory reset: {_err:?}");
Error::FunctionFailed
})?;
self.configured = false;
self.configure()?;

// Let the staging backend delete the rest of the data
Err(Error::RequestNotAvailable)
Expand Down
1 change: 0 additions & 1 deletion src/trussed_auth_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,6 @@ impl<Twi: I2CForT1, D: DelayUs<u32>> ExtensionImpl<trussed_auth::AuthExtension>
<trussed_auth::AuthExtension as trussed::serde_extensions::Extension>::Reply,
trussed::Error,
> {
self.configure()?;
let backend_ctx = backend_ctx.with_namespace(&self.ns, &core_ctx.path);
let auth_ctx = backend_ctx.auth;
let ns = backend_ctx.ns;
Expand Down

0 comments on commit fd3d732

Please sign in to comment.