Chapter 4 Details of Crypto-C Functions 301
B_DecryptInit
B_DecryptInit
Description
B_DecryptInit initializes algorithmObject for decrypting data using the algorithm
specified by a previous call to
B_SetAlgorithmInfo. The key object for supplying the
key information is
keyObject. The chooser for selecting the algorithm method is
algorithmChooser
. The surrender context for processing and canceling during lengthy
operations is
surrenderContext
; if its value is (A_SURRENDER_CTX *)NULL_PTR, Crypto-C
does not use it.
B_DecryptInit only needs to be called once to set up a key. The B_DecryptUpdate
routine can be called multiple times to process blocks of data, and
B_DecryptFinal is
called once to process the last block, which includes removing the trailing pad bytes.
After
B_DecryptFinal is called, B_DecryptUpdate can be called to start processing
another sequence of blocks that were encrypted in the same key. If a different CBC
Initialization Vector (IVs) is used with each sequence of blocks,
B_SetAlgorithmInfo
can be called with
AI_CBC_IV8 to set the new IV before calling B_DecryptUpdate.
There is no need to call
B_DecryptInit again with the same key.
Return value
int B_DecryptInit (
B_ALGORITHM_OBJ algorithmObject, /* algorithm object */
B_KEY_OBJ keyObject, /* key object */
B_ALGORITHM_CHOOSER algorithmChooser, /* algorithm chooser */
A_SURRENDER_CTX *surrenderContext /* surrender context */
);
Value Description
0 Operation was successful.
non-zero see Appendix A, ”Crypto-C Error Types”