* destest.c (main): Force testing of unaligned access to input, output, and key
authorKen Raeburn <raeburn@mit.edu>
Fri, 10 Jun 2005 20:40:34 +0000 (20:40 +0000)
committerKen Raeburn <raeburn@mit.edu>
Fri, 10 Jun 2005 20:40:34 +0000 (20:40 +0000)
blocks.

git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@17237 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/des/ChangeLog
src/lib/crypto/des/destest.c

index df5a9d62d575d7a3bdf5b4f6a847627e4342858f..3e1628a446dba594d96893a8c88f29a637f360de 100644 (file)
@@ -1,3 +1,8 @@
+2005-06-10  Ken Raeburn  <raeburn@mit.edu>
+
+       * destest.c (main): Force testing of unaligned access to input,
+       output, and key blocks.
+
 2005-06-09  Ken Raeburn  <raeburn@mit.edu>
 
        * f_tables.h: Include k5-platform.h.
index 0995b08bb1ee1eb79395bb25c5f8affbf928e938..2582cc3d302ffb3c083100870460cca9179b4ced 100644 (file)
@@ -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)) {