From: Jakob Cornell Date: Mon, 21 Feb 2022 19:12:09 +0000 (-0600) Subject: Don't try to verify encrypted data X-Git-Url: https://jcornell.net/gitweb/gitweb.cgi?a=commitdiff_plain;h=961a484bfd631eed25c33cad517e1adac1091f4a;p=eros.git Don't try to verify encrypted data --- diff --git a/disk_jumble/src/disk_jumble/verify.py b/disk_jumble/src/disk_jumble/verify.py index 6c15143..9466270 100644 --- a/disk_jumble/src/disk_jumble/verify.py +++ b/disk_jumble/src/disk_jumble/verify.py @@ -66,8 +66,10 @@ def do_verify(conn, disk_id: int, sector_size: int, disk_file: io.BufferedIOBase use_hasher = None chunks = [] for (slab, hasher_ref) in group: - slab_end = min(slab.entity_offset + len(slab.sectors) * sector_size, torrent_len) + if slab.crypt_key is not None: + raise NotImplementedError("verify of encrypted data") + slab_end = min(slab.entity_offset + len(slab.sectors) * sector_size, torrent_len) while offset is None or offset < slab_end: if offset is not None and slab.entity_offset > offset: if chunks: @@ -265,7 +267,8 @@ def _gen_verify_results(conn, disk_id: int, disk_file: io.BufferedIOBase, read_s ) ) as sector, entity.length as entity_length - substring(hashes, generate_series(0, octet_length(hashes) / 32 - 1, 32), 32) as hash + substring(hashes, generate_series(0, octet_length(hashes) / 32 - 1, 32), 32) as hash, + crypt_key from ( entityv2_leaf_hashes elh join slab_plus on ( @@ -279,7 +282,10 @@ def _gen_verify_results(conn, disk_id: int, disk_file: io.BufferedIOBase, read_s """, {"block_size": _V2_BLOCK_SIZE, "disk_id": disk_id} ) - for (entity_id, piece_num, sector, entity_len, hash_) in cursor: + for (entity_id, piece_num, sector, entity_len, hash_, crypt_key) in cursor: + if crypt_key is not None: + raise NotImplementedError("verify of encrypted data") + read_start = sector * _V2_BLOCK_SIZE read_end = read_start + min(_V2_BLOCK_SIZE, entity_len - piece_num * _V2_BLOCK_SIZE) disk_file.seek(read_start)