DPDK
2.2.0
Main Page
Related Pages
Data Structures
Files
Examples
File List
Globals
lib
librte_cryptodev
rte_crypto.h
Go to the documentation of this file.
1
/*-
2
* BSD LICENSE
3
*
4
* Copyright(c) 2015 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_H_
34
#define _RTE_CRYPTO_H_
35
45
#ifdef __cplusplus
46
extern
"C"
{
47
#endif
48
49
#include <
rte_mbuf.h
>
50
#include <
rte_memory.h
>
51
#include <
rte_mempool.h
>
52
54
enum
rte_crypto_cipher_algorithm
{
55
RTE_CRYPTO_CIPHER_NULL
= 1,
58
RTE_CRYPTO_CIPHER_3DES_CBC
,
60
RTE_CRYPTO_CIPHER_3DES_CTR
,
62
RTE_CRYPTO_CIPHER_3DES_ECB
,
65
RTE_CRYPTO_CIPHER_AES_CBC
,
67
RTE_CRYPTO_CIPHER_AES_CCM
,
75
RTE_CRYPTO_CIPHER_AES_CTR
,
77
RTE_CRYPTO_CIPHER_AES_ECB
,
79
RTE_CRYPTO_CIPHER_AES_F8
,
81
RTE_CRYPTO_CIPHER_AES_GCM
,
89
RTE_CRYPTO_CIPHER_AES_XTS
,
92
RTE_CRYPTO_CIPHER_ARC4
,
95
RTE_CRYPTO_CIPHER_KASUMI_F8
,
98
RTE_CRYPTO_CIPHER_SNOW3G_UEA2
,
101
RTE_CRYPTO_CIPHER_ZUC_EEA3
103
};
104
106
enum
rte_crypto_cipher_operation
{
107
RTE_CRYPTO_CIPHER_OP_ENCRYPT
,
109
RTE_CRYPTO_CIPHER_OP_DECRYPT
111
};
112
114
struct
rte_crypto_key
{
115
uint8_t *
data
;
116
phys_addr_t
phys_addr;
117
size_t
length
;
118
};
119
126
struct
rte_crypto_cipher_xform
{
127
enum
rte_crypto_cipher_operation
op
;
132
enum
rte_crypto_cipher_algorithm
algo
;
135
struct
rte_crypto_key
key
;
165
};
166
168
enum
rte_crypto_auth_algorithm
{
169
RTE_CRYPTO_AUTH_NULL
= 1,
172
RTE_CRYPTO_AUTH_AES_CBC_MAC
,
174
RTE_CRYPTO_AUTH_AES_CCM
,
183
RTE_CRYPTO_AUTH_AES_CMAC
,
185
RTE_CRYPTO_AUTH_AES_GCM
,
193
RTE_CRYPTO_AUTH_AES_GMAC
,
201
RTE_CRYPTO_AUTH_AES_XCBC_MAC
,
204
RTE_CRYPTO_AUTH_KASUMI_F9
,
207
RTE_CRYPTO_AUTH_MD5
,
209
RTE_CRYPTO_AUTH_MD5_HMAC
,
212
RTE_CRYPTO_AUTH_SHA1
,
214
RTE_CRYPTO_AUTH_SHA1_HMAC
,
216
RTE_CRYPTO_AUTH_SHA224
,
218
RTE_CRYPTO_AUTH_SHA224_HMAC
,
220
RTE_CRYPTO_AUTH_SHA256
,
222
RTE_CRYPTO_AUTH_SHA256_HMAC
,
224
RTE_CRYPTO_AUTH_SHA384
,
226
RTE_CRYPTO_AUTH_SHA384_HMAC
,
228
RTE_CRYPTO_AUTH_SHA512
,
230
RTE_CRYPTO_AUTH_SHA512_HMAC
,
233
RTE_CRYPTO_AUTH_SNOW3G_UIA2
,
236
RTE_CRYPTO_AUTH_ZUC_EIA3
,
238
};
239
241
enum
rte_crypto_auth_operation
{
242
RTE_CRYPTO_AUTH_OP_VERIFY
,
243
RTE_CRYPTO_AUTH_OP_GENERATE
244
};
245
253
struct
rte_crypto_auth_xform
{
254
enum
rte_crypto_auth_operation
op
;
256
enum
rte_crypto_auth_algorithm
algo
;
259
struct
rte_crypto_key
key
;
266
uint32_t
digest_length
;
278
uint32_t
add_auth_data_length
;
306
};
307
309
enum
rte_crypto_xform_type
{
310
RTE_CRYPTO_XFORM_NOT_SPECIFIED
= 0,
311
RTE_CRYPTO_XFORM_AUTH
,
312
RTE_CRYPTO_XFORM_CIPHER
313
};
314
324
struct
rte_crypto_xform
{
325
struct
rte_crypto_xform
*
next
;
327
enum
rte_crypto_xform_type
type
;
328
union
{
329
struct
rte_crypto_auth_xform
auth
;
331
struct
rte_crypto_cipher_xform
cipher
;
333
};
334
};
335
341
enum
rte_crypto_op_sess_type
{
342
RTE_CRYPTO_OP_WITH_SESSION
,
343
RTE_CRYPTO_OP_SESSIONLESS
344
};
345
347
enum
rte_crypto_op_status
{
348
RTE_CRYPTO_OP_STATUS_SUCCESS
,
350
RTE_CRYPTO_OP_STATUS_NO_SUBMITTED
,
352
RTE_CRYPTO_OP_STATUS_ENQUEUED
,
354
RTE_CRYPTO_OP_STATUS_AUTH_FAILED
,
356
RTE_CRYPTO_OP_STATUS_INVALID_ARGS
,
358
RTE_CRYPTO_OP_STATUS_ERROR
,
360
};
361
369
struct
rte_crypto_op
{
370
enum
rte_crypto_op_sess_type
type;
371
enum
rte_crypto_op_status
status;
372
373
struct
{
374
struct
rte_mbuf
*
m
;
375
uint8_t
offset
;
376
} dst;
377
378
union
{
379
struct
rte_cryptodev_session *
session
;
381
struct
rte_crypto_xform
*
xform
;
383
};
384
385
struct
{
386
struct
{
387
uint32_t
offset
;
395
uint32_t
length
;
414
}
to_cipher
;
416
struct
{
417
uint32_t
offset
;
432
uint32_t
length
;
446
}
to_hash
;
447
}
data
;
449
struct
{
450
uint8_t *
data
;
476
phys_addr_t
phys_addr
;
477
size_t
length
;
495
}
iv
;
497
struct
{
498
uint8_t *
data
;
524
phys_addr_t
phys_addr
;
525
uint32_t
length
;
526
}
digest
;
528
struct
{
529
uint8_t *
data
;
571
phys_addr_t
phys_addr
;
572
uint32_t
length
;
573
}
additional_auth
;
576
struct
rte_mempool
*
pool
;
579
void
*
user_data
;
581
};
582
583
589
static
inline
void
590
__rte_crypto_op_reset
(
struct
rte_crypto_op
*op)
591
{
592
op->type =
RTE_CRYPTO_OP_SESSIONLESS
;
593
op->dst.
m
= NULL;
594
op->dst.
offset
= 0;
595
}
596
598
static
inline
void
599
rte_crypto_op_attach_session
(
struct
rte_crypto_op
*op,
600
struct
rte_cryptodev_session *sess)
601
{
602
op->
session
= sess;
603
op->type =
RTE_CRYPTO_OP_WITH_SESSION
;
604
}
605
606
#ifdef __cplusplus
607
}
608
#endif
609
610
#endif
/* _RTE_CRYPTO_H_ */
Generated by
1.8.1.2