DPDK  17.11.10
rte_crypto_sym.h
Go to the documentation of this file.
1 /*-
2  * BSD LICENSE
3  *
4  * Copyright(c) 2016-2017 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 
109  RTE_CRYPTO_CIPHER_LIST_END
110 
111 };
112 
114 extern const char *
116 
123 };
124 
126 extern const char *
128 
144  struct {
145  uint8_t *data;
146  uint16_t length;
147  } key;
174  struct {
175  uint16_t offset;
206  uint16_t length;
224  } iv;
225 };
226 
276  RTE_CRYPTO_AUTH_LIST_END
277 };
278 
280 extern const char *
282 
287 };
288 
290 extern const char *
292 
306  struct {
307  uint8_t *data;
308  uint16_t length;
309  } key;
317  struct {
318  uint16_t offset;
333  uint16_t length;
343  } iv;
345  uint16_t digest_length;
355 };
356 
357 
364  RTE_CRYPTO_AEAD_LIST_END
365 };
366 
368 extern const char *
370 
377 };
378 
380 extern const char *
382 
383 struct rte_crypto_aead_xform {
386  enum rte_crypto_aead_algorithm algo;
389  struct {
390  uint8_t *data;
391  uint16_t length;
392  } key;
393 
394  struct {
395  uint16_t offset;
415  uint16_t length;
424  } iv;
426  uint16_t digest_length;
427 
428  uint16_t aad_length;
434 };
435 
442 };
443 
457  ;
459  union {
464  struct rte_crypto_aead_xform aead;
466  };
467 };
468 
470 
502  struct rte_mbuf *m_src;
503  struct rte_mbuf *m_dst;
506  union {
511  struct rte_security_session *sec_session;
513  };
514 
516  union {
517  struct {
518  struct {
519  uint32_t offset;
524  uint32_t length;
529  } data;
530  struct {
531  uint8_t *data;
553  } digest;
554  struct {
555  uint8_t *data;
587  } aad;
589  } aead;
590 
591  struct {
592  struct {
593  struct {
594  uint32_t offset;
608  uint32_t length;
622  } data;
623  } cipher;
624 
625  struct {
626  struct {
627  uint32_t offset;
643  uint32_t length;
659  } data;
662  struct {
663  uint8_t *data;
685  } digest;
686  } auth;
687  };
688  };
689 };
690 
691 
697 static inline void
699 {
700  memset(op, 0, sizeof(*op));
701 }
702 
703 
714 static inline struct rte_crypto_sym_xform *
716  void *priv_data, uint8_t nb_xforms)
717 {
718  struct rte_crypto_sym_xform *xform;
719 
720  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
721 
722  do {
724  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
725  } while (xform);
726 
727  return sym_op->xform;
728 }
729 
730 
737 static inline int
739  struct rte_cryptodev_sym_session *sess)
740 {
741  sym_op->session = sess;
742 
743  return 0;
744 }
745 
746 
747 #ifdef __cplusplus
748 }
749 #endif
750 
751 #endif /* _RTE_CRYPTO_SYM_H_ */
enum rte_crypto_cipher_operation op
struct rte_crypto_sym_op::@37::@39::@44 aad
struct rte_security_session * sec_session
struct rte_crypto_auth_xform auth
struct rte_crypto_auth_xform::@29 key
struct rte_crypto_cipher_xform cipher
struct rte_crypto_cipher_xform::@27 key
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_auth_operation
const char * rte_crypto_cipher_operation_strings[]
const char * rte_crypto_aead_operation_strings[]
rte_crypto_cipher_operation
enum rte_crypto_auth_algorithm algo
struct rte_crypto_sym_op::@37::@39::@43 digest
const char * rte_crypto_aead_algorithm_strings[]
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)
rte_crypto_aead_operation
struct rte_mbuf * m_dst
struct rte_crypto_aead_xform aead
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::@37::@39::@42 data
struct rte_cryptodev_sym_session * session
struct rte_crypto_auth_xform::@30 iv
#define RTE_STD_C11
Definition: rte_common.h:66
rte_crypto_auth_algorithm
rte_crypto_sym_xform_type
const char * rte_crypto_auth_algorithm_strings[]
uint64_t rte_iova_t
Definition: rte_memory.h:107
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
rte_iova_t phys_addr
struct rte_crypto_cipher_xform::@28 iv
rte_crypto_aead_algorithm
const char * rte_crypto_cipher_algorithm_strings[]
rte_crypto_cipher_algorithm