MyBltDataCrypto


< Prev  TOC  Next >

TBLT_RETC TBLT_CALLBACK MyBltDataCrypto(ULONG mode,
                                        TBLT_DH *dhPtr,
                                        VOID *recordPtr,
                                        ULONG recNo);


 mode           I:sub-function to perform
 dhPtr          I:data file control structure
 recordPtr      IO:record data
 recNo          I:number of the record (informational)

Note: This routine is not part of the base Bullet 3 package but is documented here for the record. An example crypto routine is included in the regular distribution (crypto.c). Once written, a function pointer to the crypto routine is assigned to TBLT_DH.cryptoPtr.

This routine encrypts or decrypts the data record, depending on the mode.

The mode parameter varies depending on which Bullet routine calls here:

 CRYPTO_FROM_RECADD     from BltDataAddRecord()
 CRYPTO_FROM_XRECADD    (at Add exit)
 CRYPTO_FROM_RECUPD     from BltDataUpdateRecord()
 CRYPTO_FROM_XRECUPD    (at Update exit)
 CRYPTO_FROM_RECGET     from BltDataGetRecord()

For RECADD and RECUPD, the data record should be encrypted. For RECGET, XRECADD, and XRECUPD, it should be decrypted. The data is both read and written to recordPtr. The size of the record is available in dhPtr->recordLength. The recNo is provided for informational use. In the case of RECADD/XRECADD, recNo is always 0.

There is no memo crypto since memo I/O is already under total control of the programmer.

Return: Non-zero indicates an error, otherwise the data at recordPtr has been encrypted or decrypted.

All content Copyright © 1999 Cornel Huth. All rights reserved.