DPDK  18.11.11
rte_crypto_sym.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: BSD-3-Clause
2  * Copyright(c) 2016-2017 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  uint8_t *data;
118  uint16_t length;
119  } key;
146  struct {
147  uint16_t offset;
178  uint16_t length;
196  } iv;
197 };
198 
268  RTE_CRYPTO_AUTH_LIST_END
269 };
270 
272 extern const char *
274 
279 };
280 
282 extern const char *
284 
298  struct {
299  uint8_t *data;
300  uint16_t length;
301  } key;
309  struct {
310  uint16_t offset;
325  uint16_t length;
335  } iv;
337  uint16_t digest_length;
347 };
348 
349 
356  RTE_CRYPTO_AEAD_LIST_END
357 };
358 
360 extern const char *
362 
369 };
370 
372 extern const char *
374 
375 struct rte_crypto_aead_xform {
378  enum rte_crypto_aead_algorithm algo;
381  struct {
382  uint8_t *data;
383  uint16_t length;
384  } key;
385 
386  struct {
387  uint16_t offset;
407  uint16_t length;
416  } iv;
418  uint16_t digest_length;
419 
420  uint16_t aad_length;
426 };
427 
434 };
435 
449  ;
451  union {
456  struct rte_crypto_aead_xform aead;
458  };
459 };
460 
462 
494  struct rte_mbuf *m_src;
495  struct rte_mbuf *m_dst;
498  union {
503  struct rte_security_session *sec_session;
505  };
506 
508  union {
509  struct {
510  struct {
511  uint32_t offset;
516  uint32_t length;
521  } data;
522  struct {
523  uint8_t *data;
545  } digest;
546  struct {
547  uint8_t *data;
579  } aad;
581  } aead;
582 
583  struct {
584  struct {
585  struct {
586  uint32_t offset;
600  uint32_t length;
614  } data;
615  } cipher;
616 
617  struct {
618  struct {
619  uint32_t offset;
635  uint32_t length;
651  } data;
654  struct {
655  uint8_t *data;
677  } digest;
678  } auth;
679  };
680  };
681 };
682 
683 
689 static inline void
691 {
692  memset(op, 0, sizeof(*op));
693 }
694 
695 
706 static inline struct rte_crypto_sym_xform *
708  void *priv_data, uint8_t nb_xforms)
709 {
710  struct rte_crypto_sym_xform *xform;
711 
712  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
713 
714  do {
716  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
717  } while (xform);
718 
719  return sym_op->xform;
720 }
721 
722 
729 static inline int
731  struct rte_cryptodev_sym_session *sess)
732 {
733  sym_op->session = sess;
734 
735  return 0;
736 }
737 
738 
739 #ifdef __cplusplus
740 }
741 #endif
742 
743 #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:690
rte_crypto_sym_xform::auth
struct rte_crypto_auth_xform auth
Definition: rte_crypto_sym.h:452
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:208
RTE_CRYPTO_CIPHER_3DES_ECB
@ RTE_CRYPTO_CIPHER_3DES_ECB
Definition: rte_crypto_sym.h:38
RTE_CRYPTO_AEAD_AES_CCM
@ RTE_CRYPTO_AEAD_AES_CCM
Definition: rte_crypto_sym.h:352
rte_crypto_cipher_xform::key
struct rte_crypto_cipher_xform::@77 key
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:240
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:300
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:213
rte_crypto_auth_operation
rte_crypto_auth_operation
Definition: rte_crypto_sym.h:276
RTE_CRYPTO_AUTH_AES_CMAC
@ RTE_CRYPTO_AUTH_AES_CMAC
Definition: rte_crypto_sym.h:206
rte_crypto_cipher_xform::data
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:430
RTE_CRYPTO_AUTH_SHA512_HMAC
@ RTE_CRYPTO_AUTH_SHA512_HMAC
Definition: rte_crypto_sym.h:242
rte_crypto_sym_op::phys_addr
rte_iova_t phys_addr
Definition: rte_crypto_sym.h:543
RTE_CRYPTO_AUTH_SHA3_224
@ RTE_CRYPTO_AUTH_SHA3_224
Definition: rte_crypto_sym.h:251
rte_crypto_sym_op::data
struct rte_crypto_sym_op::@87::@89::@92 data
__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:730
RTE_CRYPTO_AUTH_SHA3_384
@ RTE_CRYPTO_AUTH_SHA3_384
Definition: rte_crypto_sym.h:259
RTE_CRYPTO_AUTH_AES_CBC_MAC
@ RTE_CRYPTO_AUTH_AES_CBC_MAC
Definition: rte_crypto_sym.h:204
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:223
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:501
RTE_CRYPTO_AEAD_OP_ENCRYPT
@ RTE_CRYPTO_AEAD_OP_ENCRYPT
Definition: rte_crypto_sym.h:365
RTE_CRYPTO_CIPHER_ZUC_EEA3
@ RTE_CRYPTO_CIPHER_ZUC_EEA3
Definition: rte_crypto_sym.h:61
rte_mbuf
Definition: rte_mbuf.h:478
RTE_CRYPTO_AUTH_ZUC_EIA3
@ RTE_CRYPTO_AUTH_ZUC_EIA3
Definition: rte_crypto_sym.h:248
rte_crypto_sym_op::m_src
struct rte_mbuf * m_src
Definition: rte_crypto_sym.h:494
RTE_CRYPTO_AUTH_OP_VERIFY
@ RTE_CRYPTO_AUTH_OP_VERIFY
Definition: rte_crypto_sym.h:277
rte_crypto_auth_xform::op
enum rte_crypto_auth_operation op
Definition: rte_crypto_sym.h:293
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:707
rte_crypto_sym_op::length
uint32_t length
Definition: rte_crypto_sym.h:516
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:245
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:236
rte_crypto_sym_op::data
uint8_t * data
Definition: rte_crypto_sym.h:523
rte_crypto_cipher_xform::offset
uint16_t offset
Definition: rte_crypto_sym.h:147
rte_crypto_cipher_operation
rte_crypto_cipher_operation
Definition: rte_crypto_sym.h:90
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:210
rte_crypto_cipher_xform
Definition: rte_crypto_sym.h:107
rte_crypto_sym_op::digest
struct rte_crypto_sym_op::@87::@89::@93 digest
rte_crypto_sym_op::sec_session
struct rte_security_session * sec_session
Definition: rte_crypto_sym.h:503
rte_crypto_aead_algorithm
rte_crypto_aead_algorithm
Definition: rte_crypto_sym.h:351
rte_common.h
RTE_CRYPTO_AUTH_SHA224
@ RTE_CRYPTO_AUTH_SHA224
Definition: rte_crypto_sym.h:228
RTE_CRYPTO_CIPHER_AES_F8
@ RTE_CRYPTO_CIPHER_AES_F8
Definition: rte_crypto_sym.h:47
RTE_CRYPTO_AUTH_MD5
@ RTE_CRYPTO_AUTH_MD5
Definition: rte_crypto_sym.h:216
rte_crypto_sym_xform::aead
struct rte_crypto_aead_xform aead
Definition: rte_crypto_sym.h:456
rte_crypto_auth_xform::key
struct rte_crypto_auth_xform::@79 key
RTE_CRYPTO_AUTH_SHA256
@ RTE_CRYPTO_AUTH_SHA256
Definition: rte_crypto_sym.h:232
rte_crypto_sym_xform
Definition: rte_crypto_sym.h:445
RTE_CRYPTO_AUTH_SHA1
@ RTE_CRYPTO_AUTH_SHA1
Definition: rte_crypto_sym.h:221
rte_crypto_auth_xform::digest_length
uint16_t digest_length
Definition: rte_crypto_sym.h:337
rte_crypto_auth_xform
Definition: rte_crypto_sym.h:292
RTE_CRYPTO_AUTH_SHA224_HMAC
@ RTE_CRYPTO_AUTH_SHA224_HMAC
Definition: rte_crypto_sym.h:230
RTE_CRYPTO_AUTH_NULL
@ RTE_CRYPTO_AUTH_NULL
Definition: rte_crypto_sym.h:201
RTE_STD_C11
#define RTE_STD_C11
Definition: rte_common.h:37
rte_crypto_sym_xform::type
enum rte_crypto_sym_xform_type type
Definition: rte_crypto_sym.h:448
RTE_CRYPTO_AUTH_MD5_HMAC
@ RTE_CRYPTO_AUTH_MD5_HMAC
Definition: rte_crypto_sym.h:218
RTE_CRYPTO_AEAD_AES_GCM
@ RTE_CRYPTO_AEAD_AES_GCM
Definition: rte_crypto_sym.h:354
RTE_CRYPTO_SYM_XFORM_AUTH
@ RTE_CRYPTO_SYM_XFORM_AUTH
Definition: rte_crypto_sym.h:431
rte_cryptodev_sym_session
Definition: rte_cryptodev.h:956
rte_crypto_sym_xform_type
rte_crypto_sym_xform_type
Definition: rte_crypto_sym.h:429
rte_iova_t
uint64_t rte_iova_t
Definition: rte_memory.h:82
rte_mempool.h
RTE_CRYPTO_SYM_XFORM_CIPHER
@ RTE_CRYPTO_SYM_XFORM_CIPHER
Definition: rte_crypto_sym.h:432
rte_crypto_sym_op::offset
uint32_t offset
Definition: rte_crypto_sym.h:511
rte_crypto_aead_operation
rte_crypto_aead_operation
Definition: rte_crypto_sym.h:364
rte_crypto_sym_op::session
struct rte_cryptodev_sym_session * session
Definition: rte_crypto_sym.h:499
rte_crypto_auth_xform::iv
struct rte_crypto_auth_xform::@80 iv
rte_mbuf.h
RTE_CRYPTO_AUTH_SHA3_512_HMAC
@ RTE_CRYPTO_AUTH_SHA3_512_HMAC
Definition: rte_crypto_sym.h:265
RTE_CRYPTO_AEAD_OP_DECRYPT
@ RTE_CRYPTO_AEAD_OP_DECRYPT
Definition: rte_crypto_sym.h:367
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:200
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:433
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:446
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:295
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:454
RTE_CRYPTO_AUTH_SHA3_384_HMAC
@ RTE_CRYPTO_AUTH_SHA3_384_HMAC
Definition: rte_crypto_sym.h:261
RTE_CRYPTO_CIPHER_SNOW3G_UEA2
@ RTE_CRYPTO_CIPHER_SNOW3G_UEA2
Definition: rte_crypto_sym.h:58
rte_crypto_auth_xform::data
uint8_t * data
Definition: rte_crypto_sym.h:299
RTE_CRYPTO_AUTH_SHA3_256
@ RTE_CRYPTO_AUTH_SHA3_256
Definition: rte_crypto_sym.h:255
RTE_CRYPTO_AUTH_SHA3_256_HMAC
@ RTE_CRYPTO_AUTH_SHA3_256_HMAC
Definition: rte_crypto_sym.h:257
RTE_CRYPTO_AUTH_SHA384_HMAC
@ RTE_CRYPTO_AUTH_SHA384_HMAC
Definition: rte_crypto_sym.h:238
RTE_CRYPTO_AUTH_OP_GENERATE
@ RTE_CRYPTO_AUTH_OP_GENERATE
Definition: rte_crypto_sym.h:278
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:234
rte_crypto_sym_op
Definition: rte_crypto_sym.h:493
rte_crypto_sym_op::m_dst
struct rte_mbuf * m_dst
Definition: rte_crypto_sym.h:495
rte_crypto_cipher_xform::iv
struct rte_crypto_cipher_xform::@78 iv
RTE_CRYPTO_AUTH_SHA3_512
@ RTE_CRYPTO_AUTH_SHA3_512
Definition: rte_crypto_sym.h:263
rte_crypto_sym_op::aad
struct rte_crypto_sym_op::@87::@89::@94 aad
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:253
rte_crypto_auth_xform::offset
uint16_t offset
Definition: rte_crypto_sym.h:310