[openssl-users] CBC ciphers + TLS 1.0 protocol does not work in OpenSSL 1.0.2d

Benjamin Kaduk bkaduk at akamai.com
Thu Dec 10 17:04:18 UTC 2015


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. 
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mta.openssl.org/pipermail/openssl-users/attachments/20151210/2c27751b/attachment.html>


More information about the openssl-users mailing list