cryptodev: remove unused field
[dpdk.git] / lib / librte_cryptodev / rte_crypto_sym.h
1 /*-
2  *   BSD LICENSE
3  *
4  *   Copyright(c) 2016 Intel Corporation. All rights reserved.
5  *
6  *   Redistribution and use in source and binary forms, with or without
7  *   modification, are permitted provided that the following conditions
8  *   are met:
9  *
10  *     * Redistributions of source code must retain the above copyright
11  *       notice, this list of conditions and the following disclaimer.
12  *     * Redistributions in binary form must reproduce the above copyright
13  *       notice, this list of conditions and the following disclaimer in
14  *       the documentation and/or other materials provided with the
15  *       distribution.
16  *     * Neither the name of Intel Corporation nor the names of its
17  *       contributors may be used to endorse or promote products derived
18  *       from this software without specific prior written permission.
19  *
20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32
33 #ifndef _RTE_CRYPTO_SYM_H_
34 #define _RTE_CRYPTO_SYM_H_
35
36 /**
37  * @file rte_crypto_sym.h
38  *
39  * RTE Definitions for Symmetric Cryptography
40  *
41  * Defines symmetric cipher and authentication algorithms and modes, as well
42  * as supported symmetric crypto operation combinations.
43  */
44
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48
49 #include <rte_mbuf.h>
50 #include <rte_memory.h>
51 #include <rte_mempool.h>
52
53
54 /** Symmetric Cipher Algorithms */
55 enum rte_crypto_cipher_algorithm {
56         RTE_CRYPTO_CIPHER_NULL = 1,
57         /**< NULL cipher algorithm. No mode applies to the NULL algorithm. */
58
59         RTE_CRYPTO_CIPHER_3DES_CBC,
60         /**< Triple DES algorithm in CBC mode */
61         RTE_CRYPTO_CIPHER_3DES_CTR,
62         /**< Triple DES algorithm in CTR mode */
63         RTE_CRYPTO_CIPHER_3DES_ECB,
64         /**< Triple DES algorithm in ECB mode */
65
66         RTE_CRYPTO_CIPHER_AES_CBC,
67         /**< AES algorithm in CBC mode */
68         RTE_CRYPTO_CIPHER_AES_CCM,
69         /**< AES algorithm in CCM mode. When this cipher algorithm is used the
70          * *RTE_CRYPTO_AUTH_AES_CCM* element of the
71          * *rte_crypto_hash_algorithm* enum MUST be used to set up the related
72          * *rte_crypto_auth_xform* structure in the session context or in
73          * the op_params of the crypto operation structure in the case of a
74          * session-less crypto operation
75          */
76         RTE_CRYPTO_CIPHER_AES_CTR,
77         /**< AES algorithm in Counter mode */
78         RTE_CRYPTO_CIPHER_AES_ECB,
79         /**< AES algorithm in ECB mode */
80         RTE_CRYPTO_CIPHER_AES_F8,
81         /**< AES algorithm in F8 mode */
82         RTE_CRYPTO_CIPHER_AES_GCM,
83         /**< AES algorithm in GCM mode. When this cipher algorithm is used the
84          * *RTE_CRYPTO_AUTH_AES_GCM* element of the
85          * *rte_crypto_auth_algorithm* enum MUST be used to set up the related
86          * *rte_crypto_auth_setup_data* structure in the session context or in
87          * the op_params of the crypto operation structure in the case of a
88          * session-less crypto operation.
89          */
90         RTE_CRYPTO_CIPHER_AES_XTS,
91         /**< AES algorithm in XTS mode */
92
93         RTE_CRYPTO_CIPHER_ARC4,
94         /**< (A)RC4 cipher algorithm */
95
96         RTE_CRYPTO_CIPHER_KASUMI_F8,
97         /**< Kasumi algorithm in F8 mode */
98
99         RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
100         /**< SNOW3G algorithm in UEA2 mode */
101
102         RTE_CRYPTO_CIPHER_ZUC_EEA3
103         /**< ZUC algorithm in EEA3 mode */
104 };
105
106 /** Symmetric Cipher Direction */
107 enum rte_crypto_cipher_operation {
108         RTE_CRYPTO_CIPHER_OP_ENCRYPT,
109         /**< Encrypt cipher operation */
110         RTE_CRYPTO_CIPHER_OP_DECRYPT
111         /**< Decrypt cipher operation */
112 };
113
114
115 /**
116  * Symmetric Cipher Setup Data.
117  *
118  * This structure contains data relating to Cipher (Encryption and Decryption)
119  *  use to create a session.
120  */
121 struct rte_crypto_cipher_xform {
122         enum rte_crypto_cipher_operation op;
123         /**< This parameter determines if the cipher operation is an encrypt or
124          * a decrypt operation. For the RC4 algorithm and the F8/CTR modes,
125          * only encrypt operations are valid.
126          */
127         enum rte_crypto_cipher_algorithm algo;
128         /**< Cipher algorithm */
129
130         struct {
131                 uint8_t *data;  /**< pointer to key data */
132                 size_t length;  /**< key length in bytes */
133         } key;
134         /**< Cipher key
135          *
136          * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will
137          * point to a concatenation of the AES encryption key followed by a
138          * keymask. As per RFC3711, the keymask should be padded with trailing
139          * bytes to match the length of the encryption key used.
140          *
141          * For AES-XTS mode of operation, two keys must be provided and
142          * key.data must point to the two keys concatenated together (Key1 ||
143          * Key2). The cipher key length will contain the total size of both
144          * keys.
145          *
146          * Cipher key length is in bytes. For AES it can be 128 bits (16 bytes),
147          * 192 bits (24 bytes) or 256 bits (32 bytes).
148          *
149          * For the CCM mode of operation, the only supported key length is 128
150          * bits (16 bytes).
151          *
152          * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.length
153          * should be set to the combined length of the encryption key and the
154          * keymask. Since the keymask and the encryption key are the same size,
155          * key.length should be set to 2 x the AES encryption key length.
156          *
157          * For the AES-XTS mode of operation:
158          *  - Two keys must be provided and key.length refers to total length of
159          *    the two keys.
160          *  - Each key can be either 128 bits (16 bytes) or 256 bits (32 bytes).
161          *  - Both keys must have the same size.
162          **/
163 };
164
165 /** Symmetric Authentication / Hash Algorithms */
166 enum rte_crypto_auth_algorithm {
167         RTE_CRYPTO_AUTH_NULL = 1,
168         /**< NULL hash algorithm. */
169
170         RTE_CRYPTO_AUTH_AES_CBC_MAC,
171         /**< AES-CBC-MAC algorithm. Only 128-bit keys are supported. */
172         RTE_CRYPTO_AUTH_AES_CCM,
173         /**< AES algorithm in CCM mode. This is an authenticated cipher. When
174          * this hash algorithm is used, the *RTE_CRYPTO_CIPHER_AES_CCM*
175          * element of the *rte_crypto_cipher_algorithm* enum MUST be used to
176          * set up the related rte_crypto_cipher_setup_data structure in the
177          * session context or the corresponding parameter in the crypto
178          * operation data structures op_params parameter MUST be set for a
179          * session-less crypto operation.
180          */
181         RTE_CRYPTO_AUTH_AES_CMAC,
182         /**< AES CMAC algorithm. */
183         RTE_CRYPTO_AUTH_AES_GCM,
184         /**< AES algorithm in GCM mode. When this hash algorithm
185          * is used, the RTE_CRYPTO_CIPHER_AES_GCM element of the
186          * rte_crypto_cipher_algorithm enum MUST be used to set up the related
187          * rte_crypto_cipher_setup_data structure in the session context, or
188          * the corresponding parameter in the crypto operation data structures
189          * op_params parameter MUST be set for a session-less crypto operation.
190          */
191         RTE_CRYPTO_AUTH_AES_GMAC,
192         /**< AES GMAC algorithm. When this hash algorithm
193         * is used, the RTE_CRYPTO_CIPHER_AES_GCM element of the
194         * rte_crypto_cipher_algorithm enum MUST be used to set up the related
195         * rte_crypto_cipher_setup_data structure in the session context,  or
196         * the corresponding parameter in the crypto operation data structures
197         * op_params parameter MUST be set for a session-less crypto operation.
198         */
199         RTE_CRYPTO_AUTH_AES_XCBC_MAC,
200         /**< AES XCBC algorithm. */
201
202         RTE_CRYPTO_AUTH_KASUMI_F9,
203         /**< Kasumi algorithm in F9 mode. */
204
205         RTE_CRYPTO_AUTH_MD5,
206         /**< MD5 algorithm */
207         RTE_CRYPTO_AUTH_MD5_HMAC,
208         /**< HMAC using MD5 algorithm */
209
210         RTE_CRYPTO_AUTH_SHA1,
211         /**< 128 bit SHA algorithm. */
212         RTE_CRYPTO_AUTH_SHA1_HMAC,
213         /**< HMAC using 128 bit SHA algorithm. */
214         RTE_CRYPTO_AUTH_SHA224,
215         /**< 224 bit SHA algorithm. */
216         RTE_CRYPTO_AUTH_SHA224_HMAC,
217         /**< HMAC using 224 bit SHA algorithm. */
218         RTE_CRYPTO_AUTH_SHA256,
219         /**< 256 bit SHA algorithm. */
220         RTE_CRYPTO_AUTH_SHA256_HMAC,
221         /**< HMAC using 256 bit SHA algorithm. */
222         RTE_CRYPTO_AUTH_SHA384,
223         /**< 384 bit SHA algorithm. */
224         RTE_CRYPTO_AUTH_SHA384_HMAC,
225         /**< HMAC using 384 bit SHA algorithm. */
226         RTE_CRYPTO_AUTH_SHA512,
227         /**< 512 bit SHA algorithm. */
228         RTE_CRYPTO_AUTH_SHA512_HMAC,
229         /**< HMAC using 512 bit SHA algorithm. */
230
231         RTE_CRYPTO_AUTH_SNOW3G_UIA2,
232         /**< SNOW3G algorithm in UIA2 mode. */
233
234         RTE_CRYPTO_AUTH_ZUC_EIA3,
235         /**< ZUC algorithm in EIA3 mode */
236 };
237
238 /** Symmetric Authentication / Hash Operations */
239 enum rte_crypto_auth_operation {
240         RTE_CRYPTO_AUTH_OP_VERIFY,      /**< Verify authentication digest */
241         RTE_CRYPTO_AUTH_OP_GENERATE     /**< Generate authentication digest */
242 };
243
244 /**
245  * Authentication / Hash transform data.
246  *
247  * This structure contains data relating to an authentication/hash crypto
248  * transforms. The fields op, algo and digest_length are common to all
249  * authentication transforms and MUST be set.
250  */
251 struct rte_crypto_auth_xform {
252         enum rte_crypto_auth_operation op;
253         /**< Authentication operation type */
254         enum rte_crypto_auth_algorithm algo;
255         /**< Authentication algorithm selection */
256
257         struct {
258                 uint8_t *data;  /**< pointer to key data */
259                 size_t length;  /**< key length in bytes */
260         } key;
261         /**< Authentication key data.
262          * The authentication key length MUST be less than or equal to the
263          * block size of the algorithm. It is the callers responsibility to
264          * ensure that the key length is compliant with the standard being used
265          * (for example RFC 2104, FIPS 198a).
266          */
267
268         uint32_t digest_length;
269         /**< Length of the digest to be returned. If the verify option is set,
270          * this specifies the length of the digest to be compared for the
271          * session.
272          *
273          * If the value is less than the maximum length allowed by the hash,
274          * the result shall be truncated.  If the value is greater than the
275          * maximum length allowed by the hash then an error will be generated
276          * by *rte_cryptodev_sym_session_create* or by the
277          * *rte_cryptodev_sym_enqueue_burst* if using session-less APIs.
278          */
279
280         uint32_t add_auth_data_length;
281         /**< The length of the additional authenticated data (AAD) in bytes.
282          * The maximum permitted value is 240 bytes, unless otherwise specified
283          * below.
284          *
285          * This field must be specified when the hash algorithm is one of the
286          * following:
287          *
288          * - For SNOW3G (@ref RTE_CRYPTO_AUTH_SNOW3G_UIA2), this is the
289          *   length of the IV (which should be 16).
290          *
291          * - For GCM (@ref RTE_CRYPTO_AUTH_AES_GCM).  In this case, this is
292          *   the length of the Additional Authenticated Data (called A, in NIST
293          *   SP800-38D).
294          *
295          * - For CCM (@ref RTE_CRYPTO_AUTH_AES_CCM).  In this case, this is
296          *   the length of the associated data (called A, in NIST SP800-38C).
297          *   Note that this does NOT include the length of any padding, or the
298          *   18 bytes reserved at the start of the above field to store the
299          *   block B0 and the encoded length.  The maximum permitted value in
300          *   this case is 222 bytes.
301          *
302          * @note
303          *  For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC) mode of operation
304          *  this field is not used and should be set to 0. Instead the length
305          *  of the AAD data is specified in the message length to hash field of
306          *  the rte_crypto_sym_op_data structure.
307          */
308 };
309
310 /** Crypto transformation types */
311 enum rte_crypto_sym_xform_type {
312         RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED = 0, /**< No xform specified */
313         RTE_CRYPTO_SYM_XFORM_AUTH,              /**< Authentication xform */
314         RTE_CRYPTO_SYM_XFORM_CIPHER             /**< Cipher xform  */
315 };
316
317 /**
318  * Symmetric crypto transform structure.
319  *
320  * This is used to specify the crypto transforms required, multiple transforms
321  * can be chained together to specify a chain transforms such as authentication
322  * then cipher, or cipher then authentication. Each transform structure can
323  * hold a single transform, the type field is used to specify which transform
324  * is contained within the union
325  */
326 struct rte_crypto_sym_xform {
327         struct rte_crypto_sym_xform *next;
328         /**< next xform in chain */
329         enum rte_crypto_sym_xform_type type
330         ; /**< xform type */
331         union {
332                 struct rte_crypto_auth_xform auth;
333                 /**< Authentication / hash xform */
334                 struct rte_crypto_cipher_xform cipher;
335                 /**< Cipher xform */
336         };
337 };
338
339 /**
340  * Crypto operation session type. This is used to specify whether a crypto
341  * operation has session structure attached for immutable parameters or if all
342  * operation information is included in the operation data structure.
343  */
344 enum rte_crypto_sym_op_sess_type {
345         RTE_CRYPTO_SYM_OP_WITH_SESSION, /**< Session based crypto operation */
346         RTE_CRYPTO_SYM_OP_SESSIONLESS   /**< Session-less crypto operation */
347 };
348
349
350 /**
351  * Cryptographic Operation Data.
352  *
353  * This structure contains data relating to performing cryptographic processing
354  * on a data buffer. This request is used with rte_crypto_sym_enqueue_burst()
355  * call for performing cipher, hash, or a combined hash and cipher operations.
356  */
357 struct rte_crypto_sym_op {
358         enum rte_crypto_sym_op_sess_type type;
359         enum rte_crypto_op_status status;
360
361         struct {
362                 struct rte_mbuf *m;     /**< Destination mbuf */
363                 uint8_t offset;         /**< Data offset */
364         } dst;
365
366         union {
367                 struct rte_cryptodev_sym_session *session;
368                 /**< Handle for the initialised session context */
369                 struct rte_crypto_sym_xform *xform;
370                 /**< Session-less API crypto operation parameters */
371         };
372
373         struct {
374                 struct {
375                          uint32_t offset;
376                          /**< Starting point for cipher processing, specified
377                           * as number of bytes from start of data in the source
378                           * buffer. The result of the cipher operation will be
379                           * written back into the output buffer starting at
380                           * this location.
381                           */
382
383                          uint32_t length;
384                          /**< The message length, in bytes, of the source buffer
385                           * on which the cryptographic operation will be
386                           * computed. This must be a multiple of the block size
387                           * if a block cipher is being used. This is also the
388                           * same as the result length.
389                           *
390                           * @note
391                           * In the case of CCM @ref RTE_CRYPTO_AUTH_AES_CCM,
392                           * this value should not include the length of the
393                           * padding or the length of the MAC; the driver will
394                           * compute the actual number of bytes over which the
395                           * encryption will occur, which will include these
396                           * values.
397                           *
398                           * @note
399                           * For AES-GMAC @ref RTE_CRYPTO_AUTH_AES_GMAC, this
400                           * field should be set to 0.
401                           */
402                 } to_cipher; /**< Data offsets and length for ciphering */
403
404                 struct {
405                          uint32_t offset;
406                          /**< Starting point for hash processing, specified as
407                           * number of bytes from start of packet in source
408                           * buffer.
409                           *
410                           * @note
411                           * For CCM and GCM modes of operation, this field is
412                           * ignored. The field @ref additional_auth field
413                           * should be set instead.
414                           *
415                           * @note For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC)
416                           * mode of operation, this field specifies the start
417                           * of the AAD data in the source buffer.
418                           */
419
420                          uint32_t length;
421                          /**< The message length, in bytes, of the source
422                           * buffer that the hash will be computed on.
423                           *
424                           * @note
425                           * For CCM and GCM modes of operation, this field is
426                           * ignored. The field @ref additional_auth field
427                           * should be set instead.
428                           *
429                           * @note
430                           * For AES-GMAC @ref RTE_CRYPTO_AUTH_AES_GMAC mode
431                           * of operation, this field specifies the length of
432                           * the AAD data in the source buffer.
433                           */
434                 } to_hash; /**< Data offsets and length for authentication */
435         } data; /**< Details of data to be operated on */
436
437         struct {
438                 uint8_t *data;
439                 /**< Initialisation Vector or Counter.
440                  *
441                  * - For block ciphers in CBC or F8 mode, or for Kasumi in F8
442                  * mode, or for SNOW3G in UEA2 mode, this is the Initialisation
443                  * Vector (IV) value.
444                  *
445                  * - For block ciphers in CTR mode, this is the counter.
446                  *
447                  * - For GCM mode, this is either the IV (if the length is 96
448                  * bits) or J0 (for other sizes), where J0 is as defined by
449                  * NIST SP800-38D. Regardless of the IV length, a full 16 bytes
450                  * needs to be allocated.
451                  *
452                  * - For CCM mode, the first byte is reserved, and the nonce
453                  * should be written starting at &iv[1] (to allow space for the
454                  * implementation to write in the flags in the first byte).
455                  * Note that a full 16 bytes should be allocated, even though
456                  * the length field will have a value less than this.
457                  *
458                  * - For AES-XTS, this is the 128bit tweak, i, from IEEE Std
459                  * 1619-2007.
460                  *
461                  * For optimum performance, the data pointed to SHOULD be
462                  * 8-byte aligned.
463                  */
464                 phys_addr_t phys_addr;
465                 size_t length;
466                 /**< Length of valid IV data.
467                  *
468                  * - For block ciphers in CBC or F8 mode, or for Kasumi in F8
469                  * mode, or for SNOW3G in UEA2 mode, this is the length of the
470                  * IV (which must be the same as the block length of the
471                  * cipher).
472                  *
473                  * - For block ciphers in CTR mode, this is the length of the
474                  * counter (which must be the same as the block length of the
475                  * cipher).
476                  *
477                  * - For GCM mode, this is either 12 (for 96-bit IVs) or 16, in
478                  * which case data points to J0.
479                  *
480                  * - For CCM mode, this is the length of the nonce, which can
481                  * be in the range 7 to 13 inclusive.
482                  */
483         } iv;   /**< Initialisation vector parameters */
484
485         struct {
486                 uint8_t *data;
487                 /**< If this member of this structure is set this is a
488                  * pointer to the location where the digest result should be
489                  * inserted (in the case of digest generation) or where the
490                  * purported digest exists (in the case of digest
491                  * verification).
492                  *
493                  * At session creation time, the client specified the digest
494                  * result length with the digest_length member of the @ref
495                  * rte_crypto_auth_xform structure. For physical crypto
496                  * devices the caller must allocate at least digest_length of
497                  * physically contiguous memory at this location.
498                  *
499                  * For digest generation, the digest result will overwrite
500                  * any data at this location.
501                  *
502                  * @note
503                  * For GCM (@ref RTE_CRYPTO_AUTH_AES_GCM), for
504                  * "digest result" read "authentication tag T".
505                  *
506                  * If this member is not set the digest result is understood
507                  * to be in the destination buffer for digest generation, and
508                  * in the source buffer for digest verification. The location
509                  * of the digest result in this case is immediately following
510                  * the region over which the digest is computed.
511                  */
512                 phys_addr_t phys_addr;  /**< Physical address of digest */
513                 uint32_t length;        /**< Length of digest */
514         } digest; /**< Digest parameters */
515
516         struct {
517                 uint8_t *data;
518                 /**< Pointer to Additional Authenticated Data (AAD) needed for
519                  * authenticated cipher mechanisms (CCM and GCM), and to the IV
520                  * for SNOW3G authentication
521                  * (@ref RTE_CRYPTO_AUTH_SNOW3G_UIA2). For other
522                  * authentication mechanisms this pointer is ignored.
523                  *
524                  * The length of the data pointed to by this field is set up
525                  * for the session in the @ref rte_crypto_auth_xform structure
526                  * as part of the @ref rte_cryptodev_sym_session_create function
527                  * call.  This length must not exceed 240 bytes.
528                  *
529                  * Specifically for CCM (@ref RTE_CRYPTO_AUTH_AES_CCM), the
530                  * caller should setup this field as follows:
531                  *
532                  * - the nonce should be written starting at an offset of one
533                  *   byte into the array, leaving room for the implementation
534                  *   to write in the flags to the first byte.
535                  *
536                  * - the additional  authentication data itself should be
537                  *   written starting at an offset of 18 bytes into the array,
538                  *   leaving room for the length encoding in the first two
539                  *   bytes of the second block.
540                  *
541                  * - the array should be big enough to hold the above fields,
542                  *   plus any padding to round this up to the nearest multiple
543                  *   of the block size (16 bytes).  Padding will be added by
544                  *   the implementation.
545                  *
546                  * Finally, for GCM (@ref RTE_CRYPTO_AUTH_AES_GCM), the
547                  * caller should setup this field as follows:
548                  *
549                  * - the AAD is written in starting at byte 0
550                  * - the array must be big enough to hold the AAD, plus any
551                  *   space to round this up to the nearest multiple of the
552                  *   block size (16 bytes).
553                  *
554                  * @note
555                  * For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC) mode of
556                  * operation, this field is not used and should be set to 0.
557                  * Instead the AAD data should be placed in the source buffer.
558                  */
559                 phys_addr_t phys_addr;  /**< physical address */
560                 uint32_t length;        /**< Length of digest */
561         } additional_auth;
562         /**< Additional authentication parameters */
563
564         struct rte_mempool *pool;
565         /**< mempool used to allocate crypto op */
566
567         void *user_data;
568         /**< opaque pointer for user data */
569 };
570
571
572 /**
573  * Reset the fields of a crypto operation to their default values.
574  *
575  * @param       op      The crypto operation to be reset.
576  */
577 static inline void
578 __rte_crypto_sym_op_reset(struct rte_crypto_sym_op *op)
579 {
580         op->type = RTE_CRYPTO_SYM_OP_SESSIONLESS;
581         op->dst.m = NULL;
582         op->dst.offset = 0;
583 }
584
585 /** Attach a session to a crypto operation */
586 static inline void
587 rte_crypto_sym_op_attach_session(struct rte_crypto_sym_op *op,
588                 struct rte_cryptodev_sym_session *sess)
589 {
590         op->session = sess;
591         op->type = RTE_CRYPTO_SYM_OP_WITH_SESSION;
592 }
593
594 #ifdef __cplusplus
595 }
596 #endif
597
598 #endif /* _RTE_CRYPTO_SYM_H_ */