Initialize internal block cipher state for a given key. This call is used to establish state for use of the block cipher with the given key. The resulting state is passed to the Encrypt or Decrpyt call for each block to be encrypted or decrypted. This state can serve as an optimized cache of a key transform (e.g., an expanded key in AES), so that the transform does not need to be repeated for every call. Since only the state is passed, it is a requirement that the state include everything necessary to perform the encryption or decryption (e.g., the key itself, or a transform of the key). The key buffer will remain valid for the entire duration of use of the key state (thus, it is safe to store a pointer to the key in the key state instead of copying the key). This call must be thread safe, and should not depend on any non-const global data. This call must not be NULL.
|