crypto/ecdsa/ecdsatest.c:219: error: INTEGER_OVERFLOW_L2
  ([0, 1] - 1):unsigned64 by call to `BN_cmp`.
Showing all 10 steps of the trace


crypto/ecdsa/ecdsatest.c:214:37: Call
212.   	(void)BIO_flush(out);
213.   	/* compare the created signature with the expected signature */
214.   	if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)
                                           ^
215.   		goto x962_int_err;
216.   	if (!BN_dec2bn(&r, r_in) ||

crypto/bn/bn_lib.c:308:2: Assignment
  306.   		}
  307.   	ret->flags=BN_FLG_MALLOCED;
  308.   	ret->top=0;
          ^
  309.   	ret->neg=0;
  310.   	ret->dmax=0;

crypto/ecdsa/ecdsatest.c:216:7: Call
214.   	if ((r = BN_new()) == NULL || (s = BN_new()) == NULL)
215.   		goto x962_int_err;
216.   	if (!BN_dec2bn(&r, r_in) ||
             ^
217.   	    !BN_dec2bn(&s, s_in))
218.   		goto x962_int_err;

crypto/bn/bn_print.c:239:1: Parameter `(*bn)->top`
  237.   	}
  238.   
  239. > int BN_dec2bn(BIGNUM **bn, const char *a)
  240.   	{
  241.   	BIGNUM *ret=NULL;

crypto/ecdsa/ecdsatest.c:217:7: Call
215.   		goto x962_int_err;
216.   	if (!BN_dec2bn(&r, r_in) ||
217.   	    !BN_dec2bn(&s, s_in))
             ^
218.   		goto x962_int_err;
219.   	if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))

crypto/bn/bn_print.c:239:1: Parameter `(*bn)->top`
  237.   	}
  238.   
  239. > int BN_dec2bn(BIGNUM **bn, const char *a)
  240.   	{
  241.   	BIGNUM *ret=NULL;

crypto/ecdsa/ecdsatest.c:219:6: Call
217.   	    !BN_dec2bn(&s, s_in))
218.   		goto x962_int_err;
219.   	if (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))
            ^
220.   		goto x962_int_err;
221.   	BIO_printf(out, ".");

crypto/bn/bn_lib.c:678:1: <LHS trace>
676.   	}
677.   
678. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
679.   	{
680.   	int i;

crypto/bn/bn_lib.c:678:1: Parameter `a->top`
  676.   	}
  677.   
  678. > int BN_cmp(const BIGNUM *a, const BIGNUM *b)
  679.   	{
  680.   	int i;

crypto/bn/bn_lib.c:709:7: Binary operation: ([0, 1] - 1):unsigned64 by call to `BN_cmp` 
  707.   	if (a->top > b->top) return(gt);
  708.   	if (a->top < b->top) return(lt);
  709.   	for (i=a->top-1; i>=0; i--)
               ^
  710.   		{
  711.   		t1=a->d[i];

int BN_cmp(const BIGNUM *a, const BIGNUM *b)
	{
	int i;
	int gt,lt;
	BN_ULONG t1,t2;
	if ((a == NULL) || (b == NULL))
		{
		if (a != NULL)
			return(-1);
		else if (b != NULL)
			return(1);
		else
			return(0);
		}
	bn_check_top(a);
	bn_check_top(b);
	if (a->neg != b->neg)
		{
		if (a->neg)
			return(-1);
		else	return(1);
		}
	if (a->neg == 0)
		{ gt=1; lt= -1; }
	else	{ gt= -1; lt=1; }
	if (a->top > b->top) return(gt);
	if (a->top < b->top) return(lt);
	for (i=a->top-1; i>=0; i--)
		{
		t1=a->d[i];
		t2=b->d[i];
		if (t1 > t2) return(gt);
		if (t1 < t2) return(lt);
		}
	return(0);
	}
['int x9_62_test_internal(BIO *out, int nid, const char *r_in, const char *s_in)\n\t{\n\tint\tret = 0;\n\tconst char message[] = "abc";\n\tunsigned char digest[20];\n\tunsigned int  dgst_len = 0;\n\tEVP_MD_CTX md_ctx;\n\tEC_KEY    *key = NULL;\n\tECDSA_SIG *signature = NULL;\n\tBIGNUM    *r = NULL, *s = NULL;\n\tEVP_MD_CTX_init(&md_ctx);\n\tEVP_DigestInit(&md_ctx, EVP_ecdsa());\n\tEVP_DigestUpdate(&md_ctx, (const void*)message, 3);\n\tEVP_DigestFinal(&md_ctx, digest, &dgst_len);\n\tBIO_printf(out, "testing %s: ", OBJ_nid2sn(nid));\n\tif ((key = EC_KEY_new_by_curve_name(nid)) == NULL)\n\t\tgoto x962_int_err;\n\tif (!EC_KEY_generate_key(key))\n\t\tgoto x962_int_err;\n\tBIO_printf(out, ".");\n\t(void)BIO_flush(out);\n\tsignature = ECDSA_do_sign(digest, 20, key);\n\tif (signature == NULL)\n\t\tgoto x962_int_err;\n\tBIO_printf(out, ".");\n\t(void)BIO_flush(out);\n\tif ((r = BN_new()) == NULL || (s = BN_new()) == NULL)\n\t\tgoto x962_int_err;\n\tif (!BN_dec2bn(&r, r_in) ||\n\t    !BN_dec2bn(&s, s_in))\n\t\tgoto x962_int_err;\n\tif (BN_cmp(signature->r ,r) || BN_cmp(signature->s, s))\n\t\tgoto x962_int_err;\n\tBIO_printf(out, ".");\n\t(void)BIO_flush(out);\n\tif (ECDSA_do_verify(digest, 20, signature, key) != 1)\n\t\tgoto x962_int_err;\n\tBIO_printf(out, ".");\n\t(void)BIO_flush(out);\n\tBIO_printf(out, " ok\\n");\n\tret = 1;\nx962_int_err:\n\tif (!ret)\n\t\tBIO_printf(out, " failed\\n");\n\tif (key)\n\t\tEC_KEY_free(key);\n\tif (signature)\n\t\tECDSA_SIG_free(signature);\n\tif (r)\n\t\tBN_free(r);\n\tif (s)\n\t\tBN_free(s);\n\tEVP_MD_CTX_cleanup(&md_ctx);\n\treturn ret;\n\t}', 'BIGNUM *BN_new(void)\n\t{\n\tBIGNUM *ret;\n\tif ((ret=(BIGNUM *)OPENSSL_malloc(sizeof(BIGNUM))) == NULL)\n\t\t{\n\t\tBNerr(BN_F_BN_NEW,ERR_R_MALLOC_FAILURE);\n\t\treturn(NULL);\n\t\t}\n\tret->flags=BN_FLG_MALLOCED;\n\tret->top=0;\n\tret->neg=0;\n\tret->dmax=0;\n\tret->d=NULL;\n\tbn_check_top(ret);\n\treturn(ret);\n\t}', "int BN_dec2bn(BIGNUM **bn, const char *a)\n\t{\n\tBIGNUM *ret=NULL;\n\tBN_ULONG l=0;\n\tint neg=0,i,j;\n\tint num;\n\tif ((a == NULL) || (*a == '\\0')) return(0);\n\tif (*a == '-') { neg=1; a++; }\n\tfor (i=0; isdigit((unsigned char) a[i]); i++)\n\t\t;\n\tnum=i+neg;\n\tif (bn == NULL) return(num);\n\tif (*bn == NULL)\n\t\t{\n\t\tif ((ret=BN_new()) == NULL) return(0);\n\t\t}\n\telse\n\t\t{\n\t\tret= *bn;\n\t\tBN_zero(ret);\n\t\t}\n\tif (bn_expand(ret,i*4) == NULL) goto err;\n\tj=BN_DEC_NUM-(i%BN_DEC_NUM);\n\tif (j == BN_DEC_NUM) j=0;\n\tl=0;\n\twhile (*a)\n\t\t{\n\t\tl*=10;\n\t\tl+= *a-'0';\n\t\ta++;\n\t\tif (++j == BN_DEC_NUM)\n\t\t\t{\n\t\t\tBN_mul_word(ret,BN_DEC_CONV);\n\t\t\tBN_add_word(ret,l);\n\t\t\tl=0;\n\t\t\tj=0;\n\t\t\t}\n\t\t}\n\tret->neg=neg;\n\tbn_correct_top(ret);\n\t*bn=ret;\n\tbn_check_top(ret);\n\treturn(num);\nerr:\n\tif (*bn == NULL) BN_free(ret);\n\treturn(0);\n\t}", 'int BN_cmp(const BIGNUM *a, const BIGNUM *b)\n\t{\n\tint i;\n\tint gt,lt;\n\tBN_ULONG t1,t2;\n\tif ((a == NULL) || (b == NULL))\n\t\t{\n\t\tif (a != NULL)\n\t\t\treturn(-1);\n\t\telse if (b != NULL)\n\t\t\treturn(1);\n\t\telse\n\t\t\treturn(0);\n\t\t}\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tif (a->neg != b->neg)\n\t\t{\n\t\tif (a->neg)\n\t\t\treturn(-1);\n\t\telse\treturn(1);\n\t\t}\n\tif (a->neg == 0)\n\t\t{ gt=1; lt= -1; }\n\telse\t{ gt= -1; lt=1; }\n\tif (a->top > b->top) return(gt);\n\tif (a->top < b->top) return(lt);\n\tfor (i=a->top-1; i>=0; i--)\n\t\t{\n\t\tt1=a->d[i];\n\t\tt2=b->d[i];\n\t\tif (t1 > t2) return(gt);\n\t\tif (t1 < t2) return(lt);\n\t\t}\n\treturn(0);\n\t}']