class SignTool:
@staticmethod
def sign(input_f: str, output_f: str, opts: UkifyConfig) -> None:
- raise NotImplementedError()
+ raise NotImplementedError
@staticmethod
def verify(opts: UkifyConfig) -> bool:
- raise NotImplementedError()
+ raise NotImplementedError
@staticmethod
def from_string(name: str) -> type['SignTool']:
for i, s in enumerate(pe.sections[:n_original_sections]):
if pe_strip_section_name(s.Name) == section.name and section.name != '.dtbauto':
if new_section.Misc_VirtualSize > s.SizeOfRawData:
- raise PEError(f'Not enough space in existing section {section.name} to append new data.')
+ raise PEError(f'Not enough space in existing section {section.name} to append new data')
padding = bytes(new_section.SizeOfRawData - new_section.Misc_VirtualSize)
pe.__data__ = (
encoded = json.dumps(j).encode()
if len(encoded) > section.SizeOfRawData:
raise PEError(
- f'Not enough space in existing section .pcrsig of size {section.SizeOfRawData} to append new data of size {len(encoded)}.' # noqa: E501
+ f'Not enough space in existing section .pcrsig of size {section.SizeOfRawData} to append new data of size {len(encoded)}' # noqa: E501
)
-
section.Misc_VirtualSize = len(encoded)
# bytes(n) results in an array of n zeroes
padding = bytes(section.SizeOfRawData - len(encoded))
def parse_efifw_dir(path: Path) -> bytes:
if not path.is_dir():
- raise ValueError(f'{path} is not a directory or it does not exist.')
+ raise ValueError(f'{path} is not a directory or it does not exist')
# only one firmware image must be present in the directory
# to uniquely identify that firmware with its ID.
if len(list(path.glob('*'))) != 1:
- raise ValueError(f'{path} must contain exactly one firmware image file.')
+ raise ValueError(f'{path} must contain exactly one firmware image file')
payload_blob = b''
for fw in path.iterdir():