ravikumar Amaravadi <[EMAIL PROTECTED]> writes:
> We are developing an application to Encrypt the contents of MemoDB and
> rewrite the cipher contents back...In the process, when MemoDB size is
> of 8 KB with 10 records, we are able to encrypt and maintain the
> ciphers in the Database. But when we are decrypting the ciphers back,
> we are running out of Dynamic memory space with the error showing
> "Memory Mgr.c NULL Handle"...How do we cope up with this problem of
> memory management ? Our application size is of 67 KB and the PalmOS
> ver is 3.2 and RAM is of 2 MB...
If you're using some kind of block cipher, your best method is to
encrypt and decrypt to a database rather than to memory in the
heap. Then, you only have to maintain a chunk of memory the size of the
block. Something like:
UInt16 o_offset = 0;
UInt16 i_offset = 0;
MemHandle input = DmQueryRecord(db, recnum);
void* inputp = MemHandleLock(input);
MemHandle output = DmResizeRecord(tmpdb, 0, required_size);
UInt8* block = MemPtrNew(blocksize);
for ( ... ) { // Fill in appropriate loop conditions
decrypt(input + i_offset, block, params...);
DmWrite(output, o_offset, block, sizeof(block));
i_offset += blocksize;
o_offset += blocksize;
}
I use this technique with EncDES all the time. I also use a similar
technique when doing compression and uncompression.
--
Dave Carrigan ([EMAIL PROTECTED]) | Yow! Did I do an INCORRECT
UNIX-Apache-Perl-Linux-Firewalls-LDAP-C-DNS | THING??
Seattle, WA, USA |
http://www.rudedog.org/ |
--
For information on using the Palm Developer Forums, or to unsubscribe, please see
http://www.palmos.com/dev/tech/support/forums/