You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: MfciDxe: ValidateBlobWithXdrCertificates - XDR certificate handling assumes the PublicKeyDataXdr buffer is 4-byte aligned #814
The current implementation for XDR certificate handling assumes the PublicKeyDataXdr buffer is 4-byte aligned. This is not always the case. For example, if PublicKeyDataXdr=0x02, and the length is 0x05, the correct offset should be 0x2 + align_up(0x5, 4) -> 0x2 + 0x8 = 0xA. The current logic produces align_up(0x2 + 0x5, 4) -> align_up(0x7, 4) = 0x8.
(4) Why is the XDR unit four bytes wide?
There is a tradeoff in choosing the XDR unit size. Choosing a small
size, such as two, makes the encoded data small, but causes alignment
problems for machines that aren't aligned on these boundaries. A
large size, such as eight, means the data will be aligned on
virtually every machine, but causes the encoded data to grow too big.
We chose four as a compromise. Four is big enough to support most
architectures efficiently, except for rare machines such as the
eight-byte-aligned Cray*. Four is also small enough to keep the
encoded data restricted to a reasonable size.
Expected Behavior
The XDR certificate parsing is able to properly analyze an XDR certificate buffer with multiple certificates.
Steps To Reproduce
Attempt to utilize MFCI feature
The second certificate is the certificate needed for validation
This design is incorrect, as the expected value for the end of the certificate should be 0xA. PublicKeyDataXdr += ALIGN_VALUE (PublicKeyDataLength, 4);
The initial value of PublicKeyDataXdr is not being correctly accounted for in the original math, since the pointer alignment loses it as part of the alignment.
Activity
antklein commentedon Jan 21, 2026
A related bug that was similarly fixed in FmpDevicePkg.
tianocore/edk2#11529
antklein commentedon Jan 21, 2026
Looks like there was a proposed fix for this that went stale.
#765
Aaron (@apop5) FYI
makubacki commentedon Jan 21, 2026
Antaeus Kleinert-Strand (@antklein), since you selected "I will fix it", I've assigned you as the issue owner.