1 /***************************************************************************
2  *
3  *   BSD LICENSE
4  *
5  *   Copyright(c) 2007-2023 Intel Corporation. All rights reserved.
6  *   All rights reserved.
7  *
8  *   Redistribution and use in source and binary forms, with or without
9  *   modification, are permitted provided that the following conditions
10  *   are met:
11  *
12  *     * Redistributions of source code must retain the above copyright
13  *       notice, this list of conditions and the following disclaimer.
14  *     * Redistributions in binary form must reproduce the above copyright
15  *       notice, this list of conditions and the following disclaimer in
16  *       the documentation and/or other materials provided with the
17  *       distribution.
18  *     * Neither the name of Intel Corporation nor the names of its
19  *       contributors may be used to endorse or promote products derived
20  *       from this software without specific prior written permission.
21  *
22  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
23  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
24  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
25  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
26  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
27  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
28  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
29  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
30  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
31  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
32  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
33  *
34  *
35  ***************************************************************************/
36 
37 /*
38  *****************************************************************************
39  * Doxygen group definitions
40  ****************************************************************************/
41 
42 /**
43  *****************************************************************************
44  * @file cpa_cy_key.h
45  *
46  * @defgroup cpaCyKeyGen Cryptographic Key and Mask Generation API
47  *
48  * @ingroup cpaCy
49  *
50  * @description
51  *      These functions specify the API for key and mask generation
52  *      operations.
53  *
54  *****************************************************************************/
55 
56 #ifndef CPA_CY_KEY_H
57 #define CPA_CY_KEY_H
58 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif
62 
63 #include "cpa_cy_common.h"
64 #include "cpa_cy_sym.h" /* needed for hash algorithm, for MGF */
65 
66 /**
67  *****************************************************************************
68  * @ingroup cpaCyKeyGen
69  *      SSL or TLS key generation random number length.
70  *
71  * @description
72  *      Defines the permitted SSL or TLS random number length in bytes that
73  *      may be used with the functions @ref cpaCyKeyGenSsl and @ref
74  *      cpaCyKeyGenTls.   This is the length of the client or server random
75  *      number values.
76  *****************************************************************************/
77 #define CPA_CY_KEY_GEN_SSL_TLS_RANDOM_LEN_IN_BYTES   (32)
78 
79 /**
80  *****************************************************************************
81  * @ingroup cpaCyKeyGen
82  *      SSL Operation Types
83  * @description
84  *      Enumeration of the different SSL operations that can be specified in
85  *      the struct @ref CpaCyKeyGenSslOpData.  It identifies the label.
86  *****************************************************************************/
87 typedef enum _CpaCyKeySslOp
88 {
89     CPA_CY_KEY_SSL_OP_MASTER_SECRET_DERIVE = 1,
90     /**< Derive the master secret */
91     CPA_CY_KEY_SSL_OP_KEY_MATERIAL_DERIVE,
92     /**< Derive the key material */
93     CPA_CY_KEY_SSL_OP_USER_DEFINED
94     /**< User Defined Operation for custom labels*/
95 } CpaCyKeySslOp;
96 
97 
98 /**
99  *****************************************************************************
100  * @ingroup cpaCyKeyGen
101  *      SSL data for key generation functions
102  * @description
103  *      This structure contains data for use in key generation operations for
104  *      SSL. For specific SSL key generation operations, the structure fields
105  *      MUST be set as follows:
106  *
107  *      @par SSL Master-Secret Derivation:
108  *          <br> sslOp = CPA_CY_KEY_SSL_OP_MASTER_SECRET_DERIVE
109  *          <br> secret = pre-master secret key
110  *          <br> seed = client_random + server_random
111  *          <br> userLabel = NULL
112  *
113  *      @par SSL Key-Material Derivation:
114  *          <br> sslOp = CPA_CY_KEY_SSL_OP_KEY_MATERIAL_DERIVE
115  *          <br> secret = master secret key
116  *          <br> seed = server_random + client_random
117  *          <br> userLabel = NULL
118  *
119  *          <br> Note that the client/server random order is reversed from that
120  *          used for master-secret derivation.
121  *
122  *      @note Each of the client and server random numbers need to be of
123  *      length CPA_CY_KEY_GEN_SSL_TLS_RANDOM_LEN_IN_BYTES.
124  *
125  *      @note In each of the above descriptions, + indicates concatenation.
126  *
127  *      @note The label used is predetermined by the SSL operation in line
128  *      with the SSL 3.0 specification, and can be overridden by using
129  *      a user defined operation CPA_CY_KEY_SSL_OP_USER_DEFINED and
130  *      associated userLabel.
131  *
132  ****************************************************************************/
133 typedef struct _CpaCyKeyGenSslOpData {
134     CpaCyKeySslOp sslOp;
135     /**< Indicate the SSL operation to be performed */
136     CpaFlatBuffer secret;
137     /**<  Flat buffer containing a pointer to either the master or pre-master
138      * secret key. The length field indicates the length of the secret key in
139      * bytes. Implementation-specific limits may apply to this length. */
140     CpaFlatBuffer seed;
141     /**<  Flat buffer containing a pointer to the seed data.
142      * Implementation-specific limits may apply to this length. */
143     CpaFlatBuffer info;
144     /**<  Flat buffer containing a pointer to the info data.
145      * Implementation-specific limits may apply to this length. */
146     Cpa32U generatedKeyLenInBytes;
147     /**< The requested length of the generated key in bytes.
148      * Implementation-specific limits may apply to this length. */
149     CpaFlatBuffer userLabel;
150     /**<  Optional flat buffer containing a pointer to a user defined label.
151      * The length field indicates the length of the label in bytes. To use this
152      * field, the sslOp must be CPA_CY_KEY_SSL_OP_USER_DEFINED,
153      * or otherwise it is ignored and can be set to NULL.
154      * Implementation-specific limits may apply to this length. */
155 } CpaCyKeyGenSslOpData;
156 
157 /**
158  *****************************************************************************
159  * @ingroup cpaCyKeyGen
160  *      TLS Operation Types
161  * @description
162  *      Enumeration of the different TLS operations that can be specified in
163  *      the CpaCyKeyGenTlsOpData.  It identifies the label.
164  *
165  *      The functions @ref cpaCyKeyGenTls and @ref cpaCyKeyGenTls2
166  *      accelerate the TLS PRF, which is defined as part of RFC2246 (TLS
167  *      v1.0), RFC4346 (TLS v1.1), and RFC5246 (TLS v1.2).
168  *      One of the inputs to each of these functions is a label.
169  *      This enumerated type defines values that correspond to some of
170  *      the required labels.
171  *      However, for some of the operations/labels required by these RFCs,
172  *      no values are specified.
173  *
174  *      In such cases, a user-defined value must be provided.  The client
175  *      should use the enum value @ref CPA_CY_KEY_TLS_OP_USER_DEFINED, and
176  *      pass the label using the userLabel field of the @ref
177  *      CpaCyKeyGenTlsOpData data structure.
178  *
179  *****************************************************************************/
180 typedef enum _CpaCyKeyTlsOp
181 {
182     CPA_CY_KEY_TLS_OP_MASTER_SECRET_DERIVE = 1,
183     /**< Derive the master secret using the TLS PRF.
184      * Corresponds to RFC2246/5246 section 8.1, operation "Computing the
185      * master secret", label "master secret". */
186     CPA_CY_KEY_TLS_OP_KEY_MATERIAL_DERIVE,
187     /**< Derive the key material using the TLS PRF.
188      * Corresponds to RFC2246/5246 section 6.3, operation "Derive the key
189      * material", label "key expansion". */
190     CPA_CY_KEY_TLS_OP_CLIENT_FINISHED_DERIVE,
191     /**< Derive the client finished tag using the TLS PRF.
192      * Corresponds to RFC2246/5246 section 7.4.9, operation "Client finished",
193      * label "client finished". */
194     CPA_CY_KEY_TLS_OP_SERVER_FINISHED_DERIVE,
195     /**< Derive the server finished tag using the TLS PRF.
196      * Corresponds to RFC2246/5246 section 7.4.9, operation "Server finished",
197      * label "server finished". */
198     CPA_CY_KEY_TLS_OP_USER_DEFINED
199     /**< User Defined Operation for custom labels. */
200 
201 } CpaCyKeyTlsOp;
202 
203 
204 /**
205  *****************************************************************************
206  * @file cpa_cy_key.h
207  * @ingroup cpaCyKeyGen
208  *      TLS Operation Types
209  * @description
210  *      Enumeration of the different TLS operations that can be specified in
211  *      the CpaCyKeyGenHKDFOpData.
212  *
213  *      The function @ref cpaCyKeyGenTls3
214  *      accelerates the TLS HKDF, which is defined as part of RFC5869 (HKDF)
215  *      and RFC8446 (TLS v1.3).
216  *
217  *      This enumerated type defines the support HKDF operations for
218  *      extraction and expansion of keying material.
219  *
220  *****************************************************************************/
221 typedef enum _CpaCyKeyHKDFOp
222 {
223     CPA_CY_HKDF_KEY_EXTRACT = 12,
224     /**< HKDF Extract operation
225      * Corresponds to RFC5869 section 2.2, step 1 "Extract" */
226     CPA_CY_HKDF_KEY_EXPAND,
227     /**< HKDF Expand operation
228      * Corresponds to RFC5869 section 2.3, step 2 "Expand" */
229     CPA_CY_HKDF_KEY_EXTRACT_EXPAND,
230     /**< HKDF operation
231      * This performs HKDF_EXTRACT and HKDF_EXPAND in a single
232      * API invocation. */
233     CPA_CY_HKDF_KEY_EXPAND_LABEL ,
234     /**< HKDF Expand label operation for TLS 1.3
235      * Corresponds to RFC8446 section 7.1 Key Schedule definition for
236      * HKDF-Expand-Label, which refers to HKDF-Expand defined in RFC5869. */
237     CPA_CY_HKDF_KEY_EXTRACT_EXPAND_LABEL
238     /**< HKDF Extract plus Expand label operation for TLS 1.3
239      * Corresponds to  RFC5869 section 2.2, step 1 "Extract" followed by
240      * RFC8446 section 7.1 Key Schedule definition for
241      * HKDF-Expand-Label, which refers to HKDF-Expand defined in RFC5869. */
242 } CpaCyKeyHKDFOp;
243 
244 
245 /**
246  *****************************************************************************
247  * @file cpa_cy_key.h
248  * @ingroup cpaCyKeyGen
249  *      TLS Operation Types
250  * @description
251  *      Enumeration of the different cipher suites that may be used in a TLS
252  *      v1.3 operation.  This value is used to infer the sizes of the key
253  *      and iv sublabel.
254  *
255  *      The function @ref cpaCyKeyGenTls3
256  *      accelerates the TLS HKDF, which is defined as part of RFC5869 (HKDF)
257  *      and RFC8446 (TLS v1.3).
258  *
259  *      This enumerated type defines the supported cipher suites in the
260  *      TLS operation that require HKDF key operations.
261  *
262  *****************************************************************************/
263 typedef enum _CpaCyKeyHKDFCipherSuite
264 {
265     CPA_CY_HKDF_TLS_AES_128_GCM_SHA256 = 1,
266     CPA_CY_HKDF_TLS_AES_256_GCM_SHA384,
267     CPA_CY_HKDF_TLS_CHACHA20_POLY1305_SHA256 ,
268     CPA_CY_HKDF_TLS_AES_128_CCM_SHA256,
269     CPA_CY_HKDF_TLS_AES_128_CCM_8_SHA256
270 } CpaCyKeyHKDFCipherSuite;
271 
272 
273 /**
274  *****************************************************************************
275  * @file cpa_cy_key.h
276  * @ingroup cpaCyKeyGen
277  *      TLS Operation Types
278  * @description
279  *      Bitwise constants for HKDF sublabels
280  *
281  *      These definitions provide bit settings for sublabels for
282  *      HKDF-ExpandLabel operations.
283  *
284  *      <br> key             sublabel to generate "key" keying material
285  *      <br> iv              sublabel to generate "iv" keying material
286  *      <br> resumption      sublabel to generate "resumption" keying material
287  *      <br> finished        sublabel to generate "finished" keying material
288  *
289  *****************************************************************************/
290 
291 #define    CPA_CY_HKDF_SUBLABEL_KEY                   ((Cpa16U)0x0001)
292         /**< Bit for creation of key material for 'key' sublabel */
293 #define    CPA_CY_HKDF_SUBLABEL_IV                    ((Cpa16U)0x0002)
294         /**< Bit for creation of key material for 'iv' sublabel */
295 #define    CPA_CY_HKDF_SUBLABEL_RESUMPTION            ((Cpa16U)0x0004)
296         /**< Bit for creation of key material for 'resumption' sublabel */
297 #define    CPA_CY_HKDF_SUBLABEL_FINISHED              ((Cpa16U)0x0008)
298         /**< Bit for creation of key material for 'finished' sublabel */
299 
300 #define CPA_CY_HKDF_KEY_MAX_SECRET_SZ   ((Cpa8U)80)
301         /** space in bytes PSK or (EC)DH */
302 #define CPA_CY_HKDF_KEY_MAX_HMAC_SZ     ((Cpa8U)48)
303         /** space in bytes of CPA_CY_SYM_HASH_SHA384 result */
304 #define CPA_CY_HKDF_KEY_MAX_INFO_SZ     ((Cpa8U)80)
305         /** space in bytes of largest info needed for TLS 1.3,
306           * rounded up to multiple of 8 */
307 #define CPA_CY_HKDF_KEY_MAX_LABEL_SZ    ((Cpa8U)78)
308         /** space in bytes of largest label for TLS 1.3 */
309 #define CPA_CY_HKDF_KEY_MAX_LABEL_COUNT ((Cpa8U)4)
310         /** Maximum number of labels in op structure */
311 
312 /**
313  *****************************************************************************
314  * @file cpa_cy_key.h
315  * @ingroup cpaCyKeyGen
316  *      TLS data for key generation functions
317  * @description
318  *      This structure contains data for describing label for the
319  *      HKDF Extract Label function
320  *
321  *      @par Extract Label Function
322  *          <br> labelLen = length of the label field
323  *          <br> contextLen = length of the context field
324  *          <br> sublabelFlag = Mask of sub labels required for this label.
325  *          <br> label = label as defined in RFC8446
326  *          <br> context = context as defined in RFC8446
327  *
328  ****************************************************************************/
329 typedef struct _CpaCyKeyGenHKDFExpandLabel
330 {
331     Cpa8U label[CPA_CY_HKDF_KEY_MAX_LABEL_SZ];
332     /**< HKDFLabel field as defined in RFC8446 sec 7.1.
333       */
334     Cpa8U   labelLen;
335     /**< The length, in bytes of the label */
336     Cpa8U   sublabelFlag;
337     /**< mask of sublabels to be generated.
338       *  This flag is composed of zero or more of:
339       *    CPA_CY_HKDF_SUBLABEL_KEY
340       *    CPA_CY_HKDF_SUBLABEL_IV
341       *    CPA_CY_HKDF_SUBLABEL_RESUMPTION
342       *    CPA_CY_HKDF_SUBLABEL_FINISHED
343       */
344 } CpaCyKeyGenHKDFExpandLabel;
345 
346 /**
347  *****************************************************************************
348  * @ingroup cpaCyKeyGen
349  *      TLS data for key generation functions
350  * @description
351  *      This structure contains data for all HKDF operations:
352  *          <br> HKDF Extract
353  *          <br> HKDF Expand
354  *          <br> HKDF Expand Label
355  *          <br> HKDF Extract and Expand
356  *          <br> HKDF Extract and Expand Label
357  *
358  *      @par HKDF Map Structure Elements
359  *          <br> secret - IKM value for extract operations or PRK for expand
360  *                        or expand operations.
361  *          <br> seed -   contains the salt for extract
362  *                        operations
363  *          <br> info -   contains the info data for extract operations
364  *          <br> labels - See notes above
365  *
366  ****************************************************************************/
367 typedef struct _CpaCyKeyGenHKDFOpData
368 {
369     CpaCyKeyHKDFOp hkdfKeyOp;
370     /**< Keying operation to be performed. */
371     Cpa8U secretLen;
372     /**< Length of secret field */
373     Cpa16U seedLen;
374     /**< Length of seed field */
375     Cpa16U infoLen;
376     /**< Length of info field */
377     Cpa16U numLabels;
378     /**< Number of filled CpaCyKeyGenHKDFExpandLabel elements */
379     Cpa8U secret[CPA_CY_HKDF_KEY_MAX_SECRET_SZ];
380     /**< Input Key Material or PRK */
381     Cpa8U seed[CPA_CY_HKDF_KEY_MAX_HMAC_SZ];
382     /**< Input salt */
383     Cpa8U info[CPA_CY_HKDF_KEY_MAX_INFO_SZ];
384     /**< info field */
385     CpaCyKeyGenHKDFExpandLabel label[CPA_CY_HKDF_KEY_MAX_LABEL_COUNT];
386     /**< array of Expand Label structures */
387 } CpaCyKeyGenHKDFOpData;
388 
389 /**
390  *****************************************************************************
391  * @ingroup cpaCyKeyGen
392  *      TLS data for key generation functions
393  * @description
394  *      This structure contains data for use in key generation operations for
395  *      TLS. For specific TLS key generation operations, the structure fields
396  *      MUST be set as follows:
397  *
398  *      @par TLS Master-Secret Derivation:
399  *          <br> tlsOp = CPA_CY_KEY_TLS_OP_MASTER_SECRET_DERIVE
400  *          <br> secret = pre-master secret key
401  *          <br> seed = client_random + server_random
402  *          <br> userLabel = NULL
403  *
404  *      @par TLS Key-Material Derivation:
405  *          <br> tlsOp = CPA_CY_KEY_TLS_OP_KEY_MATERIAL_DERIVE
406  *          <br> secret = master secret key
407  *          <br> seed = server_random + client_random
408  *          <br> userLabel = NULL
409  *
410  *          <br> Note that the client/server random order is reversed from
411  *          that used for Master-Secret Derivation.
412  *
413  *      @par TLS Client finished/Server finished tag Derivation:
414  *          <br> tlsOp = CPA_CY_KEY_TLS_OP_CLIENT_FINISHED_DERIVE  (client)
415  *          <br>      or CPA_CY_KEY_TLS_OP_SERVER_FINISHED_DERIVE  (server)
416  *          <br> secret = master secret key
417  *          <br> seed = MD5(handshake_messages) + SHA-1(handshake_messages)
418  *          <br> userLabel = NULL
419  *
420  *      @note Each of the client and server random seeds need to be of
421  *      length CPA_CY_KEY_GEN_SSL_TLS_RANDOM_LEN_IN_BYTES.
422  *      @note In each of the above descriptions, + indicates concatenation.
423  *      @note The label used is predetermined by the TLS operation in line
424  *      with the TLS specifications, and can be overridden by using
425  *      a user defined operation CPA_CY_KEY_TLS_OP_USER_DEFINED
426  *      and associated userLabel.
427  *
428  ****************************************************************************/
429 typedef struct _CpaCyKeyGenTlsOpData {
430     CpaCyKeyTlsOp tlsOp;
431     /**< TLS operation to be performed */
432     CpaFlatBuffer secret;
433     /**< Flat buffer containing a pointer to either the master or pre-master
434      * secret key. The length field indicates the length of the secret in
435      * bytes.  */
436     CpaFlatBuffer seed;
437     /**< Flat buffer containing a pointer to the seed data.
438      * Implementation-specific limits may apply to this length. */
439     Cpa32U generatedKeyLenInBytes;
440     /**< The requested length of the generated key in bytes.
441      * Implementation-specific limits may apply to this length. */
442     CpaFlatBuffer userLabel;
443     /**< Optional flat buffer containing a pointer to a user defined label.
444      * The length field indicates the length of the label in bytes. To use this
445      * field, the tlsOp must be CPA_CY_KEY_TLS_OP_USER_DEFINED.
446          * Implementation-specific limits may apply to this length. */
447 } CpaCyKeyGenTlsOpData;
448 
449 /**
450  *****************************************************************************
451  * @ingroup cpaCyKeyGen
452  *      Key Generation Mask Generation Function (MGF) Data
453  * @description
454  *      This structure contains data relating to Mask Generation Function
455  *      key generation operations.
456  *
457  *      @note The default hash algorithm used by the MGF is SHA-1.  If a
458  *      different hash algorithm is preferred, then see the extended
459  *      version of this structure, @ref CpaCyKeyGenMgfOpDataExt.
460  * @see
461  *        cpaCyKeyGenMgf
462  ****************************************************************************/
463 typedef struct _CpaCyKeyGenMgfOpData {
464     CpaFlatBuffer seedBuffer;
465     /**<  Caller MUST allocate a buffer and populate with the input seed
466      * data. For optimal performance the start of the seed SHOULD be allocated
467      * on an 8-byte boundary. The length field represents the seed length in
468      * bytes.  Implementation-specific limits may apply to this length. */
469     Cpa32U maskLenInBytes;
470     /**< The requested length of the generated mask in bytes.
471      * Implementation-specific limits may apply to this length. */
472 } CpaCyKeyGenMgfOpData;
473 
474 /**
475  *****************************************************************************
476  * @ingroup cpaCyKeyGen
477  *      Extension to the original Key Generation Mask Generation Function
478  *      (MGF) Data
479  * @description
480  *      This structure is an extension to the original MGF data structure.
481  *      The extension allows the hash function to be specified.
482  * @note
483  *      This structure is separate from the base @ref CpaCyKeyGenMgfOpData
484  *      structure in order to retain backwards compatibility with the
485  *      original version of the API.
486  * @see
487  *        cpaCyKeyGenMgfExt
488  ****************************************************************************/
489 typedef struct _CpaCyKeyGenMgfOpDataExt {
490     CpaCyKeyGenMgfOpData baseOpData;
491     /**<  "Base" operational data for MGF generation */
492     CpaCySymHashAlgorithm hashAlgorithm;
493     /**< Specifies the hash algorithm to be used by the Mask Generation
494      * Function */
495 } CpaCyKeyGenMgfOpDataExt;
496 
497 /**
498  *****************************************************************************
499  * @ingroup cpaCyKeyGen
500  *      Key Generation Statistics.
501  * @deprecated
502  *      As of v1.3 of the Crypto API, this structure has been deprecated,
503  *      replaced by @ref CpaCyKeyGenStats64.
504  * @description
505  *      This structure contains statistics on the key and mask generation
506  *      operations. Statistics are set to zero when the component is
507  *      initialized, and are collected per instance.
508  *
509  ****************************************************************************/
510 typedef struct _CpaCyKeyGenStats {
511     Cpa32U numSslKeyGenRequests;
512     /**< Total number of successful SSL key generation requests. */
513     Cpa32U numSslKeyGenRequestErrors;
514     /**< Total number of SSL key generation requests that had an error and
515      *   could not be processed. */
516     Cpa32U numSslKeyGenCompleted;
517     /**< Total number of SSL key generation operations that completed
518      *   successfully. */
519     Cpa32U numSslKeyGenCompletedErrors;
520     /**< Total number of SSL key generation operations that could not be
521      *   completed successfully due to errors. */
522     Cpa32U numTlsKeyGenRequests;
523     /**< Total number of successful TLS key generation requests. */
524     Cpa32U numTlsKeyGenRequestErrors;
525     /**< Total number of TLS key generation requests that had an error and
526      *   could not be processed. */
527     Cpa32U numTlsKeyGenCompleted;
528     /**< Total number of TLS key generation operations that completed
529      *   successfully. */
530     Cpa32U numTlsKeyGenCompletedErrors;
531     /**< Total number of TLS key generation operations that could not be
532      *   completed successfully due to errors. */
533     Cpa32U numMgfKeyGenRequests;
534     /**< Total number of successful MGF key generation requests (including
535      *   "extended" MGF requests). */
536     Cpa32U numMgfKeyGenRequestErrors;
537     /**< Total number of MGF key generation requests that had an error and
538      *   could not be processed. */
539     Cpa32U numMgfKeyGenCompleted;
540     /**< Total number of MGF key generation operations that completed
541      *   successfully. */
542     Cpa32U numMgfKeyGenCompletedErrors;
543     /**< Total number of MGF key generation operations that could not be
544      *   completed successfully due to errors. */
545 } CpaCyKeyGenStats CPA_DEPRECATED;
546 
547 /**
548  *****************************************************************************
549  * @ingroup cpaCyKeyGen
550  *      Key Generation Statistics (64-bit version).
551  * @description
552  *      This structure contains the 64-bit version of the statistics
553  *      on the key and mask generation operations.
554  *      Statistics are set to zero when the component is
555  *      initialized, and are collected per instance.
556  *
557  ****************************************************************************/
558 typedef struct _CpaCyKeyGenStats64 {
559     Cpa64U numSslKeyGenRequests;
560     /**< Total number of successful SSL key generation requests. */
561     Cpa64U numSslKeyGenRequestErrors;
562     /**< Total number of SSL key generation requests that had an error and
563      *   could not be processed. */
564     Cpa64U numSslKeyGenCompleted;
565     /**< Total number of SSL key generation operations that completed
566      *   successfully. */
567     Cpa64U numSslKeyGenCompletedErrors;
568     /**< Total number of SSL key generation operations that could not be
569      *   completed successfully due to errors. */
570     Cpa64U numTlsKeyGenRequests;
571     /**< Total number of successful TLS key generation requests. */
572     Cpa64U numTlsKeyGenRequestErrors;
573     /**< Total number of TLS key generation requests that had an error and
574      *   could not be processed. */
575     Cpa64U numTlsKeyGenCompleted;
576     /**< Total number of TLS key generation operations that completed
577      *   successfully. */
578     Cpa64U numTlsKeyGenCompletedErrors;
579     /**< Total number of TLS key generation operations that could not be
580      *   completed successfully due to errors. */
581     Cpa64U numMgfKeyGenRequests;
582     /**< Total number of successful MGF key generation requests (including
583      *   "extended" MGF requests). */
584     Cpa64U numMgfKeyGenRequestErrors;
585     /**< Total number of MGF key generation requests that had an error and
586      *   could not be processed. */
587     Cpa64U numMgfKeyGenCompleted;
588     /**< Total number of MGF key generation operations that completed
589      *   successfully. */
590     Cpa64U numMgfKeyGenCompletedErrors;
591     /**< Total number of MGF key generation operations that could not be
592      *   completed successfully due to errors. */
593 } CpaCyKeyGenStats64;
594 
595 /**
596  *****************************************************************************
597  * @ingroup cpaCyKeyGen
598  *      SSL Key Generation Function.
599  * @description
600  *      This function is used for SSL key generation.  It implements the key
601  *      generation function defined in section 6.2.2 of the SSL 3.0
602  *      specification as described in
603  *      http://www.mozilla.org/projects/security/pki/nss/ssl/draft302.txt.
604  *
605  *      The input seed is taken as a flat buffer and the generated key is
606  *      returned to caller in a flat destination data buffer.
607  * @context
608  *      When called as an asynchronous function it cannot sleep. It can be
609  *      executed in a context that does not permit sleeping.
610  *      When called as a synchronous function it may sleep. It MUST NOT be
611  *      executed in a context that DOES NOT permit sleeping.
612  * @assumptions
613  *      None
614  * @sideEffects
615  *      None
616  * @blocking
617  *      Yes when configured to operate in synchronous mode.
618  * @reentrant
619  *      No
620  * @threadSafe
621  *      Yes
622  *
623  * @param[in] instanceHandle             Instance handle.
624  * @param[in] pKeyGenCb                  Pointer to callback function to be
625  *                                       invoked when the operation is complete.
626  *                                       If this is set to a NULL value the
627  *                                       function will operate synchronously.
628  * @param[in] pCallbackTag               Opaque User Data for this specific
629  *                                       call. Will be returned unchanged in the
630  *                                       callback.
631  * @param[in] pKeyGenSslOpData           Structure containing all the data
632  *                                       needed to perform the SSL key
633  *                                       generation operation. The client code
634  *                                       allocates the memory for this
635  *                                       structure. This component takes
636  *                                       ownership of the memory until it is
637  *                                       returned in the callback.
638  * @param[out] pGeneratedKeyBuffer       Caller MUST allocate a sufficient
639  *                                       buffer to hold the key generation
640  *                                       output. The data pointer SHOULD be
641  *                                       aligned on an 8-byte boundary. The
642  *                                       length field passed in represents the
643  *                                       size of the buffer in bytes. The value
644  *                                       that is returned is the size of the
645  *                                       result key in bytes.
646  *                                       On invocation the callback function
647  *                                       will contain this parameter in the
648  *                                       pOut parameter.
649  *
650  * @retval CPA_STATUS_SUCCESS            Function executed successfully.
651  * @retval CPA_STATUS_FAIL               Function failed.
652  * @retval CPA_STATUS_RETRY              Resubmit the request.
653  * @retval CPA_STATUS_INVALID_PARAM      Invalid parameter passed in.
654  * @retval CPA_STATUS_RESOURCE           Error related to system resources.
655  * @retval CPA_STATUS_RESTARTING         API implementation is restarting.
656  *                                       Resubmit the request.
657  *
658  * @pre
659  *      The component has been initialized via cpaCyStartInstance function.
660  * @post
661  *      None
662  * @see
663  *      CpaCyKeyGenSslOpData,
664  *      CpaCyGenFlatBufCbFunc
665  *
666  *****************************************************************************/
667 CpaStatus
668 cpaCyKeyGenSsl(const CpaInstanceHandle instanceHandle,
669         const CpaCyGenFlatBufCbFunc pKeyGenCb,
670         void *pCallbackTag,
671         const CpaCyKeyGenSslOpData *pKeyGenSslOpData,
672         CpaFlatBuffer *pGeneratedKeyBuffer);
673 
674 /**
675  *****************************************************************************
676  * @ingroup cpaCyKeyGen
677  *      TLS Key Generation Function.
678  * @description
679  *      This function is used for TLS key generation.  It implements the
680  *      TLS PRF (Pseudo Random Function) as defined by RFC2246 (TLS v1.0)
681  *      and RFC4346 (TLS v1.1).
682  *
683  *      The input seed is taken as a flat buffer and the generated key is
684  *      returned to caller in a flat destination data buffer.
685  *
686  * @context
687  *      When called as an asynchronous function it cannot sleep. It can be
688  *      executed in a context that does not permit sleeping.
689  *      When called as a synchronous function it may sleep. It MUST NOT be
690  *      executed in a context that DOES NOT permit sleeping.
691  * @assumptions
692  *      None
693  * @sideEffects
694  *      None
695  * @blocking
696  *      Yes when configured to operate in synchronous mode.
697  * @reentrant
698  *      No
699  * @threadSafe
700  *      Yes
701  *
702  * @param[in]  instanceHandle            Instance handle.
703  * @param[in]  pKeyGenCb                 Pointer to callback function to be
704  *                                       invoked when the operation is complete.
705  *                                       If this is set to a NULL value the
706  *                                       function will operate synchronously.
707  * @param[in]  pCallbackTag              Opaque User Data for this specific
708  *                                       call. Will be returned unchanged in the
709  *                                       callback.
710  * @param[in]  pKeyGenTlsOpData          Structure containing all the data
711  *                                       needed to perform the TLS key
712  *                                       generation operation. The client code
713  *                                       allocates the memory for this
714  *                                       structure. This component takes
715  *                                       ownership of the memory until it is
716  *                                       returned in the callback.
717  * @param[out] pGeneratedKeyBuffer       Caller MUST allocate a sufficient
718  *                                       buffer to hold the key generation
719  *                                       output. The data pointer SHOULD be
720  *                                       aligned on an 8-byte boundary. The
721  *                                       length field passed in represents the
722  *                                       size of the buffer in bytes. The value
723  *                                       that is returned is the size of the
724  *                                       result key in bytes.
725  *                                       On invocation the callback function
726  *                                       will contain this parameter in the
727  *                                       pOut parameter.
728  *
729  * @retval CPA_STATUS_SUCCESS            Function executed successfully.
730  * @retval CPA_STATUS_FAIL               Function failed.
731  * @retval CPA_STATUS_RETRY              Resubmit the request.
732  * @retval CPA_STATUS_INVALID_PARAM      Invalid parameter passed in.
733  * @retval CPA_STATUS_RESOURCE           Error related to system resources.
734  * @retval CPA_STATUS_RESTARTING         API implementation is restarting.
735  *                                       Resubmit the request.
736  *
737  * @pre
738  *      The component has been initialized via cpaCyStartInstance function.
739  * @post
740  *      None
741  * @see
742  *      CpaCyKeyGenTlsOpData,
743  *      CpaCyGenFlatBufCbFunc
744  *
745  *****************************************************************************/
746 CpaStatus
747 cpaCyKeyGenTls(const CpaInstanceHandle instanceHandle,
748         const CpaCyGenFlatBufCbFunc pKeyGenCb,
749         void *pCallbackTag,
750         const CpaCyKeyGenTlsOpData *pKeyGenTlsOpData,
751         CpaFlatBuffer *pGeneratedKeyBuffer);
752 
753 /**
754  *****************************************************************************
755  * @ingroup cpaCyKeyGen
756  *      TLS Key Generation Function version 2.
757  * @description
758  *      This function is used for TLS key generation.  It implements the
759  *      TLS PRF (Pseudo Random Function) as defined by RFC5246 (TLS v1.2).
760  *
761  *      The input seed is taken as a flat buffer and the generated key is
762  *      returned to caller in a flat destination data buffer.
763  *
764  * @context
765  *      When called as an asynchronous function it cannot sleep. It can be
766  *      executed in a context that does not permit sleeping.
767  *      When called as a synchronous function it may sleep. It MUST NOT be
768  *      executed in a context that DOES NOT permit sleeping.
769  * @assumptions
770  *      None
771  * @sideEffects
772  *      None
773  * @blocking
774  *      Yes when configured to operate in synchronous mode.
775  * @reentrant
776  *      No
777  * @threadSafe
778  *      Yes
779  *
780  * @param[in]  instanceHandle            Instance handle.
781  * @param[in]  pKeyGenCb                 Pointer to callback function to be
782  *                                       invoked when the operation is complete.
783  *                                       If this is set to a NULL value the
784  *                                       function will operate synchronously.
785  * @param[in]  pCallbackTag              Opaque User Data for this specific
786  *                                       call. Will be returned unchanged in the
787  *                                       callback.
788  * @param[in]  pKeyGenTlsOpData          Structure containing all the data
789  *                                       needed to perform the TLS key
790  *                                       generation operation. The client code
791  *                                       allocates the memory for this
792  *                                       structure. This component takes
793  *                                       ownership of the memory until it is
794  *                                       returned in the callback.
795  * @param[in]  hashAlgorithm             Specifies the hash algorithm to use.
796  *                                       According to RFC5246, this should be
797  *                                       "SHA-256 or a stronger standard hash
798  *                                       function."
799  * @param[out] pGeneratedKeyBuffer       Caller MUST allocate a sufficient
800  *                                       buffer to hold the key generation
801  *                                       output. The data pointer SHOULD be
802  *                                       aligned on an 8-byte boundary. The
803  *                                       length field passed in represents the
804  *                                       size of the buffer in bytes. The value
805  *                                       that is returned is the size of the
806  *                                       result key in bytes.
807  *                                       On invocation the callback function
808  *                                       will contain this parameter in the
809  *                                       pOut parameter.
810  *
811  * @retval CPA_STATUS_SUCCESS            Function executed successfully.
812  * @retval CPA_STATUS_FAIL               Function failed.
813  * @retval CPA_STATUS_RETRY              Resubmit the request.
814  * @retval CPA_STATUS_INVALID_PARAM      Invalid parameter passed in.
815  * @retval CPA_STATUS_RESOURCE           Error related to system resources.
816  * @retval CPA_STATUS_RESTARTING         API implementation is restarting.
817  *                                       Resubmit the request.
818  *
819  * @pre
820  *      The component has been initialized via cpaCyStartInstance function.
821  * @post
822  *      None
823  * @see
824  *      CpaCyKeyGenTlsOpData,
825  *      CpaCyGenFlatBufCbFunc
826  *
827  *****************************************************************************/
828 CpaStatus
829 cpaCyKeyGenTls2(const CpaInstanceHandle instanceHandle,
830         const CpaCyGenFlatBufCbFunc pKeyGenCb,
831         void *pCallbackTag,
832         const CpaCyKeyGenTlsOpData *pKeyGenTlsOpData,
833         CpaCySymHashAlgorithm hashAlgorithm,
834         CpaFlatBuffer *pGeneratedKeyBuffer);
835 
836 
837 /**
838  *****************************************************************************
839  * @ingroup cpaCyKeyGen
840  *      TLS Key Generation Function version 3.
841  * @description
842  *      This function is used for TLS key generation.  It implements the
843  *      TLS HKDF (HMAC Key Derivation Function) as defined by
844  *      RFC5689 (HKDF) and RFC8446 (TLS 1.3).
845  *
846  *      The input seed is taken as a flat buffer and the generated key is
847  *      returned to caller in a flat destination data buffer.
848  *
849  * @context
850  *      When called as an asynchronous function it cannot sleep. It can be
851  *      executed in a context that does not permit sleeping.
852  *      When called as a synchronous function it may sleep. It MUST NOT be
853  *      executed in a context that DOES NOT permit sleeping.
854  * @assumptions
855  *      None
856  * @sideEffects
857  *      None
858  * @blocking
859  *      Yes when configured to operate in synchronous mode.
860  * @reentrant
861  *      No
862  * @threadSafe
863  *      Yes
864  *
865  * @param[in]  instanceHandle            Instance handle.
866  * @param[in]  pKeyGenCb                 Pointer to callback function to be
867  *                                       invoked when the operation is complete.
868  *                                       If this is set to a NULL value the
869  *                                       function will operate synchronously.
870  * @param[in]  pCallbackTag              Opaque User Data for this specific
871  *                                       call. Will be returned unchanged in the
872  *                                       callback.
873  * @param[in]  pKeyGenTlsOpData          Structure containing all the data
874  *                                       needed to perform the TLS key
875  *                                       generation operation. The client code
876  *                                       allocates the memory for this
877  *                                       structure. This component takes
878  *                                       ownership of the memory until it is
879  *                                       returned in the callback. The memory
880  *                                       must be pinned and contiguous, suitable
881  *                                       for DMA operations.
882  * @param[in]  hashAlgorithm             Specifies the hash algorithm to use.
883  *                                       According to RFC5246, this should be
884  *                                       "SHA-256 or a stronger standard hash
885  *                                       function."
886  * @param[out] pGeneratedKeyBuffer       Caller MUST allocate a sufficient
887  *                                       buffer to hold the key generation
888  *                                       output. The data pointer SHOULD be
889  *                                       aligned on an 8-byte boundary. The
890  *                                       length field passed in represents the
891  *                                       size of the buffer in bytes. The value
892  *                                       that is returned is the size of the
893  *                                       result key in bytes.
894  *                                       On invocation the callback function
895  *                                       will contain this parameter in the
896  *                                       pOut parameter.
897  *
898  * @retval CPA_STATUS_SUCCESS            Function executed successfully.
899  * @retval CPA_STATUS_FAIL               Function failed.
900  * @retval CPA_STATUS_RETRY              Resubmit the request.
901  * @retval CPA_STATUS_INVALID_PARAM      Invalid parameter passed in.
902  * @retval CPA_STATUS_RESOURCE           Error related to system resources.
903  * @retval CPA_STATUS_RESTARTING         API implementation is restarting.
904  *                                       Resubmit the request.
905  *
906  * @pre
907  *      The component has been initialized via cpaCyStartInstance function.
908  * @post
909  *      None
910  * @see
911  *      CpaCyGenFlatBufCbFunc
912  *      CpaCyKeyGenHKDFOpData
913  *
914  *****************************************************************************/
915 CpaStatus
916 cpaCyKeyGenTls3(const CpaInstanceHandle instanceHandle,
917         const CpaCyGenFlatBufCbFunc pKeyGenCb,
918         void *pCallbackTag,
919         const CpaCyKeyGenHKDFOpData *pKeyGenTlsOpData,
920         CpaCyKeyHKDFCipherSuite cipherSuite,
921         CpaFlatBuffer *pGeneratedKeyBuffer);
922 
923 
924 /**
925  *****************************************************************************
926  * @ingroup cpaCyKeyGen
927  *      Mask Generation Function.
928  * @description
929  *      This function implements the mask generation function MGF1 as
930  *      defined by PKCS#1 v2.1, and RFC3447.  The input seed is taken
931  *      as a flat buffer and the generated mask is returned to caller in a
932  *      flat destination data buffer.
933  *
934  *      @note The default hash algorithm used by the MGF is SHA-1.  If a
935  *      different hash algorithm is preferred, then see the "extended"
936  *      version of this function, @ref cpaCyKeyGenMgfExt.
937  *
938  * @context
939  *      When called as an asynchronous function it cannot sleep. It can be
940  *      executed in a context that does not permit sleeping.
941  *      When called as a synchronous function it may sleep. It MUST NOT be
942  *      executed in a context that DOES NOT permit sleeping.
943  * @assumptions
944  *      None
945  * @sideEffects
946  *      None
947  * @blocking
948  *      Yes when configured to operate in synchronous mode.
949  * @reentrant
950  *      No
951  * @threadSafe
952  *      Yes
953  *
954  * @param[in]  instanceHandle        Instance handle.
955  * @param[in]  pKeyGenCb             Pointer to callback function to be
956  *                                   invoked when the operation is complete.
957  *                                   If this is set to a NULL value the
958  *                                   function will operate synchronously.
959  * @param[in]  pCallbackTag          Opaque User Data for this specific call.
960  *                                   Will be returned unchanged in the
961  *                                   callback.
962  * @param[in]  pKeyGenMgfOpData      Structure containing all the data needed
963  *                                   to perform the MGF key generation
964  *                                   operation. The client code allocates the
965  *                                   memory for this structure. This
966  *                                   component takes ownership of the memory
967  *                                   until it is returned in the callback.
968  * @param[out] pGeneratedMaskBuffer  Caller MUST allocate a sufficient buffer
969  *                                   to hold the generated mask. The data
970  *                                   pointer SHOULD be aligned on an 8-byte
971  *                                   boundary. The length field passed in
972  *                                   represents the size of the buffer in
973  *                                   bytes. The value that is returned is the
974  *                                   size of the generated mask in bytes.
975  *                                   On invocation the callback function
976  *                                   will contain this parameter in the
977  *                                   pOut parameter.
978  *
979  * @retval CPA_STATUS_SUCCESS           Function executed successfully.
980  * @retval CPA_STATUS_FAIL              Function failed.
981  * @retval CPA_STATUS_RETRY             Resubmit the request.
982  * @retval CPA_STATUS_INVALID_PARAM     Invalid parameter passed in.
983  * @retval CPA_STATUS_RESOURCE          Error related to system resources.
984  * @retval CPA_STATUS_RESTARTING        API implementation is restarting.
985  *                                      Resubmit the request.
986  *
987  * @pre
988  *      The component has been initialized via cpaCyStartInstance function.
989  * @post
990  *      None
991  * @see
992  *      CpaCyKeyGenMgfOpData,
993  *      CpaCyGenFlatBufCbFunc
994  *
995  *****************************************************************************/
996 CpaStatus
997 cpaCyKeyGenMgf(const CpaInstanceHandle instanceHandle,
998         const CpaCyGenFlatBufCbFunc pKeyGenCb,
999         void *pCallbackTag,
1000         const CpaCyKeyGenMgfOpData *pKeyGenMgfOpData,
1001         CpaFlatBuffer *pGeneratedMaskBuffer);
1002 
1003 /**
1004  *****************************************************************************
1005  * @ingroup cpaCyKeyGen
1006  *      Extended Mask Generation Function.
1007  * @description
1008  *      This function is used for mask generation. It differs from the "base"
1009  *      version of the function (@ref cpaCyKeyGenMgf) in that it allows
1010  *      the hash function used by the Mask Generation Function to be
1011  *      specified.
1012  *
1013  * @context
1014  *      When called as an asynchronous function it cannot sleep. It can be
1015  *      executed in a context that does not permit sleeping.
1016  *      When called as a synchronous function it may sleep. It MUST NOT be
1017  *      executed in a context that DOES NOT permit sleeping.
1018  * @assumptions
1019  *      None
1020  * @sideEffects
1021  *      None
1022  * @blocking
1023  *      Yes when configured to operate in synchronous mode.
1024  * @reentrant
1025  *      No
1026  * @threadSafe
1027  *      Yes
1028  *
1029  * @param[in]  instanceHandle        Instance handle.
1030  * @param[in]  pKeyGenCb             Pointer to callback function to be
1031  *                                   invoked when the operation is complete.
1032  *                                   If this is set to a NULL value the
1033  *                                   function will operate synchronously.
1034  * @param[in]  pCallbackTag          Opaque User Data for this specific call.
1035  *                                   Will be returned unchanged in the
1036  *                                   callback.
1037  * @param[in]  pKeyGenMgfOpDataExt   Structure containing all the data needed
1038  *                                   to perform the extended MGF key generation
1039  *                                   operation. The client code allocates the
1040  *                                   memory for this structure. This
1041  *                                   component takes ownership of the memory
1042  *                                   until it is returned in the callback.
1043  * @param[out] pGeneratedMaskBuffer  Caller MUST allocate a sufficient buffer
1044  *                                   to hold the generated mask. The data
1045  *                                   pointer SHOULD be aligned on an 8-byte
1046  *                                   boundary. The length field passed in
1047  *                                   represents the size of the buffer in
1048  *                                   bytes. The value that is returned is the
1049  *                                   size of the generated mask in bytes.
1050  *                                   On invocation the callback function
1051  *                                   will contain this parameter in the
1052  *                                   pOut parameter.
1053  *
1054  * @retval CPA_STATUS_SUCCESS           Function executed successfully.
1055  * @retval CPA_STATUS_FAIL              Function failed.
1056  * @retval CPA_STATUS_RETRY             Resubmit the request.
1057  * @retval CPA_STATUS_INVALID_PARAM     Invalid parameter passed in.
1058  * @retval CPA_STATUS_RESOURCE          Error related to system resources.
1059  * @retval CPA_STATUS_RESTARTING        API implementation is restarting.
1060  *                                      Resubmit the request.
1061  *
1062  * @pre
1063  *      The component has been initialized via cpaCyStartInstance function.
1064  * @post
1065  *      None
1066  * @note
1067  *      This function is only used to generate a mask keys from seed
1068  *      material.
1069  * @see
1070  *      CpaCyKeyGenMgfOpData,
1071  *      CpaCyGenFlatBufCbFunc
1072  *
1073  *****************************************************************************/
1074 CpaStatus
1075 cpaCyKeyGenMgfExt(const CpaInstanceHandle instanceHandle,
1076         const CpaCyGenFlatBufCbFunc pKeyGenCb,
1077         void *pCallbackTag,
1078         const CpaCyKeyGenMgfOpDataExt *pKeyGenMgfOpDataExt,
1079         CpaFlatBuffer *pGeneratedMaskBuffer);
1080 
1081 /**
1082  *****************************************************************************
1083  * @ingroup cpaCyKeyGen
1084  *      Queries the Key and Mask generation statistics specific to
1085  *      an instance.
1086  *
1087  * @deprecated
1088  *      As of v1.3 of the Crypto API, this function has been deprecated,
1089  *      replaced by @ref cpaCyKeyGenQueryStats64().
1090  *
1091  * @description
1092  *      This function will query a specific instance for key and mask
1093  *      generation statistics. The user MUST allocate the CpaCyKeyGenStats
1094  *      structure and pass the reference to that into this function call. This
1095  *      function will write the statistic results into the passed in
1096  *      CpaCyKeyGenStats structure.
1097  *
1098  *      Note: statistics returned by this function do not interrupt current data
1099  *      processing and as such can be slightly out of sync with operations that
1100  *      are in progress during the statistics retrieval process.
1101  *
1102  * @context
1103  *      This is a synchronous function and it can sleep. It MUST NOT be
1104  *      executed in a context that DOES NOT permit sleeping.
1105  * @assumptions
1106  *      None
1107  * @sideEffects
1108  *      None
1109  * @blocking
1110  *      This function is synchronous and blocking.
1111  * @reentrant
1112  *      No
1113  * @threadSafe
1114  *      Yes
1115  *
1116  * @param[in]  instanceHandle       Instance handle.
1117  * @param[out] pKeyGenStats         Pointer to memory into which the statistics
1118  *                                  will be written.
1119  *
1120  * @retval CPA_STATUS_SUCCESS        Function executed successfully.
1121  * @retval CPA_STATUS_FAIL           Function failed.
1122  * @retval CPA_STATUS_INVALID_PARAM  Invalid parameter passed in.
1123  * @retval CPA_STATUS_RESOURCE       Error related to system resources.
1124  * @retval CPA_STATUS_RESTARTING     API implementation is restarting.
1125  *                                   Resubmit the request.
1126  *
1127  * @pre
1128  *      Component has been initialized.
1129  * @post
1130  *      None
1131  * @note
1132  *      This function operates in a synchronous manner and no asynchronous
1133  *      callback will be generated.
1134  *
1135  * @see
1136  *      CpaCyKeyGenStats
1137  *
1138  *****************************************************************************/
1139 CpaStatus CPA_DEPRECATED
1140 cpaCyKeyGenQueryStats(const CpaInstanceHandle instanceHandle,
1141         struct _CpaCyKeyGenStats *pKeyGenStats);
1142 
1143 /**
1144  *****************************************************************************
1145  * @ingroup cpaCyKeyGen
1146  *      Queries the Key and Mask generation statistics (64-bit version)
1147  *      specific to an instance.
1148  *
1149  * @description
1150  *      This function will query a specific instance for key and mask
1151  *      generation statistics. The user MUST allocate the CpaCyKeyGenStats64
1152  *      structure and pass the reference to that into this function call. This
1153  *      function will write the statistic results into the passed in
1154  *      CpaCyKeyGenStats64 structure.
1155  *
1156  *      Note: statistics returned by this function do not interrupt current data
1157  *      processing and as such can be slightly out of sync with operations that
1158  *      are in progress during the statistics retrieval process.
1159  *
1160  * @context
1161  *      This is a synchronous function and it can sleep. It MUST NOT be
1162  *      executed in a context that DOES NOT permit sleeping.
1163  * @assumptions
1164  *      None
1165  * @sideEffects
1166  *      None
1167  * @blocking
1168  *      This function is synchronous and blocking.
1169  * @reentrant
1170  *      No
1171  * @threadSafe
1172  *      Yes
1173  *
1174  * @param[in]  instanceHandle       Instance handle.
1175  * @param[out] pKeyGenStats         Pointer to memory into which the statistics
1176  *                                  will be written.
1177  *
1178  * @retval CPA_STATUS_SUCCESS        Function executed successfully.
1179  * @retval CPA_STATUS_FAIL           Function failed.
1180  * @retval CPA_STATUS_INVALID_PARAM  Invalid parameter passed in.
1181  * @retval CPA_STATUS_RESOURCE       Error related to system resources.
1182  * @retval CPA_STATUS_RESTARTING     API implementation is restarting.
1183  *                                   Resubmit the request.
1184  *
1185  * @pre
1186  *      Component has been initialized.
1187  * @post
1188  *      None
1189  * @note
1190  *      This function operates in a synchronous manner and no asynchronous
1191  *      callback will be generated.
1192  *
1193  * @see
1194  *      CpaCyKeyGenStats64
1195  *****************************************************************************/
1196 CpaStatus
1197 cpaCyKeyGenQueryStats64(const CpaInstanceHandle instanceHandle,
1198         CpaCyKeyGenStats64 *pKeyGenStats);
1199 
1200 #ifdef __cplusplus
1201 } /* close the extern "C" { */
1202 #endif
1203 
1204 #endif /* CPA_CY_KEY_H */
1205