Use GET_HALF_BLOCK to fetch new values instead of open-coding
authorKen Raeburn <raeburn@mit.edu>
Sat, 2 Aug 2008 06:34:51 +0000 (06:34 +0000)
committerKen Raeburn <raeburn@mit.edu>
Sat, 2 Aug 2008 06:34:51 +0000 (06:34 +0000)
git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20598 dc483132-0cff-0310-8789-dd5450dbe970

src/lib/crypto/des/d3_cbc.c
src/lib/crypto/des/f_cksum.c

index 37c32c76f937787317f61cb3a6de43fb08c5a5d4..077e78d2c0f184dfdc2201e0e90b7068d2c990c1 100644 (file)
@@ -84,14 +84,11 @@ krb5int_des3_cbc_encrypt(const mit_des_cblock *in,
         * forward.  Otherwise we have to fart around.
         */
        if (length >= 8) {
-           left  ^= ((*ip++) & FF_UINT32) << 24;
-           left  ^= ((*ip++) & FF_UINT32) << 16;
-           left  ^= ((*ip++) & FF_UINT32) <<  8;
-           left  ^=  (*ip++) & FF_UINT32;
-           right ^= ((*ip++) & FF_UINT32) << 24;
-           right ^= ((*ip++) & FF_UINT32) << 16;
-           right ^= ((*ip++) & FF_UINT32) <<  8;
-           right ^=  (*ip++) & FF_UINT32;
+           unsigned DES_INT32 temp;
+           GET_HALF_BLOCK(temp, ip);
+           left  ^= temp;
+           GET_HALF_BLOCK(temp, ip);
+           right ^= temp;
            length -= 8;
        } else {
            /*
index 1b9e9a02b51c11fbad883874957ff39921fa8ac0..a11e3403cda919b55968d4785ec17a3502ecdcd1 100644 (file)
@@ -60,14 +60,11 @@ mit_des_cbc_cksum(const krb5_octet *in, krb5_octet *out,
                 * forward.  Otherwise we have to fart around.
                 */
                if (len >= 8) {
-                       left  ^= ((*ip++) & FF_UINT32) << 24;
-                       left  ^= ((*ip++) & FF_UINT32) << 16;
-                       left  ^= ((*ip++) & FF_UINT32) <<  8;
-                       left  ^=  (*ip++) & FF_UINT32;
-                       right ^= ((*ip++) & FF_UINT32) << 24;
-                       right ^= ((*ip++) & FF_UINT32) << 16;
-                       right ^= ((*ip++) & FF_UINT32) <<  8;
-                       right ^=  (*ip++) & FF_UINT32;
+                       unsigned DES_INT32 temp;
+                       GET_HALF_BLOCK(temp, ip);
+                       left  ^= temp;
+                       GET_HALF_BLOCK(temp, ip);
+                       right ^= temp;
                        len -= 8;
                } else {
                        /*