DPDK  17.08.2
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;
177  struct {
178  uint16_t offset;
207  uint16_t length;
225  } iv;
226 };
227 
277  RTE_CRYPTO_AUTH_LIST_END
278 };
279 
281 extern const char *
283 
288 };
289 
291 extern const char *
293 
307  struct {
308  uint8_t *data;
309  uint16_t length;
310  } key;
318  struct {
319  uint16_t offset;
334  uint16_t length;
344  } iv;
346  uint16_t digest_length;
356 };
357 
358 
365  RTE_CRYPTO_AEAD_LIST_END
366 };
367 
369 extern const char *
371 
378 };
379 
381 extern const char *
383 
384 struct rte_crypto_aead_xform {
387  enum rte_crypto_aead_algorithm algo;
390  struct {
391  uint8_t *data;
392  uint16_t length;
393  } key;
394 
395  struct {
396  uint16_t offset;
416  uint16_t length;
425  } iv;
427  uint16_t digest_length;
428 
429  uint16_t aad_length;
431 };
432 
439 };
440 
454  ;
456  union {
461  struct rte_crypto_aead_xform aead;
463  };
464 };
465 
467 
499  struct rte_mbuf *m_src;
500  struct rte_mbuf *m_dst;
503  union {
508  };
509 
511  union {
512  struct {
513  struct {
514  uint32_t offset;
519  uint32_t length;
524  } data;
525  struct {
526  uint8_t *data;
548  } digest;
549  struct {
550  uint8_t *data;
583  } aad;
585  } aead;
586 
587  struct {
588  struct {
589  struct {
590  uint32_t offset;
604  uint32_t length;
618  } data;
619  } cipher;
620 
621  struct {
622  struct {
623  uint32_t offset;
639  uint32_t length;
655  } data;
658  struct {
659  uint8_t *data;
681  } digest;
682  } auth;
683  };
684  };
685 };
686 
687 
693 static inline void
695 {
696  memset(op, 0, sizeof(*op));
697 }
698 
699 
710 static inline struct rte_crypto_sym_xform *
712  void *priv_data, uint8_t nb_xforms)
713 {
714  struct rte_crypto_sym_xform *xform;
715 
716  sym_op->xform = xform = (struct rte_crypto_sym_xform *)priv_data;
717 
718  do {
720  xform = xform->next = --nb_xforms > 0 ? xform + 1 : NULL;
721  } while (xform);
722 
723  return sym_op->xform;
724 }
725 
726 
733 static inline int
735  struct rte_cryptodev_sym_session *sess)
736 {
737  sym_op->session = sess;
738 
739  return 0;
740 }
741 
742 
743 #ifdef __cplusplus
744 }
745 #endif
746 
747 #endif /* _RTE_CRYPTO_SYM_H_ */