DPDK  make-f/builddir/build/BUILD/dpdk-17.02/mk/rte.sdkconfig.mkshowversion
rte_crypto_sym.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2016 Intel Corporation. All rights reserved.
5  *
6  * Redistribution and use in source and binary forms, with or without
7  * modification, are permitted provided that the following conditions
8  * are met:
9  *
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
15  * distribution.
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.
19  *
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.
31  */
32 
33 #ifndef _RTE_CRYPTO_SYM_H_
34 #define _RTE_CRYPTO_SYM_H_
35 
45 #ifdef __cplusplus
46 extern "C" {
47 #endif
48 
49 #include <string.h>
50 
51 #include <rte_mbuf.h>
52 #include <rte_memory.h>
53 #include <rte_mempool.h>
54 #include <rte_common.h>
55 
56 
111  RTE_CRYPTO_CIPHER_LIST_END
112 
113 };
114 
116 extern const char *
118 
125 };
126 
128 extern const char *
130 
146  struct {
147  uint8_t *data;
148  size_t length;
149  } key;
179 };
180 
253  RTE_CRYPTO_AUTH_LIST_END
254 };
255 
257 extern const char *
259 
264 };
265 
267 extern const char *
269 
283  struct {
284  uint8_t *data;
285  size_t length;
286  } key;
294  uint32_t digest_length;
334 };
335 
341 };
342 
356  ;
358  union {
361  struct rte_crypto_cipher_xform cipher;
363  };
364 };
365 
374 };
375 
376 
378 
410  struct rte_mbuf *m_src;
411  struct rte_mbuf *m_dst;
413  enum rte_crypto_sym_op_sess_type sess_type;
414 
416  union {
421  };
422 
423  struct {
424  struct {
425  uint32_t offset;
439  uint32_t length;
464  } data;
466  struct {
467  uint8_t *data;
495  uint16_t length;
513  } iv;
514  } cipher;
515 
516  struct {
517  struct {
518  uint32_t offset;
540  uint32_t length;
560  } data;
562  struct {
563  uint8_t *data;
583  phys_addr_t phys_addr;
585  uint16_t length;
587  } digest;
589  struct {
590  uint8_t *data;
633  phys_addr_t phys_addr;
634  uint16_t length;
635  } aad;
637  } auth;
639 
640 
646 static inline void
648 {
649  memset(op, 0, sizeof(*op));
650 
651  op->sess_type = RTE_CRYPTO_SYM_OP_SESSIONLESS;
652 }
653 
654 
665 static inline struct rte_crypto_sym_xform *
667  void *priv_data, uint8_t nb_xforms)
668 {
669  struct rte_crypto_sym_xform *xform;
670 
671  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
672 
673  do {
675  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
676  } while (xform);
677 
678  return sym_op->xform;
679 }
680 
681 
688 static inline int
690  struct rte_cryptodev_sym_session *sess)
691 {
692  sym_op->session = sess;
693  sym_op->sess_type = RTE_CRYPTO_SYM_OP_WITH_SESSION;
694 
695  return 0;
696 }
697 
698 
699 #ifdef __cplusplus
700 }
701 #endif
702 
703 #endif /* _RTE_CRYPTO_SYM_H_ */
enum rte_crypto_cipher_operation op
phys_addr_t phys_addr
static void __rte_crypto_sym_op_reset(struct rte_crypto_sym_op *op)
struct rte_mbuf * m_src
rte_crypto_sym_op_sess_type
rte_crypto_auth_operation
const char * rte_crypto_cipher_operation_strings[]
rte_crypto_cipher_operation
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)
struct rte_mbuf * m_dst
static int __rte_crypto_sym_op_attach_sym_session(struct rte_crypto_sym_op *sym_op, struct rte_cryptodev_sym_session *sess)
struct rte_crypto_cipher_xform::@13 key
struct rte_cryptodev_sym_session * session
#define RTE_STD_C11
Definition: rte_common.h:64
rte_crypto_auth_algorithm
rte_crypto_sym_xform_type
const char * rte_crypto_auth_algorithm_strings[]
uint64_t phys_addr_t
Definition: rte_memory.h:103
#define __rte_cache_aligned
Definition: rte_memory.h:96
struct rte_crypto_sym_xform * xform
enum rte_crypto_sym_xform_type type
enum rte_crypto_cipher_algorithm algo
const char * rte_crypto_auth_operation_strings[]
struct rte_crypto_sym_xform * next
const char * rte_crypto_cipher_algorithm_strings[]
rte_crypto_cipher_algorithm