From 63a1a5b27cc0ec321069cfa7b73715f059c98348 Mon Sep 17 00:00:00 2001 From: Horst Birthelmer Date: Wed, 13 Oct 2004 02:28:25 +0000 Subject: [PATCH] aix-des-cleanup-20041012 incrementing pointers behind casts apparently pisses of vac 6 --- src/des/des.c | 16 ++++++++++------ src/rxkad/domestic/fcrypt.c | 8 ++++---- 2 files changed, 14 insertions(+), 10 deletions(-) diff --git a/src/des/des.c b/src/des/des.c index d6d652244..ada021688 100644 --- a/src/des/des.c +++ b/src/des/des.c @@ -77,7 +77,8 @@ des_ecb_encrypt(void * clear, void * cipher, { /* better pass 8 bytes, length not checked here */ - register afs_uint32 R1 = 0, L1 = 0; /* R1 = r10, L1 = r9 */ + register afs_uint32 R1 = 0; + register afs_uint32 L1 = 0; /* R1 = r10, L1 = r9 */ register afs_uint32 R2 = 0, L2 = 0; /* R2 = r8, L2 = r7 */ afs_int32 i; /* one more registers left on VAX, see below P_temp_p */ @@ -129,15 +130,16 @@ des_ecb_encrypt(void * clear, void * cipher, } #endif if ((afs_int32) clear & 3) { - memcpy((char *)&L_save, (char *)clear++, sizeof(L_save)); - memcpy((char *)&R_save, (char *)clear, sizeof(R_save)); + clear=((char*)clear)+1; + memcpy((char *)(&L_save), (char *)clear, sizeof(L_save)); + memcpy((char *)(&R_save), (char *)clear, sizeof(R_save)); L1 = L_save; R1 = R_save; } else #endif { if (clear) - L1 = *((afs_int32 *)clear)++; + L1 = (*((afs_int32 *)clear))++; else L1 = 0; if (clear) @@ -441,12 +443,14 @@ des_ecb_encrypt(void * clear, void * cipher, if ((afs_int32) cipher & 3) { L_save = L2; /* cant bcopy a reg */ R_save = R2; - memcpy((char *)cipher++, (char *)&L_save, sizeof(L_save)); + cipher=((char*)cipher)+1; + memcpy((char *)cipher, (char *)&L_save, sizeof(L_save)); memcpy((char *)cipher, (char *)&R_save, sizeof(R_save)); } else #endif { - *((afs_int32 *)cipher)++ = L2; + (*((afs_int32 *)cipher))++; + *((afs_int32*)cipher)= L2; *((afs_int32 *)cipher) = R2; } diff --git a/src/rxkad/domestic/fcrypt.c b/src/rxkad/domestic/fcrypt.c index 0820e9350..b7c959ea6 100644 --- a/src/rxkad/domestic/fcrypt.c +++ b/src/rxkad/domestic/fcrypt.c @@ -215,7 +215,7 @@ fc_cbc_encrypt(void *input, void *output, afs_int32 length, for (i = 0; length > 0; i++, length -= 8) { /* get input */ memcpy(t_input, input, sizeof(t_input)); - (char *)input += sizeof(t_input); + input=((char *)input) + sizeof(t_input); /* zero pad */ for (j = length; j <= 7; j++) @@ -229,7 +229,7 @@ fc_cbc_encrypt(void *input, void *output, afs_int32 length, /* copy temp output and save it for cbc */ memcpy(output, t_output, sizeof(t_output)); - (char *)output += sizeof(t_output); + output=(char *)output + sizeof(t_output); /* calculate xor value for next round from plain & cipher text */ xor[0] = t_input[0] ^ t_output[0]; @@ -244,7 +244,7 @@ fc_cbc_encrypt(void *input, void *output, afs_int32 length, for (i = 0; length > 0; i++, length -= 8) { /* get input */ memcpy(t_input, input, sizeof(t_input)); - (char *)input += sizeof(t_input); + input=((char *)input) + sizeof(t_input); /* no padding for decrypt */ fc_ecb_encrypt(t_input, t_output, key, encrypt); @@ -255,7 +255,7 @@ fc_cbc_encrypt(void *input, void *output, afs_int32 length, /* copy temp output */ memcpy(output, t_output, sizeof(t_output)); - (char *)output += sizeof(t_output); + output=((char *)output) + sizeof(t_output); /* calculate xor value for next round from plain & cipher text */ xor[0] = t_input[0] ^ t_output[0]; -- 2.39.5