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

Cert Template Generation of Field Offsets is Fragile #1736

Open
nquarton opened this issue Oct 24, 2024 · 0 comments
Open

Cert Template Generation of Field Offsets is Fragile #1736

nquarton opened this issue Oct 24, 2024 · 0 comments

Comments

@nquarton
Copy link
Contributor

The method used for generating the field offsets in the cert parameters is to populate the field with a known value when generating the tbs, then to search for that value after generation. This should be reasonably robust for larger fields, but is very fragile for fields that are a single byte.

As an example, an issue was hit when a change in the FMC alias cert caused a length to be 197 (0xc5) which happened to be the value used for the SVN fuse value used when generating the cert. This caused the SVN fuse value offset to be incorrect and overwrite the length value. https://github.com/chipsalliance/caliptra-sw/blob/main/x509/build/cert.rs#L95

As a small improvement to make this easier to catch, I will be adding a check to confirm the value truly is unique in the TBS.

Overall, a more robust method is likely needed here. Either by including other known data around the unique value (such as length encodings and identifiers). Or, better yet, by actually parsing the cert for specific fields.

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

No branches or pull requests

1 participant