On Tue, Sep 24, 2013 at 2:05 AM, Tsutomu Oyamada <[email protected]>wrote:

> Hi,
>
> I investigated the value using the following programs.
>
> ----
> #include "stdlib.h"
> #include "bignum_fast.h"
>
> int main(int argc, char **argv) {
>
>         printf("fp_digit: %d\n",sizeof(fp_digit));
>         printf("unsigned long: %d\n",sizeof(unsigned long));
>
> #ifdef FP_64BIT
>         printf("FP_64BIT: %d\n",FP_64BIT);
> #else
>         printf("FP_64BIT not defined\n");
> #endif
>
> #ifdef DIGIT_BIT
>         printf("DIGIT_BIT: %d\n",DIGIT_BIT);
> #else
>         printf("DIGIT_BIT not defined\n");
> #endif
>
> #ifdef CHAR_BIT
>         printf("CHAR_BIT: %d\n",CHAR_BIT);
> #else
>         printf("CHAR_BIT not defined\n");
> #endif
>
> #ifdef FP_MAX_SIZE
>         printf("FP_MAX_SIZE: %d\n",FP_MAX_SIZE);
> #else
>         printf("FP_MAX_SIZE not defined\n");
> #endif
>
> #ifdef FP_SIZE
>         printf("FP_SIZE: %d\n",FP_SIZE);
> #else
>         printf("FP_SIZE not defined\n");
> #endif
>
> #ifdef TFM_ASM
>         printf("TFM_ASM: defined\n");
> #else
>         printf("TFM_ASM not defined\n");
> #endif
>
>         exit(0);
> }
> ----
>
> The result was as follows.
>
> fp_digit: 8
> unsigned long: 8
> FP_64BIT not defined
> DIGIT_BIT: 64
> CHAR_BIT: 8
> FP_MAX_SIZE: 8704
> FP_SIZE: 136
> TFM_ASM not defined
>
> Can you find a problem by this result?
>
> Thanks.
>
> --
> T.Oyamada
>
> _______________________________________________
> http://lurker.clamav.net/list/clamav-devel.html
> Please submit your patches to our Bugzilla: http://bugs.clamav.net
>

I do not have an immediate fix, but that information does give me some
leads.

Basic issue: the tomsfastmath code must be falling through to the code
block on lines 280-302 of fp_mul_comba.c.
1) The right shift causing the warning is DIGIT_BIT (64).
2) The datatype being shifted is fp_word.
3) fp_word defined as "typedef ulong64 fp_word;" from bignum_fast.h line 253
4) ulong64 defined as "typedef unsigned long long ulong64;" from
bignum_fast.h line 248

I think the problem is one of three issues:
A) fp_word is not defined as a 64-bit datatype.
B) line 301 of tomsfastmath/mul/fp_mul_comba.c is mistakenly downcasting t
from fp_word to fp_digit before shifting.
C) s390 is not allowing use of all 64 bits of fp_word.

Problems A or B are easier fixed than C.

Please add these lines to your test and re-run:

printf("fp_word: %d\n",sizeof(fp_word));
printf("ulong64: %d\n",sizeof(ulong64));
printf("unsigned long long: %d\n",sizeof(unsigned long long));
#ifdef CRYPT
        printf("CRYPT: defined\n");
#else
        printf("CRYPT not defined\n");
#endif

I would like to see the config.log file generated by running configure. It
would also be useful to have the full output from running make. The log
snip shows line 91, but I expect that it first warned about line 15.

The easiest way to continue and share logfiles is via Bugzilla. Please open
a bug report on bugzilla.clamav.net on this issue. You can then attach the
files to that bug.

Hope this helps,

Dave R.

-- 
---
Dave Raynor
Sourcefire Vulnerability Research Team
[email protected]
_______________________________________________
http://lurker.clamav.net/list/clamav-devel.html
Please submit your patches to our Bugzilla: http://bugs.clamav.net

Reply via email to