CBC ciphers + TLS 1.0 protocol does not work in OpenSSL 1.0.2d

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Thu, Dec 10, 2015 at 04:55:29AM -0700, Jayalakshmi bhat wrote:

> 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))));
> }

The replacement is not right.  This function is supposed to return
0xfffffff for inputs with the high bit set, and 0x0000000 for inputs
with the high bit not set.  Could you try:

    static inline unsigned int constant_time_msb(unsigned int a) {
      return 0 - (a >> ((int)(sizeof(a) * 8 - 1)));
    }

Just in case the compiler is promoting "a" to the (larger?) size
of sizeof(a), which would cause an unsigned "a" to get a zero MSB,
while a signed "a" would be promoted "correctly".

--
	Viktor.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux