* f_tables.h (DES_DO_ENCRYPT, DES_DO_DECRYPT): Allocate temporary variable
authorKen Raeburn <raeburn@mit.edu>
Tue, 17 Feb 2004 23:53:44 +0000 (23:53 +0000)
committerKen Raeburn <raeburn@mit.edu>
Tue, 17 Feb 2004 23:53:44 +0000 (23:53 +0000)
locally instead of taking the extra argument.
* d3_cbc.c (krb5int_des3_cbc_encrypt): Don't pass the extra argument, and
delete the automatic variable.
(krb5int_des3_cbc_decrypt): Likewise.
* f_cbc.c (krb5int_des_cbc_encrypt, krb5int_des_cbc_decrypt): Likewise.
* f_cksum.c (mit_des_cbc_cksum): Likewise.

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

src/lib/crypto/des/ChangeLog
src/lib/crypto/des/d3_cbc.c
src/lib/crypto/des/f_cbc.c
src/lib/crypto/des/f_cksum.c
src/lib/crypto/des/f_tables.h

index ae28fa253c86ca0ea824ef8ba75b87647e27f137..0e469642d540421edf5faa426fbd672b4b6cf921 100644 (file)
@@ -1,5 +1,14 @@
 2004-02-17  Ken Raeburn  <raeburn@mit.edu>
 
+       * f_tables.h (DES_DO_ENCRYPT, DES_DO_DECRYPT): Allocate temporary
+       variable locally instead of taking the extra argument.
+       * d3_cbc.c (krb5int_des3_cbc_encrypt): Don't pass the extra
+       argument, and delete the automatic variable.
+       (krb5int_des3_cbc_decrypt): Likewise.
+       * f_cbc.c (krb5int_des_cbc_encrypt, krb5int_des_cbc_decrypt):
+       Likewise.
+       * f_cksum.c (mit_des_cbc_cksum): Likewise.
+
        * afsstring2key.c (krb5_afs_encrypt): Drop EDFLAG as an argument,
        make it local instead, since we always pass 0.
        (afs_crypt): Call changed.
index abef25737b47c0abfe93da390856858e78aadf1f..c49c6eafbd9551138355ac493669e77fc9f0f1c7 100644 (file)
@@ -54,7 +54,6 @@ krb5int_des3_cbc_encrypt(const mit_des_cblock *in,
                         const mit_des_cblock ivec)
 {
     register unsigned DES_INT32 left, right;
-    register unsigned DES_INT32 temp;
     const unsigned DES_INT32 *kp1, *kp2, *kp3;
     const unsigned char *ip;
     unsigned char *op;
@@ -119,9 +118,9 @@ krb5int_des3_cbc_encrypt(const mit_des_cblock *in,
        /*
         * Encrypt what we have
         */
-       DES_DO_ENCRYPT(left, right, temp, kp1);
-       DES_DO_DECRYPT(left, right, temp, kp2);
-       DES_DO_ENCRYPT(left, right, temp, kp3);
+       DES_DO_ENCRYPT(left, right, kp1);
+       DES_DO_DECRYPT(left, right, kp2);
+       DES_DO_ENCRYPT(left, right, kp3);
 
        /*
         * Copy the results out
@@ -141,7 +140,6 @@ krb5int_des3_cbc_decrypt(const mit_des_cblock *in,
                         const mit_des_cblock ivec)
 {
     register unsigned DES_INT32 left, right;
-    register unsigned DES_INT32 temp;
     const unsigned DES_INT32 *kp1, *kp2, *kp3;
     const unsigned char *ip;
     unsigned char *op;
@@ -189,9 +187,9 @@ krb5int_des3_cbc_decrypt(const mit_des_cblock *in,
        /*
         * Decrypt this.
         */
-       DES_DO_DECRYPT(left, right, temp, kp3);
-       DES_DO_ENCRYPT(left, right, temp, kp2);
-       DES_DO_DECRYPT(left, right, temp, kp1);
+       DES_DO_DECRYPT(left, right, kp3);
+       DES_DO_ENCRYPT(left, right, kp2);
+       DES_DO_DECRYPT(left, right, kp1);
 
        /*
         * Xor with the old cipher to get plain
index dea27e70211f1cd481164627ea281a8e20362994..aa15fefed47c56056fa192402e0c29b3df7d5682 100644 (file)
@@ -66,7 +66,6 @@ krb5int_des_cbc_encrypt(const mit_des_cblock *in,
                        const mit_des_cblock ivec)
 {
        register unsigned DES_INT32 left, right;
-       register unsigned DES_INT32 temp;
        const unsigned DES_INT32 *kp;
        const unsigned char *ip;
        unsigned char *op;
@@ -136,7 +135,7 @@ krb5int_des_cbc_encrypt(const mit_des_cblock *in,
                /*
                 * Encrypt what we have
                 */
-               DES_DO_ENCRYPT(left, right, temp, kp);
+               DES_DO_ENCRYPT(left, right, kp);
 
                /*
                 * Copy the results out
@@ -154,7 +153,6 @@ krb5int_des_cbc_decrypt(const mit_des_cblock *in,
                        const mit_des_cblock ivec)
 {
        register unsigned DES_INT32 left, right;
-       register unsigned DES_INT32 temp;
        const unsigned DES_INT32 *kp;
        const unsigned char *ip;
        unsigned char *op;
@@ -200,7 +198,7 @@ krb5int_des_cbc_decrypt(const mit_des_cblock *in,
                /*
                 * Decrypt this.
                 */
-               DES_DO_DECRYPT(left, right, temp, kp);
+               DES_DO_DECRYPT(left, right, kp);
 
                /*
                 * Xor with the old cipher to get plain
index 8c80751deea32dd484786049ec716bf50c1db6a0..781a1f4fa15ba719f4703330de746c8bdfd47e7b 100644 (file)
@@ -37,7 +37,6 @@ mit_des_cbc_cksum(in, out, length, schedule, ivec)
        const krb5_octet *ivec;
 {
        register unsigned DES_INT32 left, right;
-       register unsigned DES_INT32 temp;
        const unsigned DES_INT32 *kp;
        const unsigned char *ip;
        unsigned char *op;
@@ -104,7 +103,7 @@ mit_des_cbc_cksum(in, out, length, schedule, ivec)
                 * Encrypt what we have
                 */
                kp = (const unsigned DES_INT32 *)schedule;
-               DES_DO_ENCRYPT(left, right, temp, kp);
+               DES_DO_ENCRYPT(left, right, kp);
        }
 
        /*
index a8b477d4d469ebc751c708b7cd06467a2db6ecda..5d49fc6d96dc8a04c17cb34750249593a5bf5756 100644 (file)
@@ -200,33 +200,35 @@ extern const unsigned DES_INT32 des_SP_table[8][64];
  * at each stage of the encryption, so that by comparing the output to
  * a known good machine, the location of the first error can be found.
  */
-#define        DES_DO_ENCRYPT(left, right, temp, kp) \
+#define        DES_DO_ENCRYPT(left, right, kp) \
        do { \
                register int i; \
+               register unsigned DES_INT32 temp1; \
                DEB (("do_encrypt %8lX %8lX \n", left, right)); \
-               DES_INITIAL_PERM((left), (right), (temp)); \
+               DES_INITIAL_PERM((left), (right), (temp1)); \
                DEB (("  after IP %8lX %8lX\n", left, right)); \
                for (i = 0; i < 8; i++) { \
-                       DES_SP_ENCRYPT_ROUND((left), (right), (temp), (kp)); \
+                       DES_SP_ENCRYPT_ROUND((left), (right), (temp1), (kp)); \
                        DEB (("  round %2d %8lX %8lX \n", i*2, left, right)); \
-                       DES_SP_ENCRYPT_ROUND((right), (left), (temp), (kp)); \
+                       DES_SP_ENCRYPT_ROUND((right), (left), (temp1), (kp)); \
                        DEB (("  round %2d %8lX %8lX \n", 1+i*2, left, right)); \
                } \
-               DES_FINAL_PERM((left), (right), (temp)); \
+               DES_FINAL_PERM((left), (right), (temp1)); \
                (kp) -= (2 * 16); \
                DEB (("  after FP %8lX %8lX \n", left, right)); \
        } while (0)
 
-#define        DES_DO_DECRYPT(left, right, temp, kp) \
+#define        DES_DO_DECRYPT(left, right, kp) \
        do { \
                register int i; \
-               DES_INITIAL_PERM((left), (right), (temp)); \
+               register unsigned DES_INT32 temp2; \
+               DES_INITIAL_PERM((left), (right), (temp2)); \
                (kp) += (2 * 16); \
                for (i = 0; i < 8; i++) { \
-                       DES_SP_DECRYPT_ROUND((left), (right), (temp), (kp)); \
-                       DES_SP_DECRYPT_ROUND((right), (left), (temp), (kp)); \
+                       DES_SP_DECRYPT_ROUND((left), (right), (temp2), (kp)); \
+                       DES_SP_DECRYPT_ROUND((right), (left), (temp2), (kp)); \
                } \
-               DES_FINAL_PERM((left), (right), (temp)); \
+               DES_FINAL_PERM((left), (right), (temp2)); \
        } while (0)
 
 /*