-
Notifications
You must be signed in to change notification settings - Fork 877
[rom_ext] Boot services refactor and unit tests #27453
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
[rom_ext] Boot services refactor and unit tests #27453
Conversation
0f7fa3d
to
5d5a639
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Dropped a couple comments. In general mostly LGTM. Thanks for this first submission!
One other improvement that would be useful: could you please add/expand commit messages? Each commit just has a title but no detailed description. See here https://opentitan.org/book/doc/contributing/detailed_contribution_guide/index.html?highlight=commit%20messages#what-should-commit-messages-look-like for some guidelines, and also it can be useful to take a look at other commit messages in the repo already.
sw/device/silicon_creator/rom_ext/rom_ext_boot_services_unittest.cc
Outdated
Show resolved
Hide resolved
5d5a639
to
a85d6ea
Compare
In preparation for fuzzing efforts, all boot services related code in rom_ext has been refactored into a seperate library. This will allow unit tests, and fuzz tests, to run this code directly on the host by removing device dependencies. The majority of code changes in this commit are due to moving code from one file to another. Signed-off-by: Collin MacDonald <cmacd@google.com>
This change converts the owner_verify library into a dual library, with support for running both on device and host targets. Additionally, this change adds the required mocks to allow hosts to run owner_verify. Signed-off-by: Collin MacDonald <cmacd@google.com>
This change expands the existing Manifest mock to include support for three additional methods: manifest_ext_get_spx_key, manifest_ext_get_spx_signature, and manifest_ext_get_isfb. Future unit tests will use each of these methods. Signed-off-by: Collin MacDonald <cmacd@google.com>
When running on a host target, the rescue type is undefined, as it is currently only defined on a per device basis. This change adds a NULL rescue type to be used by future unit tests. Signed-off-by: Collin MacDonald <cmacd@google.com>
This change adds conditional compilation flags to dbg_print related functions to better support on host unit tests. Additionally, to support existing dbg_print unit tests, a unit test specific flag was added. Signed-off-by: Collin MacDonald <cmacd@google.com>
This change adds 7 initial tests for boot services with basic parameters for each. These tests serve as a starting point for more complex unit tests and fuzzing tests related to boot services. Signed-off-by: Collin MacDonald <cmacd@google.com>
This change fills out the BootSvcEnterRescue, BootSvcOwnershipUnlock, and BootSvcOwnershipActivate unit tests with the required inputs to pass. Signed-off-by: Ellis Sarza-Nguyen <sarzanguyen@google.com>
Adds additional equality checks, formats all unit tests, and ensures similar checks are present in all 7 boot service handler related unit tests. Signed-off-by: Collin MacDonald <cmacd@google.com>
a85d6ea
to
ad767bb
Compare
These changes refactor the
handle_boot_svc
method and several related methods out ofrom_ext.c
into separate libraries -rom_ext_boot_services.c
androm_ext_verify.c
. This enables standalone unit tests to be written for boot services (and shortly, fuzzing for boot services).Unit tests were added for each action handled in
handle_boot_svc
. Mocks and conditional compilation were added where necessary to support on-host tests forrom_ext
.