OLD | NEW |
1 /* test/igetest.c -*- mode:C; c-file-style: "eay" -*- */ | 1 /* test/igetest.c -*- mode:C; c-file-style: "eay" -*- */ |
2 /* ==================================================================== | 2 /* ==================================================================== |
3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. | 3 * Copyright (c) 2006 The OpenSSL Project. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * | 8 * |
9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
(...skipping 203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
214 printf("IGE test vector %d failed\n", n); | 214 printf("IGE test vector %d failed\n", n); |
215 hexdump(stdout, "key", v->key, sizeof v->key); | 215 hexdump(stdout, "key", v->key, sizeof v->key); |
216 hexdump(stdout, "iv", v->iv, sizeof v->iv); | 216 hexdump(stdout, "iv", v->iv, sizeof v->iv); |
217 hexdump(stdout, "in", v->in, v->length); | 217 hexdump(stdout, "in", v->in, v->length); |
218 hexdump(stdout, "expected", v->out, v->length); | 218 hexdump(stdout, "expected", v->out, v->length); |
219 hexdump(stdout, "got", buf, v->length); | 219 hexdump(stdout, "got", buf, v->length); |
220 | 220 |
221 ++errs; | 221 ++errs; |
222 } | 222 } |
223 | 223 |
224 » » /* try with in == out */ | 224 /* try with in == out */ |
225 memcpy(iv, v->iv, sizeof iv); | 225 memcpy(iv, v->iv, sizeof iv); |
226 » » memcpy(buf, v->in, v->length); | 226 memcpy(buf, v->in, v->length); |
227 AES_ige_encrypt(buf, buf, v->length, &key, iv, v->encrypt); | 227 AES_ige_encrypt(buf, buf, v->length, &key, iv, v->encrypt); |
228 | 228 |
229 if(memcmp(v->out, buf, v->length)) | 229 if(memcmp(v->out, buf, v->length)) |
230 { | 230 { |
231 printf("IGE test vector %d failed (with in == out)\n", n
); | 231 printf("IGE test vector %d failed (with in == out)\n", n
); |
232 hexdump(stdout, "key", v->key, sizeof v->key); | 232 hexdump(stdout, "key", v->key, sizeof v->key); |
233 hexdump(stdout, "iv", v->iv, sizeof v->iv); | 233 hexdump(stdout, "iv", v->iv, sizeof v->iv); |
234 hexdump(stdout, "in", v->in, v->length); | 234 hexdump(stdout, "in", v->in, v->length); |
235 hexdump(stdout, "expected", v->out, v->length); | 235 hexdump(stdout, "expected", v->out, v->length); |
236 hexdump(stdout, "got", buf, v->length); | 236 hexdump(stdout, "got", buf, v->length); |
(...skipping 257 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
494 if(matches > sizeof checktext/100) | 494 if(matches > sizeof checktext/100) |
495 { | 495 { |
496 printf("More than 1%% matches after bidirectional garbling (3)\n
"); | 496 printf("More than 1%% matches after bidirectional garbling (3)\n
"); |
497 ++err; | 497 ++err; |
498 } | 498 } |
499 | 499 |
500 err += run_test_vectors(); | 500 err += run_test_vectors(); |
501 | 501 |
502 return err; | 502 return err; |
503 } | 503 } |
OLD | NEW |