rename x86 macroes due to collisions on HPUX

git-svn: trunk@3141
remotes/push_mirror/metadata
aCaB 19 years ago
parent 7f49ea4b7e
commit adc98193b8
  1. 5
      ChangeLog
  2. 2
      libclamav/aspack.c
  3. 10
      libclamav/others.h
  4. 6
      libclamav/spin.c
  5. 2
      libclamav/unsp.c
  6. 2
      libclamav/upack.c
  7. 4
      libclamav/upx.c
  8. 8
      libclamav/yc.c

@ -1,3 +1,8 @@
Thu Jul 12 01:41:56 CEST 2007 (acab)
------------------------------------
* libclamav: rename x86 macroes due to collisions on HPUX
reported by njh
Wed Jul 11 10:20:53 BST 2007 (njh) Wed Jul 11 10:20:53 BST 2007 (njh)
---------------------------------- ----------------------------------
* libclamav: Fix warnings on HP-UX * libclamav: Fix warnings on HP-UX

@ -375,7 +375,7 @@ int unaspack212(uint8_t *image, unsigned int size, struct cli_exe_section *secti
wrkbuf = &image[block_rva+i+1]; wrkbuf = &image[block_rva+i+1];
if (*wrkbuf == image[ep+0x148]) { if (*wrkbuf == image[ep+0x148]) {
uint32_t target = cli_readint32(wrkbuf) & 0xffffff00; uint32_t target = cli_readint32(wrkbuf) & 0xffffff00;
ROL(target, 0x18); CLI_ROL(target, 0x18);
cli_writeint32(wrkbuf, target - i); cli_writeint32(wrkbuf, target - i);
i+=4; i+=4;
} }

@ -129,16 +129,16 @@ typedef struct {
#endif #endif
/* used by: spin, yc (C) aCaB */ /* used by: spin, yc (C) aCaB */
#define ROL(a,b) a = ( a << (b % (sizeof(a)<<3) )) | (a >> ( (sizeof(a)<<3) - (b % (sizeof(a)<<3 )) ) ) #define CLI_ROL(a,b) a = ( a << (b % (sizeof(a)<<3) )) | (a >> ( (sizeof(a)<<3) - (b % (sizeof(a)<<3 )) ) )
#define ROR(a,b) a = ( a >> (b % (sizeof(a)<<3) )) | (a << ( (sizeof(a)<<3) - (b % (sizeof(a)<<3 )) ) ) #define CLI_ROR(a,b) a = ( a >> (b % (sizeof(a)<<3) )) | (a << ( (sizeof(a)<<3) - (b % (sizeof(a)<<3 )) ) )
/* Implementation independent sign-extended signed right shift */ /* Implementation independent sign-extended signed right shift */
#ifdef HAVE_SAR #ifdef HAVE_SAR
#define SRS(n,s) ((n)>>(s)) #define CLI_SRS(n,s) ((n)>>(s))
#else #else
#define SRS(n,s) (((n)>>(s)) ^ (1<<(sizeof(n)*8-1-s)) - (1<<(sizeof(n)*8-1-s))) #define CLI_SRS(n,s) (((n)>>(s)) ^ (1<<(sizeof(n)*8-1-s)) - (1<<(sizeof(n)*8-1-s)))
#endif #endif
#define SAR(n,s) n = SRS(n,s) #define CLI_SAR(n,s) n = CLI_SRS(n,s)
#ifndef FALSE #ifndef FALSE
#define FALSE (0) #define FALSE (0)

@ -112,8 +112,8 @@ static char exec86(uint8_t aelle, uint8_t cielle, char *curremu, int *retval) {
case 0xc0: /* ror/rol al, ?? */ case 0xc0: /* ror/rol al, ?? */
support = curremu[len]; support = curremu[len];
len++; len++;
if ( support == 0xc0 ) ROL(aelle, curremu[len]); if ( support == 0xc0 ) CLI_ROL(aelle, curremu[len]);
else ROR(aelle, curremu[len]); else CLI_ROR(aelle, curremu[len]);
len++; len++;
break; break;
@ -144,7 +144,7 @@ static uint32_t summit (char *src, int size)
eax ^= ebx>>8 & 0xff; eax ^= ebx>>8 & 0xff;
eax += 0x7801a108; eax += 0x7801a108;
eax ^= ebx; eax ^= ebx;
ROR(eax, ebx&0xff); CLI_ROR(eax, ebx&0xff);
swap = eax; swap = eax;
eax = ebx; eax = ebx;
ebx = swap; ebx = swap;

@ -400,7 +400,7 @@ int getbit_from_table(uint16_t *intable, struct UNSP *read_struct) {
read_struct->bitmap = nval; read_struct->bitmap = nval;
nval = *intable; nval = *intable;
sval = 0x800 - nval; sval = 0x800 - nval;
sval = SRS((int32_t)sval,5); /* signed */ sval = CLI_SRS((int32_t)sval,5); /* signed */
sval += nval; sval += nval;
*intable=sval; *intable=sval;
if (read_struct->bitmap<0x1000000) { /* unsigned */ if (read_struct->bitmap<0x1000000) { /* unsigned */

@ -543,7 +543,7 @@ int unupack399(char *bs, uint32_t bl, uint32_t init_eax, char *init_ebx, uint32_
return -1; return -1;
/* cdq, loc_edx = (loc_eax&0x80000000)?0xffffffff:0; */ /* cdq, loc_edx = (loc_eax&0x80000000)?0xffffffff:0; */
loc_ecx = temp_ebp; loc_ecx = temp_ebp;
temp_ebp = SRS((int32_t)loc_eax, 31); /* thx, desp */ temp_ebp = CLI_SRS((int32_t)loc_eax, 31); /* thx, desp */
/* loc_483a00 */ /* loc_483a00 */
do { do {
temp_ebp += temp_ebp; temp_ebp += temp_ebp;

@ -394,7 +394,7 @@ int upx_inflate2d(char *src, uint32_t ssize, char *dst, uint32_t *dsize, uint32_
if (!backbytes) if (!backbytes)
break; break;
backsize = backbytes & 1; backsize = backbytes & 1;
SAR(backbytes,1); CLI_SAR(backbytes,1);
unp_offset = backbytes; unp_offset = backbytes;
} else { } else {
if ( (backsize = (uint32_t)doubleebx(src, &myebx, &scur, ssize)) == 0xffffffff ) if ( (backsize = (uint32_t)doubleebx(src, &myebx, &scur, ssize)) == 0xffffffff )
@ -474,7 +474,7 @@ int upx_inflate2e(char *src, uint32_t ssize, char *dst, uint32_t *dsize, uint32_
if (!backbytes) if (!backbytes)
break; break;
backsize = backbytes & 1; /* Using backsize to carry on the shifted out bit (UPX uses CF) */ backsize = backbytes & 1; /* Using backsize to carry on the shifted out bit (UPX uses CF) */
SAR(backbytes,1); CLI_SAR(backbytes,1);
unp_offset = backbytes; unp_offset = backbytes;
} else { } else {
if ( (backsize = (uint32_t)doubleebx(src, &myebx, &scur, ssize)) == 0xffffffff ) if ( (backsize = (uint32_t)doubleebx(src, &myebx, &scur, ssize)) == 0xffffffff )

@ -120,12 +120,12 @@ static int yc_poly_emulator(char* decryptor_offset, char* code, unsigned int ecx
if(decryptor_offset[j]=='\xC0') /* ROL AL,num */ if(decryptor_offset[j]=='\xC0') /* ROL AL,num */
{ {
j++; j++;
ROL(al,decryptor_offset[j]); CLI_ROL(al,decryptor_offset[j]);
} }
else /* ROR AL,num */ else /* ROR AL,num */
{ {
j++; j++;
ROR(al,decryptor_offset[j]); CLI_ROR(al,decryptor_offset[j]);
} }
break; break;
@ -134,12 +134,12 @@ static int yc_poly_emulator(char* decryptor_offset, char* code, unsigned int ecx
if(decryptor_offset[j]=='\xC8') /* ROR AL,CL */ if(decryptor_offset[j]=='\xC8') /* ROR AL,CL */
{ {
j++; j++;
ROR(al,cl); CLI_ROR(al,cl);
} }
else /* ROL AL,CL */ else /* ROL AL,CL */
{ {
j++; j++;
ROL(al,cl); CLI_ROL(al,cl);
} }
break; break;

Loading…
Cancel
Save