Problem in writing encrypted data on the FAT partition...

Hello Friends,
I am writing a disk filter driver ( or rewriting diskperformance monitor
driver ). I am doing simple encryption and decryption
on the data( that is incriment the ascii value of the byte by one while
encrypting and decriment the value bye one while decrypting).
Right now my driver is attached to only one partition. This encryption and
decryption works fine with the NTFS
partition and I am able to keep the partition in encrypted form.
But if the partition is FAT, while writing data on it ( creating any
folder or any thing else), its FAT table gets currpted ?
when i restart the machine the partition become inaccessble. How can i solve
this problem ?

Thanks in advance
Maliye

Are you accounting for crypto on system files required at boot time? For
example, if you encrypt the boot sector, the system will not boot because
the BIOS does not know how to decrypt it. This also holds tru for other
files that may be accessed via the RAW file system while booting; i.e.
before your filter loads.

Jamey

-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]On Behalf Of Amit Gorantivar
Sent: Thursday, June 15, 2000 10:42 AM
To: File Systems Developers
Subject: [ntfsd] Problem in writing encrypted data on the FAT
partition…

Hello Friends,
I am writing a disk filter driver ( or rewriting
diskperformance monitor
driver ). I am doing simple encryption and decryption
on the data( that is incriment the ascii value of the byte by one while
encrypting and decriment the value bye one while decrypting).
Right now my driver is attached to only one partition. This
encryption and
decryption works fine with the NTFS
partition and I am able to keep the partition in encrypted form.
But if the partition is FAT, while writing data on it ( creating any
folder or any thing else), its FAT table gets currpted ?
when i restart the machine the partition become inaccessble. How
can i solve
this problem ?

Thanks in advance
Maliye


You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

No I am not encrypting any system files. On my machine NT is installed on C
drive.
Other thing is I am having to harddisk, and encrypted partition is on second
disk.
We made a expansion bios also which take care of initial encryption and
decryption.
But the problem is accuring because of my filter driver, while writing the
FAT it is not
encrypting it properly, and data gets currupted, and when next time i boot
the machine
partition becomes inaccessble.

-----Original Message-----
From: Jamey Kirby
To: File Systems Developers
Date: Thursday, June 15, 2000 8:49 PM
Subject: [ntfsd] RE: Problem in writing encrypted data on the FAT
partition…

>Are you accounting for crypto on system files required at boot time? For
>example, if you encrypt the boot sector, the system will not boot because
>the BIOS does not know how to decrypt it. This also holds tru for other
>files that may be accessed via the RAW file system while booting; i.e.
>before your filter loads.
>
>Jamey
>
>> -----Original Message-----
>> From: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com]On Behalf Of Amit Gorantivar
>> Sent: Thursday, June 15, 2000 10:42 AM
>> To: File Systems Developers
>> Subject: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> Hello Friends,
>> I am writing a disk filter driver ( or rewriting
>> diskperformance monitor
>> driver ). I am doing simple encryption and decryption
>> on the data( that is incriment the ascii value of the byte by one while
>> encrypting and decriment the value bye one while decrypting).
>> Right now my driver is attached to only one partition. This
>> encryption and
>> decryption works fine with the NTFS
>> partition and I am able to keep the partition in encrypted form.
>> But if the partition is FAT, while writing data on it ( creating any
>> folder or any thing else), its FAT table gets currpted ?
>> when i restart the machine the partition become inaccessble. How
>> can i solve
>> this problem ?
>>
>> Thanks in advance
>> Maliye
>>
>>
>> —
>> You are currently subscribed to ntfsd as: xxxxx@storagecraft.com
>> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>>
>
>
>—
>You are currently subscribed to ntfsd as: amitg@i3-micro.com
>To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>
>

Hello

I don’t know if you’re developing a physical sector encrypt or
a logical driver encrypt. If you’re developing a phyisical encryption
you should see no difecencies among any file system.

Probably this is a design problem. When I developed a driver
like this I had a similar problem like you and it was caused by the way
the FAT driver writes. When you modified a file the FAT driver reads
the FAT modified it and writes the two copies of the FAT simultanieously.
If you’re using the write buffer and you are not allocating a new one
when the FAT driver tries to write the second time the FAT the buffer
is encrypted and your driver encrypt it again.

The fact is you shouldn’t encrypt the same buffer what is used
by the upper layers to write because this buffer can be used while it is
encrypted.

Perhaps this is not your problem, if you give me more data perharps
I can help you.

Bye

-----Mensaje original-----
De: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com]En nombre de Amit Gorantivar
Enviado el: jueves 15 de junio de 2000 19:42
Para: File Systems Developers
Asunto: [ntfsd] Problem in writing encrypted data on the FAT
partition…

Hello Friends,
I am writing a disk filter driver ( or rewriting
diskperformance monitor
driver ). I am doing simple encryption and decryption
on the data( that is incriment the ascii value of the byte by one while
encrypting and decriment the value bye one while decrypting).
Right now my driver is attached to only one partition. This
encryption and
decryption works fine with the NTFS
partition and I am able to keep the partition in encrypted form.
But if the partition is FAT, while writing data on it ( creating any
folder or any thing else), its FAT table gets currpted ?
when i restart the machine the partition become inaccessble. How
can i solve
this problem ?

Thanks in advance
Maliye


You are currently subscribed to ntfsd as: xxxxx@jazzfree.com
To unsubscribe send a blank email to $subst(‘Email.Unsub’)

Hi,
Some how this problem is not getting solve. I’m encrypting data in a very
simple way,
following is the code used by me for encrypting the data.

StoreUserMdl = Irp -> MdlAddress;
while ( StoreUserMdl != NULL )
{
MmMapLockedPages ( StoreUserMdl, KernelMode );
for ( i = 0; i <= ( ULONG ) StoreUserMdl -> ByteCount ; i++ )
{
++ * ( (PCHAR) ( StoreUserMdl -> MappedSystemVa ) + ( StoreUserMdl ->
ByteOffset + i ) );
}
StoreUserMdl = StoreUserMdl -> Next;
}// end of while

does I am doing encryption in right way or I have to do some thing else.

Thanks
Maliye

PS. Sorry till now I havn’t implemented the changes sugested by Tomas.
Because I had this great confusion with data buffer.

-----Original Message-----
From: Tomas Gutiérrez
To: Amit Gorantivar
Date: Monday, June 19, 2000 12:54 PM
Subject: RE: [ntfsd] Problem in writing encrypted data on the FAT
partition…

>Hi
>
> No, there is not more buffers, this is the way i get the write
>buffer:
>
> Buffer = MmGetSystemAddressForMdl(Irp->MdlAddress);
>
> After I get the address I copy the datas to my own buffer,
>encrypt then and send it to the lower layers.
>
>Bye.
>Tomas
>
>> -----Mensaje original-----
>> De: Amit Gorantivar [mailto:amitg@i3-micro.com]
>> Enviado el: lunes 19 de junio de 2000 11:34
>> Para: Tomas Gutiérrez
>> Asunto: Re: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> Hi,
>> Thanks for the help, but After observation, I come to the conclusion,
>> the data going to the FAT tables is not getting encrypted, it is
>> stored in
>> plain text on the disk. and when i restart machine since the FAT is in
>> unencrypted
>> form and my driver tries to decrypt the data and data gets
>> currpted, so i’m
>> not
>> able to access the drive. If i manually Encrypt the FATs then I am able
to
>> access
>> the drive and able to access the data.
>> Right now I am encrypting the data in the MDL. I think there is some more
>> buffers
>> I have to encrypt, but I don’t know which ones ? Does I’m
>> thinking in right
>> direction,
>> if yes, which additional buffers I have to encrypt.
>>
>> Thanks
>> Maliye
>> -----Original Message-----
>> From: Tomas Gutiérrez >> To: Amit Gorantivar >> Date: Friday, June 16, 2000 1:30 PM
>> Subject: RE: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> Hi
>>
>> I’m think your’re encrypting in the right way except for
>> using the upper layer buffer for encrypt the data. The FAT driver
>> always and any other applications can make a asyncronous writes
>> and use the buffer for any other thing before your completion
>> routine is called. The applications always going to get strange data
>> when reads it in this moment.
>>
>> What are you doing is what i call a physical sector encryption,
>> i didn’t realize in your previous mail if you’re encrypting files or
>> sector.
>>
>> I hope this help you. I think the first change you have to do
>> is change the write buffer on every call and test your driver again.
>> I you said that it is working fine over NTFS i’m quite sure that this
>> is your problem.
>>
>> Bye.
>> Tomas
>>
>>
>> -----Mensaje original-----
>> De: Amit Gorantivar [mailto:amitg@i3-micro.com]
>> Enviado el: viernes 16 de junio de 2000 13:03
>> Para: Tomas Gutiérrez
>> Asunto: Re: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> Hi,
>> I think i am doing the logical sector encryption. I get the sector
>> number using “currentIrpStack-Parameters.Read.ByteOffset.LowPart9”.
>>
>> What i am doing is while writing the data on the disk I encrypt it and
>> in the completion routine of the write I decrypt the data, so the will
>> remains unencrypted in the buffer.
>> But You said its simultanieous write of the FAT, I think I got problem
>> there it self. I am printing all the 512 bytes going to the FAT,
>> but What i
>> obeserved
>> is when it writes the FAT its containts are deferent from the
>> containt which
>> i read from the disk.
>> Other thing is I am using direct io mechanism, and encrypting the data
>> stored in
>> “mapped system Vartual address”,does i have to encrypt some other data
>> buffer also which
>> is i am missing. Because i also observed that when i see the FAT using
>> the
>> diskeditor utillity from the DOS the
>> data is in unencrypted form.
>>
>> also how can i use the physical sector encrypt?
>>
>> Thanks
>> Maliye
>>
>> -----Original Message-----
>> From: Tomas Gutiérrez >> To: File Systems Developers >> Cc: amitg@i3-micro.com >> Date: Friday, June 16, 2000 9:50 AM
>> Subject: RE: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> Hello
>>
>> I don’t know if you’re developing a physical sector encrypt or
>> a logical driver encrypt. If you’re developing a phyisical encryption
>> you should see no difecencies among any file system.
>>
>> Probably this is a design problem. When I developed a driver
>> like this I had a similar problem like you and it was caused by the way
>> the FAT driver writes. When you modified a file the FAT driver reads
>> the FAT modified it and writes the two copies of the FAT
>> simultanieously.
>> If you’re using the write buffer and you are not allocating a new one
>> when the FAT driver tries to write the second time the FAT the buffer
>> is encrypted and your driver encrypt it again.
>>
>> The fact is you shouldn’t encrypt the same buffer what is used
>> by the upper layers to write because this buffer can be used while it is
>> encrypted.
>>
>> Perhaps this is not your problem, if you give me more data perharps
>> I can help you.
>>
>>
>> Bye
>>
>> -----Mensaje original-----
>> De: xxxxx@lists.osr.com
>> [mailto:xxxxx@lists.osr.com]En nombre de Amit Gorantivar
>> Enviado el: jueves 15 de junio de 2000 19:42
>> Para: File Systems Developers
>> Asunto: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> Hello Friends,
>> I am writing a disk filter driver ( or rewriting
>> diskperformance monitor
>> driver ). I am doing simple encryption and decryption
>> on the data( that is incriment the ascii value of the byte by one
>> while
>> encrypting and decriment the value bye one while decrypting).
>> Right now my driver is attached to only one partition. This
>> encryption and
>> decryption works fine with the NTFS
>> partition and I am able to keep the partition in encrypted form.
>> But if the partition is FAT, while writing data on it ( creating
>> any
>> folder or any thing else), its FAT table gets currpted ?
>> when i restart the machine the partition become inaccessble. How
>> can i solve
>> this problem ?
>>
>> Thanks in advance
>> Maliye
>>
>>
>> —
>> You are currently subscribed to ntfsd as: xxxxx@jazzfree.com
>> To unsubscribe send a blank email to $subst(‘Email.Unsub’)
>>
>>
>>
>>
>>
>>
>>
>> -----Original Message-----
>> From: Tomas Gutiérrez
>> To: Amit Gorantivar
>> Date: Friday, June 16, 2000 1:30 PM
>> Subject: RE: [ntfsd] Problem in writing encrypted data on the FAT
>> partition…
>>
>>
>> >Hi
>> >
>> > I’m think your’re encrypting in the right way except for
>> >using the upper layer buffer for encrypt the data. The FAT driver
>> >always and any other applications can make a asyncronous writes
>> >and use the buffer for any other thing before your completion
>> >routine is called. The applications always going to get strange data
>> >when reads it in this moment.
>> >
>> > What are you doing is what i call a physical sector encryption,
>> >i didn’t realize in your previous mail if you’re encrypting files or
>> >sector.
>> >
>> > I hope this help you. I think the first change you have to do
>> >is change the write buffer on every call and test your driver again.
>> >I you said that it is working fine over NTFS i’m quite sure that this
>> >is your problem.
>> >
>> >Bye.
>> >Tomas
>> >
>> >
>> >> -----Mensaje original-----
>> >> De: Amit Gorantivar [mailto:amitg@i3-micro.com]
>> >> Enviado el: viernes 16 de junio de 2000 13:03
>> >> Para: Tomas Gutiérrez
>> >> Asunto: Re: [ntfsd] Problem in writing encrypted data on the FAT
>> >> partition…
>> >>
>> >>
>> >> Hi,
>> >> I think i am doing the logical sector encryption. I get the sector
>> >> number using “currentIrpStack->Parameters.Read.ByteOffset.LowPart>>9”.
>> >>
>> >> What i am doing is while writing the data on the disk I encrypt it and
>> >> in the completion routine of the write I decrypt the data, so the will
>> >> remains unencrypted in the buffer.
>> >> But You said its simultanieous write of the FAT, I think I got problem
>> >> there it self. I am printing all the 512 bytes going to the FAT,
>> >> but What i
>> >> obeserved
>> >> is when it writes the FAT its containts are deferent from the
>> >> containt which
>> >> i read from the disk.
>> >> Other thing is I am using direct io mechanism, and encrypting the data
>> >> stored in
>> >> “mapped system Vartual address”,does i have to encrypt some other data
>> >> buffer also which
>> >> is i am missing. Because i also observed that when i see the FAT using
>> the
>> >> diskeditor utillity from the DOS the
>> >> data is in unencrypted form.
>> >>
>> >> also how can i use the physical sector encrypt?
>> >>
>> >> Thanks
>> >> Maliye
>> >>
>> >> -----Original Message-----
>> >> From: Tomas Gutiérrez
>> >> To: File Systems Developers
>> >> Cc: amitg@i3-micro.com
>> >> Date: Friday, June 16, 2000 9:50 AM
>> >> Subject: RE: [ntfsd] Problem in writing encrypted data on the FAT
>> >> partition…
>> >>
>> >>
>> >> >Hello
>> >> >
>> >> >I don’t know if you’re developing a physical sector encrypt or
>> >> >a logical driver encrypt. If you’re developing a phyisical encryption
>> >> >you should see no difecencies among any file system.
>> >> >
>> >> > Probably this is a design problem. When I developed a driver
>> >> >like this I had a similar problem like you and it was caused
>> by the way
>> >> >the FAT driver writes. When you modified a file the FAT driver reads
>> >> >the FAT modified it and writes the two copies of the FAT
>> simultanieously.
>> >> >If you’re using the write buffer and you are not allocating a new one
>> >> >when the FAT driver tries to write the second time the FAT the buffer
>> >> >is encrypted and your driver encrypt it again.
>> >> >
>> >> > The fact is you shouldn’t encrypt the same buffer what is used
>> >> >by the upper layers to write because this buffer can be used
>> while it is
>> >> >encrypted.
>> >> >
>> >> > Perhaps this is not your problem, if you give me more data perharps
>> >> >I can help you.
>> >> >
>> >> >
>> >> >Bye
>> >> >
>> >> >> -----Mensaje original-----
>> >> >> De: xxxxx@lists.osr.com
>> >> >> [mailto:xxxxx@lists.osr.com]En nombre de Amit
Gorantivar
>> >> >> Enviado el: jueves 15 de junio de 2000 19:42
>> >> >> Para: File Systems Developers
>> >> >> Asunto: [ntfsd] Problem in writing encrypted data on the FAT
>> >> >> partition…
>> >> >>
>> >> >>
>> >> >> Hello Friends,
>> >> >> I am writing a disk filter driver ( or rewriting
>> >> >> diskperformance monitor
>> >> >> driver ). I am doing simple encryption and decryption
>> >> >> on the data( that is incriment the ascii value of the byte by one
>> while
>> >> >> encrypting and decriment the value bye one while decrypting).
>> >> >> Right now my driver is attached to only one partition. This
>> >> >> encryption and
>> >> >> decryption works fine with the NTFS
>> >> >> partition and I am able to keep the partition in encrypted form.
>> >> >> But if the partition is FAT, while writing data on it ( creating
>> any
>> >> >> folder or any thing else), its FAT table gets currpted ?
>> >> >> when i restart the machine the partition become inaccessble. How
>> >> >> can i solve
>> >> >> this problem ?
>> >> >>
>> >> >> Thanks in advance
>> >> >> Maliye
>> >> >>
>> >> >>
>> >> >> —
>> >> >> You are currently subscribed to ntfsd as: xxxxx@jazzfree.com
>> >> >> To unsubscribe send a blank email to
$subst(‘Email.Unsub’)
>> >> >>
>> >> >
>> >>
>> >
>> >
>>
>
>