On 12/10/2015 05:55 AM, Jayalakshmi bhat wrote:
> Hi Matt,
>
> Thanks for the patch. Unfortunately patch did not work. I continued
> debugging and found that issue was in constant_time_msb.
>
> static inline unsigned int constant_time_msb(unsigned int a) {
> -    *return 0 - (a >> (sizeof(a) * 8 - 1));*
> + return (((unsigned)((int)(a) >> (sizeof(int) * 8 - 1))));

Hmm, right-shifting a negative value is implementation-defined behavior,
so I don't think that this construct would necessarily be portable to
all systems.  It's not clear to me what purpose the "0 - " was supposed
to perform in the original version, though.

In any case, it seems that the '8' literal there ought to be CHAR_BIT
(<limits.h>).  I am curious what value CHAR_BIT has in the environment
that Jaya is running in.

-Ben

> } 
>
> Changed constant_time_msb implementation as shown above. All the tests
> passed. I have attached the dis-assembly of the code for both
> successful case and failure case.  This was requested by Jakob. 
>

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

Reply via email to