Changes by: antona
Update of /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25290
Modified Files:
decrypt.c
Log Message:
Use double indirection in case libgcrypt clones the key for you hack for
closing the des cipher.
Index: decrypt.c
===================================================================
RCS file: /cvsroot/linux-ntfs/ntfsprogs/ntfsprogs/decrypt.c,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -p -r1.17 -r1.18
--- decrypt.c 28 Jul 2005 10:36:32 -0000 1.17
+++ decrypt.c 28 Jul 2005 11:27:31 -0000 1.18
@@ -473,7 +473,8 @@ static gcry_err_code_t ntfs_desx_setkey(
* Take a note of the ctx->gcry_cipher_hd since we need to close it at
* ntfs_decrypt_data_key_close() time.
*/
- *(gcry_cipher_hd_t*)(key + ((keylen + 7) & ~7)) = ctx->gcry_cipher_hd;
+ **(gcry_cipher_hd_t***)(key + ((keylen + 7) & ~7)) =
+ &ctx->gcry_cipher_hd;
return GPG_ERR_NO_ERROR;
}
@@ -614,9 +615,9 @@ ntfs_decrypt_data_key *ntfs_decrypt_data
key->alg_id = *(u32*)(data + 8);
key->key_data = (u8*)key + ((sizeof(*key) + 7) & ~7);
memcpy(key->key_data, data + 16, key_size);
- key->des_gcry_cipher_hd_ptr = (gcry_cipher_hd_t*)(key->key_data +
- ((key_size + 7) & ~7));
- *key->des_gcry_cipher_hd_ptr = NULL;
+ key->des_gcry_cipher_hd_ptr = NULL;
+ *(gcry_cipher_hd_t***)(key->key_data + ((key_size + 7) & ~7)) =
+ &key->des_gcry_cipher_hd_ptr;
gcry_control(GCRYCTL_DISABLE_SECMEM, 0);
switch (key->alg_id) {
case CALG_DESX:
@@ -691,7 +692,7 @@ ntfs_decrypt_data_key *ntfs_decrypt_data
void ntfs_decrypt_data_key_close(ntfs_decrypt_data_key *key)
{
NTFS_DECRYPT_DATA_KEY *dkey = (NTFS_DECRYPT_DATA_KEY*)key;
- if (*dkey->des_gcry_cipher_hd_ptr)
+ if (dkey->des_gcry_cipher_hd_ptr)
gcry_cipher_close(*dkey->des_gcry_cipher_hd_ptr);
gcry_cipher_close(dkey->gcry_cipher_hd);
free(key);
|