mirror of
https://xff.cz/git/u-boot/
synced 2025-10-03 08:21:30 +02:00
efi_loader: Fix EFI_VARIABLE_APPEND_WRITE hash check
According to UEFI v2.10 spec section 8.2.6, if a caller invokes the SetVariables() service, it will produce a digest from hash(VariableName, VendorGuid, Attributes, TimeStamp, DataNew_variable_content), then the firmware that implements the SetVariable() service will compare the digest with the result of applying the signer’s public key to the signature. For EFI variable append write, efitools sign-efi-sig-list has an option "-a" to add EFI_VARIABLE_APPEND_WRITE attr, and u-boot will drop this attribute in efi_set_variable_int(). So if a caller uses "sign-efi-sig-list -a" to create the authenticated variable, this append write will fail in the u-boot due to "hash check failed". This patch resumes writing the EFI_VARIABLE_APPEND_WRITE attr to ensure that the hash check is correct. And also update the "test_efi_secboot" test case to compliance with the change. Signed-off-by: Weizhao Ouyang <o451686892@gmail.com>
This commit is contained in:
committed by
Heinrich Schuchardt
parent
1ebd659cf0
commit
3b7d26eb2b
@@ -183,7 +183,7 @@ class TestEfiAuthVar(object):
|
||||
assert 'db:' in ''.join(output)
|
||||
|
||||
output = u_boot_console.run_command_list([
|
||||
'fatload host 0:1 4000000 db1.auth',
|
||||
'fatload host 0:1 4000000 db2.auth',
|
||||
'setenv -e -nv -bs -rt -a -i 4000000:$filesize db'])
|
||||
assert 'Failed to set EFI variable' in ''.join(output)
|
||||
|
||||
@@ -197,7 +197,7 @@ class TestEfiAuthVar(object):
|
||||
with u_boot_console.log.section('Test Case 3c'):
|
||||
# Test Case 3c, update with correct signature
|
||||
output = u_boot_console.run_command_list([
|
||||
'fatload host 0:1 4000000 db1.auth',
|
||||
'fatload host 0:1 4000000 db2.auth',
|
||||
'setenv -e -nv -bs -rt -at -a -i 4000000:$filesize db',
|
||||
'printenv -e -n -guid d719b2cb-3d3a-4596-a3bc-dad00e67656f db'])
|
||||
assert 'Failed to set EFI variable' not in ''.join(output)
|
||||
|
Reference in New Issue
Block a user