Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <51321599.5070705@gmail.com>
Date: Sat, 02 Mar 2013 12:07:05 -0300
From: Claudio André <claudioandre.br@...il.com>
To: john-dev@...ts.openwall.com
Subject: Re: sizeof(unsigned long)

Em 02-03-2013 07:53, magnum escreveu:
> On 1 Mar, 2013, at 13:50 , Claudio André <claudioandre.br@...il.com> wrote:
>
>> Em 01-03-2013 06:25, magnum escreveu:
>>> On 1 Mar, 2013, at 4:03 , Claudio André <claudioandre.br@...il.com>
>>>   wrote:
>>>
>>>
>>>> Em 28-02-2013 23:37, magnum escreveu:
>>>>
>>>>> Claudio,
>>>>>
>>>>> In both opencl_sha256.h and opencl_sha512.h, you define uint64_t like this:
>>>>>
>>>>> #define uint64_t unsigned long  //Tip: unsigned long long int failed on compile (AMD).
>>>>>
>>>>> Unsigned long will fail on most 32-bit builds and even some 64-bit ones, because it will be just 32-bits. If you need a workaround, this is not sufficient. OTOH if uint32_t is enough, you should obviously use that instead.
>>>>>
>>>>> Apparently some people are very fond of 32-bit builds so this must be fixed. Are you sure using long longs caused failures? Sounds weird to me.
>>>>>
>>>> Well (it should be C99 compliant):
>>>> Build log: "/tmp/OCLhwRn1e.cl", line 37: error: the type "long long" is nonstandard
>>>>
>>>> I care about it only inside OpenCL code. I will try to think about it further.
>>>>
>>>> Claudio
>>>>
>>>>
>>> Apparently long long is 128-bit in OpenCL, and long is always 64-bit. I did not know this, I just saw it in the reference. So on GPU side you should keep it as unsigned long but on CPU side it should better be ARCH_WORD_64 (or better, include "stdint.h" for a proper definition of uint64_t)
>>>
>>> magnum
>>>
>> I tried this:
>> https://github.com/claudioandre/JohnTheRipper/commit/94fdc15bf9f92140ee05252b82e2e5fb47e6c0df
> Where does the host side get its definition or typedef from with this patch applied? I see no inclusion of stdint.h. BTW I see that common-opencl.c use uint64_t but I can't find where it is defined or included.

To 'my host' code:
sha2.h has the inclusion (at the time I looked at it I had the felling i 
can trust the inclusion is there). Maybe i shouldn't.

common-opencl.c
=> #include <ctype.h> => #include <bits/types.h> => <types.h> have it.

I will create a new patch with the includes. Something like this:
https://github.com/claudioandre/JohnTheRipper/commit/f31c366380b61b90ef66aa4adb8b17fe29ea6118

Claudio

Powered by blists - more mailing lists

Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.