Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add verify command for lpc55 #21

Merged
merged 1 commit into from
Sep 13, 2023
Merged

Add verify command for lpc55 #21

merged 1 commit into from
Sep 13, 2023

Conversation

labbott
Copy link
Contributor

@labbott labbott commented Sep 11, 2023

Verify that a particular binary will work with a specified CMPA/CFPA combination

pub fn verify(
&mut self,
src_cmpa: PathBuf,
src_cfpa: PathBuf,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API nit - I think these should probably be either &[u8] or even [u8; 512]. In the wicket case we will have fetched these via MGS and have them in memory already, right? If we make them [u8; 512] we can also ditch the new "bad length" error variants, since we force the callers to size them correctly.


lpc55_sign::verify::log_verify_only_on_failure();
lpc55_sign::verify::verify_image(&self.image.data, cmpa, cfpa)
.map_err(|e| Error::Lpc55(e))?;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How much information do we get back from this e? Looking at the output from your run:

[ERROR lpc55_sign::verify] ROTKH in CMPA does not match RKH table in image
Error: LPC55 support error: verification failed; see log for details

Caused by:
    verification failed; see log for details

I think we'd really like the ROTKH in CMPA does not match RKH table in image message to be in the error and not just the log (where does that log end up if I'm using this as a library from a running service?), although this looks like an issue in lpc55_sign and not this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We only get a yes/no answer right now from verify. I was debating switching verify to have proper error type and I think your point about running this as a service is a good argument for cleaning that up.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fixed up the verify_image function to return a proper error

Verify that a particular binary will work with a specified CMPA/CFPA
combination
@labbott labbott merged commit 2481445 into main Sep 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants