efi: refactoring to prepare for the introduction of efi/preinstall #310
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
efi/preinstall
will depend onefi
so it is necessary to break some cyclic dependencies, which I've done via theefi/internal
package.The most problematic dependency is that
efi/preinstall
needs to use theefi.PCRProfileOption
interface which contains an unexported method that takes a pointer to the unexportedpcrProfileGenerator
type - a type that should remain unexported. This has been solved by adding a simpleinternal.PCRProfileOptionVisitor
interface that is implemented bypcrProfileGenerator
and can be consumed in bothefi
andefi/preinstall
packages. This has simplified direct testing of types that implement theefi.PCRProfileOption
interface as well.On this note, this did highlight a couple of testing gaps - we had no direct tests for the
WithSignatureDBUpdates
andWithShimSbatPolicyLatest
options. I've added tests for these, which found a bug in the way the branching for the quirk handling worked forWithSignatureDBUpdates
.As part of this, I did rename a couple of types to give them names I felt make more sense. Eg,
rootVarsCollector
is nowvariableSetCollector
, to bring it more in line with the newinternal.VariableSet
interface. TherootVarReader
type is nowinitialVarReader
, but other than that, no other changes to this code has been made - there's just been a lot of moving of types to the newefi/internal
package.