crypto/rsa/rsa_ssl.c:87: error: INTEGER_OVERFLOW_L2
  ([0, max(0, `flen`)] - 1):unsigned32 by call to `constant_time_is_zero`.
Showing all 5 steps of the trace


crypto/rsa/rsa_ssl.c:61:1: Parameter `flen`
59.    * preserves error code reporting for backward compatibility.
60.    */
61. > int RSA_padding_check_SSLv23(unsigned char *to, int tlen,
62.                                const unsigned char *from, int flen, int num)
63.   {

crypto/rsa/rsa_ssl.c:87:17: Call
85.        */
86.       for (from += flen, em += num, i = 0; i < num; i++) {
87.           mask = ~constant_time_is_zero(flen);
                      ^
88.           flen -= 1 & mask;
89.           from -= 1 & mask;

include/internal/constant_time_locl.h:164:1: <LHS trace>
162.   }
163.   
164. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
165.   {
166.       return constant_time_msb(~a & (a - 1));

include/internal/constant_time_locl.h:164:1: Parameter `a`
  162.   }
  163.   
  164. > static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
  165.   {
  166.       return constant_time_msb(~a & (a - 1));

include/internal/constant_time_locl.h:166:12: Binary operation: ([0, max(0, flen)] - 1):unsigned32 by call to `constant_time_is_zero` 
  164.   static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
  165.   {
  166.       return constant_time_msb(~a & (a - 1));
                    ^
  167.   }
  168.   

static ossl_inline unsigned int constant_time_is_zero(unsigned int a)
{
    return constant_time_msb(~a & (a - 1));
}
['int RSA_padding_check_SSLv23(unsigned char *to, int tlen,\n                             const unsigned char *from, int flen, int num)\n{\n    int i;\n    unsigned char *em = NULL;\n    unsigned int good, found_zero_byte, mask, threes_in_row;\n    int zero_index = 0, msg_index, mlen = -1, err;\n    if (flen < 10) {\n        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, RSA_R_DATA_TOO_SMALL);\n        return -1;\n    }\n    em = OPENSSL_malloc(num);\n    if (em == NULL) {\n        RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, ERR_R_MALLOC_FAILURE);\n        return -1;\n    }\n    for (from += flen, em += num, i = 0; i < num; i++) {\n        mask = ~constant_time_is_zero(flen);\n        flen -= 1 & mask;\n        from -= 1 & mask;\n        *--em = *from & mask;\n    }\n    from = em;\n    good = constant_time_is_zero(from[0]);\n    good &= constant_time_eq(from[1], 2);\n    err = constant_time_select_int(good, 0, RSA_R_BLOCK_TYPE_IS_NOT_02);\n    mask = ~good;\n    found_zero_byte = 0;\n    threes_in_row = 0;\n    for (i = 2; i < num; i++) {\n        unsigned int equals0 = constant_time_is_zero(from[i]);\n        zero_index = constant_time_select_int(~found_zero_byte & equals0,\n                                              i, zero_index);\n        found_zero_byte |= equals0;\n        threes_in_row += 1 & ~found_zero_byte;\n        threes_in_row &= found_zero_byte | constant_time_eq(from[i], 3);\n    }\n    good &= constant_time_ge(zero_index, 2 + 8);\n    err = constant_time_select_int(mask | good, err,\n                                   RSA_R_NULL_BEFORE_BLOCK_MISSING);\n    mask = ~good;\n    good &= constant_time_lt(threes_in_row, 8);\n    err = constant_time_select_int(mask | good, err,\n                                   RSA_R_SSLV3_ROLLBACK_ATTACK);\n    mask = ~good;\n    msg_index = zero_index + 1;\n    mlen = num - msg_index;\n    good &= constant_time_ge(tlen, mlen);\n    err = constant_time_select_int(mask | good, err, RSA_R_DATA_TOO_LARGE);\n    tlen = constant_time_select_int(constant_time_lt(num, tlen), num, tlen);\n    msg_index = constant_time_select_int(good, msg_index, num - tlen);\n    mlen = num - msg_index;\n    for (from += msg_index, mask = good, i = 0; i < tlen; i++) {\n        unsigned int equals = constant_time_eq(i, mlen);\n        from -= tlen & equals;\n        mask &= mask ^ equals;\n        to[i] = constant_time_select_8(mask, from[i], to[i]);\n    }\n    OPENSSL_clear_free(em, num);\n    RSAerr(RSA_F_RSA_PADDING_CHECK_SSLV23, err);\n    err_clear_last_constant_time(1 & good);\n    return constant_time_select_int(good, mlen, -1);\n}', 'static ossl_inline unsigned int constant_time_is_zero(unsigned int a)\n{\n    return constant_time_msb(~a & (a - 1));\n}']