FD.io VPP
v20.05.1-6-gf53edbc3b
Vector Packet Processing
crypto.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2019 Cisco and/or its affiliates.
3
* Licensed under the Apache License, Version 2.0 (the "License");
4
* you may not use this file except in compliance with the License.
5
* You may obtain a copy of the License at:
6
*
7
* http://www.apache.org/licenses/LICENSE-2.0
8
*
9
* Unless required by applicable law or agreed to in writing, software
10
* distributed under the License is distributed on an "AS IS" BASIS,
11
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
* See the License for the specific language governing permissions and
13
* limitations under the License.
14
*/
15
16
17
#ifndef included_unittest_crypto_crypto_h
18
#define included_unittest_crypto_crypto_h
19
20
#define CRYPTO_TEST_MAX_OP_CHUNKS 8
21
22
typedef
struct
23
{
24
u32
length
;
25
u8
*
data
;
26
}
unittest_crypto_test_data_t
;
27
28
typedef
struct
unittest_crypto_test_registration
29
{
30
char
*
name
;
31
vnet_crypto_alg_t
alg
;
32
unittest_crypto_test_data_t
iv
,
key
,
digest
,
plaintext
,
ciphertext
,
aad
,
33
tag
;
34
u32
plaintext_incremental
;
35
u8
is_chained
;
36
37
/* plaintext and cipher text data used for testing chained buffers */
38
unittest_crypto_test_data_t
pt_chunks
[
CRYPTO_TEST_MAX_OP_CHUNKS
+ 1];
39
unittest_crypto_test_data_t
ct_chunks
[
CRYPTO_TEST_MAX_OP_CHUNKS
+ 1];
40
41
/* next */
42
struct
unittest_crypto_test_registration
*
next
;
43
}
unittest_crypto_test_registration_t
;
44
45
46
typedef
struct
47
{
48
int
verbose
;
49
u8
*
inc_data
;
50
51
/* perf */
52
vnet_crypto_alg_t
alg
;
53
u32
warmup_rounds
;
54
u32
rounds
;
55
u32
buffer_size
;
56
u32
n_buffers
;
57
58
unittest_crypto_test_registration_t
*
test_registrations
;
59
}
crypto_test_main_t
;
60
61
extern
crypto_test_main_t
crypto_test_main
;
62
63
#define TEST_DATA(n) { .data = (u8 *) n, .length = sizeof (n)}
64
#define TEST_DATA_CHUNK(s,off,n) { .data = (u8 *) s + off, .length = n}
65
66
#define UNITTEST_REGISTER_CRYPTO_TEST(x) \
67
unittest_crypto_test_registration_t __unittest_crypto_test_##x; \
68
static void __clib_constructor \
69
__unittest_crypto_test_registration_##x (void) \
70
{ \
71
crypto_test_main_t * cm = &crypto_test_main; \
72
__unittest_crypto_test_##x.next = cm->test_registrations; \
73
cm->test_registrations = & __unittest_crypto_test_##x; \
74
} \
75
unittest_crypto_test_registration_t __unittest_crypto_test_##x
76
77
#endif
78
79
/*
80
* fd.io coding-style-patch-verification: ON
81
*
82
* Local Variables:
83
* eval: (c-set-style "gnu")
84
* End:
85
*/
crypto_test_main_t::verbose
int verbose
Definition:
crypto.h:48
unittest_crypto_test_registration::aad
unittest_crypto_test_data_t aad
Definition:
crypto.h:32
unittest_crypto_test_data_t::length
u32 length
Definition:
crypto.h:24
unittest_crypto_test_data_t::data
u8 * data
Definition:
crypto.h:25
unittest_crypto_test_registration::iv
unittest_crypto_test_data_t iv
Definition:
crypto.h:32
u8
unsigned char u8
Definition:
types.h:56
unittest_crypto_test_registration
Definition:
crypto.h:28
unittest_crypto_test_registration::plaintext
unittest_crypto_test_data_t plaintext
Definition:
crypto.h:32
unittest_crypto_test_registration_t
struct unittest_crypto_test_registration unittest_crypto_test_registration_t
u32
unsigned int u32
Definition:
types.h:88
crypto_test_main_t::buffer_size
u32 buffer_size
Definition:
crypto.h:55
vnet_crypto_alg_t
vnet_crypto_alg_t
Definition:
crypto.h:121
unittest_crypto_test_registration::ct_chunks
unittest_crypto_test_data_t ct_chunks[CRYPTO_TEST_MAX_OP_CHUNKS+1]
Definition:
crypto.h:39
crypto_test_main_t::test_registrations
unittest_crypto_test_registration_t * test_registrations
Definition:
crypto.h:58
crypto_test_main
crypto_test_main_t crypto_test_main
unittest_crypto_test_registration::plaintext_incremental
u32 plaintext_incremental
Definition:
crypto.h:34
unittest_crypto_test_registration::alg
vnet_crypto_alg_t alg
Definition:
crypto.h:31
unittest_crypto_test_registration::pt_chunks
unittest_crypto_test_data_t pt_chunks[CRYPTO_TEST_MAX_OP_CHUNKS+1]
Definition:
crypto.h:38
unittest_crypto_test_registration::is_chained
u8 is_chained
Definition:
crypto.h:35
unittest_crypto_test_registration::name
char * name
Definition:
crypto.h:30
unittest_crypto_test_registration::ciphertext
unittest_crypto_test_data_t ciphertext
Definition:
crypto.h:32
crypto_test_main_t::inc_data
u8 * inc_data
Definition:
crypto.h:49
crypto_test_main_t::alg
vnet_crypto_alg_t alg
Definition:
crypto.h:52
unittest_crypto_test_registration::tag
unittest_crypto_test_data_t tag
Definition:
crypto.h:32
crypto_test_main_t::warmup_rounds
u32 warmup_rounds
Definition:
crypto.h:53
unittest_crypto_test_data_t
Definition:
crypto.h:22
crypto_test_main_t::rounds
u32 rounds
Definition:
crypto.h:54
unittest_crypto_test_registration::digest
unittest_crypto_test_data_t digest
Definition:
crypto.h:32
CRYPTO_TEST_MAX_OP_CHUNKS
#define CRYPTO_TEST_MAX_OP_CHUNKS
Definition:
crypto.h:20
crypto_test_main_t
Definition:
crypto.h:46
crypto_test_main_t::n_buffers
u32 n_buffers
Definition:
crypto.h:56
unittest_crypto_test_registration::next
struct unittest_crypto_test_registration * next
Definition:
crypto.h:42
unittest_crypto_test_registration::key
unittest_crypto_test_data_t key
Definition:
crypto.h:32
src
plugins
unittest
crypto
crypto.h
Generated on Mon Oct 12 2020 16:04:43 for FD.io VPP by
1.8.13