DPDK
17.08.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-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
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_CTR
,
73
RTE_CRYPTO_CIPHER_AES_ECB
,
75
RTE_CRYPTO_CIPHER_AES_F8
,
77
RTE_CRYPTO_CIPHER_AES_XTS
,
80
RTE_CRYPTO_CIPHER_ARC4
,
83
RTE_CRYPTO_CIPHER_KASUMI_F8
,
86
RTE_CRYPTO_CIPHER_SNOW3G_UEA2
,
89
RTE_CRYPTO_CIPHER_ZUC_EEA3
,
92
RTE_CRYPTO_CIPHER_DES_CBC
,
95
RTE_CRYPTO_CIPHER_AES_DOCSISBPI
,
102
RTE_CRYPTO_CIPHER_DES_DOCSISBPI
,
109
RTE_CRYPTO_CIPHER_LIST_END
110
111
};
112
114
extern
const
char
*
115
rte_crypto_cipher_algorithm_strings
[];
116
118
enum
rte_crypto_cipher_operation
{
119
RTE_CRYPTO_CIPHER_OP_ENCRYPT
,
121
RTE_CRYPTO_CIPHER_OP_DECRYPT
123
};
124
126
extern
const
char
*
127
rte_crypto_cipher_operation_strings
[];
128
135
struct
rte_crypto_cipher_xform
{
136
enum
rte_crypto_cipher_operation
op
;
141
enum
rte_crypto_cipher_algorithm
algo
;
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
229
enum
rte_crypto_auth_algorithm
{
230
RTE_CRYPTO_AUTH_NULL
= 1,
233
RTE_CRYPTO_AUTH_AES_CBC_MAC
,
235
RTE_CRYPTO_AUTH_AES_CMAC
,
237
RTE_CRYPTO_AUTH_AES_GMAC
,
239
RTE_CRYPTO_AUTH_AES_XCBC_MAC
,
242
RTE_CRYPTO_AUTH_KASUMI_F9
,
245
RTE_CRYPTO_AUTH_MD5
,
247
RTE_CRYPTO_AUTH_MD5_HMAC
,
250
RTE_CRYPTO_AUTH_SHA1
,
252
RTE_CRYPTO_AUTH_SHA1_HMAC
,
254
RTE_CRYPTO_AUTH_SHA224
,
256
RTE_CRYPTO_AUTH_SHA224_HMAC
,
258
RTE_CRYPTO_AUTH_SHA256
,
260
RTE_CRYPTO_AUTH_SHA256_HMAC
,
262
RTE_CRYPTO_AUTH_SHA384
,
264
RTE_CRYPTO_AUTH_SHA384_HMAC
,
266
RTE_CRYPTO_AUTH_SHA512
,
268
RTE_CRYPTO_AUTH_SHA512_HMAC
,
271
RTE_CRYPTO_AUTH_SNOW3G_UIA2
,
274
RTE_CRYPTO_AUTH_ZUC_EIA3
,
277
RTE_CRYPTO_AUTH_LIST_END
278
};
279
281
extern
const
char
*
282
rte_crypto_auth_algorithm_strings
[];
283
285
enum
rte_crypto_auth_operation
{
286
RTE_CRYPTO_AUTH_OP_VERIFY
,
287
RTE_CRYPTO_AUTH_OP_GENERATE
288
};
289
291
extern
const
char
*
292
rte_crypto_auth_operation_strings
[];
293
301
struct
rte_crypto_auth_xform
{
302
enum
rte_crypto_auth_operation
op
;
304
enum
rte_crypto_auth_algorithm
algo
;
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
360
enum
rte_crypto_aead_algorithm
{
361
RTE_CRYPTO_AEAD_AES_CCM
= 1,
363
RTE_CRYPTO_AEAD_AES_GCM
,
365
RTE_CRYPTO_AEAD_LIST_END
366
};
367
369
extern
const
char
*
370
rte_crypto_aead_algorithm_strings
[];
371
373
enum
rte_crypto_aead_operation
{
374
RTE_CRYPTO_AEAD_OP_ENCRYPT
,
376
RTE_CRYPTO_AEAD_OP_DECRYPT
378
};
379
381
extern
const
char
*
382
rte_crypto_aead_operation_strings
[];
383
384
struct
rte_crypto_aead_xform {
385
enum
rte_crypto_aead_operation
op;
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
434
enum
rte_crypto_sym_xform_type
{
435
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
= 0,
436
RTE_CRYPTO_SYM_XFORM_AUTH
,
437
RTE_CRYPTO_SYM_XFORM_CIPHER
,
438
RTE_CRYPTO_SYM_XFORM_AEAD
439
};
440
450
struct
rte_crypto_sym_xform
{
451
struct
rte_crypto_sym_xform
*
next
;
453
enum
rte_crypto_sym_xform_type
type
454
;
455
RTE_STD_C11
456
union
{
457
struct
rte_crypto_auth_xform
auth
;
459
struct
rte_crypto_cipher_xform
cipher
;
461
struct
rte_crypto_aead_xform
aead
;
463
};
464
};
465
466
struct
rte_cryptodev_sym_session
;
467
498
struct
rte_crypto_sym_op
{
499
struct
rte_mbuf
*
m_src
;
500
struct
rte_mbuf
*
m_dst
;
502
RTE_STD_C11
503
union
{
504
struct
rte_cryptodev_sym_session
*
session
;
506
struct
rte_crypto_sym_xform
*
xform
;
508
};
509
510
RTE_STD_C11
511
union
{
512
struct
{
513
struct
{
514
uint32_t
offset
;
519
uint32_t
length
;
524
}
data
;
525
struct
{
526
uint8_t *
data
;
546
phys_addr_t
phys_addr
;
548
}
digest
;
549
struct
{
550
uint8_t *
data
;
582
phys_addr_t
phys_addr
;
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
;
679
phys_addr_t
phys_addr
;
681
}
digest
;
682
} auth;
683
};
684
};
685
};
686
687
693
static
inline
void
694
__rte_crypto_sym_op_reset
(
struct
rte_crypto_sym_op
*op)
695
{
696
memset(op, 0,
sizeof
(*op));
697
}
698
699
710
static
inline
struct
rte_crypto_sym_xform
*
711
__rte_crypto_sym_op_sym_xforms_alloc
(
struct
rte_crypto_sym_op
*sym_op,
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
{
719
xform->
type
=
RTE_CRYPTO_SYM_XFORM_NOT_SPECIFIED
;
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
734
__rte_crypto_sym_op_attach_sym_session
(
struct
rte_crypto_sym_op
*sym_op,
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_ */
Generated by
1.8.1.2