Repository navigation
Commit b558383
committed
scripts: fix compute_authenticode_hash for unsigned PEs
When the PE has no attached certificate the security data directory
fields VirtualAddress and Size are both 0. The previous unconditional
slicing:
pe_data[certificate_table_offset + 0x08 : 0] # -> empty
+ pe_data[0 + 0 :] # -> whole file re-appended
produced a wrong digest for unsigned images.
Add an explicit branch: when VirtualAddress == 0, hash only the bytes
that follow the 8-byte cert-dir data-directory entry, which is the
correct tail of an unsigned PE image.
Signed-off-by: Jeremy Compostella <jeremy.compostella@intel.com>1 parent 1291637 commit b558383
1 file changed
Lines changed: 11 additions & 4 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
447 | 447 | | |
448 | 448 | | |
449 | 449 | | |
450 | | - | |
451 | | - | |
452 | | - | |
453 | | - | |
| 450 | + | |
| 451 | + | |
| 452 | + | |
| 453 | + | |
| 454 | + | |
| 455 | + | |
| 456 | + | |
| 457 | + | |
| 458 | + | |
| 459 | + | |
| 460 | + | |
454 | 461 | | |
455 | 462 | | |
456 | 463 | | |
| |||
0 commit comments