DPDK
16.04.0
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_cryptodev
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
55
57
enum
rte_crypto_cipher_algorithm
{
58
RTE_CRYPTO_CIPHER_NULL
= 1,
61
RTE_CRYPTO_CIPHER_3DES_CBC
,
63
RTE_CRYPTO_CIPHER_3DES_CTR
,
65
RTE_CRYPTO_CIPHER_3DES_ECB
,
68
RTE_CRYPTO_CIPHER_AES_CBC
,
70
RTE_CRYPTO_CIPHER_AES_CCM
,
78
RTE_CRYPTO_CIPHER_AES_CTR
,
80
RTE_CRYPTO_CIPHER_AES_ECB
,
82
RTE_CRYPTO_CIPHER_AES_F8
,
84
RTE_CRYPTO_CIPHER_AES_GCM
,
92
RTE_CRYPTO_CIPHER_AES_XTS
,
95
RTE_CRYPTO_CIPHER_ARC4
,
98
RTE_CRYPTO_CIPHER_KASUMI_F8
,
101
RTE_CRYPTO_CIPHER_SNOW3G_UEA2
,
104
RTE_CRYPTO_CIPHER_ZUC_EEA3
,
107
RTE_CRYPTO_CIPHER_LIST_END
108
};
109
111
enum
rte_crypto_cipher_operation
{
112
RTE_CRYPTO_CIPHER_OP_ENCRYPT
,
114
RTE_CRYPTO_CIPHER_OP_DECRYPT
116
};
117
124
struct
rte_crypto_cipher_xform
{
125
enum
rte_crypto_cipher_operation
op
;
130
enum
rte_crypto_cipher_algorithm
algo
;
133
struct
{
134
uint8_t *
data
;
135
size_t
length
;
136
}
key
;
166
};
167
169
enum
rte_crypto_auth_algorithm
{
170
RTE_CRYPTO_AUTH_NULL
= 1,
173
RTE_CRYPTO_AUTH_AES_CBC_MAC
,
175
RTE_CRYPTO_AUTH_AES_CCM
,
184
RTE_CRYPTO_AUTH_AES_CMAC
,
186
RTE_CRYPTO_AUTH_AES_GCM
,
194
RTE_CRYPTO_AUTH_AES_GMAC
,
202
RTE_CRYPTO_AUTH_AES_XCBC_MAC
,
205
RTE_CRYPTO_AUTH_KASUMI_F9
,
208
RTE_CRYPTO_AUTH_MD5
,
210
RTE_CRYPTO_AUTH_MD5_HMAC
,
213
RTE_CRYPTO_AUTH_SHA1
,
215
RTE_CRYPTO_AUTH_SHA1_HMAC
,
217
RTE_CRYPTO_AUTH_SHA224
,
219
RTE_CRYPTO_AUTH_SHA224_HMAC
,
221
RTE_CRYPTO_AUTH_SHA256
,
223
RTE_CRYPTO_AUTH_SHA256_HMAC
,
225
RTE_CRYPTO_AUTH_SHA384
,
227
RTE_CRYPTO_AUTH_SHA384_HMAC
,
229
RTE_CRYPTO_AUTH_SHA512
,
231
RTE_CRYPTO_AUTH_SHA512_HMAC
,
234
RTE_CRYPTO_AUTH_SNOW3G_UIA2
,
237
RTE_CRYPTO_AUTH_ZUC_EIA3
,
240
RTE_CRYPTO_AUTH_LIST_END
241
};
242
244
enum
rte_crypto_auth_operation
{
245
RTE_CRYPTO_AUTH_OP_VERIFY
,
246
RTE_CRYPTO_AUTH_OP_GENERATE
247
};
248
256
struct
rte_crypto_auth_xform
{
257
enum
rte_crypto_auth_operation
op
;
259
enum
rte_crypto_auth_algorithm
algo
;
262
struct
{
263
uint8_t *
data
;
264
size_t
length
;
265
}
key
;
273
uint32_t
digest_length
;
285
uint32_t
add_auth_data_length
;
313
};
314
316
enum
rte_crypto_sym_xform_type
{
317
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
= 0,
318
RTE_CRYPTO_SYM_XFORM_AUTH
,
319
RTE_CRYPTO_SYM_XFORM_CIPHER
320
};
321
331
struct
rte_crypto_sym_xform
{
332
struct
rte_crypto_sym_xform
*
next
;
334
enum
rte_crypto_sym_xform_type
type
335
;
336
union
{
337
struct
rte_crypto_auth_xform
auth
;
339
struct
rte_crypto_cipher_xform
cipher
;
341
};
342
};
343
349
enum
rte_crypto_sym_op_sess_type
{
350
RTE_CRYPTO_SYM_OP_WITH_SESSION
,
351
RTE_CRYPTO_SYM_OP_SESSIONLESS
352
};
353
354
355
struct
rte_cryptodev_sym_session
;
356
368
struct
rte_crypto_sym_op
{
369
struct
rte_mbuf
*
m_src
;
370
struct
rte_mbuf
*
m_dst
;
372
enum
rte_crypto_sym_op_sess_type
sess_type;
373
374
union
{
375
struct
rte_cryptodev_sym_session
*
session
;
377
struct
rte_crypto_sym_xform
*
xform
;
379
};
380
381
struct
{
382
struct
{
383
uint32_t
offset
;
395
uint32_t
length
;
418
}
data
;
420
struct
{
421
uint8_t *
data
;
448
phys_addr_t
phys_addr
;
449
uint16_t
length
;
467
}
iv
;
468
} cipher;
469
470
struct
{
471
struct
{
472
uint32_t
offset
;
491
uint32_t
length
;
509
}
data
;
511
struct
{
512
uint8_t *
data
;
540
phys_addr_t
phys_addr
;
542
uint16_t
length
;
544
}
digest
;
546
struct
{
547
uint8_t *
data
;
592
phys_addr_t
phys_addr
;
593
uint16_t
length
;
594
}
aad
;
596
} auth;
597
}
__rte_cache_aligned
;
598
599
605
static
inline
void
606
__rte_crypto_sym_op_reset
(
struct
rte_crypto_sym_op
*op)
607
{
608
memset(op, 0,
sizeof
(*op));
609
610
op->sess_type =
RTE_CRYPTO_SYM_OP_SESSIONLESS
;
611
}
612
613
624
static
inline
struct
rte_crypto_sym_xform
*
625
__rte_crypto_sym_op_sym_xforms_alloc
(
struct
rte_crypto_sym_op
*sym_op,
626
void
*priv_data, uint8_t nb_xforms)
627
{
628
struct
rte_crypto_sym_xform
*xform;
629
630
sym_op->
xform
= xform = (
struct
rte_crypto_sym_xform
*)priv_data;
631
632
do
{
633
xform->
type
=
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
;
634
xform = xform->
next
= --nb_xforms > 0 ? xform + 1 : NULL;
635
}
while
(xform);
636
637
return
sym_op->
xform
;
638
}
639
640
647
static
inline
int
648
__rte_crypto_sym_op_attach_sym_session
(
struct
rte_crypto_sym_op
*sym_op,
649
struct
rte_cryptodev_sym_session
*sess)
650
{
651
sym_op->
session
= sess;
652
sym_op->sess_type =
RTE_CRYPTO_SYM_OP_WITH_SESSION
;
653
654
return
0;
655
}
656
657
658
#ifdef __cplusplus
659
}
660
#endif
661
662
#endif
/* _RTE_CRYPTO_SYM_H_ */
Generated by
1.8.1.2