• Home
  • Raw
  • Download

Lines Matching full:section

22     """An object to hold information about a firmware section.
94 DELTA = 1 # value to add to a byte to corrupt a section contents
168 for section in self.fv_sections.itervalues():
169 for subsection_name in section.names():
179 blob = self.fum.get_section(self.image, section.get_body_name())
183 section.set_sha(s.hexdigest())
186 if not section.get_sig_name():
189 # Now determine this section's version number.
191 self.image, section.get_sig_name())
193 section.set_version(self.os_if.retrieve_body_version(vb_section))
194 section.set_flags(self.os_if.retrieve_preamble_flags(vb_section))
195 section.set_datakey_version(
197 section.set_kernel_subkey_version(
201 s.update(self.fum.get_section(self.image, section.get_sig_name()))
202 section.set_sig_sha(s.hexdigest())
208 """Retrieve root public key from the firmware GBB section."""
229 # GBB section the key is stored as a standalone entity, so the offset
257 for section in self.fv_sections.itervalues():
258 if section.get_sig_name():
260 self.os_if.state_dir_file(section.get_sig_name()),
262 self.os_if.state_dir_file(section.get_body_name()))
265 def _modify_section(self, section, delta, body_or_sig=False, argument
267 """Modify a firmware section inside the image, either body or signature.
270 section. Otherwise, the delta is added to the value located at 2% offset
271 into the section blob, either body or signature.
273 Calling this function again for the same section the complimentary
274 delta value would restore the section contents.
280 if section not in self.fv_sections:
281 raise FlashromHandlerError('Unknown FW section %s'
282 % section)
284 # Get the appropriate section of the image.
286 subsection_name = self.fv_sections[section].get_body_name()
288 subsection_name = self.fv_sections[section].get_sig_name()
291 # Modify the byte in it within 2% of the section blob.
304 def corrupt_section(self, section, corrupt_all=False): argument
305 """Corrupt a section signature of the image"""
307 return self._modify_section(section, self.DELTA, body_or_sig=False,
310 def corrupt_section_body(self, section, corrupt_all=False): argument
311 """Corrupt a section body of the image"""
313 return self._modify_section(section, self.DELTA, body_or_sig=True,
316 def restore_section(self, section, restore_all=False): argument
317 """Restore a previously corrupted section signature of the image."""
319 return self._modify_section(section, -self.DELTA, body_or_sig=False,
322 def restore_section_body(self, section, restore_all=False): argument
323 """Restore a previously corrupted section body of the image."""
325 return self._modify_section(section, -self.DELTA, body_or_sig=True,
328 def corrupt_firmware(self, section, corrupt_all=False): argument
329 """Corrupt a section signature in the FLASHROM!!!"""
331 subsection_name = self.corrupt_section(section, corrupt_all=corrupt_all)
334 def corrupt_firmware_body(self, section, corrupt_all=False): argument
335 """Corrupt a section body in the FLASHROM!!!"""
337 subsection_name = self.corrupt_section_body(section,
341 def restore_firmware(self, section, restore_all=False): argument
342 """Restore the previously corrupted section sig in the FLASHROM!!!"""
344 subsection_name = self.restore_section(section, restore_all=restore_all)
347 def restore_firmware_body(self, section, restore_all=False): argument
348 """Restore the previously corrupted section body in the FLASHROM!!!"""
350 subsection_name = self.restore_section_body(section,
368 """Copy one firmware image section to another.
370 This function copies both signature and body of one firmware section
431 def dump_section_body(self, section, filename): argument
432 """Write the body of a firmware section into a file"""
433 subsection_name = self.fv_sections[section].get_body_name()
436 def get_section_hash(self, section): argument
437 """Retrieve the hash of the body of a firmware section"""
440 self.dump_section_body(section, f.name)
475 def get_section_sig_sha(self, section): argument
476 """Retrieve SHA1 hash of a firmware vblock section"""
477 return self.fv_sections[section].get_sig_sha()
479 def get_section_sha(self, section): argument
480 """Retrieve SHA1 hash of a firmware body section"""
481 return self.fv_sections[section].get_sha()
483 def get_section_version(self, section): argument
484 """Retrieve version number of a firmware section"""
485 return self.fv_sections[section].get_version()
487 def get_section_flags(self, section): argument
488 """Retrieve preamble flags of a firmware section"""
489 return self.fv_sections[section].get_flags()
491 def get_section_datakey_version(self, section): argument
492 """Retrieve data key version number of a firmware section"""
493 return self.fv_sections[section].get_datakey_version()
495 def get_section_kernel_subkey_version(self, section): argument
496 """Retrieve kernel subkey version number of a firmware section"""
497 return self.fv_sections[section].get_kernel_subkey_version()
499 def get_section_body(self, section): argument
500 """Retrieve body of a firmware section"""
501 subsection_name = self.fv_sections[section].get_body_name()
505 def has_section_body(self, section): argument
506 """Return True if the section body is in the image"""
507 return bool(self.get_section_body(section))
509 def get_section_sig(self, section): argument
510 """Retrieve vblock of a firmware section"""
511 subsection_name = self.fv_sections[section].get_sig_name()
515 def get_section_fwid(self, section): argument
516 """Retrieve fwid blob of a firmware section"""
517 subsection_name = self.fv_sections[section].get_fwid_name()
521 def set_section_body(self, section, blob, write_through=False): argument
522 """Put the supplied blob to the body of the firmware section"""
523 subsection_name = self.fv_sections[section].get_body_name()
526 def set_section_sig(self, section, blob, write_through=False): argument
527 """Put the supplied blob to the vblock of the firmware section"""
528 subsection_name = self.fv_sections[section].get_sig_name()
531 def set_section_fwid(self, section, blob, write_through=False): argument
532 """Put the supplied blob to the fwid of the firmware section"""
533 subsection_name = self.fv_sections[section].get_fwid_name()
547 def set_section_version(self, section, version, flags, argument
550 Re-sign the firmware section using the supplied version number and
553 if (self.get_section_version(section) == version and
554 self.get_section_flags(section) == flags):
558 'Attempt to set version %d on section %s' % (version, section))
559 fv_section = self.fv_sections[section]