pyctr.type.save.partdesc.ivfc module
- exception pyctr.type.save.partdesc.ivfc.IVFCReadOnlyError[source]
Bases:
PartitionDescriptorErrorThe DPFS level is read-only.
- class pyctr.type.save.partdesc.ivfc.IVFC(master_hash_size, lv1, lv2, lv3, lv4, descriptor_size)[source]
Bases:
NamedTuple- Parameters:
- class pyctr.type.save.partdesc.ivfc.IVFCLevel4Reader(tree, verify=True, deep_verify=True)[source]
Bases:
RawIOBase- Parameters:
tree (IVFCHashTree)
verify (bool)
deep_verify (bool)
- seek(offset, whence=0)[source]
Change the stream position to the given byte offset.
- offset
The stream position, relative to ‘whence’.
- whence
The relative position to seek from.
The offset is interpreted relative to the position indicated by whence. Values for whence are:
os.SEEK_SET or 0 – start of stream (the default); offset should be zero or positive
os.SEEK_CUR or 1 – current stream position; offset may be negative
os.SEEK_END or 2 – end of stream; offset is usually negative
Return the new absolute position.
- class pyctr.type.save.partdesc.ivfc.IVFCHashTree(fp, ivfc, master_hashes, *, lv4_fp=None, update_master_hashes_callback=None)[source]
Bases:
objectImplements an IVFC hash tree. This covers levels 1, 2, and 3. IVFC Level 4 contains the actual data.
- Parameters:
fp (BinaryIO) – A file-like object with levels 1, 2, and 3. If lv4_fp is not specified, this must also contain level 4.
master_hashes (list[bytes]) – Master hashes from the partition descriptor, which verify IVFC Level 1.
lv4_fp (BinaryIO) – A file-like object with level 4. Only used if the DIFI header has enabled external IVFC Level 4.
update_master_hashes_callback (Callable[[list[bytes]], None]) – Function to be called when master hashes are updated. This is used by DISA and DIFF to write the master hashes to the partition descriptor.
ivfc (IVFC)
- get_block(level, block, *, verify=True, deep_verify=True)[source]
Get the data from a block. The data is validated using the IVFC levels above the requested one.
- Parameters:
- Returns:
The data, and if the hash of it was valid. True if valid, False if invalid, None if uninitialized (expected hash is all zeros) or verify was false.
- Return type: