4 * Copyright(c) 2016 Intel Corporation. All rights reserved.
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
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
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.
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.
33 #ifndef _RTE_CRYPTO_SYM_H_
34 #define _RTE_CRYPTO_SYM_H_
37 * @file rte_crypto_sym.h
39 * RTE Definitions for Symmetric Cryptography
41 * Defines symmetric cipher and authentication algorithms and modes, as well
42 * as supported symmetric crypto operation combinations.
52 #include <rte_memory.h>
53 #include <rte_mempool.h>
54 #include <rte_common.h>
57 /** Symmetric Cipher Algorithms */
58 enum rte_crypto_cipher_algorithm {
59 RTE_CRYPTO_CIPHER_NULL = 1,
60 /**< NULL cipher algorithm. No mode applies to the NULL algorithm. */
62 RTE_CRYPTO_CIPHER_3DES_CBC,
63 /**< Triple DES algorithm in CBC mode */
64 RTE_CRYPTO_CIPHER_3DES_CTR,
65 /**< Triple DES algorithm in CTR mode */
66 RTE_CRYPTO_CIPHER_3DES_ECB,
67 /**< Triple DES algorithm in ECB mode */
69 RTE_CRYPTO_CIPHER_AES_CBC,
70 /**< AES algorithm in CBC mode */
71 RTE_CRYPTO_CIPHER_AES_CCM,
72 /**< AES algorithm in CCM mode. When this cipher algorithm is used the
73 * *RTE_CRYPTO_AUTH_AES_CCM* element of the
74 * *rte_crypto_hash_algorithm* enum MUST be used to set up the related
75 * *rte_crypto_auth_xform* structure in the session context or in
76 * the op_params of the crypto operation structure in the case of a
77 * session-less crypto operation
79 RTE_CRYPTO_CIPHER_AES_CTR,
80 /**< AES algorithm in Counter mode */
81 RTE_CRYPTO_CIPHER_AES_ECB,
82 /**< AES algorithm in ECB mode */
83 RTE_CRYPTO_CIPHER_AES_F8,
84 /**< AES algorithm in F8 mode */
85 RTE_CRYPTO_CIPHER_AES_GCM,
86 /**< AES algorithm in GCM mode. When this cipher algorithm is used the
87 * *RTE_CRYPTO_AUTH_AES_GCM* or *RTE_CRYPTO_AUTH_AES_GMAC* element
88 * of the *rte_crypto_auth_algorithm* enum MUST be used to set up
89 * the related *rte_crypto_auth_setup_data* structure in the session
90 * context or in the op_params of the crypto operation structure
91 * in the case of a session-less crypto operation.
93 RTE_CRYPTO_CIPHER_AES_XTS,
94 /**< AES algorithm in XTS mode */
96 RTE_CRYPTO_CIPHER_ARC4,
97 /**< (A)RC4 cipher algorithm */
99 RTE_CRYPTO_CIPHER_KASUMI_F8,
100 /**< KASUMI algorithm in F8 mode */
102 RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
103 /**< SNOW 3G algorithm in UEA2 mode */
105 RTE_CRYPTO_CIPHER_ZUC_EEA3,
106 /**< ZUC algorithm in EEA3 mode */
108 RTE_CRYPTO_CIPHER_DES_CBC,
109 /**< DES algorithm in CBC mode */
111 RTE_CRYPTO_CIPHER_AES_DOCSISBPI,
112 /**< AES algorithm using modes required by
113 * DOCSIS Baseline Privacy Plus Spec.
116 RTE_CRYPTO_CIPHER_DES_DOCSISBPI,
117 /**< DES algorithm using modes required by
118 * DOCSIS Baseline Privacy Plus Spec.
121 RTE_CRYPTO_CIPHER_LIST_END
125 /** Cipher algorithm name strings */
127 rte_crypto_cipher_algorithm_strings[];
129 /** Symmetric Cipher Direction */
130 enum rte_crypto_cipher_operation {
131 RTE_CRYPTO_CIPHER_OP_ENCRYPT,
132 /**< Encrypt cipher operation */
133 RTE_CRYPTO_CIPHER_OP_DECRYPT
134 /**< Decrypt cipher operation */
137 /** Cipher operation name strings */
139 rte_crypto_cipher_operation_strings[];
142 * Symmetric Cipher Setup Data.
144 * This structure contains data relating to Cipher (Encryption and Decryption)
145 * use to create a session.
147 struct rte_crypto_cipher_xform {
148 enum rte_crypto_cipher_operation op;
149 /**< This parameter determines if the cipher operation is an encrypt or
150 * a decrypt operation. For the RC4 algorithm and the F8/CTR modes,
151 * only encrypt operations are valid.
153 enum rte_crypto_cipher_algorithm algo;
154 /**< Cipher algorithm */
157 uint8_t *data; /**< pointer to key data */
158 size_t length; /**< key length in bytes */
162 * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.data will
163 * point to a concatenation of the AES encryption key followed by a
164 * keymask. As per RFC3711, the keymask should be padded with trailing
165 * bytes to match the length of the encryption key used.
167 * For AES-XTS mode of operation, two keys must be provided and
168 * key.data must point to the two keys concatenated together (Key1 ||
169 * Key2). The cipher key length will contain the total size of both
172 * Cipher key length is in bytes. For AES it can be 128 bits (16 bytes),
173 * 192 bits (24 bytes) or 256 bits (32 bytes).
175 * For the CCM mode of operation, the only supported key length is 128
178 * For the RTE_CRYPTO_CIPHER_AES_F8 mode of operation, key.length
179 * should be set to the combined length of the encryption key and the
180 * keymask. Since the keymask and the encryption key are the same size,
181 * key.length should be set to 2 x the AES encryption key length.
183 * For the AES-XTS mode of operation:
184 * - Two keys must be provided and key.length refers to total length of
186 * - Each key can be either 128 bits (16 bytes) or 256 bits (32 bytes).
187 * - Both keys must have the same size.
191 /** Symmetric Authentication / Hash Algorithms */
192 enum rte_crypto_auth_algorithm {
193 RTE_CRYPTO_AUTH_NULL = 1,
194 /**< NULL hash algorithm. */
196 RTE_CRYPTO_AUTH_AES_CBC_MAC,
197 /**< AES-CBC-MAC algorithm. Only 128-bit keys are supported. */
198 RTE_CRYPTO_AUTH_AES_CCM,
199 /**< AES algorithm in CCM mode. This is an authenticated cipher. When
200 * this hash algorithm is used, the *RTE_CRYPTO_CIPHER_AES_CCM*
201 * element of the *rte_crypto_cipher_algorithm* enum MUST be used to
202 * set up the related rte_crypto_cipher_setup_data structure in the
203 * session context or the corresponding parameter in the crypto
204 * operation data structures op_params parameter MUST be set for a
205 * session-less crypto operation.
207 RTE_CRYPTO_AUTH_AES_CMAC,
208 /**< AES CMAC algorithm. */
209 RTE_CRYPTO_AUTH_AES_GCM,
210 /**< AES algorithm in GCM mode. When this hash algorithm
211 * is used, the RTE_CRYPTO_CIPHER_AES_GCM element of the
212 * rte_crypto_cipher_algorithm enum MUST be used to set up the related
213 * rte_crypto_cipher_setup_data structure in the session context, or
214 * the corresponding parameter in the crypto operation data structures
215 * op_params parameter MUST be set for a session-less crypto operation.
217 RTE_CRYPTO_AUTH_AES_GMAC,
218 /**< AES GMAC algorithm. When this hash algorithm
219 * is used, the RTE_CRYPTO_CIPHER_AES_GCM element of the
220 * rte_crypto_cipher_algorithm enum MUST be used to set up the related
221 * rte_crypto_cipher_setup_data structure in the session context, or
222 * the corresponding parameter in the crypto operation data structures
223 * op_params parameter MUST be set for a session-less crypto operation.
225 RTE_CRYPTO_AUTH_AES_XCBC_MAC,
226 /**< AES XCBC algorithm. */
228 RTE_CRYPTO_AUTH_KASUMI_F9,
229 /**< KASUMI algorithm in F9 mode. */
232 /**< MD5 algorithm */
233 RTE_CRYPTO_AUTH_MD5_HMAC,
234 /**< HMAC using MD5 algorithm */
236 RTE_CRYPTO_AUTH_SHA1,
237 /**< 128 bit SHA algorithm. */
238 RTE_CRYPTO_AUTH_SHA1_HMAC,
239 /**< HMAC using 128 bit SHA algorithm. */
240 RTE_CRYPTO_AUTH_SHA224,
241 /**< 224 bit SHA algorithm. */
242 RTE_CRYPTO_AUTH_SHA224_HMAC,
243 /**< HMAC using 224 bit SHA algorithm. */
244 RTE_CRYPTO_AUTH_SHA256,
245 /**< 256 bit SHA algorithm. */
246 RTE_CRYPTO_AUTH_SHA256_HMAC,
247 /**< HMAC using 256 bit SHA algorithm. */
248 RTE_CRYPTO_AUTH_SHA384,
249 /**< 384 bit SHA algorithm. */
250 RTE_CRYPTO_AUTH_SHA384_HMAC,
251 /**< HMAC using 384 bit SHA algorithm. */
252 RTE_CRYPTO_AUTH_SHA512,
253 /**< 512 bit SHA algorithm. */
254 RTE_CRYPTO_AUTH_SHA512_HMAC,
255 /**< HMAC using 512 bit SHA algorithm. */
257 RTE_CRYPTO_AUTH_SNOW3G_UIA2,
258 /**< SNOW 3G algorithm in UIA2 mode. */
260 RTE_CRYPTO_AUTH_ZUC_EIA3,
261 /**< ZUC algorithm in EIA3 mode */
263 RTE_CRYPTO_AUTH_LIST_END
266 /** Authentication algorithm name strings */
268 rte_crypto_auth_algorithm_strings[];
270 /** Symmetric Authentication / Hash Operations */
271 enum rte_crypto_auth_operation {
272 RTE_CRYPTO_AUTH_OP_VERIFY, /**< Verify authentication digest */
273 RTE_CRYPTO_AUTH_OP_GENERATE /**< Generate authentication digest */
276 /** Authentication operation name strings */
278 rte_crypto_auth_operation_strings[];
281 * Authentication / Hash transform data.
283 * This structure contains data relating to an authentication/hash crypto
284 * transforms. The fields op, algo and digest_length are common to all
285 * authentication transforms and MUST be set.
287 struct rte_crypto_auth_xform {
288 enum rte_crypto_auth_operation op;
289 /**< Authentication operation type */
290 enum rte_crypto_auth_algorithm algo;
291 /**< Authentication algorithm selection */
294 uint8_t *data; /**< pointer to key data */
295 size_t length; /**< key length in bytes */
297 /**< Authentication key data.
298 * The authentication key length MUST be less than or equal to the
299 * block size of the algorithm. It is the callers responsibility to
300 * ensure that the key length is compliant with the standard being used
301 * (for example RFC 2104, FIPS 198a).
304 uint32_t digest_length;
305 /**< Length of the digest to be returned. If the verify option is set,
306 * this specifies the length of the digest to be compared for the
309 * If the value is less than the maximum length allowed by the hash,
310 * the result shall be truncated. If the value is greater than the
311 * maximum length allowed by the hash then an error will be generated
312 * by *rte_cryptodev_sym_session_create* or by the
313 * *rte_cryptodev_sym_enqueue_burst* if using session-less APIs.
316 uint32_t add_auth_data_length;
317 /**< The length of the additional authenticated data (AAD) in bytes.
318 * The maximum permitted value is 240 bytes, unless otherwise specified
321 * This field must be specified when the hash algorithm is one of the
324 * - For SNOW 3G (@ref RTE_CRYPTO_AUTH_SNOW3G_UIA2), this is the
325 * length of the IV (which should be 16).
327 * - For GCM (@ref RTE_CRYPTO_AUTH_AES_GCM). In this case, this is
328 * the length of the Additional Authenticated Data (called A, in NIST
331 * - For CCM (@ref RTE_CRYPTO_AUTH_AES_CCM). In this case, this is
332 * the length of the associated data (called A, in NIST SP800-38C).
333 * Note that this does NOT include the length of any padding, or the
334 * 18 bytes reserved at the start of the above field to store the
335 * block B0 and the encoded length. The maximum permitted value in
336 * this case is 222 bytes.
339 * For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC) mode of operation
340 * this field is not used and should be set to 0. Instead the length
341 * of the AAD data is specified in additional authentication data
342 * length field of the rte_crypto_sym_op_data structure
346 /** Crypto transformation types */
347 enum rte_crypto_sym_xform_type {
348 RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED = 0, /**< No xform specified */
349 RTE_CRYPTO_SYM_XFORM_AUTH, /**< Authentication xform */
350 RTE_CRYPTO_SYM_XFORM_CIPHER /**< Cipher xform */
354 * Symmetric crypto transform structure.
356 * This is used to specify the crypto transforms required, multiple transforms
357 * can be chained together to specify a chain transforms such as authentication
358 * then cipher, or cipher then authentication. Each transform structure can
359 * hold a single transform, the type field is used to specify which transform
360 * is contained within the union
362 struct rte_crypto_sym_xform {
363 struct rte_crypto_sym_xform *next;
364 /**< next xform in chain */
365 enum rte_crypto_sym_xform_type type
369 struct rte_crypto_auth_xform auth;
370 /**< Authentication / hash xform */
371 struct rte_crypto_cipher_xform cipher;
377 * Crypto operation session type. This is used to specify whether a crypto
378 * operation has session structure attached for immutable parameters or if all
379 * operation information is included in the operation data structure.
381 enum rte_crypto_sym_op_sess_type {
382 RTE_CRYPTO_SYM_OP_WITH_SESSION, /**< Session based crypto operation */
383 RTE_CRYPTO_SYM_OP_SESSIONLESS /**< Session-less crypto operation */
387 struct rte_cryptodev_sym_session;
390 * Symmetric Cryptographic Operation.
392 * This structure contains data relating to performing symmetric cryptographic
393 * processing on a referenced mbuf data buffer.
395 * When a symmetric crypto operation is enqueued with the device for processing
396 * it must have a valid *rte_mbuf* structure attached, via m_src parameter,
397 * which contains the source data which the crypto operation is to be performed
399 * While the mbuf is in use by a crypto operation no part of the mbuf should be
400 * changed by the application as the device may read or write to any part of the
401 * mbuf. In the case of hardware crypto devices some or all of the mbuf
402 * may be DMAed in and out of the device, so writing over the original data,
403 * though only the part specified by the rte_crypto_sym_op for transformation
405 * Out-of-place (OOP) operation, where the source mbuf is different to the
406 * destination mbuf, is a special case. Data will be copied from m_src to m_dst.
407 * The part copied includes all the parts of the source mbuf that will be
408 * operated on, based on the cipher.data.offset+cipher.data.length and
409 * auth.data.offset+auth.data.length values in the rte_crypto_sym_op. The part
410 * indicated by the cipher parameters will be transformed, any extra data around
411 * this indicated by the auth parameters will be copied unchanged from source to
413 * Also in OOP operation the cipher.data.offset and auth.data.offset apply to
414 * both source and destination mbufs. As these offsets are relative to the
415 * data_off parameter in each mbuf this can result in the data written to the
416 * destination buffer being at a different alignment, relative to buffer start,
417 * to the data in the source buffer.
419 struct rte_crypto_sym_op {
420 struct rte_mbuf *m_src; /**< source mbuf */
421 struct rte_mbuf *m_dst; /**< destination mbuf */
423 enum rte_crypto_sym_op_sess_type sess_type;
427 struct rte_cryptodev_sym_session *session;
428 /**< Handle for the initialised session context */
429 struct rte_crypto_sym_xform *xform;
430 /**< Session-less API crypto operation parameters */
436 /**< Starting point for cipher processing, specified
437 * as number of bytes from start of data in the source
438 * buffer. The result of the cipher operation will be
439 * written back into the output buffer starting at
443 * For SNOW 3G @ RTE_CRYPTO_CIPHER_SNOW3G_UEA2,
444 * KASUMI @ RTE_CRYPTO_CIPHER_KASUMI_F8
445 * and ZUC @ RTE_CRYPTO_CIPHER_ZUC_EEA3,
446 * this field should be in bits.
450 /**< The message length, in bytes, of the source buffer
451 * on which the cryptographic operation will be
452 * computed. This must be a multiple of the block size
453 * if a block cipher is being used. This is also the
454 * same as the result length.
457 * In the case of CCM @ref RTE_CRYPTO_AUTH_AES_CCM,
458 * this value should not include the length of the
459 * padding or the length of the MAC; the driver will
460 * compute the actual number of bytes over which the
461 * encryption will occur, which will include these
465 * For AES-GMAC @ref RTE_CRYPTO_AUTH_AES_GMAC, this
466 * field should be set to 0.
469 * For SNOW 3G @ RTE_CRYPTO_AUTH_SNOW3G_UEA2,
470 * KASUMI @ RTE_CRYPTO_CIPHER_KASUMI_F8
471 * and ZUC @ RTE_CRYPTO_CIPHER_ZUC_EEA3,
472 * this field should be in bits.
474 } data; /**< Data offsets and length for ciphering */
478 /**< Initialisation Vector or Counter.
480 * - For block ciphers in CBC or F8 mode, or for KASUMI
481 * in F8 mode, or for SNOW 3G in UEA2 mode, this is the
482 * Initialisation Vector (IV) value.
484 * - For block ciphers in CTR mode, this is the counter.
486 * - For GCM mode, this is either the IV (if the length
487 * is 96 bits) or J0 (for other sizes), where J0 is as
488 * defined by NIST SP800-38D. Regardless of the IV
489 * length, a full 16 bytes needs to be allocated.
491 * - For CCM mode, the first byte is reserved, and the
492 * nonce should be written starting at &iv[1] (to allow
493 * space for the implementation to write in the flags
494 * in the first byte). Note that a full 16 bytes should
495 * be allocated, even though the length field will
496 * have a value less than this.
498 * - For AES-XTS, this is the 128bit tweak, i, from
499 * IEEE Std 1619-2007.
501 * For optimum performance, the data pointed to SHOULD
504 phys_addr_t phys_addr;
506 /**< Length of valid IV data.
508 * - For block ciphers in CBC or F8 mode, or for KASUMI
509 * in F8 mode, or for SNOW 3G in UEA2 mode, this is the
510 * length of the IV (which must be the same as the
511 * block length of the cipher).
513 * - For block ciphers in CTR mode, this is the length
514 * of the counter (which must be the same as the block
515 * length of the cipher).
517 * - For GCM mode, this is either 12 (for 96-bit IVs)
518 * or 16, in which case data points to J0.
520 * - For CCM mode, this is the length of the nonce,
521 * which can be in the range 7 to 13 inclusive.
523 } iv; /**< Initialisation vector parameters */
529 /**< Starting point for hash processing, specified as
530 * number of bytes from start of packet in source
534 * For CCM and GCM modes of operation, this field is
535 * ignored. The field @ref aad field
536 * should be set instead.
538 * @note For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC)
539 * mode of operation, this field is set to 0. aad data
540 * pointer of rte_crypto_sym_op_data structure is
544 * For SNOW 3G @ RTE_CRYPTO_AUTH_SNOW3G_UIA2,
545 * KASUMI @ RTE_CRYPTO_AUTH_KASUMI_F9
546 * and ZUC @ RTE_CRYPTO_AUTH_ZUC_EIA3,
547 * this field should be in bits.
551 /**< The message length, in bytes, of the source
552 * buffer that the hash will be computed on.
555 * For CCM and GCM modes of operation, this field is
556 * ignored. The field @ref aad field should be set
560 * For AES-GMAC @ref RTE_CRYPTO_AUTH_AES_GMAC mode
561 * of operation, this field is set to 0.
562 * Auth.aad.length is used instead.
565 * For SNOW 3G @ RTE_CRYPTO_AUTH_SNOW3G_UIA2,
566 * KASUMI @ RTE_CRYPTO_AUTH_KASUMI_F9
567 * and ZUC @ RTE_CRYPTO_AUTH_ZUC_EIA3,
568 * this field should be in bits.
570 } data; /**< Data offsets and length for authentication */
574 /**< This points to the location where the digest result
575 * should be inserted (in the case of digest generation)
576 * or where the purported digest exists (in the case of
577 * digest verification).
579 * At session creation time, the client specified the
580 * digest result length with the digest_length member
581 * of the @ref rte_crypto_auth_xform structure. For
582 * physical crypto devices the caller must allocate at
583 * least digest_length of physically contiguous memory
586 * For digest generation, the digest result will
587 * overwrite any data at this location.
590 * For GCM (@ref RTE_CRYPTO_AUTH_AES_GCM), for
591 * "digest result" read "authentication tag T".
593 phys_addr_t phys_addr;
594 /**< Physical address of digest */
596 /**< Length of digest */
597 } digest; /**< Digest parameters */
601 /**< Pointer to Additional Authenticated Data (AAD)
602 * needed for authenticated cipher mechanisms (CCM and
603 * GCM), and to the IV for SNOW 3G authentication
604 * (@ref RTE_CRYPTO_AUTH_SNOW3G_UIA2). For other
605 * authentication mechanisms this pointer is ignored.
607 * The length of the data pointed to by this field is
608 * set up for the session in the @ref
609 * rte_crypto_auth_xform structure as part of the @ref
610 * rte_cryptodev_sym_session_create function call.
611 * This length must not exceed 240 bytes.
613 * Specifically for CCM (@ref RTE_CRYPTO_AUTH_AES_CCM),
614 * the caller should setup this field as follows:
616 * - the nonce should be written starting at an offset
617 * of one byte into the array, leaving room for the
618 * implementation to write in the flags to the first
621 * - the additional authentication data itself should
622 * be written starting at an offset of 18 bytes into
623 * the array, leaving room for the length encoding in
624 * the first two bytes of the second block.
626 * - the array should be big enough to hold the above
627 * fields, plus any padding to round this up to the
628 * nearest multiple of the block size (16 bytes).
629 * Padding will be added by the implementation.
631 * Finally, for GCM (@ref RTE_CRYPTO_AUTH_AES_GCM), the
632 * caller should setup this field as follows:
634 * - the AAD is written in starting at byte 0
635 * - the array must be big enough to hold the AAD, plus
636 * any space to round this up to the nearest multiple
637 * of the block size (16 bytes).
640 * For AES-GMAC (@ref RTE_CRYPTO_AUTH_AES_GMAC) mode of
641 * operation, this field is used to pass plaintext.
643 phys_addr_t phys_addr; /**< physical address */
644 uint16_t length; /**< Length of digest */
646 /**< Additional authentication parameters */
648 } __rte_cache_aligned;
652 * Reset the fields of a symmetric operation to their default values.
654 * @param op The crypto operation to be reset.
657 __rte_crypto_sym_op_reset(struct rte_crypto_sym_op *op)
659 memset(op, 0, sizeof(*op));
661 op->sess_type = RTE_CRYPTO_SYM_OP_SESSIONLESS;
666 * Allocate space for symmetric crypto xforms in the private data space of the
667 * crypto operation. This also defaults the crypto xform type to
668 * RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED and configures the chaining of the xforms
669 * in the crypto operation
672 * - On success returns pointer to first crypto xform in crypto operations chain
673 * - On failure returns NULL
675 static inline struct rte_crypto_sym_xform *
676 __rte_crypto_sym_op_sym_xforms_alloc(struct rte_crypto_sym_op *sym_op,
677 void *priv_data, uint8_t nb_xforms)
679 struct rte_crypto_sym_xform *xform;
681 sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
684 xform->type = RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED;
685 xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
688 return sym_op->xform;
693 * Attach a session to a symmetric crypto operation
695 * @param sym_op crypto operation
696 * @param sess cryptodev session
699 __rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op,
700 struct rte_cryptodev_sym_session *sess)
702 sym_op->session = sess;
703 sym_op->sess_type = RTE_CRYPTO_SYM_OP_WITH_SESSION;
713 #endif /* _RTE_CRYPTO_SYM_H_ */