From: Ken Raeburn Date: Fri, 10 Jun 2005 20:40:34 +0000 (+0000) Subject: * destest.c (main): Force testing of unaligned access to input, output, and key X-Git-Tag: ms-bug-test-20060525~236 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=d8314626758a50370954a3716ac9aaac45d3f1d6;p=krb5.git * destest.c (main): Force testing of unaligned access to input, output, and key blocks. git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17237 dc483132-0cff-0310-8789-dd5450dbe970 --- diff --git a/src/lib/crypto/des/ChangeLog b/src/lib/crypto/des/ChangeLog index df5a9d62d..3e1628a44 100644 --- a/src/lib/crypto/des/ChangeLog +++ b/src/lib/crypto/des/ChangeLog @@ -1,3 +1,8 @@ +2005-06-10 Ken Raeburn + + * destest.c (main): Force testing of unaligned access to input, + output, and key blocks. + 2005-06-09 Ken Raeburn * f_tables.h: Include k5-platform.h. diff --git a/src/lib/crypto/des/destest.c b/src/lib/crypto/des/destest.c index 0995b08bb..2582cc3d3 100644 --- a/src/lib/crypto/des/destest.c +++ b/src/lib/crypto/des/destest.c @@ -71,8 +71,17 @@ main(argc, argv) char *argv[]; { char block1[17], block2[17], block3[17]; - +#if 0 mit_des_cblock key, input, output, output2; +#else + /* Force tests of unaligned accesses. */ + union { unsigned char c[8*4+3]; long l; } u; + unsigned char *ioblocks = u.c; + unsigned char *input = ioblocks+1; + unsigned char *output = ioblocks+10; + unsigned char *output2 = ioblocks+19; + unsigned char *key = ioblocks+27; +#endif mit_des_key_schedule sched; int num = 0; int retval; @@ -89,7 +98,7 @@ main(argc, argv) fprintf(stderr, "des test: can't process key"); exit(1); } - mit_des_cbc_encrypt((const mit_des_cblock *) &input, &output2, 8, + mit_des_cbc_encrypt((const mit_des_cblock *) input, output2, 8, sched, zeroblock, 1); if (memcmp((char *)output2, (char *)output, 8)) { @@ -104,7 +113,7 @@ main(argc, argv) /* * Now try decrypting.... */ - mit_des_cbc_encrypt((const mit_des_cblock *) &output, &output2, 8, + mit_des_cbc_encrypt((const mit_des_cblock *) output, output2, 8, sched, zeroblock, 0); if (memcmp((char *)output2, (char *)input, 8)) {