]>
Commit | Line | Data |
---|---|---|
1da177e4 LT |
1 | /* |
2 | * Quick & dirty crypto testing module. | |
3 | * | |
4 | * This will only exist until we have a better testing mechanism | |
5 | * (e.g. a char device). | |
6 | * | |
7 | * Copyright (c) 2002 James Morris <jmorris@intercode.com.au> | |
8 | * Copyright (c) 2002 Jean-Francois Dive <jef@linuxbe.org> | |
e3a4ea4f | 9 | * Copyright (c) 2007 Nokia Siemens Networks |
1da177e4 LT |
10 | * |
11 | * This program is free software; you can redistribute it and/or modify it | |
12 | * under the terms of the GNU General Public License as published by the Free | |
ef2736fc | 13 | * Software Foundation; either version 2 of the License, or (at your option) |
1da177e4 LT |
14 | * any later version. |
15 | * | |
1da177e4 LT |
16 | */ |
17 | #ifndef _CRYPTO_TCRYPT_H | |
18 | #define _CRYPTO_TCRYPT_H | |
19 | ||
da7f033d HX |
20 | struct cipher_speed_template { |
21 | const char *key; | |
22 | unsigned int klen; | |
e3a4ea4f MH |
23 | }; |
24 | ||
53f52d7a TC |
25 | struct aead_speed_template { |
26 | const char *key; | |
27 | unsigned int klen; | |
28 | }; | |
29 | ||
e9d41164 | 30 | struct hash_speed { |
e8057928 ML |
31 | unsigned int blen; /* buffer length */ |
32 | unsigned int plen; /* per-update length */ | |
18bcc919 | 33 | unsigned int klen; /* key length */ |
e8057928 ML |
34 | }; |
35 | ||
1da177e4 LT |
36 | /* |
37 | * DES test vectors. | |
38 | */ | |
da7f033d | 39 | #define DES3_SPEED_VECTORS 1 |
1da177e4 | 40 | |
da7f033d | 41 | static struct cipher_speed_template des3_speed_template[] = { |
1da177e4 | 42 | { |
de224c30 | 43 | .key = "\x01\x23\x45\x67\x89\xab\xcd\xef" |
da7f033d | 44 | "\x55\x55\x55\x55\x55\x55\x55\x55" |
de224c30 | 45 | "\xfe\xdc\xba\x98\x76\x54\x32\x10", |
02ab5a70 | 46 | .klen = 24, |
e2ee95b8 HSC |
47 | } |
48 | }; | |
49 | ||
ebfd9bcf HW |
50 | /* |
51 | * Cipher speed tests | |
52 | */ | |
d5dc3927 SS |
53 | static u8 speed_template_8[] = {8, 0}; |
54 | static u8 speed_template_24[] = {24, 0}; | |
a2c58260 | 55 | static u8 speed_template_8_16[] = {8, 16, 0}; |
d5dc3927 SS |
56 | static u8 speed_template_8_32[] = {8, 32, 0}; |
57 | static u8 speed_template_16_32[] = {16, 32, 0}; | |
58 | static u8 speed_template_16_24_32[] = {16, 24, 32, 0}; | |
69d3150c | 59 | static u8 speed_template_20_28_36[] = {20, 28, 36, 0}; |
d5dc3927 | 60 | static u8 speed_template_32_40_48[] = {32, 40, 48, 0}; |
87aae4bf | 61 | static u8 speed_template_32_48[] = {32, 48, 0}; |
d5dc3927 | 62 | static u8 speed_template_32_48_64[] = {32, 48, 64, 0}; |
5209c07a | 63 | static u8 speed_template_32_64[] = {32, 64, 0}; |
2dce063a | 64 | static u8 speed_template_32[] = {32, 0}; |
f19f5111 | 65 | |
53f52d7a TC |
66 | /* |
67 | * AEAD speed tests | |
68 | */ | |
4e4aab63 | 69 | static u8 aead_speed_template_19[] = {19, 0}; |
53f52d7a | 70 | static u8 aead_speed_template_20[] = {20, 0}; |
2dce063a | 71 | static u8 aead_speed_template_36[] = {36, 0}; |
53f52d7a | 72 | |
e8057928 ML |
73 | /* |
74 | * Digest speed tests | |
75 | */ | |
e9d41164 | 76 | static struct hash_speed generic_hash_speed_template[] = { |
de224c30 | 77 | { .blen = 16, .plen = 16, }, |
e8057928 ML |
78 | { .blen = 64, .plen = 16, }, |
79 | { .blen = 64, .plen = 64, }, | |
80 | { .blen = 256, .plen = 16, }, | |
81 | { .blen = 256, .plen = 64, }, | |
82 | { .blen = 256, .plen = 256, }, | |
83 | { .blen = 1024, .plen = 16, }, | |
84 | { .blen = 1024, .plen = 256, }, | |
85 | { .blen = 1024, .plen = 1024, }, | |
86 | { .blen = 2048, .plen = 16, }, | |
87 | { .blen = 2048, .plen = 256, }, | |
88 | { .blen = 2048, .plen = 1024, }, | |
89 | { .blen = 2048, .plen = 2048, }, | |
90 | { .blen = 4096, .plen = 16, }, | |
91 | { .blen = 4096, .plen = 256, }, | |
92 | { .blen = 4096, .plen = 1024, }, | |
93 | { .blen = 4096, .plen = 4096, }, | |
94 | { .blen = 8192, .plen = 16, }, | |
95 | { .blen = 8192, .plen = 256, }, | |
96 | { .blen = 8192, .plen = 1024, }, | |
97 | { .blen = 8192, .plen = 4096, }, | |
98 | { .blen = 8192, .plen = 8192, }, | |
99 | ||
100 | /* End marker */ | |
101 | { .blen = 0, .plen = 0, } | |
102 | }; | |
103 | ||
18bcc919 HY |
104 | static struct hash_speed hash_speed_template_16[] = { |
105 | { .blen = 16, .plen = 16, .klen = 16, }, | |
106 | { .blen = 64, .plen = 16, .klen = 16, }, | |
107 | { .blen = 64, .plen = 64, .klen = 16, }, | |
108 | { .blen = 256, .plen = 16, .klen = 16, }, | |
109 | { .blen = 256, .plen = 64, .klen = 16, }, | |
110 | { .blen = 256, .plen = 256, .klen = 16, }, | |
111 | { .blen = 1024, .plen = 16, .klen = 16, }, | |
112 | { .blen = 1024, .plen = 256, .klen = 16, }, | |
113 | { .blen = 1024, .plen = 1024, .klen = 16, }, | |
114 | { .blen = 2048, .plen = 16, .klen = 16, }, | |
115 | { .blen = 2048, .plen = 256, .klen = 16, }, | |
116 | { .blen = 2048, .plen = 1024, .klen = 16, }, | |
117 | { .blen = 2048, .plen = 2048, .klen = 16, }, | |
118 | { .blen = 4096, .plen = 16, .klen = 16, }, | |
119 | { .blen = 4096, .plen = 256, .klen = 16, }, | |
120 | { .blen = 4096, .plen = 1024, .klen = 16, }, | |
121 | { .blen = 4096, .plen = 4096, .klen = 16, }, | |
122 | { .blen = 8192, .plen = 16, .klen = 16, }, | |
123 | { .blen = 8192, .plen = 256, .klen = 16, }, | |
124 | { .blen = 8192, .plen = 1024, .klen = 16, }, | |
125 | { .blen = 8192, .plen = 4096, .klen = 16, }, | |
126 | { .blen = 8192, .plen = 8192, .klen = 16, }, | |
127 | ||
128 | /* End marker */ | |
129 | { .blen = 0, .plen = 0, .klen = 0, } | |
130 | }; | |
131 | ||
2dce063a MW |
132 | static struct hash_speed poly1305_speed_template[] = { |
133 | { .blen = 96, .plen = 16, }, | |
134 | { .blen = 96, .plen = 32, }, | |
135 | { .blen = 96, .plen = 96, }, | |
136 | { .blen = 288, .plen = 16, }, | |
137 | { .blen = 288, .plen = 32, }, | |
138 | { .blen = 288, .plen = 288, }, | |
139 | { .blen = 1056, .plen = 32, }, | |
140 | { .blen = 1056, .plen = 1056, }, | |
141 | { .blen = 2080, .plen = 32, }, | |
142 | { .blen = 2080, .plen = 2080, }, | |
143 | { .blen = 4128, .plen = 4128, }, | |
144 | { .blen = 8224, .plen = 8224, }, | |
145 | ||
146 | /* End marker */ | |
147 | { .blen = 0, .plen = 0, } | |
148 | }; | |
149 | ||
1da177e4 | 150 | #endif /* _CRYPTO_TCRYPT_H */ |