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