crypto/bn/bn_rand.c:344: error: INTEGER_OVERFLOW_L2
  (128 - [1, 379]):unsigned64 by call to `SHA512_Update`.
Showing all 12 steps of the trace


crypto/bn/bn_rand.c:340:9: Call
338.           if (RAND_bytes(random_bytes, sizeof(random_bytes)) != 1)
339.               goto err;
340.           SHA512_Init(&sha);
               ^
341.           SHA512_Update(&sha, &done, sizeof(done));
342.           SHA512_Update(&sha, private_bytes, sizeof(private_bytes));

crypto/sha/sha512.c:94:5: Assignment
  92.       c->Nl = 0;
  93.       c->Nh = 0;
  94.       c->num = 0;
            ^
  95.       c->md_len = SHA512_DIGEST_LENGTH;
  96.       return 1;

crypto/bn/bn_rand.c:341:9: Call
339.               goto err;
340.           SHA512_Init(&sha);
341.           SHA512_Update(&sha, &done, sizeof(done));
               ^
342.           SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
343.           SHA512_Update(&sha, message, message_len);

crypto/sha/sha512.c:186:1: Parameter `c->num`
  184.   }
  185.   
  186. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
  187.   {
  188.       SHA_LONG64 l;

crypto/bn/bn_rand.c:342:9: Call
340.           SHA512_Init(&sha);
341.           SHA512_Update(&sha, &done, sizeof(done));
342.           SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
               ^
343.           SHA512_Update(&sha, message, message_len);
344.           SHA512_Update(&sha, random_bytes, sizeof(random_bytes));

crypto/sha/sha512.c:186:1: Parameter `c->num`
  184.   }
  185.   
  186. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
  187.   {
  188.       SHA_LONG64 l;

crypto/bn/bn_rand.c:343:9: Call
341.           SHA512_Update(&sha, &done, sizeof(done));
342.           SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
343.           SHA512_Update(&sha, message, message_len);
               ^
344.           SHA512_Update(&sha, random_bytes, sizeof(random_bytes));
345.           SHA512_Final(digest, &sha);

crypto/sha/sha512.c:186:1: Parameter `c->num`
  184.   }
  185.   
  186. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
  187.   {
  188.       SHA_LONG64 l;

crypto/bn/bn_rand.c:344:9: Call
342.           SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
343.           SHA512_Update(&sha, message, message_len);
344.           SHA512_Update(&sha, random_bytes, sizeof(random_bytes));
               ^
345.           SHA512_Final(digest, &sha);
346.   

crypto/sha/sha512.c:186:1: <RHS trace>
184.   }
185.   
186. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
187.   {
188.       SHA_LONG64 l;

crypto/sha/sha512.c:186:1: Parameter `c->num`
  184.   }
  185.   
  186. > int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
  187.   {
  188.       SHA_LONG64 l;

crypto/sha/sha512.c:203:9: Binary operation: (128 - [1, 379]):unsigned64 by call to `SHA512_Update` 
  201.   
  202.       if (c->num != 0) {
  203.           size_t n = sizeof(c->u) - c->num;
                 ^
  204.   
  205.           if (len < n) {

int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)
{
    SHA_LONG64 l;
    unsigned char *p = c->u.p;
    const unsigned char *data = (const unsigned char *)_data;
    if (len == 0)
        return 1;
    l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff);
    if (l < c->Nl)
        c->Nh++;
    if (sizeof(len) >= 8)
        c->Nh += (((SHA_LONG64) len) >> 61);
    c->Nl = l;
    if (c->num != 0) {
        size_t n = sizeof(c->u) - c->num;
        if (len < n) {
            memcpy(p + c->num, data, len), c->num += (unsigned int)len;
            return 1;
        } else {
            memcpy(p + c->num, data, n), c->num = 0;
            len -= n, data += n;
            sha512_block_data_order(c, p, 1);
        }
    }
    if (len >= sizeof(c->u)) {
# ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA
        if ((size_t)data % sizeof(c->u.d[0]) != 0)
            while (len >= sizeof(c->u))
                memcpy(p, data, sizeof(c->u)),
                    sha512_block_data_order(c, p, 1),
                    len -= sizeof(c->u), data += sizeof(c->u);
        else
# endif
            sha512_block_data_order(c, data, len / sizeof(c->u)),
                data += len, len %= sizeof(c->u), data -= len;
    }
    if (len != 0)
        memcpy(p, data, len), c->num = (int)len;
    return 1;
}
['int BN_generate_dsa_nonce(BIGNUM *out, const BIGNUM *range,\n                          const BIGNUM *priv, const unsigned char *message,\n                          size_t message_len, BN_CTX *ctx)\n{\n    SHA512_CTX sha;\n    unsigned char random_bytes[64];\n    unsigned char digest[SHA512_DIGEST_LENGTH];\n    unsigned done, todo;\n    const unsigned num_k_bytes = BN_num_bytes(range) + 8;\n    unsigned char private_bytes[96];\n    unsigned char *k_bytes;\n    int ret = 0;\n    k_bytes = OPENSSL_malloc(num_k_bytes);\n    if (!k_bytes)\n        goto err;\n    todo = sizeof(priv->d[0]) * priv->top;\n    if (todo > sizeof(private_bytes)) {\n        BNerr(BN_F_BN_GENERATE_DSA_NONCE, BN_R_PRIVATE_KEY_TOO_LARGE);\n        goto err;\n    }\n    memcpy(private_bytes, priv->d, todo);\n    memset(private_bytes + todo, 0, sizeof(private_bytes) - todo);\n    for (done = 0; done < num_k_bytes;) {\n        if (RAND_bytes(random_bytes, sizeof(random_bytes)) != 1)\n            goto err;\n        SHA512_Init(&sha);\n        SHA512_Update(&sha, &done, sizeof(done));\n        SHA512_Update(&sha, private_bytes, sizeof(private_bytes));\n        SHA512_Update(&sha, message, message_len);\n        SHA512_Update(&sha, random_bytes, sizeof(random_bytes));\n        SHA512_Final(digest, &sha);\n        todo = num_k_bytes - done;\n        if (todo > SHA512_DIGEST_LENGTH)\n            todo = SHA512_DIGEST_LENGTH;\n        memcpy(k_bytes + done, digest, todo);\n        done += todo;\n    }\n    if (!BN_bin2bn(k_bytes, num_k_bytes, out))\n        goto err;\n    if (BN_mod(out, out, range, ctx) != 1)\n        goto err;\n    ret = 1;\n err:\n    if (k_bytes)\n        OPENSSL_free(k_bytes);\n    return ret;\n}', 'int SHA512_Init(SHA512_CTX *c)\n{\n    c->h[0] = U64(0x6a09e667f3bcc908);\n    c->h[1] = U64(0xbb67ae8584caa73b);\n    c->h[2] = U64(0x3c6ef372fe94f82b);\n    c->h[3] = U64(0xa54ff53a5f1d36f1);\n    c->h[4] = U64(0x510e527fade682d1);\n    c->h[5] = U64(0x9b05688c2b3e6c1f);\n    c->h[6] = U64(0x1f83d9abfb41bd6b);\n    c->h[7] = U64(0x5be0cd19137e2179);\n    c->Nl = 0;\n    c->Nh = 0;\n    c->num = 0;\n    c->md_len = SHA512_DIGEST_LENGTH;\n    return 1;\n}', 'int SHA512_Update(SHA512_CTX *c, const void *_data, size_t len)\n{\n    SHA_LONG64 l;\n    unsigned char *p = c->u.p;\n    const unsigned char *data = (const unsigned char *)_data;\n    if (len == 0)\n        return 1;\n    l = (c->Nl + (((SHA_LONG64) len) << 3)) & U64(0xffffffffffffffff);\n    if (l < c->Nl)\n        c->Nh++;\n    if (sizeof(len) >= 8)\n        c->Nh += (((SHA_LONG64) len) >> 61);\n    c->Nl = l;\n    if (c->num != 0) {\n        size_t n = sizeof(c->u) - c->num;\n        if (len < n) {\n            memcpy(p + c->num, data, len), c->num += (unsigned int)len;\n            return 1;\n        } else {\n            memcpy(p + c->num, data, n), c->num = 0;\n            len -= n, data += n;\n            sha512_block_data_order(c, p, 1);\n        }\n    }\n    if (len >= sizeof(c->u)) {\n# ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA\n        if ((size_t)data % sizeof(c->u.d[0]) != 0)\n            while (len >= sizeof(c->u))\n                memcpy(p, data, sizeof(c->u)),\n                    sha512_block_data_order(c, p, 1),\n                    len -= sizeof(c->u), data += sizeof(c->u);\n        else\n# endif\n            sha512_block_data_order(c, data, len / sizeof(c->u)),\n                data += len, len %= sizeof(c->u), data -= len;\n    }\n    if (len != 0)\n        memcpy(p, data, len), c->num = (int)len;\n    return 1;\n}']