Lines Matching full:section
19 """An object to hold information about a firmware section.
87 DELTA = 1 # value to add to a byte to corrupt a section contents
156 for section in self.fv_sections.itervalues():
157 for subsection_name in section.names():
167 blob = self.fum.get_section(self.image, section.get_body_name())
171 section.set_sha(s.hexdigest())
174 if not section.get_sig_name():
177 # Now determine this section's version number.
179 self.image, section.get_sig_name())
181 section.set_version(self.os_if.retrieve_body_version(vb_section))
182 section.set_flags(self.os_if.retrieve_preamble_flags(vb_section))
183 section.set_datakey_version(
185 section.set_kernel_subkey_version(
189 s.update(self.fum.get_section(self.image, section.get_sig_name()))
190 section.set_sig_sha(s.hexdigest())
196 """Retrieve root public key from the firmware GBB section."""
217 # GBB section the key is stored as a standalone entity, so the offset
245 for section in self.fv_sections.itervalues():
246 if section.get_sig_name():
248 self.os_if.state_dir_file(section.get_sig_name()),
250 self.os_if.state_dir_file(section.get_body_name()))
253 def _modify_section(self, section, delta, body_or_sig=False, argument
255 """Modify a firmware section inside the image, either body or signature.
258 section. Otherwise, the delta is added to the value located at 2% offset
259 into the section blob, either body or signature.
261 Calling this function again for the same section the complimentary
262 delta value would restore the section contents.
268 if section not in self.fv_sections:
269 raise FlashromHandlerError('Unknown FW section %s'
270 % section)
272 # Get the appropriate section of the image.
274 subsection_name = self.fv_sections[section].get_body_name()
276 subsection_name = self.fv_sections[section].get_sig_name()
279 # Modify the byte in it within 2% of the section blob.
292 def corrupt_section(self, section, corrupt_all=False): argument
293 """Corrupt a section signature of the image"""
295 return self._modify_section(section, self.DELTA, body_or_sig=False,
298 def corrupt_section_body(self, section, corrupt_all=False): argument
299 """Corrupt a section body of the image"""
301 return self._modify_section(section, self.DELTA, body_or_sig=True,
304 def restore_section(self, section, restore_all=False): argument
305 """Restore a previously corrupted section signature of the image."""
307 return self._modify_section(section, -self.DELTA, body_or_sig=False,
310 def restore_section_body(self, section, restore_all=False): argument
311 """Restore a previously corrupted section body of the image."""
313 return self._modify_section(section, -self.DELTA, body_or_sig=True,
316 def corrupt_firmware(self, section, corrupt_all=False): argument
317 """Corrupt a section signature in the FLASHROM!!!"""
319 subsection_name = self.corrupt_section(section, corrupt_all=corrupt_all)
322 def corrupt_firmware_body(self, section, corrupt_all=False): argument
323 """Corrupt a section body in the FLASHROM!!!"""
325 subsection_name = self.corrupt_section_body(section,
329 def restore_firmware(self, section, restore_all=False): argument
330 """Restore the previously corrupted section sig in the FLASHROM!!!"""
332 subsection_name = self.restore_section(section, restore_all=restore_all)
335 def restore_firmware_body(self, section, restore_all=False): argument
336 """Restore the previously corrupted section body in the FLASHROM!!!"""
338 subsection_name = self.restore_section_body(section,
356 """Copy one firmware image section to another.
358 This function copies both signature and body of one firmware section
432 def get_section_sig_sha(self, section): argument
433 """Retrieve SHA1 hash of a firmware vblock section"""
434 return self.fv_sections[section].get_sig_sha()
436 def get_section_sha(self, section): argument
437 """Retrieve SHA1 hash of a firmware body section"""
438 return self.fv_sections[section].get_sha()
440 def get_section_version(self, section): argument
441 """Retrieve version number of a firmware section"""
442 return self.fv_sections[section].get_version()
444 def get_section_flags(self, section): argument
445 """Retrieve preamble flags of a firmware section"""
446 return self.fv_sections[section].get_flags()
448 def get_section_datakey_version(self, section): argument
449 """Retrieve data key version number of a firmware section"""
450 return self.fv_sections[section].get_datakey_version()
452 def get_section_kernel_subkey_version(self, section): argument
453 """Retrieve kernel subkey version number of a firmware section"""
454 return self.fv_sections[section].get_kernel_subkey_version()
456 def get_section_body(self, section): argument
457 """Retrieve body of a firmware section"""
458 subsection_name = self.fv_sections[section].get_body_name()
462 def get_section_sig(self, section): argument
463 """Retrieve vblock of a firmware section"""
464 subsection_name = self.fv_sections[section].get_sig_name()
468 def set_section_body(self, section, blob, write_through=False): argument
469 """Put the supplied blob to the body of the firmware section"""
470 subsection_name = self.fv_sections[section].get_body_name()
478 def set_section_sig(self, section, blob, write_through=False): argument
479 """Put the supplied blob to the vblock of the firmware section"""
480 subsection_name = self.fv_sections[section].get_sig_name()
488 def set_section_version(self, section, version, flags, argument
491 Re-sign the firmware section using the supplied version number and
494 if (self.get_section_version(section) == version and
495 self.get_section_flags(section) == flags):
499 'Attempt to set version %d on section %s' % (version, section))
500 fv_section = self.fv_sections[section]