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
158 for section in self.fv_sections.itervalues():
159 for subsection_name in section.names():
169 blob = self.fum.get_section(self.image, section.get_body_name())
173 section.set_sha(s.hexdigest())
176 if not section.get_sig_name():
179 # Now determine this section's version number.
181 self.image, section.get_sig_name())
183 section.set_version(self.os_if.retrieve_body_version(vb_section))
184 section.set_flags(self.os_if.retrieve_preamble_flags(vb_section))
185 section.set_datakey_version(
187 section.set_kernel_subkey_version(
191 s.update(self.fum.get_section(self.image, section.get_sig_name()))
192 section.set_sig_sha(s.hexdigest())
198 """Retrieve root public key from the firmware GBB section."""
219 # GBB section the key is stored as a standalone entity, so the offset
247 for section in self.fv_sections.itervalues():
248 if section.get_sig_name():
250 self.os_if.state_dir_file(section.get_sig_name()),
252 self.os_if.state_dir_file(section.get_body_name()))
255 def _modify_section(self, section, delta, body_or_sig=False, argument
257 """Modify a firmware section inside the image, either body or signature.
260 section. Otherwise, the delta is added to the value located at 2% offset
261 into the section blob, either body or signature.
263 Calling this function again for the same section the complimentary
264 delta value would restore the section contents.
270 if section not in self.fv_sections:
271 raise FlashromHandlerError('Unknown FW section %s'
272 % section)
274 # Get the appropriate section of the image.
276 subsection_name = self.fv_sections[section].get_body_name()
278 subsection_name = self.fv_sections[section].get_sig_name()
281 # Modify the byte in it within 2% of the section blob.
294 def corrupt_section(self, section, corrupt_all=False): argument
295 """Corrupt a section signature of the image"""
297 return self._modify_section(section, self.DELTA, body_or_sig=False,
300 def corrupt_section_body(self, section, corrupt_all=False): argument
301 """Corrupt a section body of the image"""
303 return self._modify_section(section, self.DELTA, body_or_sig=True,
306 def restore_section(self, section, restore_all=False): argument
307 """Restore a previously corrupted section signature of the image."""
309 return self._modify_section(section, -self.DELTA, body_or_sig=False,
312 def restore_section_body(self, section, restore_all=False): argument
313 """Restore a previously corrupted section body of the image."""
315 return self._modify_section(section, -self.DELTA, body_or_sig=True,
318 def corrupt_firmware(self, section, corrupt_all=False): argument
319 """Corrupt a section signature in the FLASHROM!!!"""
321 subsection_name = self.corrupt_section(section, corrupt_all=corrupt_all)
324 def corrupt_firmware_body(self, section, corrupt_all=False): argument
325 """Corrupt a section body in the FLASHROM!!!"""
327 subsection_name = self.corrupt_section_body(section,
331 def restore_firmware(self, section, restore_all=False): argument
332 """Restore the previously corrupted section sig in the FLASHROM!!!"""
334 subsection_name = self.restore_section(section, restore_all=restore_all)
337 def restore_firmware_body(self, section, restore_all=False): argument
338 """Restore the previously corrupted section body in the FLASHROM!!!"""
340 subsection_name = self.restore_section_body(section,
358 """Copy one firmware image section to another.
360 This function copies both signature and body of one firmware section
434 def get_section_sig_sha(self, section): argument
435 """Retrieve SHA1 hash of a firmware vblock section"""
436 return self.fv_sections[section].get_sig_sha()
438 def get_section_sha(self, section): argument
439 """Retrieve SHA1 hash of a firmware body section"""
440 return self.fv_sections[section].get_sha()
442 def get_section_version(self, section): argument
443 """Retrieve version number of a firmware section"""
444 return self.fv_sections[section].get_version()
446 def get_section_flags(self, section): argument
447 """Retrieve preamble flags of a firmware section"""
448 return self.fv_sections[section].get_flags()
450 def get_section_datakey_version(self, section): argument
451 """Retrieve data key version number of a firmware section"""
452 return self.fv_sections[section].get_datakey_version()
454 def get_section_kernel_subkey_version(self, section): argument
455 """Retrieve kernel subkey version number of a firmware section"""
456 return self.fv_sections[section].get_kernel_subkey_version()
458 def get_section_body(self, section): argument
459 """Retrieve body of a firmware section"""
460 subsection_name = self.fv_sections[section].get_body_name()
464 def get_section_sig(self, section): argument
465 """Retrieve vblock of a firmware section"""
466 subsection_name = self.fv_sections[section].get_sig_name()
470 def set_section_body(self, section, blob, write_through=False): argument
471 """Put the supplied blob to the body of the firmware section"""
472 subsection_name = self.fv_sections[section].get_body_name()
480 def set_section_sig(self, section, blob, write_through=False): argument
481 """Put the supplied blob to the vblock of the firmware section"""
482 subsection_name = self.fv_sections[section].get_sig_name()
490 def set_section_version(self, section, version, flags, argument
493 Re-sign the firmware section using the supplied version number and
496 if (self.get_section_version(section) == version and
497 self.get_section_flags(section) == flags):
501 'Attempt to set version %d on section %s' % (version, section))
502 fv_section = self.fv_sections[section]