On 8/28/25 12:19 AM, Alexandre Courbot wrote:
> On Wed Aug 27, 2025 at 11:29 AM JST, John Hubbard wrote:
>> On 8/25/25 9:07 PM, Alexandre Courbot wrote:
>> ...
>>> +        let ucode_signed = {
>>
>> This ucode_signed variable is misnamed...
>>
>>> +            let mut signatures = hs_fw.signatures_iter()?.peekable();
>>> +
>>> +            if signatures.peek().is_none() {
>>> +                // If there are no signatures, then the firmware is 
>>> unsigned.
>>> +                ucode.no_patch_signature()
>>
>> ...as we can see here. :)
> 
> Technically it is of type `FirmwareDmaObject<Signed>` even if we take to
> last branch. The name is to confirm that we have taken care of the
> signature step (even if it is unneeded). Not sure what would be a better
> name for this.

So the <Signed> parameter naming is also awkward, because it refers
to non-signed firmware too, I see. So we need to rename both.

Ideas:

a) ucode_maybe_signed, FirmwareDmaObject<MaybeSigned>

b) ucode_validated, FirmwareDmaObject<Validated>

...
>> Could we do something a little more obvious instead? Sort of like this:
>>
>> impl BooterFirmware {
>>     pub(crate) fn dma_object(&self) -> &DmaObject {
>>         &self.ucode.0
>>     }
>> }
> 
> `Deref<Target = DmaObject>` is a requirement of `FalconFirmware`. That
> being said, we could turn that into a `dma_object` method of
> `FalconFirmware`, which might be a bit clearer about the intent...

That does seem clearer to me.

thanks,
-- 
John Hubbard

Reply via email to