DPDK  19.11.1
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 
254  RTE_CRYPTO_AUTH_LIST_END
255 };
256 
258 extern const char *
260 
265 };
266 
268 extern const char *
270 
284  struct {
285  const uint8_t *data;
286  uint16_t length;
287  } key;
295  struct {
296  uint16_t offset;
312  uint16_t length;
330  } iv;
332  uint16_t digest_length;
342 };
343 
344 
351  RTE_CRYPTO_AEAD_LIST_END
352 };
353 
355 extern const char *
357 
364 };
365 
367 extern const char *
369 
370 struct rte_crypto_aead_xform {
373  enum rte_crypto_aead_algorithm algo;
376  struct {
377  const uint8_t *data;
378  uint16_t length;
379  } key;
380 
381  struct {
382  uint16_t offset;
397  uint16_t length;
411  } iv;
413  uint16_t digest_length;
414 
415  uint16_t aad_length;
421 };
422 
429 };
430 
444  ;
446  union {
451  struct rte_crypto_aead_xform aead;
453  };
454 };
455 
457 
489  struct rte_mbuf *m_src;
490  struct rte_mbuf *m_dst;
493  union {
498  struct rte_security_session *sec_session;
500  };
501 
503  union {
504  struct {
505  struct {
506  uint32_t offset;
511  uint32_t length;
516  } data;
517  struct {
518  uint8_t *data;
540  } digest;
541  struct {
542  uint8_t *data;
574  } aad;
576  } aead;
577 
578  struct {
579  struct {
580  struct {
581  uint32_t offset;
597  uint32_t length;
613  } data;
614  } cipher;
615 
616  struct {
617  struct {
618  uint32_t offset;
636  uint32_t length;
654  } data;
657  struct {
658  uint8_t *data;
731  } digest;
732  } auth;
733  };
734  };
735 };
736 
737 
743 static inline void
745 {
746  memset(op, 0, sizeof(*op));
747 }
748 
749 
760 static inline struct rte_crypto_sym_xform *
762  void *priv_data, uint8_t nb_xforms)
763 {
764  struct rte_crypto_sym_xform *xform;
765 
766  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
767 
768  do {
770  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
771  } while (xform);
772 
773  return sym_op->xform;
774 }
775 
776 
783 static inline int
785  struct rte_cryptodev_sym_session *sess)
786 {
787  sym_op->session = sess;
788 
789  return 0;
790 }
791 
792 
793 #ifdef __cplusplus
794 }
795 #endif
796 
797 #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:744
rte_crypto_sym_xform::auth
struct rte_crypto_auth_xform auth
Definition: rte_crypto_sym.h:447
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:347
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:226
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:286
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:262
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:425
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:228
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:538
RTE_CRYPTO_AUTH_SHA3_224
@ RTE_CRYPTO_AUTH_SHA3_224
Definition: rte_crypto_sym.h:237
__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:784
RTE_CRYPTO_AUTH_SHA3_384
@ RTE_CRYPTO_AUTH_SHA3_384
Definition: rte_crypto_sym.h:245
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:496
RTE_CRYPTO_AEAD_OP_ENCRYPT
@ RTE_CRYPTO_AEAD_OP_ENCRYPT
Definition: rte_crypto_sym.h:360
RTE_CRYPTO_CIPHER_ZUC_EEA3
@ RTE_CRYPTO_CIPHER_ZUC_EEA3
Definition: rte_crypto_sym.h:61
rte_mbuf
Definition: rte_mbuf_core.h:480
RTE_CRYPTO_AUTH_ZUC_EIA3
@ RTE_CRYPTO_AUTH_ZUC_EIA3
Definition: rte_crypto_sym.h:234
rte_crypto_sym_op::m_src
struct rte_mbuf * m_src
Definition: rte_crypto_sym.h:489
RTE_CRYPTO_AUTH_OP_VERIFY
@ RTE_CRYPTO_AUTH_OP_VERIFY
Definition: rte_crypto_sym.h:263
rte_crypto_auth_xform::op
enum rte_crypto_auth_operation op
Definition: rte_crypto_sym.h:279
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:761
rte_crypto_sym_op::length
uint32_t length
Definition: rte_crypto_sym.h:511
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:231
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:222
rte_crypto_sym_op::data
uint8_t * data
Definition: rte_crypto_sym.h:518
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:498
rte_crypto_aead_algorithm
rte_crypto_aead_algorithm
Definition: rte_crypto_sym.h:346
rte_common.h
RTE_CRYPTO_AUTH_SHA224
@ RTE_CRYPTO_AUTH_SHA224
Definition: rte_crypto_sym.h:214
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:451
RTE_CRYPTO_AUTH_SHA256
@ RTE_CRYPTO_AUTH_SHA256
Definition: rte_crypto_sym.h:218
rte_crypto_sym_xform
Definition: rte_crypto_sym.h:440
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:332
rte_crypto_auth_xform
Definition: rte_crypto_sym.h:278
RTE_CRYPTO_AUTH_SHA224_HMAC
@ RTE_CRYPTO_AUTH_SHA224_HMAC
Definition: rte_crypto_sym.h:216
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:443
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:349
RTE_CRYPTO_SYM_XFORM_AUTH
@ RTE_CRYPTO_SYM_XFORM_AUTH
Definition: rte_crypto_sym.h:426
rte_cryptodev_sym_session
Definition: rte_cryptodev.h:974
rte_crypto_sym_xform_type
rte_crypto_sym_xform_type
Definition: rte_crypto_sym.h:424
rte_mempool.h
RTE_CRYPTO_SYM_XFORM_CIPHER
@ RTE_CRYPTO_SYM_XFORM_CIPHER
Definition: rte_crypto_sym.h:427
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:506
rte_crypto_aead_operation
rte_crypto_aead_operation
Definition: rte_crypto_sym.h:359
rte_crypto_sym_op::session
struct rte_cryptodev_sym_session * session
Definition: rte_crypto_sym.h:494
rte_mbuf.h
RTE_CRYPTO_AUTH_SHA3_512_HMAC
@ RTE_CRYPTO_AUTH_SHA3_512_HMAC
Definition: rte_crypto_sym.h:251
RTE_CRYPTO_AEAD_OP_DECRYPT
@ RTE_CRYPTO_AEAD_OP_DECRYPT
Definition: rte_crypto_sym.h:362
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:428
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:441
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:281
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:449
RTE_CRYPTO_AUTH_SHA3_384_HMAC
@ RTE_CRYPTO_AUTH_SHA3_384_HMAC
Definition: rte_crypto_sym.h:247
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:241
rte_crypto_auth_xform::data
const uint8_t * data
Definition: rte_crypto_sym.h:285
RTE_CRYPTO_AUTH_SHA3_256_HMAC
@ RTE_CRYPTO_AUTH_SHA3_256_HMAC
Definition: rte_crypto_sym.h:243
RTE_CRYPTO_AUTH_SHA384_HMAC
@ RTE_CRYPTO_AUTH_SHA384_HMAC
Definition: rte_crypto_sym.h:224
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:264
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:220
rte_crypto_sym_op
Definition: rte_crypto_sym.h:488
rte_crypto_sym_op::m_dst
struct rte_mbuf * m_dst
Definition: rte_crypto_sym.h:490
RTE_CRYPTO_AUTH_SHA3_512
@ RTE_CRYPTO_AUTH_SHA3_512
Definition: rte_crypto_sym.h:249
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:239
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:296