<div dir="ltr"><p class="MsoNormal">Hi All,</p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Thanks for all the responses. As mentioned by Matt in the discussion
thread,constant_time_msb performs the copy the msb of the input to
all of the other bits so the return value should either be one of 0x00000000
or  0xffffffff.</p><p class="MsoNormal"></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I found another interesting thing,constant_time_msb worked
as it is without any changes, after I added a printf in
constant_time_is_zero_8 test routine to print the return value. I added the printf
just before comparing the return value with the expected value.</p><p class="MsoNormal"></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I have confirmed the failures by removing the printf and
printing any thing else other than the returned value.</p><p class="MsoNormal"></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">Now based on the discussions here and print results I am
thinking, after constant_time_msb operation probably overflow bit is set in case of 0xffffffff.
And it is not cleared before comparing, hence compare fails. When I add a
printf to print the return value probably overflow flag got cleared and
things worked.</p><p class="MsoNormal"></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I am planning to attach the debugger to check the flags. I
will get back with debugger results.</p><p class="MsoNormal"></p>

<p class="MsoNormal"> </p>

<p class="MsoNormal">I have attached the test file.</p>

<p class="MsoNormal"> </p><p class="MsoNormal">Regards</p><p class="MsoNormal">Jaya</p>

<p class="MsoNormal"> </p></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Dec 11, 2015 at 11:30 AM, Jeffrey Walton <span dir="ltr"><<a href="mailto:noloader@gmail.com" target="_blank">noloader@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">> 3. The compiler wasn't written by a fanatic who put<br>
>   the "right shift of negative signed values is<br>
>   undefined" rule above common sense.<br>
><br>
> This is only implementation-defined behavior, not undefined behavior.  It is<br>
> not permitted to crash the system or launch the missiles.  (n1256.pdf 6.5.7<br>
> paragraph 5.)<br>
<br>
</span>The potential problem with implementation defined is its not<br>
guaranteed to produce consistent results. Different compilers or<br>
different versions of the same compiler may arrive at different<br>
results.<br>
<br>
In this light, the crash might be welcomed to make it easy to find the<br>
trouble spot :)<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailman/listinfo/openssl-users</a><br>
</div></div></blockquote></div><br></div>