1 From 5f3a9153f7685f6dde29f7cd2d58534126c5b9af Mon Sep 17 00:00:00 2001
2 From: Cristian Stoica <cristian.stoica@nxp.com>
3 Date: Wed, 26 Oct 2016 10:45:40 +0300
4 Subject: [PATCH 063/104] avoid implicit conversion between signed and unsigned
7 Signed-off-by: Cristian Stoica <cristian.stoica@nxp.com>
9 tests/async_cipher.c | 36 ++++++++++++++--------------
10 tests/async_hmac.c | 8 +++----
11 tests/async_speed.c | 2 +-
12 tests/cipher-aead-srtp.c | 50 +++++++++++++++++++-------------------
13 tests/cipher-aead.c | 48 ++++++++++++++++++-------------------
14 tests/cipher-gcm.c | 62 ++++++++++++++++++++++++------------------------
15 tests/cipher.c | 35 ++++++++++++++-------------
16 tests/cipher_comp.c | 12 +++++-----
17 tests/fullspeed.c | 3 ++-
18 tests/hash_comp.c | 8 +++----
19 tests/hmac.c | 8 +++----
21 12 files changed, 138 insertions(+), 137 deletions(-)
23 diff --git a/tests/async_cipher.c b/tests/async_cipher.c
24 index 162a695..dd08403 100644
25 --- a/tests/async_cipher.c
26 +++ b/tests/async_cipher.c
33 #include <sys/ioctl.h>
34 #include <crypto/cryptodev.h>
36 @@ -26,10 +26,10 @@ static int debug = 0;
40 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
41 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
42 - char iv[BLOCK_SIZE];
44 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
45 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
46 + uint8_t iv[BLOCK_SIZE];
47 + uint8_t key[KEY_SIZE];
49 struct session_op sess;
51 @@ -62,8 +62,8 @@ test_crypto(int cfd)
52 perror("ioctl(CIOCGSESSINFO)");
55 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
56 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
57 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
58 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
60 plaintext = plaintext_raw;
61 ciphertext = ciphertext_raw;
62 @@ -127,15 +127,15 @@ test_crypto(int cfd)
64 static int test_aes(int cfd)
66 - char plaintext1_raw[BLOCK_SIZE + 63], *plaintext1;
67 - char ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 };
68 - char iv1[BLOCK_SIZE];
69 - char key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
70 - char plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 };
71 - char plaintext2_raw[BLOCK_SIZE + 63], *plaintext2;
72 - char ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 };
73 - char iv2[BLOCK_SIZE];
74 - char key2[KEY_SIZE];
75 + uint8_t plaintext1_raw[BLOCK_SIZE + 63], *plaintext1;
76 + uint8_t ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 };
77 + uint8_t iv1[BLOCK_SIZE];
78 + uint8_t key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
79 + uint8_t plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 };
80 + uint8_t plaintext2_raw[BLOCK_SIZE + 63], *plaintext2;
81 + uint8_t ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 };
82 + uint8_t iv2[BLOCK_SIZE];
83 + uint8_t key2[KEY_SIZE];
85 struct session_op sess1, sess2;
87 @@ -162,7 +162,7 @@ static int test_aes(int cfd)
88 perror("ioctl(CIOCGSESSINFO)");
91 - plaintext1 = (char *)(((unsigned long)plaintext1_raw + siop1.alignmask) & ~siop1.alignmask);
92 + plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop1.alignmask) & ~siop1.alignmask);
94 plaintext1 = plaintext1_raw;
96 @@ -185,7 +185,7 @@ static int test_aes(int cfd)
97 perror("ioctl(CIOCGSESSINFO)");
100 - plaintext2 = (char *)(((unsigned long)plaintext2_raw + siop2.alignmask) & ~siop2.alignmask);
101 + plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop2.alignmask) & ~siop2.alignmask);
103 plaintext2 = plaintext2_raw;
105 diff --git a/tests/async_hmac.c b/tests/async_hmac.c
106 index 97fd0c5..94a02c0 100644
107 --- a/tests/async_hmac.c
108 +++ b/tests/async_hmac.c
109 @@ -61,7 +61,7 @@ test_crypto(int cfd)
112 cryp.len = sizeof("what do ya want for nothing?")-1;
113 - cryp.src = "what do ya want for nothing?";
114 + cryp.src = (uint8_t*)"what do ya want for nothing?";
116 cryp.op = COP_ENCRYPT;
118 @@ -98,7 +98,7 @@ test_crypto(int cfd)
121 cryp.len = sizeof("what do ya want for nothing?")-1;
122 - cryp.src = "what do ya want for nothing?";
123 + cryp.src = (uint8_t*)"what do ya want for nothing?";
125 cryp.op = COP_ENCRYPT;
127 @@ -208,7 +208,7 @@ test_extras(int cfd)
130 cryp.len = sizeof("what do")-1;
131 - cryp.src = "what do";
132 + cryp.src = (uint8_t*)"what do";
134 cryp.op = COP_ENCRYPT;
135 cryp.flags = COP_FLAG_UPDATE;
136 @@ -218,7 +218,7 @@ test_extras(int cfd)
139 cryp.len = sizeof(" ya want for nothing?")-1;
140 - cryp.src = " ya want for nothing?";
141 + cryp.src = (uint8_t*)" ya want for nothing?";
143 cryp.op = COP_ENCRYPT;
144 cryp.flags = COP_FLAG_FINAL;
145 diff --git a/tests/async_speed.c b/tests/async_speed.c
146 index a1a1b7e..dabbbc1 100644
147 --- a/tests/async_speed.c
148 +++ b/tests/async_speed.c
149 @@ -140,7 +140,7 @@ int encrypt_data(int fdc, struct test_params tp, struct session_op *sess)
152 char *buffer[64], iv[32];
153 - char mac[64][HASH_MAX_LEN];
154 + uint8_t mac[64][HASH_MAX_LEN];
156 struct timeval start, end;
158 diff --git a/tests/cipher-aead-srtp.c b/tests/cipher-aead-srtp.c
159 index fae04e7..c44877d 100644
160 --- a/tests/cipher-aead-srtp.c
161 +++ b/tests/cipher-aead-srtp.c
162 @@ -77,13 +77,13 @@ int i;
166 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
167 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
168 - char iv[BLOCK_SIZE];
169 - char key[KEY_SIZE];
170 - unsigned char sha1mac[20];
171 - unsigned char tag[20];
172 - unsigned char mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
173 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
174 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
175 + uint8_t iv[BLOCK_SIZE];
176 + uint8_t key[KEY_SIZE];
177 + uint8_t sha1mac[20];
179 + uint8_t mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
182 struct session_op sess;
183 @@ -122,8 +122,8 @@ test_crypto(int cfd)
184 printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
185 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
187 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
188 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
189 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
190 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
192 memset(plaintext, 0x15, HEADER_SIZE); /* header */
193 memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
194 @@ -225,12 +225,12 @@ test_crypto(int cfd)
196 test_encrypt_decrypt(int cfd)
198 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
199 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
200 - char iv[BLOCK_SIZE];
201 - char key[KEY_SIZE];
202 - unsigned char tag[20];
203 - unsigned char mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
204 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
205 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
206 + uint8_t iv[BLOCK_SIZE];
207 + uint8_t key[KEY_SIZE];
209 + uint8_t mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
212 struct session_op sess;
213 @@ -265,8 +265,8 @@ test_encrypt_decrypt(int cfd)
214 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
215 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
217 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
218 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
219 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
220 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
222 memset(plaintext, 0x15, HEADER_SIZE); /* header */
223 memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
224 @@ -367,12 +367,12 @@ test_encrypt_decrypt(int cfd)
226 test_encrypt_decrypt_error(int cfd, int err)
228 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
229 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
230 - char iv[BLOCK_SIZE];
231 - char key[KEY_SIZE];
232 - unsigned char tag[20];
233 - unsigned char mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
234 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
235 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
236 + uint8_t iv[BLOCK_SIZE];
237 + uint8_t key[KEY_SIZE];
239 + uint8_t mackey[] = "\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b\x0b";
242 struct session_op sess;
243 @@ -407,8 +407,8 @@ test_encrypt_decrypt_error(int cfd, int err)
244 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
245 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
247 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
248 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
249 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
250 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
252 memset(plaintext, 0x15, HEADER_SIZE); /* header */
253 memset(&plaintext[HEADER_SIZE], 0x17, PLAINTEXT_SIZE); /* payload */
254 diff --git a/tests/cipher-aead.c b/tests/cipher-aead.c
255 index 164327f..da43aa6 100644
256 --- a/tests/cipher-aead.c
257 +++ b/tests/cipher-aead.c
258 @@ -89,12 +89,12 @@ int i;
262 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
263 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
264 - char iv[BLOCK_SIZE];
265 - char key[KEY_SIZE];
266 - char auth[AUTH_SIZE];
267 - unsigned char sha1mac[20];
268 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
269 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
270 + uint8_t iv[BLOCK_SIZE];
271 + uint8_t key[KEY_SIZE];
272 + uint8_t auth[AUTH_SIZE];
273 + uint8_t sha1mac[20];
276 struct session_op sess;
277 @@ -133,8 +133,8 @@ test_crypto(int cfd)
278 printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
279 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
281 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
282 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
283 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
284 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
285 memset(plaintext, 0x15, DATA_SIZE);
287 if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
288 @@ -242,12 +242,12 @@ test_crypto(int cfd)
290 test_encrypt_decrypt(int cfd)
292 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
293 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
294 - char iv[BLOCK_SIZE];
295 - char key[KEY_SIZE];
296 - char auth[AUTH_SIZE];
297 - unsigned char sha1mac[20];
298 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
299 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
300 + uint8_t iv[BLOCK_SIZE];
301 + uint8_t key[KEY_SIZE];
302 + uint8_t auth[AUTH_SIZE];
303 + uint8_t sha1mac[20];
306 struct session_op sess;
307 @@ -285,8 +285,8 @@ test_encrypt_decrypt(int cfd)
308 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
309 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
311 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
312 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
313 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
314 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
316 memset(plaintext, 0x15, DATA_SIZE);
318 @@ -391,12 +391,12 @@ test_encrypt_decrypt(int cfd)
320 test_encrypt_decrypt_error(int cfd, int err)
322 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
323 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
324 - char iv[BLOCK_SIZE];
325 - char key[KEY_SIZE];
326 - char auth[AUTH_SIZE];
327 - unsigned char sha1mac[20];
328 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
329 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
330 + uint8_t iv[BLOCK_SIZE];
331 + uint8_t key[KEY_SIZE];
332 + uint8_t auth[AUTH_SIZE];
333 + uint8_t sha1mac[20];
336 struct session_op sess;
337 @@ -434,8 +434,8 @@ test_encrypt_decrypt_error(int cfd, int err)
338 // printf("requested cipher CRYPTO_AES_CBC/HMAC-SHA1, got %s with driver %s\n",
339 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
341 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
342 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
343 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
344 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
345 memset(plaintext, 0x15, DATA_SIZE);
347 if (get_sha1_hmac(cfd, sess.mackey, sess.mackeylen, auth, sizeof(auth), plaintext, DATA_SIZE, sha1mac) != 0) {
348 diff --git a/tests/cipher-gcm.c b/tests/cipher-gcm.c
349 index dfc3d84..3f6cc7b 100644
350 --- a/tests/cipher-gcm.c
351 +++ b/tests/cipher-gcm.c
352 @@ -45,45 +45,45 @@ struct aes_gcm_vectors_st {
354 struct aes_gcm_vectors_st aes_gcm_vectors[] = {
358 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
362 + .plaintext = (uint8_t*)
363 "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
364 .plaintext_size = 16,
366 + .ciphertext = (uint8_t*)
367 "\x03\x88\xda\xce\x60\xb6\xa3\x92\xf3\x28\xc2\xb9\x71\xb2\xfe\x78",
368 - .iv = "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
370 + .iv = (uint8_t*)"\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00",
372 "\xab\x6e\x47\xd4\x2c\xec\x13\xbd\xf5\x3a\x67\xb2\x12\x57\xbd\xdf"
377 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
381 + .plaintext = (uint8_t*)
382 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39\x1a\xaf\xd2\x55",
383 .plaintext_size = 64,
385 + .ciphertext = (uint8_t*)
386 "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91\x47\x3f\x59\x85",
387 - .iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88",
388 - .tag = "\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4"
389 + .iv = (uint8_t*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88",
390 + .tag = (uint8_t*)"\x4d\x5c\x2a\xf3\x27\xcd\x64\xa6\x2c\xf3\x5a\xbd\x2b\xa6\xfa\xb4"
395 "\xfe\xff\xe9\x92\x86\x65\x73\x1c\x6d\x6a\x8f\x94\x67\x30\x83\x08",
398 "\xfe\xed\xfa\xce\xde\xad\xbe\xef\xfe\xed\xfa\xce\xde\xad\xbe\xef\xab\xad\xda\xd2",
401 + .plaintext = (uint8_t*)
402 "\xd9\x31\x32\x25\xf8\x84\x06\xe5\xa5\x59\x09\xc5\xaf\xf5\x26\x9a\x86\xa7\xa9\x53\x15\x34\xf7\xda\x2e\x4c\x30\x3d\x8a\x31\x8a\x72\x1c\x3c\x0c\x95\x95\x68\x09\x53\x2f\xcf\x0e\x24\x49\xa6\xb5\x25\xb1\x6a\xed\xf5\xaa\x0d\xe6\x57\xba\x63\x7b\x39",
403 .plaintext_size = 60,
405 + .ciphertext = (uint8_t*)
406 "\x42\x83\x1e\xc2\x21\x77\x74\x24\x4b\x72\x21\xb7\x84\xd0\xd4\x9c\xe3\xaa\x21\x2f\x2c\x02\xa4\xe0\x35\xc1\x7e\x23\x29\xac\xa1\x2e\x21\xd5\x14\xb2\x54\x66\x93\x1c\x7d\x8f\x6a\x5a\xac\x84\xaa\x05\x1b\xa3\x0b\x39\x6a\x0a\xac\x97\x3d\x58\xe0\x91",
407 - .iv = "\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88",
409 + .iv = (uint8_t*)"\xca\xfe\xba\xbe\xfa\xce\xdb\xad\xde\xca\xf8\x88",
411 "\x5b\xc9\x4f\xbc\x32\x21\xa5\xdb\x94\xfa\xe9\x5a\xe7\x12\x1a\x47"
414 @@ -94,7 +94,7 @@ struct aes_gcm_vectors_st aes_gcm_vectors[] = {
415 static int test_crypto(int cfd)
421 struct session_op sess;
422 struct crypt_auth_op cao;
423 @@ -191,11 +191,11 @@ static int test_crypto(int cfd)
425 static int test_encrypt_decrypt(int cfd)
427 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
428 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
429 - char iv[BLOCK_SIZE];
430 - char key[KEY_SIZE];
431 - char auth[AUTH_SIZE];
432 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
433 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
434 + uint8_t iv[BLOCK_SIZE];
435 + uint8_t key[KEY_SIZE];
436 + uint8_t auth[AUTH_SIZE];
439 struct session_op sess;
440 @@ -233,10 +233,10 @@ static int test_encrypt_decrypt(int cfd)
441 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
444 - (char *) (((unsigned long) plaintext_raw + siop.alignmask) &
445 + (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) &
448 - (char *) (((unsigned long) ciphertext_raw + siop.alignmask) &
449 + (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) &
452 memset(plaintext, 0x15, DATA_SIZE);
453 @@ -336,11 +336,11 @@ static int test_encrypt_decrypt(int cfd)
455 static int test_encrypt_decrypt_error(int cfd, int err)
457 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
458 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
459 - char iv[BLOCK_SIZE];
460 - char key[KEY_SIZE];
461 - char auth[AUTH_SIZE];
462 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
463 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
464 + uint8_t iv[BLOCK_SIZE];
465 + uint8_t key[KEY_SIZE];
466 + uint8_t auth[AUTH_SIZE];
469 struct session_op sess;
470 @@ -386,10 +386,10 @@ static int test_encrypt_decrypt_error(int cfd, int err)
471 // siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
474 - (char *) (((unsigned long) plaintext_raw + siop.alignmask) &
475 + (uint8_t *) (((unsigned long) plaintext_raw + siop.alignmask) &
478 - (char *) (((unsigned long) ciphertext_raw + siop.alignmask) &
479 + (uint8_t *) (((unsigned long) ciphertext_raw + siop.alignmask) &
482 memset(plaintext, 0x15, DATA_SIZE);
483 diff --git a/tests/cipher.c b/tests/cipher.c
484 index 07144f2..f3ca2f0 100644
493 #include <sys/ioctl.h>
494 #include <crypto/cryptodev.h>
495 @@ -21,10 +22,10 @@ static int debug = 0;
499 - char plaintext_raw[DATA_SIZE + 63], *plaintext;
500 - char ciphertext_raw[DATA_SIZE + 63], *ciphertext;
501 - char iv[BLOCK_SIZE];
502 - char key[KEY_SIZE];
503 + uint8_t plaintext_raw[DATA_SIZE + 63], *plaintext;
504 + uint8_t ciphertext_raw[DATA_SIZE + 63], *ciphertext;
505 + uint8_t iv[BLOCK_SIZE];
506 + uint8_t key[KEY_SIZE];
508 struct session_op sess;
510 @@ -57,8 +58,8 @@ test_crypto(int cfd)
511 printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n",
512 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
514 - plaintext = (char *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
515 - ciphertext = (char *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
516 + plaintext = (uint8_t *)(((unsigned long)plaintext_raw + siop.alignmask) & ~siop.alignmask);
517 + ciphertext = (uint8_t *)(((unsigned long)ciphertext_raw + siop.alignmask) & ~siop.alignmask);
519 plaintext = plaintext_raw;
520 ciphertext = ciphertext_raw;
521 @@ -143,15 +144,15 @@ test_crypto(int cfd)
523 static int test_aes(int cfd)
525 - char plaintext1_raw[BLOCK_SIZE + 63], *plaintext1;
526 - char ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 };
527 - char iv1[BLOCK_SIZE];
528 - char key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
529 - char plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 };
530 - char plaintext2_raw[BLOCK_SIZE + 63], *plaintext2;
531 - char ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 };
532 - char iv2[BLOCK_SIZE];
533 - char key2[KEY_SIZE];
534 + uint8_t plaintext1_raw[BLOCK_SIZE + 63], *plaintext1;
535 + uint8_t ciphertext1[BLOCK_SIZE] = { 0xdf, 0x55, 0x6a, 0x33, 0x43, 0x8d, 0xb8, 0x7b, 0xc4, 0x1b, 0x17, 0x52, 0xc5, 0x5e, 0x5e, 0x49 };
536 + uint8_t iv1[BLOCK_SIZE];
537 + uint8_t key1[KEY_SIZE] = { 0xff, 0xff, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
538 + uint8_t plaintext2_data[BLOCK_SIZE] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0x00 };
539 + uint8_t plaintext2_raw[BLOCK_SIZE + 63], *plaintext2;
540 + uint8_t ciphertext2[BLOCK_SIZE] = { 0xb7, 0x97, 0x2b, 0x39, 0x41, 0xc4, 0x4b, 0x90, 0xaf, 0xa7, 0xb2, 0x64, 0xbf, 0xba, 0x73, 0x87 };
541 + uint8_t iv2[BLOCK_SIZE];
542 + uint8_t key2[KEY_SIZE];
544 struct session_op sess;
546 @@ -176,7 +177,7 @@ static int test_aes(int cfd)
547 perror("ioctl(CIOCGSESSINFO)");
550 - plaintext1 = (char *)(((unsigned long)plaintext1_raw + siop.alignmask) & ~siop.alignmask);
551 + plaintext1 = (uint8_t *)(((unsigned long)plaintext1_raw + siop.alignmask) & ~siop.alignmask);
553 plaintext1 = plaintext1_raw;
555 @@ -226,7 +227,7 @@ static int test_aes(int cfd)
556 printf("requested cipher CRYPTO_AES_CBC, got %s with driver %s\n",
557 siop.cipher_info.cra_name, siop.cipher_info.cra_driver_name);
559 - plaintext2 = (char *)(((unsigned long)plaintext2_raw + siop.alignmask) & ~siop.alignmask);
560 + plaintext2 = (uint8_t *)(((unsigned long)plaintext2_raw + siop.alignmask) & ~siop.alignmask);
562 plaintext2 = plaintext2_raw;
564 diff --git a/tests/cipher_comp.c b/tests/cipher_comp.c
565 index b2bc5af..03f67bf 100644
566 --- a/tests/cipher_comp.c
567 +++ b/tests/cipher_comp.c
570 test_crypto(int cfd, struct session_op *sess, int datalen)
572 - char *data, *encrypted;
573 - char *encrypted_comp;
574 + uint8_t *data, *encrypted;
575 + uint8_t *encrypted_comp;
577 - char iv_in[BLOCK_SIZE];
578 - char iv[BLOCK_SIZE];
579 - char iv_comp[BLOCK_SIZE];
580 + uint8_t iv_in[BLOCK_SIZE];
581 + uint8_t iv[BLOCK_SIZE];
582 + uint8_t iv_comp[BLOCK_SIZE];
584 struct crypt_op cryp;
586 @@ -90,7 +90,7 @@ main(int argc, char **argv)
589 struct session_op sess;
590 - unsigned char key[KEY_SIZE];
591 + uint8_t key[KEY_SIZE];
592 int datalen = BLOCK_SIZE;
593 int datalen_end = MAX_DATALEN;
595 diff --git a/tests/fullspeed.c b/tests/fullspeed.c
596 index 611859d..c025130 100644
597 --- a/tests/fullspeed.c
598 +++ b/tests/fullspeed.c
600 #include <sys/types.h>
605 #include <crypto/cryptodev.h>
607 @@ -74,7 +75,7 @@ static void value2human(int si, double bytes, double time, double* data, double*
608 int encrypt_data(int algo, void* keybuf, int key_size, int fdc, int chunksize)
611 - char *buffer, iv[32];
612 + uint8_t *buffer, iv[32];
614 struct timeval start, end;
616 diff --git a/tests/hash_comp.c b/tests/hash_comp.c
617 index 9e700a1..e6a4346 100644
618 --- a/tests/hash_comp.c
619 +++ b/tests/hash_comp.c
620 @@ -30,11 +30,9 @@ static void printhex(unsigned char *buf, int buflen)
622 test_crypto(int cfd, struct session_op *sess, int datalen)
624 - unsigned char *data;
626 - unsigned char mac[AALG_MAX_RESULT_LEN];
628 - unsigned char mac_comp[AALG_MAX_RESULT_LEN];
630 + uint8_t mac[AALG_MAX_RESULT_LEN];
631 + uint8_t mac_comp[AALG_MAX_RESULT_LEN];
633 struct crypt_op cryp;
635 diff --git a/tests/hmac.c b/tests/hmac.c
636 index 1d9349e..80a2c42 100644
639 @@ -69,7 +69,7 @@ test_crypto(int cfd)
642 cryp.len = sizeof("what do ya want for nothing?")-1;
643 - cryp.src = "what do ya want for nothing?";
644 + cryp.src = (uint8_t*)"what do ya want for nothing?";
646 cryp.op = COP_ENCRYPT;
647 if (ioctl(cfd, CIOCCRYPT, &cryp)) {
648 @@ -113,7 +113,7 @@ test_crypto(int cfd)
651 cryp.len = sizeof("what do ya want for nothing?")-1;
652 - cryp.src = "what do ya want for nothing?";
653 + cryp.src = (uint8_t*)"what do ya want for nothing?";
655 cryp.op = COP_ENCRYPT;
656 if (ioctl(cfd, CIOCCRYPT, &cryp)) {
657 @@ -246,7 +246,7 @@ test_extras(int cfd)
660 cryp.len = sizeof("what do")-1;
661 - cryp.src = "what do";
662 + cryp.src = (uint8_t*)"what do";
664 cryp.op = COP_ENCRYPT;
665 cryp.flags = COP_FLAG_UPDATE;
666 @@ -257,7 +257,7 @@ test_extras(int cfd)
669 cryp.len = sizeof(" ya want for nothing?")-1;
670 - cryp.src = " ya want for nothing?";
671 + cryp.src = (uint8_t*)" ya want for nothing?";
673 cryp.op = COP_ENCRYPT;
674 cryp.flags = COP_FLAG_FINAL;
675 diff --git a/tests/speed.c b/tests/speed.c
676 index d2e1aed..0e2bbc3 100644
680 #include <sys/types.h>
685 #include <crypto/cryptodev.h>
687 @@ -75,7 +76,7 @@ int encrypt_data(struct session_op *sess, int fdc, int chunksize, int alignmask)
690 char *buffer, iv[32];
691 - char mac[HASH_MAX_LEN];
692 + uint8_t mac[HASH_MAX_LEN];
694 struct timeval start, end;