DPDK  19.11.12
rte_crypto_sym.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2019 Intel Corporation
3  */
4 
5 #ifndef _RTE_CRYPTO_SYM_H_
6 #define _RTE_CRYPTO_SYM_H_
7 
17 #ifdef __cplusplus
18 extern "C" {
19 #endif
20 
21 #include <string.h>
22 
23 #include <rte_mbuf.h>
24 #include <rte_memory.h>
25 #include <rte_mempool.h>
26 #include <rte_common.h>
27 
28 
81  RTE_CRYPTO_CIPHER_LIST_END
82 
83 };
84 
86 extern const char *
88 
95 };
96 
98 extern const char *
100 
116  struct {
117  const uint8_t *data;
118  uint16_t length;
119  } key;
143  struct {
144  uint16_t offset;
170  uint16_t length;
185  } iv;
186 };
187 
257  RTE_CRYPTO_AUTH_LIST_END
258 };
259 
261 extern const char *
263 
268 };
269 
271 extern const char *
273 
287  struct {
288  const uint8_t *data;
289  uint16_t length;
290  } key;
298  struct {
299  uint16_t offset;
315  uint16_t length;
333  } iv;
335  uint16_t digest_length;
345 };
346 
347 
354  RTE_CRYPTO_AEAD_LIST_END
355 };
356 
358 extern const char *
360 
367 };
368 
370 extern const char *
372 
373 struct rte_crypto_aead_xform {
376  enum rte_crypto_aead_algorithm algo;
379  struct {
380  const uint8_t *data;
381  uint16_t length;
382  } key;
383 
384  struct {
385  uint16_t offset;
400  uint16_t length;
414  } iv;
416  uint16_t digest_length;
417 
418  uint16_t aad_length;
424 };
425 
432 };
433 
447  ;
449  union {
454  struct rte_crypto_aead_xform aead;
456  };
457 };
458 
460 
492  struct rte_mbuf *m_src;
493  struct rte_mbuf *m_dst;
496  union {
501  struct rte_security_session *sec_session;
503  };
504 
506  union {
507  struct {
508  struct {
509  uint32_t offset;
514  uint32_t length;
519  } data;
520  struct {
521  uint8_t *data;
543  } digest;
544  struct {
545  uint8_t *data;
577  } aad;
579  } aead;
580 
581  struct {
582  struct {
583  struct {
584  uint32_t offset;
600  uint32_t length;
616  } data;
617  } cipher;
618 
619  struct {
620  struct {
621  uint32_t offset;
639  uint32_t length;
657  } data;
660  struct {
661  uint8_t *data;
734  } digest;
735  } auth;
736  };
737  };
738 };
739 
740 
746 static inline void
748 {
749  memset(op, 0, sizeof(*op));
750 }
751 
752 
763 static inline struct rte_crypto_sym_xform *
765  void *priv_data, uint8_t nb_xforms)
766 {
767  struct rte_crypto_sym_xform *xform;
768 
769  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
770 
771  do {
773  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
774  } while (xform);
775 
776  return sym_op->xform;
777 }
778 
779 
786 static inline int
788  struct rte_cryptodev_sym_session *sess)
789 {
790  sym_op->session = sess;
791 
792  return 0;
793 }
794 
795 
796 #ifdef __cplusplus
797 }
798 #endif
799 
800 #endif /* _RTE_CRYPTO_SYM_H_ */
__rte_crypto_sym_op_reset
static void __rte_crypto_sym_op_reset(struct rte_crypto_sym_op *op)
Definition: rte_crypto_sym.h:747
rte_crypto_sym_xform::auth
struct rte_crypto_auth_xform auth
Definition: rte_crypto_sym.h:450
rte_crypto_auth_algorithm_strings
const char * rte_crypto_auth_algorithm_strings[]
RTE_CRYPTO_CIPHER_KASUMI_F8
@ RTE_CRYPTO_CIPHER_KASUMI_F8
Definition: rte_crypto_sym.h:55
rte_crypto_cipher_xform::op
enum rte_crypto_cipher_operation op
Definition: rte_crypto_sym.h:108
rte_crypto_cipher_algorithm
rte_crypto_cipher_algorithm
Definition: rte_crypto_sym.h:30
rte_memory.h
RTE_CRYPTO_CIPHER_ARC4
@ RTE_CRYPTO_CIPHER_ARC4
Definition: rte_crypto_sym.h:52
RTE_CRYPTO_AUTH_AES_GMAC
@ RTE_CRYPTO_AUTH_AES_GMAC
Definition: rte_crypto_sym.h:197
RTE_CRYPTO_CIPHER_3DES_ECB
@ RTE_CRYPTO_CIPHER_3DES_ECB
Definition: rte_crypto_sym.h:38
rte_iova_t
uint64_t rte_iova_t
Definition: rte_common.h:335
RTE_CRYPTO_AEAD_AES_CCM
@ RTE_CRYPTO_AEAD_AES_CCM
Definition: rte_crypto_sym.h:350
RTE_CRYPTO_CIPHER_NULL
@ RTE_CRYPTO_CIPHER_NULL
Definition: rte_crypto_sym.h:31
RTE_CRYPTO_CIPHER_AES_XTS
@ RTE_CRYPTO_CIPHER_AES_XTS
Definition: rte_crypto_sym.h:49
RTE_CRYPTO_AUTH_SHA512
@ RTE_CRYPTO_AUTH_SHA512
Definition: rte_crypto_sym.h:229
rte_crypto_auth_operation_strings
const char * rte_crypto_auth_operation_strings[]
rte_crypto_auth_xform::length
uint16_t length
Definition: rte_crypto_sym.h:289
rte_crypto_cipher_xform::algo
enum rte_crypto_cipher_algorithm algo
Definition: rte_crypto_sym.h:113
RTE_CRYPTO_AUTH_KASUMI_F9
@ RTE_CRYPTO_AUTH_KASUMI_F9
Definition: rte_crypto_sym.h:202
rte_crypto_auth_operation
rte_crypto_auth_operation
Definition: rte_crypto_sym.h:265
RTE_CRYPTO_AUTH_AES_CMAC
@ RTE_CRYPTO_AUTH_AES_CMAC
Definition: rte_crypto_sym.h:195
rte_crypto_cipher_xform::data
const uint8_t * data
Definition: rte_crypto_sym.h:117
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
@ RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
Definition: rte_crypto_sym.h:428
rte_crypto_auth_xform::iv
struct rte_crypto_auth_xform::@99 iv
RTE_CRYPTO_AUTH_SHA512_HMAC
@ RTE_CRYPTO_AUTH_SHA512_HMAC
Definition: rte_crypto_sym.h:231
rte_crypto_sym_op::digest
struct rte_crypto_sym_op::@106::@108::@112 digest
rte_crypto_sym_op::phys_addr
rte_iova_t phys_addr
Definition: rte_crypto_sym.h:541
RTE_CRYPTO_AUTH_SHA3_224
@ RTE_CRYPTO_AUTH_SHA3_224
Definition: rte_crypto_sym.h:240
__rte_crypto_sym_op_attach_sym_session
static int __rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op, struct rte_cryptodev_sym_session *sess)
Definition: rte_crypto_sym.h:787
RTE_CRYPTO_AUTH_SHA3_384
@ RTE_CRYPTO_AUTH_SHA3_384
Definition: rte_crypto_sym.h:248
RTE_CRYPTO_AUTH_AES_CBC_MAC
@ RTE_CRYPTO_AUTH_AES_CBC_MAC
Definition: rte_crypto_sym.h:193
RTE_CRYPTO_CIPHER_3DES_CTR
@ RTE_CRYPTO_CIPHER_3DES_CTR
Definition: rte_crypto_sym.h:36
RTE_CRYPTO_AUTH_SHA1_HMAC
@ RTE_CRYPTO_AUTH_SHA1_HMAC
Definition: rte_crypto_sym.h:212
RTE_CRYPTO_CIPHER_DES_CBC
@ RTE_CRYPTO_CIPHER_DES_CBC
Definition: rte_crypto_sym.h:64
rte_crypto_sym_op::xform
struct rte_crypto_sym_xform * xform
Definition: rte_crypto_sym.h:499
RTE_CRYPTO_AEAD_OP_ENCRYPT
@ RTE_CRYPTO_AEAD_OP_ENCRYPT
Definition: rte_crypto_sym.h:363
RTE_CRYPTO_CIPHER_ZUC_EEA3
@ RTE_CRYPTO_CIPHER_ZUC_EEA3
Definition: rte_crypto_sym.h:61
rte_mbuf
Definition: rte_mbuf_core.h:482
RTE_CRYPTO_AUTH_ZUC_EIA3
@ RTE_CRYPTO_AUTH_ZUC_EIA3
Definition: rte_crypto_sym.h:237
rte_crypto_sym_op::m_src
struct rte_mbuf * m_src
Definition: rte_crypto_sym.h:492
RTE_CRYPTO_AUTH_OP_VERIFY
@ RTE_CRYPTO_AUTH_OP_VERIFY
Definition: rte_crypto_sym.h:266
rte_crypto_auth_xform::op
enum rte_crypto_auth_operation op
Definition: rte_crypto_sym.h:282
RTE_CRYPTO_CIPHER_AES_CTR
@ RTE_CRYPTO_CIPHER_AES_CTR
Definition: rte_crypto_sym.h:43
RTE_CRYPTO_CIPHER_DES_DOCSISBPI
@ RTE_CRYPTO_CIPHER_DES_DOCSISBPI
Definition: rte_crypto_sym.h:74
__rte_crypto_sym_op_sym_xforms_alloc
static struct rte_crypto_sym_xform * __rte_crypto_sym_op_sym_xforms_alloc(struct rte_crypto_sym_op *sym_op, void *priv_data, uint8_t nb_xforms)
Definition: rte_crypto_sym.h:764
rte_crypto_sym_op::length
uint32_t length
Definition: rte_crypto_sym.h:514
RTE_CRYPTO_CIPHER_AES_CBC
@ RTE_CRYPTO_CIPHER_AES_CBC
Definition: rte_crypto_sym.h:41
RTE_CRYPTO_AUTH_SNOW3G_UIA2
@ RTE_CRYPTO_AUTH_SNOW3G_UIA2
Definition: rte_crypto_sym.h:234
RTE_CRYPTO_CIPHER_AES_ECB
@ RTE_CRYPTO_CIPHER_AES_ECB
Definition: rte_crypto_sym.h:45
RTE_CRYPTO_AUTH_SHA384
@ RTE_CRYPTO_AUTH_SHA384
Definition: rte_crypto_sym.h:225
rte_crypto_sym_op::data
uint8_t * data
Definition: rte_crypto_sym.h:521
rte_crypto_cipher_xform::offset
uint16_t offset
Definition: rte_crypto_sym.h:144
rte_crypto_cipher_operation
rte_crypto_cipher_operation
Definition: rte_crypto_sym.h:90
rte_crypto_sym_op::data
struct rte_crypto_sym_op::@106::@108::@111 data
rte_crypto_cipher_xform::length
uint16_t length
Definition: rte_crypto_sym.h:118
RTE_CRYPTO_AUTH_AES_XCBC_MAC
@ RTE_CRYPTO_AUTH_AES_XCBC_MAC
Definition: rte_crypto_sym.h:199
rte_crypto_cipher_xform
Definition: rte_crypto_sym.h:107
rte_crypto_sym_op::sec_session
struct rte_security_session * sec_session
Definition: rte_crypto_sym.h:501
rte_crypto_aead_algorithm
rte_crypto_aead_algorithm
Definition: rte_crypto_sym.h:349
rte_common.h
RTE_CRYPTO_AUTH_SHA224
@ RTE_CRYPTO_AUTH_SHA224
Definition: rte_crypto_sym.h:217
RTE_CRYPTO_CIPHER_AES_F8
@ RTE_CRYPTO_CIPHER_AES_F8
Definition: rte_crypto_sym.h:47
rte_crypto_cipher_xform::iv
struct rte_crypto_cipher_xform::@97 iv
RTE_CRYPTO_AUTH_MD5
@ RTE_CRYPTO_AUTH_MD5
Definition: rte_crypto_sym.h:205
rte_crypto_sym_xform::aead
struct rte_crypto_aead_xform aead
Definition: rte_crypto_sym.h:454
RTE_CRYPTO_AUTH_SHA256
@ RTE_CRYPTO_AUTH_SHA256
Definition: rte_crypto_sym.h:221
rte_crypto_sym_xform
Definition: rte_crypto_sym.h:443
RTE_CRYPTO_AUTH_SHA1
@ RTE_CRYPTO_AUTH_SHA1
Definition: rte_crypto_sym.h:210
rte_crypto_auth_xform::digest_length
uint16_t digest_length
Definition: rte_crypto_sym.h:335
rte_crypto_auth_xform
Definition: rte_crypto_sym.h:281
RTE_CRYPTO_AUTH_SHA224_HMAC
@ RTE_CRYPTO_AUTH_SHA224_HMAC
Definition: rte_crypto_sym.h:219
RTE_CRYPTO_AUTH_NULL
@ RTE_CRYPTO_AUTH_NULL
Definition: rte_crypto_sym.h:190
RTE_STD_C11
#define RTE_STD_C11
Definition: rte_common.h:40
rte_crypto_sym_xform::type
enum rte_crypto_sym_xform_type type
Definition: rte_crypto_sym.h:446
RTE_CRYPTO_AUTH_MD5_HMAC
@ RTE_CRYPTO_AUTH_MD5_HMAC
Definition: rte_crypto_sym.h:207
RTE_CRYPTO_AEAD_AES_GCM
@ RTE_CRYPTO_AEAD_AES_GCM
Definition: rte_crypto_sym.h:352
RTE_CRYPTO_SYM_XFORM_AUTH
@ RTE_CRYPTO_SYM_XFORM_AUTH
Definition: rte_crypto_sym.h:429
rte_cryptodev_sym_session
Definition: rte_cryptodev.h:974
rte_crypto_sym_xform_type
rte_crypto_sym_xform_type
Definition: rte_crypto_sym.h:427
rte_mempool.h
RTE_CRYPTO_SYM_XFORM_CIPHER
@ RTE_CRYPTO_SYM_XFORM_CIPHER
Definition: rte_crypto_sym.h:430
rte_crypto_cipher_xform::key
struct rte_crypto_cipher_xform::@96 key
rte_crypto_sym_op::offset
uint32_t offset
Definition: rte_crypto_sym.h:509
rte_crypto_aead_operation
rte_crypto_aead_operation
Definition: rte_crypto_sym.h:362
rte_crypto_sym_op::session
struct rte_cryptodev_sym_session * session
Definition: rte_crypto_sym.h:497
rte_mbuf.h
RTE_CRYPTO_AUTH_SHA3_512_HMAC
@ RTE_CRYPTO_AUTH_SHA3_512_HMAC
Definition: rte_crypto_sym.h:254
RTE_CRYPTO_AEAD_OP_DECRYPT
@ RTE_CRYPTO_AEAD_OP_DECRYPT
Definition: rte_crypto_sym.h:365
RTE_CRYPTO_CIPHER_OP_ENCRYPT
@ RTE_CRYPTO_CIPHER_OP_ENCRYPT
Definition: rte_crypto_sym.h:91
rte_crypto_auth_algorithm
rte_crypto_auth_algorithm
Definition: rte_crypto_sym.h:189
RTE_CRYPTO_CIPHER_OP_DECRYPT
@ RTE_CRYPTO_CIPHER_OP_DECRYPT
Definition: rte_crypto_sym.h:93
RTE_CRYPTO_CIPHER_3DES_CBC
@ RTE_CRYPTO_CIPHER_3DES_CBC
Definition: rte_crypto_sym.h:34
RTE_CRYPTO_SYM_XFORM_AEAD
@ RTE_CRYPTO_SYM_XFORM_AEAD
Definition: rte_crypto_sym.h:431
RTE_CRYPTO_CIPHER_AES_DOCSISBPI
@ RTE_CRYPTO_CIPHER_AES_DOCSISBPI
Definition: rte_crypto_sym.h:67
rte_crypto_sym_xform::next
struct rte_crypto_sym_xform * next
Definition: rte_crypto_sym.h:444
rte_crypto_cipher_algorithm_strings
const char * rte_crypto_cipher_algorithm_strings[]
rte_crypto_auth_xform::algo
enum rte_crypto_auth_algorithm algo
Definition: rte_crypto_sym.h:284
rte_crypto_aead_algorithm_strings
const char * rte_crypto_aead_algorithm_strings[]
rte_crypto_sym_xform::cipher
struct rte_crypto_cipher_xform cipher
Definition: rte_crypto_sym.h:452
RTE_CRYPTO_AUTH_SHA3_384_HMAC
@ RTE_CRYPTO_AUTH_SHA3_384_HMAC
Definition: rte_crypto_sym.h:250
RTE_CRYPTO_CIPHER_SNOW3G_UEA2
@ RTE_CRYPTO_CIPHER_SNOW3G_UEA2
Definition: rte_crypto_sym.h:58
RTE_CRYPTO_AUTH_SHA3_256
@ RTE_CRYPTO_AUTH_SHA3_256
Definition: rte_crypto_sym.h:244
rte_crypto_auth_xform::data
const uint8_t * data
Definition: rte_crypto_sym.h:288
RTE_CRYPTO_AUTH_SHA3_256_HMAC
@ RTE_CRYPTO_AUTH_SHA3_256_HMAC
Definition: rte_crypto_sym.h:246
RTE_CRYPTO_AUTH_SHA384_HMAC
@ RTE_CRYPTO_AUTH_SHA384_HMAC
Definition: rte_crypto_sym.h:227
rte_crypto_sym_op::aad
struct rte_crypto_sym_op::@106::@108::@113 aad
RTE_CRYPTO_AUTH_OP_GENERATE
@ RTE_CRYPTO_AUTH_OP_GENERATE
Definition: rte_crypto_sym.h:267
rte_crypto_aead_operation_strings
const char * rte_crypto_aead_operation_strings[]
RTE_CRYPTO_AUTH_SHA256_HMAC
@ RTE_CRYPTO_AUTH_SHA256_HMAC
Definition: rte_crypto_sym.h:223
rte_crypto_sym_op
Definition: rte_crypto_sym.h:491
rte_crypto_sym_op::m_dst
struct rte_mbuf * m_dst
Definition: rte_crypto_sym.h:493
RTE_CRYPTO_AUTH_SHA3_512
@ RTE_CRYPTO_AUTH_SHA3_512
Definition: rte_crypto_sym.h:252
rte_crypto_cipher_operation_strings
const char * rte_crypto_cipher_operation_strings[]
RTE_CRYPTO_AUTH_SHA3_224_HMAC
@ RTE_CRYPTO_AUTH_SHA3_224_HMAC
Definition: rte_crypto_sym.h:242
rte_crypto_auth_xform::key
struct rte_crypto_auth_xform::@98 key
rte_crypto_auth_xform::offset
uint16_t offset
Definition: rte_crypto_sym.h:299