DPDK  16.11.11
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 
108  RTE_CRYPTO_CIPHER_LIST_END
109 };
110 
117 };
118 
134  struct {
135  uint8_t *data;
136  size_t length;
137  } key;
167 };
168 
241  RTE_CRYPTO_AUTH_LIST_END
242 };
243 
248 };
249 
263  struct {
264  uint8_t *data;
265  size_t length;
266  } key;
274  uint32_t digest_length;
313 };
314 
320 };
321 
335  ;
337  union {
342  };
343 };
344 
353 };
354 
355 
357 
389  struct rte_mbuf *m_src;
390  struct rte_mbuf *m_dst;
392  enum rte_crypto_sym_op_sess_type sess_type;
393 
395  union {
400  };
401 
402  struct {
403  struct {
404  uint32_t offset;
418  uint32_t length;
443  } data;
445  struct {
446  uint8_t *data;
474  uint16_t length;
492  } iv;
493  } cipher;
494 
495  struct {
496  struct {
497  uint32_t offset;
519  uint32_t length;
539  } data;
541  struct {
542  uint8_t *data;
572  uint16_t length;
576  } digest;
578  struct {
579  uint8_t *data;
623  uint16_t length;
624  } aad;
626  } auth;
628 
629 
635 static inline void
637 {
638  memset(op, 0, sizeof(*op));
639 
640  op->sess_type = RTE_CRYPTO_SYM_OP_SESSIONLESS;
641 }
642 
643 
654 static inline struct rte_crypto_sym_xform *
656  void *priv_data, uint8_t nb_xforms)
657 {
658  struct rte_crypto_sym_xform *xform;
659 
660  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
661 
662  do {
664  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
665  } while (xform);
666 
667  return sym_op->xform;
668 }
669 
670 
677 static inline int
679  struct rte_cryptodev_sym_session *sess)
680 {
681  sym_op->session = sess;
682  sym_op->sess_type = RTE_CRYPTO_SYM_OP_WITH_SESSION;
683 
684  return 0;
685 }
686 
687 
688 #ifdef __cplusplus
689 }
690 #endif
691 
692 #endif /* _RTE_CRYPTO_SYM_H_ */
enum rte_crypto_cipher_operation op
phys_addr_t phys_addr
struct rte_crypto_auth_xform auth
struct rte_crypto_auth_xform::@14 key
struct rte_crypto_cipher_xform cipher
struct rte_crypto_sym_op::@20::@25 aad
static void __rte_crypto_sym_op_reset(struct rte_crypto_sym_op *op)
enum rte_crypto_auth_operation op
struct rte_mbuf * m_src
rte_crypto_sym_op_sess_type
rte_crypto_auth_operation
struct rte_crypto_sym_op::@19::@21 data
rte_crypto_cipher_operation
enum rte_crypto_auth_algorithm algo
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_sym_op::@20::@24 digest
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
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
struct rte_crypto_sym_xform * next
struct rte_crypto_sym_op::@19::@22 iv
rte_crypto_cipher_algorithm