DPDK
17.05.2
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
#include <
rte_common.h
>
55
56
58
enum
rte_crypto_cipher_algorithm
{
59
RTE_CRYPTO_CIPHER_NULL
= 1,
62
RTE_CRYPTO_CIPHER_3DES_CBC
,
64
RTE_CRYPTO_CIPHER_3DES_CTR
,
66
RTE_CRYPTO_CIPHER_3DES_ECB
,
69
RTE_CRYPTO_CIPHER_AES_CBC
,
71
RTE_CRYPTO_CIPHER_AES_CCM
,
79
RTE_CRYPTO_CIPHER_AES_CTR
,
81
RTE_CRYPTO_CIPHER_AES_ECB
,
83
RTE_CRYPTO_CIPHER_AES_F8
,
85
RTE_CRYPTO_CIPHER_AES_GCM
,
93
RTE_CRYPTO_CIPHER_AES_XTS
,
96
RTE_CRYPTO_CIPHER_ARC4
,
99
RTE_CRYPTO_CIPHER_KASUMI_F8
,
102
RTE_CRYPTO_CIPHER_SNOW3G_UEA2
,
105
RTE_CRYPTO_CIPHER_ZUC_EEA3
,
108
RTE_CRYPTO_CIPHER_DES_CBC
,
111
RTE_CRYPTO_CIPHER_AES_DOCSISBPI
,
118
RTE_CRYPTO_CIPHER_DES_DOCSISBPI
,
125
RTE_CRYPTO_CIPHER_LIST_END
126
127
};
128
130
extern
const
char
*
131
rte_crypto_cipher_algorithm_strings
[];
132
134
enum
rte_crypto_cipher_operation
{
135
RTE_CRYPTO_CIPHER_OP_ENCRYPT
,
137
RTE_CRYPTO_CIPHER_OP_DECRYPT
139
};
140
142
extern
const
char
*
143
rte_crypto_cipher_operation_strings
[];
144
151
struct
rte_crypto_cipher_xform
{
152
enum
rte_crypto_cipher_operation
op
;
157
enum
rte_crypto_cipher_algorithm
algo
;
160
struct
{
161
uint8_t *
data
;
162
size_t
length
;
163
}
key
;
193
};
194
196
enum
rte_crypto_auth_algorithm
{
197
RTE_CRYPTO_AUTH_NULL
= 1,
200
RTE_CRYPTO_AUTH_AES_CBC_MAC
,
202
RTE_CRYPTO_AUTH_AES_CCM
,
211
RTE_CRYPTO_AUTH_AES_CMAC
,
213
RTE_CRYPTO_AUTH_AES_GCM
,
221
RTE_CRYPTO_AUTH_AES_GMAC
,
229
RTE_CRYPTO_AUTH_AES_XCBC_MAC
,
232
RTE_CRYPTO_AUTH_KASUMI_F9
,
235
RTE_CRYPTO_AUTH_MD5
,
237
RTE_CRYPTO_AUTH_MD5_HMAC
,
240
RTE_CRYPTO_AUTH_SHA1
,
242
RTE_CRYPTO_AUTH_SHA1_HMAC
,
244
RTE_CRYPTO_AUTH_SHA224
,
246
RTE_CRYPTO_AUTH_SHA224_HMAC
,
248
RTE_CRYPTO_AUTH_SHA256
,
250
RTE_CRYPTO_AUTH_SHA256_HMAC
,
252
RTE_CRYPTO_AUTH_SHA384
,
254
RTE_CRYPTO_AUTH_SHA384_HMAC
,
256
RTE_CRYPTO_AUTH_SHA512
,
258
RTE_CRYPTO_AUTH_SHA512_HMAC
,
261
RTE_CRYPTO_AUTH_SNOW3G_UIA2
,
264
RTE_CRYPTO_AUTH_ZUC_EIA3
,
267
RTE_CRYPTO_AUTH_LIST_END
268
};
269
271
extern
const
char
*
272
rte_crypto_auth_algorithm_strings
[];
273
275
enum
rte_crypto_auth_operation
{
276
RTE_CRYPTO_AUTH_OP_VERIFY
,
277
RTE_CRYPTO_AUTH_OP_GENERATE
278
};
279
281
extern
const
char
*
282
rte_crypto_auth_operation_strings
[];
283
291
struct
rte_crypto_auth_xform
{
292
enum
rte_crypto_auth_operation
op
;
294
enum
rte_crypto_auth_algorithm
algo
;
297
struct
{
298
uint8_t *
data
;
299
size_t
length
;
300
}
key
;
308
uint32_t
digest_length
;
319
uint32_t
add_auth_data_length
;
347
};
348
350
enum
rte_crypto_sym_xform_type
{
351
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
= 0,
352
RTE_CRYPTO_SYM_XFORM_AUTH
,
353
RTE_CRYPTO_SYM_XFORM_CIPHER
354
};
355
365
struct
rte_crypto_sym_xform
{
366
struct
rte_crypto_sym_xform
*
next
;
368
enum
rte_crypto_sym_xform_type
type
369
;
370
RTE_STD_C11
371
union
{
372
struct
rte_crypto_auth_xform
auth
;
374
struct
rte_crypto_cipher_xform
cipher
;
376
};
377
};
378
384
enum
rte_crypto_sym_op_sess_type
{
385
RTE_CRYPTO_SYM_OP_WITH_SESSION
,
386
RTE_CRYPTO_SYM_OP_SESSIONLESS
387
};
388
389
390
struct
rte_cryptodev_sym_session
;
391
422
struct
rte_crypto_sym_op
{
423
struct
rte_mbuf
*
m_src
;
424
struct
rte_mbuf
*
m_dst
;
426
enum
rte_crypto_sym_op_sess_type
sess_type;
427
428
RTE_STD_C11
429
union
{
430
struct
rte_cryptodev_sym_session
*
session
;
432
struct
rte_crypto_sym_xform
*
xform
;
434
};
435
436
struct
{
437
struct
{
438
uint32_t
offset
;
452
uint32_t
length
;
477
}
data
;
479
struct
{
480
uint8_t *
data
;
507
phys_addr_t
phys_addr
;
508
uint16_t
length
;
526
}
iv
;
527
} cipher;
528
529
struct
{
530
struct
{
531
uint32_t
offset
;
553
uint32_t
length
;
573
}
data
;
575
struct
{
576
uint8_t *
data
;
596
phys_addr_t
phys_addr
;
598
uint16_t
length
;
602
}
digest
;
604
struct
{
605
uint8_t *
data
;
648
phys_addr_t
phys_addr
;
649
uint16_t
length
;
653
}
aad
;
655
} auth;
656
}
__rte_cache_aligned
;
657
658
664
static
inline
void
665
__rte_crypto_sym_op_reset
(
struct
rte_crypto_sym_op
*op)
666
{
667
memset(op, 0,
sizeof
(*op));
668
669
op->sess_type =
RTE_CRYPTO_SYM_OP_SESSIONLESS
;
670
}
671
672
683
static
inline
struct
rte_crypto_sym_xform
*
684
__rte_crypto_sym_op_sym_xforms_alloc
(
struct
rte_crypto_sym_op
*sym_op,
685
void
*priv_data, uint8_t nb_xforms)
686
{
687
struct
rte_crypto_sym_xform
*xform;
688
689
sym_op->
xform
= xform = (
struct
rte_crypto_sym_xform
*)priv_data;
690
691
do
{
692
xform->
type
=
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
;
693
xform = xform->
next
= --nb_xforms > 0 ? xform + 1 : NULL;
694
}
while
(xform);
695
696
return
sym_op->
xform
;
697
}
698
699
706
static
inline
int
707
__rte_crypto_sym_op_attach_sym_session
(
struct
rte_crypto_sym_op
*sym_op,
708
struct
rte_cryptodev_sym_session
*sess)
709
{
710
sym_op->
session
= sess;
711
sym_op->sess_type =
RTE_CRYPTO_SYM_OP_WITH_SESSION
;
712
713
return
0;
714
}
715
716
717
#ifdef __cplusplus
718
}
719
#endif
720
721
#endif
/* _RTE_CRYPTO_SYM_H_ */
Generated by
1.8.1.2