DPDK  18.02.2
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 
248  RTE_CRYPTO_AUTH_LIST_END
249 };
250 
252 extern const char *
254 
259 };
260 
262 extern const char *
264 
278  struct {
279  uint8_t *data;
280  uint16_t length;
281  } key;
289  struct {
290  uint16_t offset;
305  uint16_t length;
315  } iv;
317  uint16_t digest_length;
327 };
328 
329 
336  RTE_CRYPTO_AEAD_LIST_END
337 };
338 
340 extern const char *
342 
349 };
350 
352 extern const char *
354 
355 struct rte_crypto_aead_xform {
358  enum rte_crypto_aead_algorithm algo;
361  struct {
362  uint8_t *data;
363  uint16_t length;
364  } key;
365 
366  struct {
367  uint16_t offset;
387  uint16_t length;
396  } iv;
398  uint16_t digest_length;
399 
400  uint16_t aad_length;
406 };
407 
414 };
415 
429  ;
431  union {
436  struct rte_crypto_aead_xform aead;
438  };
439 };
440 
442 
474  struct rte_mbuf *m_src;
475  struct rte_mbuf *m_dst;
478  union {
483  struct rte_security_session *sec_session;
485  };
486 
488  union {
489  struct {
490  struct {
491  uint32_t offset;
496  uint32_t length;
501  } data;
502  struct {
503  uint8_t *data;
525  } digest;
526  struct {
527  uint8_t *data;
559  } aad;
561  } aead;
562 
563  struct {
564  struct {
565  struct {
566  uint32_t offset;
580  uint32_t length;
594  } data;
595  } cipher;
596 
597  struct {
598  struct {
599  uint32_t offset;
615  uint32_t length;
631  } data;
634  struct {
635  uint8_t *data;
657  } digest;
658  } auth;
659  };
660  };
661 };
662 
663 
669 static inline void
671 {
672  memset(op, 0, sizeof(*op));
673 }
674 
675 
686 static inline struct rte_crypto_sym_xform *
688  void *priv_data, uint8_t nb_xforms)
689 {
690  struct rte_crypto_sym_xform *xform;
691 
692  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
693 
694  do {
696  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
697  } while (xform);
698 
699  return sym_op->xform;
700 }
701 
702 
709 static inline int
711  struct rte_cryptodev_sym_session *sess)
712 {
713  sym_op->session = sess;
714 
715  return 0;
716 }
717 
718 
719 #ifdef __cplusplus
720 }
721 #endif
722 
723 #endif /* _RTE_CRYPTO_SYM_H_ */