crypto/rsa/rsa_ossl.c:484: error: INTEGER_OVERFLOW_L2
  (0 - [0, 1]):unsigned64 by call to `err_clear_last_constant_time`.
Showing all 5 steps of the trace


crypto/rsa/rsa_ossl.c:484:34: Assignment
482.       }
483.       RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, RSA_R_PADDING_CHECK_FAILED);
484.       err_clear_last_constant_time(r >= 0);
                                        ^
485.   
486.    err:

crypto/rsa/rsa_ossl.c:484:5: Call
482.       }
483.       RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, RSA_R_PADDING_CHECK_FAILED);
484.       err_clear_last_constant_time(r >= 0);
           ^
485.   
486.    err:

crypto/err/err.c:902:1: <RHS trace>
900.   #endif
901.   
902. > void err_clear_last_constant_time(int clear)
903.   {
904.       ERR_STATE *es;

crypto/err/err.c:902:1: Parameter `clear`
  900.   #endif
  901.   
  902. > void err_clear_last_constant_time(int clear)
  903.   {
  904.       ERR_STATE *es;

crypto/err/err.c:914:5: Binary operation: (0 - [0, 1]):unsigned64 by call to `err_clear_last_constant_time` 
  912.   
  913.       es->err_flags[top] &= ~(0 - clear);
  914.       es->err_buffer[top] &= ~(0UL - clear);
             ^
  915.       es->err_file[top] = (const char *)((UINTPTR_T)es->err_file[top] &
  916.                                          ~((UINTPTR_T)0 - clear));

void err_clear_last_constant_time(int clear)
{
    ERR_STATE *es;
    int top;
    es = ERR_get_state();
    if (es == NULL)
        return;
    top = es->top;
    es->err_flags[top] &= ~(0 - clear);
    es->err_buffer[top] &= ~(0UL - clear);
    es->err_file[top] = (const char *)((UINTPTR_T)es->err_file[top] &
                                       ~((UINTPTR_T)0 - clear));
    es->err_line[top] |= 0 - clear;
    es->top = (top + ERR_NUM_ERRORS - clear) % ERR_NUM_ERRORS;
}
['static int rsa_ossl_private_decrypt(int flen, const unsigned char *from,\n                                   unsigned char *to, RSA *rsa, int padding)\n{\n    BIGNUM *f, *ret;\n    int j, num = 0, r = -1;\n    unsigned char *buf = NULL;\n    BN_CTX *ctx = NULL;\n    int local_blinding = 0;\n    BIGNUM *unblind = NULL;\n    BN_BLINDING *blinding = NULL;\n    if ((ctx = BN_CTX_new()) == NULL)\n        goto err;\n    BN_CTX_start(ctx);\n    f = BN_CTX_get(ctx);\n    ret = BN_CTX_get(ctx);\n    num = BN_num_bytes(rsa->n);\n    buf = OPENSSL_malloc(num);\n    if (ret == NULL || buf == NULL) {\n        RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, ERR_R_MALLOC_FAILURE);\n        goto err;\n    }\n    if (flen > num) {\n        RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT,\n               RSA_R_DATA_GREATER_THAN_MOD_LEN);\n        goto err;\n    }\n    if (BN_bin2bn(from, (int)flen, f) == NULL)\n        goto err;\n    if (BN_ucmp(f, rsa->n) >= 0) {\n        RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT,\n               RSA_R_DATA_TOO_LARGE_FOR_MODULUS);\n        goto err;\n    }\n    if (!(rsa->flags & RSA_FLAG_NO_BLINDING)) {\n        blinding = rsa_get_blinding(rsa, &local_blinding, ctx);\n        if (blinding == NULL) {\n            RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, ERR_R_INTERNAL_ERROR);\n            goto err;\n        }\n    }\n    if (blinding != NULL) {\n        if (!local_blinding && ((unblind = BN_CTX_get(ctx)) == NULL)) {\n            RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        if (!rsa_blinding_convert(blinding, f, unblind, ctx))\n            goto err;\n    }\n    if ((rsa->flags & RSA_FLAG_EXT_PKEY) ||\n        (rsa->version == RSA_ASN1_VERSION_MULTI) ||\n        ((rsa->p != NULL) &&\n         (rsa->q != NULL) &&\n         (rsa->dmp1 != NULL) && (rsa->dmq1 != NULL) && (rsa->iqmp != NULL))) {\n        if (!rsa->meth->rsa_mod_exp(ret, f, rsa, ctx))\n            goto err;\n    } else {\n        BIGNUM *d = BN_new();\n        if (d == NULL) {\n            RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, ERR_R_MALLOC_FAILURE);\n            goto err;\n        }\n        BN_with_flags(d, rsa->d, BN_FLG_CONSTTIME);\n        if (rsa->flags & RSA_FLAG_CACHE_PUBLIC)\n            if (!BN_MONT_CTX_set_locked(&rsa->_method_mod_n, rsa->lock,\n                                        rsa->n, ctx)) {\n                BN_free(d);\n                goto err;\n            }\n        if (!rsa->meth->bn_mod_exp(ret, f, d, rsa->n, ctx,\n                                   rsa->_method_mod_n)) {\n            BN_free(d);\n            goto err;\n        }\n        BN_free(d);\n    }\n    if (blinding)\n        if (!rsa_blinding_invert(blinding, ret, unblind, ctx))\n            goto err;\n    j = BN_bn2binpad(ret, buf, num);\n    switch (padding) {\n    case RSA_PKCS1_PADDING:\n        r = RSA_padding_check_PKCS1_type_2(to, num, buf, j, num);\n        break;\n    case RSA_PKCS1_OAEP_PADDING:\n        r = RSA_padding_check_PKCS1_OAEP(to, num, buf, j, num, NULL, 0);\n        break;\n    case RSA_SSLV23_PADDING:\n        r = RSA_padding_check_SSLv23(to, num, buf, j, num);\n        break;\n    case RSA_NO_PADDING:\n        memcpy(to, buf, (r = j));\n        break;\n    default:\n        RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, RSA_R_UNKNOWN_PADDING_TYPE);\n        goto err;\n    }\n    RSAerr(RSA_F_RSA_OSSL_PRIVATE_DECRYPT, RSA_R_PADDING_CHECK_FAILED);\n    err_clear_last_constant_time(r >= 0);\n err:\n    if (ctx != NULL)\n        BN_CTX_end(ctx);\n    BN_CTX_free(ctx);\n    OPENSSL_clear_free(buf, num);\n    return r;\n}', 'void err_clear_last_constant_time(int clear)\n{\n    ERR_STATE *es;\n    int top;\n    es = ERR_get_state();\n    if (es == NULL)\n        return;\n    top = es->top;\n    es->err_flags[top] &= ~(0 - clear);\n    es->err_buffer[top] &= ~(0UL - clear);\n    es->err_file[top] = (const char *)((UINTPTR_T)es->err_file[top] &\n                                       ~((UINTPTR_T)0 - clear));\n    es->err_line[top] |= 0 - clear;\n    es->top = (top + ERR_NUM_ERRORS - clear) % ERR_NUM_ERRORS;\n}']