tronconneuse: how is current_position done?
Wesley Leggette <lists-+42/j/[email protected]> Thu, 24 Mar 2005 20:49:58 +0100
| Newsgroups | gmane.comp.sysutils.backup.dar.general |
|---|---|
| Message-ID | <1111693798.12309.24.camel@localhost> |
Denis,
If you remember my question about where data offsets (as stored in the
catalog) are zeroed, I've been looking at the tronconneuse code, and I
see this code in the constructor:
--------------
tronconneuse::tronconneuse(user_interaction & dialog, U_32 block_size,
generic_file & encrypted_side) : generic_file(dialog,
encrypted_side.get_mode())
{
...
clear_block_size = block_size;
current_position = 0;
initial_shift = encrypted_side.get_position();
block_num = 0;
encrypted = & encrypted_side;
...
}
--------------
Where current_position = 0. get_position is the implemented as return
current_position. At the same time, initial_shift is set to
encrypted_side.get_position() and block_num is set to 0. Here, I'm
assuming that initial_shift ends up being the size of the version
header.
So if that assumption is correct, is the position actually zeroed at the
beginning of the encryption stream? If that is the case, would the
following be true?
(Here, we are looking at the "virtual file" above the SAR layer.)
Case 1: Encrypted archive
+----------+---------------------------------------------------------+
| version | Encrypted data |
| header | |
+----------+---------------------------------------------------------+
+-----+---------------------------------------+------+----+
| EEE | Compressed data | TTTT | EE |
| | | | |
+-----+---------------------------------------+------+----+
| +------+--+...................+---------+
| | file |EA| | Catalog |
| | data | | | |
| +------+--+-------------------+---------+
^
zero offset
Case 1a: Encrypted archive (If I'm wrong about the first case)
+----------+---------------------------------------------------------+
| version | Encrypted data |
| header | |
+----------+---------------------------------------------------------+
| +-----+---------------------------------------+------+----+
| | EEE | Compressed data | TTTT | EE |
| | | | | |
| +-----+---------------------------------------+------+----+
|
| +------+--+...................+---------+
| | file |EA| | Catalog |
| | data | | | |
| +------+--+...................+---------+
^
zero offset
Case 2: Compressed archive
+----------+---------------------------------------------------------+
| version | Compressed data | TTTT |
| header | | |
+----------+---------------------------------------------------------+
| +------+--+..............................+---------+
| | file |EA| | Catalog |
| | data | | | |
| +------+--+..............................+---------+
^
zero offset
If case 1a is true, how is the position determined? I.e. how is it
possible to calculate the underlying position when current_position = 0?
Also, where is initial_shift used?
Thanks,
Wesley
--
Wesley Leggette <lists-+42/j/[email protected]>
GPG Key: http://www.kaylix.net/kaylix.asc or http://pgp.mit.edu
GPG Fingerprint: 9B6F 19FB 5296 5E6C 21FE 7614 2A20 5688 F848 9BDD
signature.asc
(application/pgp-signature, 189 B)
-----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.6 (GNU/Linux) iD8DBQBCQxnmKiBWiPhIm90RAqgYAKCBYxa1N2e4aZP1X58o2u6/BtY5+QCfSLhL DqK2V2UlXgAAIowXBCENTrQ= =7GUk -----END PGP SIGNATURE-----