1 /***************************************************************************
2  *
3  * <COPYRIGHT_TAG>
4  *
5  ***************************************************************************/
6 
7 /**
8  *****************************************************************************
9  * @file lac_sym_hash.h
10  *
11  * @defgroup  LacHash  Hash
12  *
13  * @ingroup LacSym
14  *
15  * API functions of the Hash component
16  *
17  * @lld_start
18  * @lld_overview
19  * There is a single \ref cpaCySym "Symmetric LAC API" for hash, cipher,
20  * auth encryption and algorithm chaining. This API is implemented by the
21  * \ref LacSym "Symmetric" module. It demultiplexes calls to this API into
22  * their basic operation and does some common parameter checking and deals
23  * with accesses to the session table.
24  *
25  * The hash component supports hashing in 3 modes. PLAIN, AUTH and NESTED.
26  * Plain mode is used to provide data integrity while auth mode is used to
27  * provide integrity as well as its authenticity. Nested mode is inteded
28  * for use by non standard HMAC like algorithms such as for the SSL master
29  * key secret. Partial packets is supported for both plain and auth modes.
30  * In-place and out-of-place processing is supported for all modes. The
31  * verify operation is supported for PLAIN and AUTH modes only.
32  *
33  * The hash component is responsible for implementing the hash specific
34  * functionality for initialising a session and for a perform operation.
35  * Statistics are maintained in the symmetric \ref CpaCySymStats64 "stats"
36  * structure. This module has been seperated out into two. The hash QAT module
37  * deals entirely with QAT data structures. The hash module itself has minimal
38  * exposure to the QAT data structures.
39  *
40  * @lld_dependencies
41  * - \ref LacCommon
42  * - \ref LacSymQat "Symmetric QAT": Hash uses the lookup table provided by
43  *   this module to validate user input. Hash also uses this module to build
44  *   the hash QAT request message, request param structure, populate the
45  *   content descriptor, allocate and populate the hash state prefix buffer.
46  *   Hash also registers its function to process the QAT response with this
47  *   module.
48  * - OSAL : For memory functions, atomics and locking
49  *
50  * @lld_module_algorithms
51  * <b>a. HMAC Precomputes</b>\n
52  * HMAC algorithm is specified as follows:
53  * \f$ HMAC(msg) = hash((key \oplus opad) \parallel
54  * hash((key \oplus ipad) \parallel msg ))\f$.
55  * The key is fixed per session, and is padded up to the block size of the
56  * algorithm if necessary and xored with the ipad/opad. The following portion
57  * of the operation can be precomputed: \f$ hash(key \oplus ipad) \f$ as the
58  * output of this intermediate hash will be the same for every perform
59  * operation. This intermediate state is the intermediate state of a partial
60  * partial packet. It is used as the initialiser state to \f$ hash(msg) \f$.
61  * The same applies to \f$ hash(key \oplus ipad) \f$. There is a saving in
62  * the data path by the length of time it takes to do two hashes on a block
63  * size of data. Note: a partial packet operation generates an intermediate
64  * state. The final operation on a partial packet or when a full packet is
65  * used applies padding and gives the final hash result. Esentially for the
66  * inner hash, a partial packet final is issued on the data, using the
67  * precomputed intermediate state and returns the digest.
68  *
69  * For the HMAC precomputes, \ref LacSymHash_HmacPreCompute(), there are two
70  * hash operations done using a internal content descriptor to configure the
71  * QAT. A first partial packet is specified as the packet type for the
72  * pre-computes as we need the state that uses the initialiser constants
73  * specific to the algorithm. The resulting output is copied from the hash
74  * state prefix buffer into the QAT content descriptor for the session being
75  * initialised. The state is used each perform operation as the initialiser
76  * to the algorithm
77  *
78  * <b>b. AES XCBC Precomputes</b>\n
79  * A similar technique to HMAC will be used to generate the precomputes for
80  * AES XCBC. In this case a cipher operation will be used to generate the
81  * precomputed result. The Pre-compute operation involves deriving 3 128-bit
82  *  keys (K1, K2 and K3) from the 128-bit secret key K.
83  *
84  * - K1 = 0x01010101010101010101010101010101 encrypted with Key K
85  * - K2 = 0x02020202020202020202020202020202 encrypted with Key K
86  * - K3 = 0x03030303030303030303030303030303 encrypted with Key K
87  *
88  * A content descriptor  is created with the cipher algorithm set to AES
89  * in ECB mode and with the keysize set to 128 bits. The 3 constants, 16 bytes
90  * each, are copied into the src buffer and an in-place cipher operation is
91  * performed on the 48 bytes. ECB mode does not maintain the state, therefore
92  * the 3 keys can be encrypted in one perform. The encrypted result is used by
93  * the state2 field in the hash setup block of the content descriptor.
94  *
95  * The precompute operations use a different lac command ID and thus have a
96  * different route in the response path to the symmetric code. In this
97  * precompute callback function the output of the precompute operation is
98  * copied into the content descriptor for the session being registered.
99  *
100  * <b>c. AES CCM Precomputes</b>\n
101  * The precomputes for AES CCM are trivial, i.e. there is no need to perform
102  * a cipher or a digest operation.  Instead, the key is stored directly in
103  * the state2 field.
104  *
105  * <b>d. AES GCM Precomputes</b>\n
106  * As with AES XCBC precomputes, a cipher operation will be used to generate
107  * the precomputed result for AES GCM.  In this case the Galois Hash
108  * Multiplier (H) must be derived and stored in the state2 field.  H is
109  * derived by encrypting a 16-byte block of zeroes with the
110  * cipher/authentication key, using AES in ECB mode.
111  *
112  * <b>Key size for Auth algorithms</b>\n
113  * <i>Min Size</i>\n
114  * RFC 2104 states "The key for HMAC can be of any length. However, less than
115  *  L bytes is strongly discouraged as it would decrease the security strength
116  *  of the function."
117  *
118  * FIPS 198a states "The size of the key, K, shall be equal to or greater than
119  * L/2, where L is the size of the hash function output."
120  *
121  * RFC 4434 states "If the key has fewer than 128 bits, lengthen it to exactly
122  * 128 bits by padding it on the right with zero bits.
123  *
124  * A key length of 0 upwards is accepted. It is up to the client to pass in a
125  * key that complies with the standard they wish to support.
126  *
127  * <i>Max Size</i>\n
128  * RFC 2104 section 2 states : "Applications that use keys longer than B bytes
129  * will first hash the key using H and then use the resultant L byte string
130  * as the actual key to HMAC
131  *
132  * RFC 4434 section 2 states:
133  * "If the key is 129 bits or longer, shorten it to exactly 128 bits
134  *  by performing the steps in AES-XCBC-PRF-128 (that is, the
135  *  algorithm described in this document).  In that re-application of
136  *  this algorithm, the key is 128 zero bits; the message is the
137  *  too-long current key."
138  *
139  * We push this up to the client. They need to do the hash operation through
140  * the LAC API if the key is greater than the block size of the algorithm. This
141  * will reduce the key size to the digest size of the algorithm.
142  *
143  * RFC 3566 section 4 states:
144  * AES-XCBC-MAC-96 is a secret key algorithm.  For use with either ESP or
145  * AH a fixed key length of 128-bits MUST be supported.  Key lengths
146  * other than 128-bits MUST NOT be supported (i.e., only 128-bit keys are
147  * to be used by AES-XCBC-MAC-96).
148  *
149  * In this case it is up to the client to provide a key that complies with
150  * the standards. i.e. exactly 128 bits in size.
151  *
152  *
153  * <b>HMAC-MD5-96 and HMAC-SHA1-96</b>\n
154  * HMAC-MD5-96 and HMAC-SHA1-96 are defined as requirements by Look Aside
155  * IPsec. The differences between HMAC-SHA1 and HMAC-SHA1-96 are that the
156  * digest produced is truncated and there are strict requirements on the
157  * size of the key that is used.
158  *
159  * They are supported in LAC by HMAC-MD5 and HMAC-SHA1. The field
160  * \ref CpaCySymHashSetupData::digestResultLenInBytes in the LAC API in
161  * bytes needs to be set to 12 bytes. There are also requirements regarding
162  * the keysize. It is up to the client to ensure the key size meets the
163  * requirements of the standards they are using.
164  *
165  * RFC 2403: HMAC-MD5-96 Key lengths other than 128-bits MUST NOT be supported.
166  * HMAC-MD5-96 produces a 128-bit authenticator value. For use with either
167  * ESP or AH, a truncated value using the first 96 bits MUST be supported.
168  *
169  * RFC2404: HMAC-SHA1-96 Key lengths other than 160- bits MUST NOT be supported
170  * HMAC-SHA-1-96 produces a 160-bit authenticator value. For use with either
171  * ESP or AH, a truncated value using the first 96 bits MUST be supported.
172  *
173  * <b>Out of place operations</b>
174  * When verify is disabled, the digest will be written to the destination
175  * buffer. When verify is enabled, the digest calculated is compared to the
176  * digest stored in the source buffer.
177  *
178  * <b>Partial Packets</b>
179  * Partial packets are handled in the \ref LacSym "Symmetric" component for
180  * the request. The hash callback function handles the update of the state
181  * in the callback.
182  *
183  *
184  * @lld_process_context
185  *
186  * Session Register Sequence Diagram: For hash modes plain and nested.
187  * \msc
188  *  APP [label="Application"], SYM [label="Symmetric LAC"],
189  *  Achain [label="Alg chain"], Hash, SQAT [label="Symmetric QAT"];
190  *
191  *  APP=>SYM [ label = "cpaCySymInitSession(cbFunc)",
192  *             URL="\ref cpaCySymInitSession()"] ;
193  *  SYM=>SYM [ label = "LacSymSession_ParamCheck()",
194  *             URL="\ref LacSymSession_ParamCheck()"];
195  *  SYM=>Achain [ label = "LacAlgChain_SessionInit()",
196  *                URL="\ref LacAlgChain_SessionInit()"];
197  *  Achain=>Hash [ label = "LacHash_HashContextCheck()",
198  *               URL="\ref LacHash_HashContextCheck()"];
199  *  Achain<<Hash [ label="return"];
200  *  Achain=>SQAT [ label = "LacSymQat_HashContentDescInit()",
201  *               URL="\ref LacSymQat_HashContentDescInit()"];
202  *  Achain<<SQAT [ label="return"];
203  *  Achain=>Hash [ label = "LacHash_StatePrefixAadBufferInit()",
204  *               URL="\ref LacHash_StatePrefixAadBufferInit()"];
205  *  Hash=>SQAT [ label = "LacSymQat_HashStatePrefixAadBufferSizeGet()",
206  *               URL="\ref LacSymQat_HashStatePrefixAadBufferSizeGet()"];
207  *  Hash<<SQAT [ label="return"];
208  *  Hash=>SQAT [ label = "LacSymQat_HashStatePrefixAadBufferPopulate()",
209  *               URL="\ref LacSymQat_HashStatePrefixAadBufferPopulate()"];
210  *  Hash<<SQAT [ label="return"];
211  *  Achain<<Hash [ label="return"];
212  *  SYM<<Achain [ label = "status" ];
213  *  SYM=>SYM [label = "LAC_SYM_STAT_INC", URL="\ref LAC_SYM_STAT_INC"];
214  *  APP<<SYM [label = "status"];
215  * \endmsc
216  *
217  * Perform Sequence Diagram: For all 3 modes, full packets and in-place.
218  * \msc
219  *  APP [label="Application"], SYM [label="Symmetric LAC"],
220  *  Achain [label="Alg chain"], Hash, SQAT [label="Symmetric QAT"],
221  *  QATCOMMS [label="QAT Comms"];
222  *
223  *  APP=>SYM [ label = "cpaCySymPerformOp()",
224  *             URL="\ref cpaCySymPerformOp()"] ;
225  *  SYM=>SYM [ label = "LacSymPerform_BufferParamCheck()",
226  *              URL="\ref LacSymPerform_BufferParamCheck()"];
227  *  SYM=>Achain [ label = "LacAlgChain_Perform()",
228  *                URL="\ref LacAlgChain_Perform()"];
229  *  Achain=>Achain [ label = "Lac_MemPoolEntryAlloc()",
230  *                  URL="\ref Lac_MemPoolEntryAlloc()"];
231  *  Achain=>SQAT [ label = "LacSymQat_packetTypeGet()",
232  *               URL="\ref LacSymQat_packetTypeGet()"];
233  *  Achain<<SQAT [ label="return"];
234  *  Achain=>Achain [ label = "LacBuffDesc_BufferListTotalSizeGet()",
235  *                  URL="\ref LacBuffDesc_BufferListTotalSizeGet()"];
236  *  Achain=>Hash [ label = "LacHash_PerformParamCheck()",
237  *                  URL = "\ref LacHash_PerformParamCheck()"];
238  *  Achain<<Hash [ label="status"];
239  *  Achain=>SQAT [ label = "LacSymQat_HashRequestParamsPopulate()",
240  *               URL="\ref LacSymQat_HashRequestParamsPopulate()"];
241  *  Achain<<SQAT [ label="return"];
242  *  Achain<<SQAT [ label="cmdFlags"];
243  *
244  *  Achain=>Achain [ label = "LacBuffDesc_BufferListDescWrite()",
245  *               URL="\ref LacBuffDesc_BufferListDescWrite()"];
246  *  Achain=>SQAT [ label = "SalQatMsg_CmnMsgAndReqParamsPopulate()",
247  *               URL="\ref SalQatMsg_CmnMsgAndReqParamsPopulate()"];
248  *  Achain<<SQAT [ label="return"];
249  *  Achain=>SYM [ label = "LacSymQueue_RequestSend()",
250  *                URL="\ref LacSymQueue_RequestSend()"];
251  *  SYM=>QATCOMMS [ label = "QatComms_MsgSend()",
252  *                   URL="\ref QatComms_MsgSend()"];
253  *  SYM<<QATCOMMS [ label="status"];
254  *  Achain<<SYM   [ label="status"];
255  *  SYM<<Achain [ label="status"];
256  *  SYM=>SYM [label = "LAC_SYM_STAT_INC", URL="\ref LAC_SYM_STAT_INC"];
257  *  APP<<SYM [label = "status"];
258  *  ... [label = "QAT processing the request and generates response.
259  *       Callback in Bottom Half Context"];
260  *  ...;
261  *  QATCOMMS=>QATCOMMS [label ="QatComms_ResponseMsgHandler()",
262  *                       URL="\ref QatComms_ResponseMsgHandler()"];
263  *  QATCOMMS=>SQAT [label ="LacSymQat_SymRespHandler()",
264  *                   URL="\ref LacSymQat_SymRespHandler()"];
265  *  SQAT=>SYM [label="LacSymCb_ProcessCallback()",
266  *              URL="\ref LacSymCb_ProcessCallback()"];
267  *  SYM=>SYM [label = "LacSymCb_ProcessCallbackInternal()",
268  *            URL="\ref LacSymCb_ProcessCallbackInternal()"];
269  *  SYM=>SYM [label = "Lac_MemPoolEntryFree()",
270  *            URL="\ref Lac_MemPoolEntryFree()"];
271  *  SYM=>SYM [label = "LAC_SYM_STAT_INC", URL="\ref LAC_SYM_STAT_INC"];
272  *  SYM=>APP [label="cbFunc"];
273  *  APP>>SYM [label="return"];
274  *  SYM>>SQAT [label="return"];
275  *  SQAT>>QATCOMMS [label="return"];
276  * \endmsc
277  *
278  * @lld_end
279  *
280  *****************************************************************************/
281 
282 /*****************************************************************************/
283 
284 #ifndef LAC_SYM_HASH_H
285 #define LAC_SYM_HASH_H
286 
287 /*
288 ******************************************************************************
289 * Include public/global header files
290 ******************************************************************************
291 */
292 
293 #include "cpa.h"
294 #include "cpa_cy_sym.h"
295 
296 /*
297 *******************************************************************************
298 * Include private header files
299 *******************************************************************************
300 */
301 
302 #include "lac_session.h"
303 #include "lac_buffer_desc.h"
304 
305 /**
306  *****************************************************************************
307  * @ingroup LacHash
308  *      Definition of callback function.
309  *
310  * @description
311  *      This is the callback function prototype. The callback function is
312  *      invoked when a hash precompute operation completes.
313  *
314  * @param[in] pCallbackTag  Opaque value provided by user while making
315  *                         individual function call.
316  *
317  * @retval
318  *      None
319  *****************************************************************************/
320 typedef void (*lac_hash_precompute_done_cb_t)(void *pCallbackTag);
321 
322 /*
323  * WARNING: There are no checks done on the parameters of the functions in
324  * this file. The expected values of the parameters are documented and it is
325  * up to the caller to provide valid values.
326  */
327 
328 /**
329 *******************************************************************************
330 * @ingroup LacHash
331 *      validate the hash context
332 *
333 * @description
334 *      The client populates the hash context in the session context structure
335 *      This is passed as parameter to the session register API function and
336 *      needs to be validated.
337 *
338 * @param[in] pHashSetupData      pointer to hash context structure
339 *
340 * @retval CPA_STATUS_SUCCESS        Success
341 * @retval CPA_STATUS_INVALID_PARAM  Invalid parameter
342 *
343 *****************************************************************************/
344 CpaStatus LacHash_HashContextCheck(CpaInstanceHandle instanceHandle,
345 				   const CpaCySymHashSetupData *pHashSetupData);
346 
347 /**
348  ******************************************************************************
349  * @ingroup LacHash
350  *      Populate the hash pre-compute data.
351  *
352  * @description
353  *      This function populates the state1 and state2 fields with the hash
354  *      pre-computes.  This is only done for authentication.  The state1
355  *      and state2 pointers must be set to point to the correct locations
356  *      in the content descriptor where the precompute result(s) will be
357  *      written, before this function is called.
358  *
359  * @param[in] instanceHandle    Instance Handle
360  * @param[in] pSessionSetup     pointer to session setup data
361  * @param[in] callbackFn        Callback function which is invoked when
362  *                              the precompute operation is completed
363  * @param[in] pCallbackTag       Opaque data which is passed back to the user
364  *                              as a parameter in the callback function
365  * @param[out] pWorkingBuffer   Pointer to working buffer, sufficient memory
366  *                              must be allocated by the caller for this.
367  *                              Assumption that this is 8 byte aligned.
368  * @param[out] pState1          pointer to State 1 in content descriptor
369  * @param[out] pState2          pointer to State 2 in content descriptor
370  *
371  * @retval CPA_STATUS_SUCCESS    Success
372  * @retval CPA_STATUS_RETRY      Retry the operation.
373  * @retval CPA_STATUS_RESOURCE   Error Allocating memory
374  * @retval CPA_STATUS_FAIL       Operation Failed
375  *
376  *****************************************************************************/
377 CpaStatus LacHash_PrecomputeDataCreate(const CpaInstanceHandle instanceHandle,
378 				       CpaCySymSessionSetupData *pSessionSetup,
379 				       lac_hash_precompute_done_cb_t callbackFn,
380 				       void *pCallbackTag,
381 				       Cpa8U *pWorkingBuffer,
382 				       Cpa8U *pState1,
383 				       Cpa8U *pState2);
384 
385 /**
386  ******************************************************************************
387  * @ingroup LacHash
388  *      populate the hash state prefix aad buffer.
389  *
390  * @description
391  *      This function populates the hash state prefix aad buffer. This function
392  *      is not called for CCM/GCM operations as the AAD data varies per request
393  *      and is stored in the cookie as opposed to the session descriptor.
394  *
395  * @param[in] pHashSetupData        pointer to hash setup structure
396  * @param[in] pHashControlBlock     pointer to hash control block
397  * @param[in] qatHashMode           QAT Mode for hash
398  * @param[in] pHashStateBuffer      pointer to hash state prefix aad buffer
399  * @param[in] pHashStateBufferInfo  Pointer to hash state prefix buffer info
400  *
401  * @retval CPA_STATUS_SUCCESS       Success
402  * @retval CPA_STATUS_FAIL          Operation Failed
403  *
404  *****************************************************************************/
405 CpaStatus LacHash_StatePrefixAadBufferInit(
406     sal_service_t *pService,
407     const CpaCySymHashSetupData *pHashSetupData,
408     icp_qat_la_bulk_req_ftr_t *pHashControlBlock,
409     icp_qat_hw_auth_mode_t qatHashMode,
410     Cpa8U *pHashStateBuffer,
411     lac_sym_qat_hash_state_buffer_info_t *pHashStateBufferInfo);
412 
413 /**
414 *******************************************************************************
415 * @ingroup LacHash
416 *      Check parameters for a hash perform operation
417 *
418 * @description
419 *      This function checks the parameters for a hash perform operation.
420 *
421 * @param[in] pSessionDesc        Pointer to session descriptor.
422 * @param[in] pOpData             Pointer to request parameters.
423 * @param[in] srcPktSize          Total size of the Buffer List
424 * @param[in] pVerifyResult       Pointer to user flag
425 *
426 * @retval CPA_STATUS_SUCCESS       Success
427 * @retval CPA_STATUS_INVALID_PARAM Invalid Parameter
428 *
429 *****************************************************************************/
430 CpaStatus LacHash_PerformParamCheck(CpaInstanceHandle instanceHandle,
431 				    lac_session_desc_t *pSessionDesc,
432 				    const CpaCySymOpData *pOpData,
433 				    Cpa64U srcPktSize,
434 				    const CpaBoolean *pVerifyResult);
435 
436 /**
437 *******************************************************************************
438 * @ingroup LacHash
439 *      Perform hash precompute operation for HMAC
440 *
441 * @description
442 *      This function sends 2 requests to the CPM for the hmac precompute
443 *      operations. The results of the ipad and opad state calculation
444 *      is copied into pState1 and pState2 (e.g. these may be the state1 and
445 *      state2 buffers in a hash content desciptor) and when
446 *      the final operation has completed the condition passed as a param to
447 *      this function is set to true.
448 *
449 *      This function performs the XORing of the IPAD and OPAD constants to
450 *      the key (which was padded to the block size of the algorithm)
451 *
452 * @param[in]  instanceHandle       Instance Handle
453 * @param[in]  hashAlgorithm        Hash Algorithm
454 * @param[in]  authKeyLenInBytes    Length of Auth Key
455 * @param[in]  pAuthKey             Pointer to Auth Key
456 * @param[out] pWorkingMemory       Pointer to working memory that is carved
457 *                                  up and used in the pre-compute operations.
458 *                                  Assumption that this is 8 byte aligned.
459 * @param[out] pState1              Pointer to State 1 in content descriptor
460 * @param[out] pState2              Pointer to State 2 in content descriptor
461 * @param[in]  callbackFn           Callback function which is invoked when
462 *                                  the precompute operation is completed
463 * @param[in]  pCallbackTag         Opaque data which is passed back to the user
464 *                                  as a parameter in the callback function
465 *
466 * @retval CPA_STATUS_SUCCESS       Success
467 * @retval CPA_STATUS_RETRY         Retry the operation.
468 * @retval CPA_STATUS_FAIL          Operation Failed
469 *
470 *****************************************************************************/
471 CpaStatus LacSymHash_HmacPreComputes(CpaInstanceHandle instanceHandle,
472 				     CpaCySymHashAlgorithm hashAlgorithm,
473 				     Cpa32U authKeyLenInBytes,
474 				     Cpa8U *pAuthKey,
475 				     Cpa8U *pWorkingMemory,
476 				     Cpa8U *pState1,
477 				     Cpa8U *pState2,
478 				     lac_hash_precompute_done_cb_t callbackFn,
479 				     void *pCallbackTag);
480 
481 /**
482 *******************************************************************************
483  * @ingroup LacHash
484  *      Perform hash precompute operation for XCBC MAC and GCM
485  *
486  * @description
487  *      This function sends 1 request to the CPM for the precompute operation
488  *      based on an AES ECB cipher. The results of the calculation is copied
489  *      into pState (this may be a pointer to the State 2 buffer in a Hash
490  *      content descriptor) and when the operation has completed the condition
491  *      passed as a param to this function is set to true.
492  *
493  * @param[in]  instanceHandle       Instance Handle
494  * @param[in]  hashAlgorithm        Hash Algorithm
495  * @param[in]  authKeyLenInBytes    Length of Auth Key
496  * @param[in]  pAuthKey             Auth Key
497  * @param[out] pWorkingMemory       Pointer to working memory that is carved
498  *                                  up and used in the pre-compute operations.
499  *                                  Assumption that this is 8 byte aligned.
500  * @param[out] pState               Pointer to output state
501  * @param[in]  callbackFn           Callback function which is invoked when
502  *                                  the precompute operation is completed
503  * @param[in]  pCallbackTag         Opaque data which is passed back to the user
504  *                                  as a parameter in the callback function
505 
506  *
507  * @retval CPA_STATUS_SUCCESS       Success
508  * @retval CPA_STATUS_RETRY         Retry the operation.
509  * @retval CPA_STATUS_FAIL          Operation Failed
510  *
511  *****************************************************************************/
512 CpaStatus LacSymHash_AesECBPreCompute(CpaInstanceHandle instanceHandle,
513 				      CpaCySymHashAlgorithm hashAlgorithm,
514 				      Cpa32U authKeyLenInBytes,
515 				      Cpa8U *pAuthKey,
516 				      Cpa8U *pWorkingMemory,
517 				      Cpa8U *pState,
518 				      lac_hash_precompute_done_cb_t callbackFn,
519 				      void *pCallbackTag);
520 
521 /**
522 *******************************************************************************
523 * @ingroup LacHash
524 *      initialise data structures for the hash precompute operations
525 *
526 * @description
527 *      This function registers the precompute callback handler function, which
528 *      is different to the default one used by symmetric. Content desciptors
529 *      are preallocted for the hmac precomputes as they are constant for these
530 *      operations.
531 *
532 * @retval CPA_STATUS_SUCCESS       Success
533 * @retval CPA_STATUS_RESOURCE      Error allocating memory
534 *
535 *****************************************************************************/
536 CpaStatus LacSymHash_HmacPrecompInit(CpaInstanceHandle instanceHandle);
537 
538 /**
539 *******************************************************************************
540 * @ingroup LacHash
541 *      free resources allocated for the precompute operations
542 *
543 * @description
544 *      free up the memory allocated on init time for the content descriptors
545 *      that were allocated for the HMAC precompute operations.
546 *
547 * @return none
548 *
549 *****************************************************************************/
550 void LacSymHash_HmacPrecompShutdown(CpaInstanceHandle instanceHandle);
551 
552 void LacSync_GenBufListVerifyCb(void *pCallbackTag,
553 				CpaStatus status,
554 				CpaCySymOp operationType,
555 				void *pOpData,
556 				CpaBufferList *pDstBuffer,
557 				CpaBoolean opResult);
558 
559 #endif /* LAC_SYM_HASH_H */
560