DPDK
17.02.1
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_LIST_END
112
113
};
114
116
extern
const
char
*
117
rte_crypto_cipher_algorithm_strings
[];
118
120
enum
rte_crypto_cipher_operation
{
121
RTE_CRYPTO_CIPHER_OP_ENCRYPT
,
123
RTE_CRYPTO_CIPHER_OP_DECRYPT
125
};
126
128
extern
const
char
*
129
rte_crypto_cipher_operation_strings
[];
130
137
struct
rte_crypto_cipher_xform
{
138
enum
rte_crypto_cipher_operation
op
;
143
enum
rte_crypto_cipher_algorithm
algo
;
146
struct
{
147
uint8_t *
data
;
148
size_t
length
;
149
}
key
;
179
};
180
182
enum
rte_crypto_auth_algorithm
{
183
RTE_CRYPTO_AUTH_NULL
= 1,
186
RTE_CRYPTO_AUTH_AES_CBC_MAC
,
188
RTE_CRYPTO_AUTH_AES_CCM
,
197
RTE_CRYPTO_AUTH_AES_CMAC
,
199
RTE_CRYPTO_AUTH_AES_GCM
,
207
RTE_CRYPTO_AUTH_AES_GMAC
,
215
RTE_CRYPTO_AUTH_AES_XCBC_MAC
,
218
RTE_CRYPTO_AUTH_KASUMI_F9
,
221
RTE_CRYPTO_AUTH_MD5
,
223
RTE_CRYPTO_AUTH_MD5_HMAC
,
226
RTE_CRYPTO_AUTH_SHA1
,
228
RTE_CRYPTO_AUTH_SHA1_HMAC
,
230
RTE_CRYPTO_AUTH_SHA224
,
232
RTE_CRYPTO_AUTH_SHA224_HMAC
,
234
RTE_CRYPTO_AUTH_SHA256
,
236
RTE_CRYPTO_AUTH_SHA256_HMAC
,
238
RTE_CRYPTO_AUTH_SHA384
,
240
RTE_CRYPTO_AUTH_SHA384_HMAC
,
242
RTE_CRYPTO_AUTH_SHA512
,
244
RTE_CRYPTO_AUTH_SHA512_HMAC
,
247
RTE_CRYPTO_AUTH_SNOW3G_UIA2
,
250
RTE_CRYPTO_AUTH_ZUC_EIA3
,
253
RTE_CRYPTO_AUTH_LIST_END
254
};
255
257
extern
const
char
*
258
rte_crypto_auth_algorithm_strings
[];
259
261
enum
rte_crypto_auth_operation
{
262
RTE_CRYPTO_AUTH_OP_VERIFY
,
263
RTE_CRYPTO_AUTH_OP_GENERATE
264
};
265
267
extern
const
char
*
268
rte_crypto_auth_operation_strings
[];
269
277
struct
rte_crypto_auth_xform
{
278
enum
rte_crypto_auth_operation
op
;
280
enum
rte_crypto_auth_algorithm
algo
;
283
struct
{
284
uint8_t *
data
;
285
size_t
length
;
286
}
key
;
294
uint32_t
digest_length
;
305
uint32_t
add_auth_data_length
;
333
};
334
336
enum
rte_crypto_sym_xform_type
{
337
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
= 0,
338
RTE_CRYPTO_SYM_XFORM_AUTH
,
339
RTE_CRYPTO_SYM_XFORM_CIPHER
340
};
341
351
struct
rte_crypto_sym_xform
{
352
struct
rte_crypto_sym_xform
*
next
;
354
enum
rte_crypto_sym_xform_type
type
355
;
356
RTE_STD_C11
357
union
{
358
struct
rte_crypto_auth_xform
auth
;
360
struct
rte_crypto_cipher_xform
cipher
;
362
};
363
};
364
370
enum
rte_crypto_sym_op_sess_type
{
371
RTE_CRYPTO_SYM_OP_WITH_SESSION
,
372
RTE_CRYPTO_SYM_OP_SESSIONLESS
373
};
374
375
376
struct
rte_cryptodev_sym_session
;
377
408
struct
rte_crypto_sym_op
{
409
struct
rte_mbuf
*
m_src
;
410
struct
rte_mbuf
*
m_dst
;
412
enum
rte_crypto_sym_op_sess_type
sess_type;
413
414
RTE_STD_C11
415
union
{
416
struct
rte_cryptodev_sym_session
*
session
;
418
struct
rte_crypto_sym_xform
*
xform
;
420
};
421
422
struct
{
423
struct
{
424
uint32_t
offset
;
438
uint32_t
length
;
463
}
data
;
465
struct
{
466
uint8_t *
data
;
493
phys_addr_t
phys_addr
;
494
uint16_t
length
;
512
}
iv
;
513
} cipher;
514
515
struct
{
516
struct
{
517
uint32_t
offset
;
539
uint32_t
length
;
559
}
data
;
561
struct
{
562
uint8_t *
data
;
582
phys_addr_t
phys_addr
;
584
uint16_t
length
;
588
}
digest
;
590
struct
{
591
uint8_t *
data
;
634
phys_addr_t
phys_addr
;
635
uint16_t
length
;
639
}
aad
;
641
} auth;
642
}
__rte_cache_aligned
;
643
644
650
static
inline
void
651
__rte_crypto_sym_op_reset
(
struct
rte_crypto_sym_op
*op)
652
{
653
memset(op, 0,
sizeof
(*op));
654
655
op->sess_type =
RTE_CRYPTO_SYM_OP_SESSIONLESS
;
656
}
657
658
669
static
inline
struct
rte_crypto_sym_xform
*
670
__rte_crypto_sym_op_sym_xforms_alloc
(
struct
rte_crypto_sym_op
*sym_op,
671
void
*priv_data, uint8_t nb_xforms)
672
{
673
struct
rte_crypto_sym_xform
*xform;
674
675
sym_op->
xform
= xform = (
struct
rte_crypto_sym_xform
*)priv_data;
676
677
do
{
678
xform->
type
=
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
;
679
xform = xform->
next
= --nb_xforms > 0 ? xform + 1 : NULL;
680
}
while
(xform);
681
682
return
sym_op->
xform
;
683
}
684
685
692
static
inline
int
693
__rte_crypto_sym_op_attach_sym_session
(
struct
rte_crypto_sym_op
*sym_op,
694
struct
rte_cryptodev_sym_session
*sess)
695
{
696
sym_op->
session
= sess;
697
sym_op->sess_type =
RTE_CRYPTO_SYM_OP_WITH_SESSION
;
698
699
return
0;
700
}
701
702
703
#ifdef __cplusplus
704
}
705
#endif
706
707
#endif
/* _RTE_CRYPTO_SYM_H_ */
Generated by
1.8.1.2