RE: [AD] docs patch

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


Title: RE: [AD] docs patch

> +   Also, if using encrypted chunks, you must set again the
> password you
> +   had selected when opening the chunk before closing it.
>
> Always ? Even if I don't change it in the meantime ? Why ?
>
> +  After the chunk is closed, you can call
> packfile_password(NULL) again.
>
> So I can't do that between the opening and the closing of the
> file ? Why ? Even if I
> follow the previous advice ?

encrypt_id encrypts an id with the current password in
packfile_password, though the rest of the encryption is
done with the password stored in the PACKFILE structure.
Thus, if you don't set the password again when closing
a chunk, ids will get encrypted with the wrong password.
Since the ids don't get encrypted when reading (or the
other way round, can't remember), we get the wrong data
back.
I'm not sure if it would be possible to make encrypt_id
work off the copied password in a PACKFILE struct, as it
may be called when no such struct exists (just a guess
as why it is done like this, I have not investigated a
possible fix).
I think the whole thing is caused at a high level by the
fact that a chunk is a temporary file, and then copied
into its parent when the chunk is closed.

--
Vincent Penquerc'h



Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/