NDN-DPDK
High-Speed Named Data Networking Forwarder
All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
cryptodev.h
Go to the documentation of this file.
1 #ifndef NDNDPDK_DPDK_CRYPTODEV_H
2 #define NDNDPDK_DPDK_CRYPTODEV_H
3 
6 #include "../core/common.h"
7 #include <rte_cryptodev.h>
8 
9 extern struct rte_crypto_sym_xform CryptoDev_Sha256Xform;
10 
12 typedef struct CryptoQueuePair {
13  void* sha256sess;
14  uint8_t dev;
15  uint16_t qp;
17 
27 __attribute__((nonnull)) static inline void
28 CryptoQueuePair_PrepareSha256(CryptoQueuePair* cqp, struct rte_crypto_op* op, struct rte_mbuf* m,
29  uint32_t offset, uint32_t length, uint8_t* output) {
30  __rte_crypto_op_reset(op, RTE_CRYPTO_OP_TYPE_SYMMETRIC);
31  op->sym->m_src = m;
32  op->sym->auth.data.offset = offset;
33  op->sym->auth.data.length = length;
34  op->sym->auth.digest.data = output;
35  int res = rte_crypto_op_attach_sym_session(op, cqp->sha256sess);
36  NDNDPDK_ASSERT(res == 0);
37 }
38 
39 #endif // NDNDPDK_DPDK_CRYPTODEV_H
#define NDNDPDK_ASSERT(x)
Definition: common.h:60
struct CryptoQueuePair CryptoQueuePair
Crypto queue pair.
struct rte_crypto_sym_xform CryptoDev_Sha256Xform
Definition: cryptodev.c:3
Crypto queue pair.
Definition: cryptodev.h:12
uint8_t dev
Definition: cryptodev.h:14
uint16_t qp
Definition: cryptodev.h:15
void * sha256sess
Definition: cryptodev.h:13