NMAKE fatal error, 32-bit time_t

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

NMAKE fatal error, 32-bit time_t

Thomas J. Hruska
         cl  /Z7 /Fdapp.pdb /Gs0 /GF /Gy /MD /W3 /wd4090 /nologo /O2 /WX
/I "include" -D"OPENSSL_SYS_WIN32" -D"WIN32_LEAN_AND_MEAN" -D"UNICODE"
-D"_UNICODE" -D"_CRT_SECURE_NO_DEPRECATE"
-D"_WINSOCK_DEPRECATED_NO_WARNINGS" -D"OPENSSL_USE_APPLINK" -D"NDEBUG"
-D_USE_32BIT_TIME_T -D_USING_V110_SDK71_
-D_WINSOCK_DEPRECATED_NO_WARNINGS /Zs /showIncludes "test\ct_test.c"
2>&1 > test\ct_test.d
NMAKE : fatal error U1077: 'cl' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual
Studio\2017\Community\VC\Tools\MSVC\14.15.26726\bin\HostX86\x86\nmake.exe"'
: return code '0x2'
Stop.

test\ct_test.c(503): error C2220: warning treated as error - no 'object'
file generated
test\ct_test.c(503): warning C4244: 'initializing': conversion from
'uint64_t' to 'const time_t', possible loss of data


Probably triggered by the usage of:

-D_USE_32BIT_TIME_T


I use that define for 32-bit builds on my 64-bit hardware as per this
old post:

https://groups.google.com/forum/#!topic/mailing.openssl.users/AGuOi4yEY9A


Casting to time_t appears to correct the issue and the build completes
successfully:

     const time_t default_time =
(time_t)CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
                                 1000;


--
Thomas Hruska
Shining Light Productions

Home of BMP2AVI and Win32 OpenSSL.
http://www.slproweb.com/
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: NMAKE fatal error, 32-bit time_t

Viktor Dukhovni


> On Sep 12, 2018, at 9:53 AM, Thomas J. Hruska <[hidden email]> wrote:
>
> Casting to time_t appears to correct the issue and the build completes successfully:
>
>    const time_t default_time = (time_t)CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
>                                1000;

Since the CT time value is in "ms" since epoch, you really don't want
to down-convert that to 32 bit *before* the division.  You'll need
some parentheses:

  https://en.cppreference.com/w/c/language/operator_precedence

type cast has higher precedence than division, but you need to
divide first, then cast.

--
        Viktor.

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: NMAKE fatal error, 32-bit time_t

Thomas J. Hruska
On 9/12/2018 7:03 AM, Viktor Dukhovni wrote:

>
>
>> On Sep 12, 2018, at 9:53 AM, Thomas J. Hruska <[hidden email]> wrote:
>>
>> Casting to time_t appears to correct the issue and the build completes successfully:
>>
>>     const time_t default_time = (time_t)CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
>>                                 1000;
>
> Since the CT time value is in "ms" since epoch, you really don't want
> to down-convert that to 32 bit *before* the division.  You'll need
> some parentheses:
>
>    https://en.cppreference.com/w/c/language/operator_precedence
>
> type cast has higher precedence than division, but you need to
> divide first, then cast.

Whoops.  Well, being pointed at the "intro to C" documentation is what I
get for rushing that.  It's a bit ironic since I'm notorious for
wrapping everything in extra parenthesis just to avoid memorizing
operator precedence.

Thanks for pointing that out though.

--
Thomas Hruska
Shining Light Productions

Home of BMP2AVI and Win32 OpenSSL.
http://www.slproweb.com/
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: NMAKE fatal error, 32-bit time_t

Matt Caswell-2


On 12/09/18 16:23, Thomas J. Hruska wrote:

> On 9/12/2018 7:03 AM, Viktor Dukhovni wrote:
>>
>>
>>> On Sep 12, 2018, at 9:53 AM, Thomas J. Hruska
>>> <[hidden email]> wrote:
>>>
>>> Casting to time_t appears to correct the issue and the build
>>> completes successfully:
>>>
>>>     const time_t default_time =
>>> (time_t)CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
>>>                                 1000;
>>
>> Since the CT time value is in "ms" since epoch, you really don't want
>> to down-convert that to 32 bit *before* the division.  You'll need
>> some parentheses:
>>
>>    https://en.cppreference.com/w/c/language/operator_precedence
>>
>> type cast has higher precedence than division, but you need to
>> divide first, then cast.
>
> Whoops.  Well, being pointed at the "intro to C" documentation is what I
> get for rushing that.  It's a bit ironic since I'm notorious for
> wrapping everything in extra parenthesis just to avoid memorizing
> operator precedence.
>
> Thanks for pointing that out though.
>

Is this new to 1.1.1? Or does it also impact 1.1.0?

Matt
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: NMAKE fatal error, 32-bit time_t

Richard Levitte - VMS Whacker-2
In message <[hidden email]> on Wed, 12 Sep 2018 16:24:03 +0100, Matt Caswell <[hidden email]> said:

>
>
> On 12/09/18 16:23, Thomas J. Hruska wrote:
> > On 9/12/2018 7:03 AM, Viktor Dukhovni wrote:
> >>
> >>
> >>> On Sep 12, 2018, at 9:53 AM, Thomas J. Hruska
> >>> <[hidden email]> wrote:
> >>>
> >>> Casting to time_t appears to correct the issue and the build
> >>> completes successfully:
> >>>
> >>>     const time_t default_time =
> >>> (time_t)CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
> >>>                                 1000;
> >>
> >> Since the CT time value is in "ms" since epoch, you really don't want
> >> to down-convert that to 32 bit *before* the division.  You'll need
> >> some parentheses:
> >>
> >>    https://en.cppreference.com/w/c/language/operator_precedence
> >>
> >> type cast has higher precedence than division, but you need to
> >> divide first, then cast.
> >
> > Whoops.  Well, being pointed at the "intro to C" documentation is what I
> > get for rushing that.  It's a bit ironic since I'm notorious for
> > wrapping everything in extra parenthesis just to avoid memorizing
> > operator precedence.
> >
> > Thanks for pointing that out though.
> >
>
> Is this new to 1.1.1? Or does it also impact 1.1.0?

The same problematic code line exists in 1.1.0 (line 545).  I cannot
say why we haven't been hit by this before...

--
Richard Levitte         [hidden email]
OpenSSL Project         http://www.openssl.org/~levitte/
--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users
Reply | Threaded
Open this post in threaded view
|

Re: NMAKE fatal error, 32-bit time_t

Viktor Dukhovni
In reply to this post by Matt Caswell-2


> On Sep 12, 2018, at 11:24 AM, Matt Caswell <[hidden email]> wrote:
>
>
> Is this new to 1.1.1? Or does it also impact 1.1.0?

Seems to affect 1.1.0 also:

$ git grep -A1 CT_POLICY_EVAL_CTX_get_time OpenSSL_1_1_0-stable -- test
OpenSSL_1_1_0-stable:test/ct_test.c:    const time_t default_time = CT_POLICY_EVAL_CTX_get_time(ct_policy_ctx) /
OpenSSL_1_1_0-stable:test/ct_test.c-            1000;

--
        Viktor.

--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users