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