crypto/bn/bn_rand.c:364: error: INTEGER_OVERFLOW_L2
  (64 - [-251, 127]):unsigned64 by call to `SHA512_Update`.
Showing all 14 steps of the trace


crypto/bn/bn_rand.c:360:3: Call
358.   		if (RAND_bytes(random_bytes, sizeof(random_bytes)) != 1)
359.   			goto err;
360.   		SHA512_Init(&sha);
         ^
361.   		SHA512_Update(&sha, &done, sizeof(done));
362.   		SHA512_Update(&sha, private_bytes, sizeof(private_bytes));

crypto/sha/sha512.c:91:9: Assignment
  89.   
  90.           c->Nl=0;        c->Nh=0;
  91.           c->num=0;       c->md_len=SHA512_DIGEST_LENGTH;
                ^
  92.           return 1;
  93.   	}

crypto/bn/bn_rand.c:361:3: Call
359.   			goto err;
360.   		SHA512_Init(&sha);
361.   		SHA512_Update(&sha, &done, sizeof(done));
         ^
362.   		SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
363.   		SHA512_Update(&sha, message, message_len);

crypto/sha/sha512.c:181:1: Parameter `c->num`
  179.   {   return SHA512_Final (md,c);   }
  180.   
  181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
  182.   	{
  183.   	SHA_LONG64	l;

crypto/bn/bn_rand.c:362:3: Call
360.   		SHA512_Init(&sha);
361.   		SHA512_Update(&sha, &done, sizeof(done));
362.   		SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
         ^
363.   		SHA512_Update(&sha, message, message_len);
364.   		SHA512_Update(&sha, random_bytes, sizeof(random_bytes));

crypto/sha/sha512.c:181:1: Parameter `c->num`
  179.   {   return SHA512_Final (md,c);   }
  180.   
  181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
  182.   	{
  183.   	SHA_LONG64	l;

crypto/bn/bn_rand.c:363:3: Call
361.   		SHA512_Update(&sha, &done, sizeof(done));
362.   		SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
363.   		SHA512_Update(&sha, message, message_len);
         ^
364.   		SHA512_Update(&sha, random_bytes, sizeof(random_bytes));
365.   		SHA512_Final(digest, &sha);

crypto/sha/sha512.c:181:1: Parameter `c->num`
  179.   {   return SHA512_Final (md,c);   }
  180.   
  181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
  182.   	{
  183.   	SHA_LONG64	l;

crypto/bn/bn_rand.c:364:3: Call
362.   		SHA512_Update(&sha, private_bytes, sizeof(private_bytes));
363.   		SHA512_Update(&sha, message, message_len);
364.   		SHA512_Update(&sha, random_bytes, sizeof(random_bytes));
         ^
365.   		SHA512_Final(digest, &sha);
366.   

crypto/sha/sha512.c:181:1: <LHS trace>
179.   {   return SHA512_Final (md,c);   }
180.   
181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
182.   	{
183.   	SHA_LONG64	l;

crypto/sha/sha512.c:181:1: Parameter `len`
  179.   {   return SHA512_Final (md,c);   }
  180.   
  181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
  182.   	{
  183.   	SHA_LONG64	l;

crypto/sha/sha512.c:181:1: <RHS trace>
179.   {   return SHA512_Final (md,c);   }
180.   
181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
182.   	{
183.   	SHA_LONG64	l;

crypto/sha/sha512.c:181:1: Parameter `len`
  179.   {   return SHA512_Final (md,c);   }
  180.   
  181. > int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)
  182.   	{
  183.   	SHA_LONG64	l;

crypto/sha/sha512.c:205:4: Binary operation: (64 - [-251, 127]):unsigned64 by call to `SHA512_Update` 
  203.   		else	{
  204.   			memcpy (p+c->num,data,n), c->num = 0;
  205.   			len-=n, data+=n;
            ^
  206.   			sha512_block_data_order (c,p,1);
  207.   			}

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, const BIGNUM* priv,\n\t\t\t  const unsigned char *message, size_t message_len,\n\t\t\t  BN_CTX *ctx)\n\t{\n\tSHA512_CTX sha;\n\tunsigned char random_bytes[64];\n\tunsigned char digest[SHA512_DIGEST_LENGTH];\n\tunsigned done, todo;\n\tconst unsigned num_k_bytes = BN_num_bytes(range) + 8;\n\tunsigned char private_bytes[96];\n\tunsigned char *k_bytes;\n\tint ret = 0;\n\tk_bytes = OPENSSL_malloc(num_k_bytes);\n\tif (!k_bytes)\n\t\tgoto err;\n\ttodo = sizeof(priv->d[0])*priv->top;\n\tif (todo > sizeof(private_bytes))\n\t\t{\n\t\tBNerr(BN_F_BN_GENERATE_DSA_NONCE, BN_R_PRIVATE_KEY_TOO_LARGE);\n\t\tgoto err;\n\t\t}\n\tmemcpy(private_bytes, priv->d, todo);\n\tmemset(private_bytes + todo, 0, sizeof(private_bytes) - todo);\n\tfor (done = 0; done < num_k_bytes;) {\n\t\tif (RAND_bytes(random_bytes, sizeof(random_bytes)) != 1)\n\t\t\tgoto err;\n\t\tSHA512_Init(&sha);\n\t\tSHA512_Update(&sha, &done, sizeof(done));\n\t\tSHA512_Update(&sha, private_bytes, sizeof(private_bytes));\n\t\tSHA512_Update(&sha, message, message_len);\n\t\tSHA512_Update(&sha, random_bytes, sizeof(random_bytes));\n\t\tSHA512_Final(digest, &sha);\n\t\ttodo = num_k_bytes - done;\n\t\tif (todo > SHA512_DIGEST_LENGTH)\n\t\t\ttodo = SHA512_DIGEST_LENGTH;\n\t\tmemcpy(k_bytes + done, digest, todo);\n\t\tdone += todo;\n\t}\n\tif (!BN_bin2bn(k_bytes, num_k_bytes, out))\n\t\tgoto err;\n\tif (BN_mod(out, out, range, ctx) != 1)\n\t\tgoto err;\n\tret = 1;\nerr:\n\tif (k_bytes)\n\t\tOPENSSL_free(k_bytes);\n\treturn ret;\n\t}', 'int SHA512_Init (SHA512_CTX *c)\n\t{\n\tc->h[0]=U64(0x6a09e667f3bcc908);\n\tc->h[1]=U64(0xbb67ae8584caa73b);\n\tc->h[2]=U64(0x3c6ef372fe94f82b);\n\tc->h[3]=U64(0xa54ff53a5f1d36f1);\n\tc->h[4]=U64(0x510e527fade682d1);\n\tc->h[5]=U64(0x9b05688c2b3e6c1f);\n\tc->h[6]=U64(0x1f83d9abfb41bd6b);\n\tc->h[7]=U64(0x5be0cd19137e2179);\n        c->Nl=0;        c->Nh=0;\n        c->num=0;       c->md_len=SHA512_DIGEST_LENGTH;\n        return 1;\n\t}', 'int SHA512_Update (SHA512_CTX *c, const void *_data, size_t len)\n\t{\n\tSHA_LONG64\tl;\n\tunsigned char  *p=c->u.p;\n\tconst unsigned char *data=(const unsigned char *)_data;\n\tif (len==0) return  1;\n\tl = (c->Nl+(((SHA_LONG64)len)<<3))&U64(0xffffffffffffffff);\n\tif (l < c->Nl)\t\tc->Nh++;\n\tif (sizeof(len)>=8)\tc->Nh+=(((SHA_LONG64)len)>>61);\n\tc->Nl=l;\n\tif (c->num != 0)\n\t\t{\n\t\tsize_t n = sizeof(c->u) - c->num;\n\t\tif (len < n)\n\t\t\t{\n\t\t\tmemcpy (p+c->num,data,len), c->num += (unsigned int)len;\n\t\t\treturn 1;\n\t\t\t}\n\t\telse\t{\n\t\t\tmemcpy (p+c->num,data,n), c->num = 0;\n\t\t\tlen-=n, data+=n;\n\t\t\tsha512_block_data_order (c,p,1);\n\t\t\t}\n\t\t}\n\tif (len >= sizeof(c->u))\n\t\t{\n#ifndef SHA512_BLOCK_CAN_MANAGE_UNALIGNED_DATA\n\t\tif ((size_t)data%sizeof(c->u.d[0]) != 0)\n\t\t\twhile (len >= sizeof(c->u))\n\t\t\t\tmemcpy (p,data,sizeof(c->u)),\n\t\t\t\tsha512_block_data_order (c,p,1),\n\t\t\t\tlen  -= sizeof(c->u),\n\t\t\t\tdata += sizeof(c->u);\n\t\telse\n#endif\n\t\t\tsha512_block_data_order (c,data,len/sizeof(c->u)),\n\t\t\tdata += len,\n\t\t\tlen  %= sizeof(c->u),\n\t\t\tdata -= len;\n\t\t}\n\tif (len != 0)\tmemcpy (p,data,len), c->num = (int)len;\n\treturn 1;\n\t}']