From fef45697544a3855a989a321b621612aa4651f20 Mon Sep 17 00:00:00 2001 From: Ken Raeburn Date: Sat, 2 Aug 2008 06:34:51 +0000 Subject: [PATCH] Use GET_HALF_BLOCK to fetch new values instead of open-coding git-svn-id: svn://anonsvn.mit.edu/krb5/trunk@20598 dc483132-0cff-0310-8789-dd5450dbe970 --- src/lib/crypto/des/d3_cbc.c | 13 +++++-------- src/lib/crypto/des/f_cksum.c | 13 +++++-------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/src/lib/crypto/des/d3_cbc.c b/src/lib/crypto/des/d3_cbc.c index 37c32c76f..077e78d2c 100644 --- a/src/lib/crypto/des/d3_cbc.c +++ b/src/lib/crypto/des/d3_cbc.c @@ -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 { /* diff --git a/src/lib/crypto/des/f_cksum.c b/src/lib/crypto/des/f_cksum.c index 1b9e9a02b..a11e3403c 100644 --- a/src/lib/crypto/des/f_cksum.c +++ b/src/lib/crypto/des/f_cksum.c @@ -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 { /* -- 2.26.2