crypto/ec/ecp_mont.c:231: error: INTEGER_OVERFLOW_L1
  ([-oo, 1] - 4):unsigned64 by call to `BN_mod_mul_montgomery`.
Showing all 13 steps of the trace


crypto/ec/ecp_mont.c:231:7: Call
229.   	one = BN_new();
230.   	if (one == NULL) goto err;
231.   	if (!BN_to_montgomery(one, BN_value_one(), mont, ctx)) goto err;
             ^
232.   
233.   	group->field_data1 = mont;

crypto/bn/bn_lib.c:137:32: Assignment
  135.   	{
  136.   	static const BN_ULONG data_one=1L;
  137.   	static const BIGNUM const_one={(BN_ULONG *)&data_one,1,1,0,BN_FLG_STATIC_DATA};
                                        ^
  138.   
  139.   	return(&const_one);

crypto/ec/ecp_mont.c:231:7: Call
229.   	one = BN_new();
230.   	if (one == NULL) goto err;
231.   	if (!BN_to_montgomery(one, BN_value_one(), mont, ctx)) goto err;
             ^
232.   
233.   	group->field_data1 = mont;

crypto/bn/bn_mont.c:129:1: Parameter `a->top`
  127.   #endif
  128.   
  129. > int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,
  130.   			  BN_MONT_CTX *mont, BN_CTX *ctx)
  131.   	{

crypto/bn/bn_mont.c:157:8: Call
  155.   	if (a == b)
  156.   		{
  157.   		if (!BN_sqr(tmp,a,ctx)) goto err;
                ^
  158.   		}
  159.   	else

crypto/bn/bn_sqr.c:65:1: Parameter `a->top`
    63.   /* r must not be a */
    64.   /* I've just gone over this and it is now %20 faster on x86 - eay - 27 Jun 96 */
    65. > int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)
    66.   	{
    67.   	int max,al;

crypto/bn/bn_sqr.c:76:2: Assignment
    74.   	bn_check_top(a);
    75.   
    76.   	al=a->top;
           ^
    77.   	if (al <= 0)
    78.   		{

crypto/bn/bn_sqr.c:132:5: Call
    130.   				{
    131.   				if (bn_wexpand(tmp,max) == NULL) goto err;
    132.   				bn_sqr_normal(rr->d,a->d,al,tmp->d);
               ^
    133.   				}
    134.   			}

crypto/bn/bn_sqr.c:158:1: Parameter `n`
      156.   
      157.   /* tmp must have 2*n words */
      158. > void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)
      159.   	{
      160.   	int i,j,max;

crypto/bn/bn_sqr.c:190:2: Call
      188.   	/* There will not be a carry */
      189.   
      190.   	bn_sqr_words(tmp,a,n);
              ^
      191.   
      192.   	bn_add_words(r,r,tmp,max);

crypto/bn/bn_asm.c:204:1: <LHS trace>
202.   	} 
203.   
204. > void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n)
205.           {
206.   	assert(n >= 0);

crypto/bn/bn_asm.c:204:1: Parameter `n`
        202.   	} 
        203.   
        204. > void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n)
        205.           {
        206.   	assert(n >= 0);

crypto/bn/bn_asm.c:216:15: Binary operation: ([-oo, 1] - 4):unsigned64 by call to `BN_mod_mul_montgomery` 
        214.   		sqr64(r[4],r[5],a[2]);
        215.   		sqr64(r[6],r[7],a[3]);
        216.   		a+=4; r+=8; n-=4;
                             ^
        217.   		}
        218.   #endif

void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n)
        {
	assert(n >= 0);
	if (n <= 0) return;
#ifndef OPENSSL_SMALL_FOOTPRINT
	while (n&~3)
		{
		sqr64(r[0],r[1],a[0]);
		sqr64(r[2],r[3],a[1]);
		sqr64(r[4],r[5],a[2]);
		sqr64(r[6],r[7],a[3]);
		a+=4; r+=8; n-=4;
		}
#endif
	while (n)
		{
		sqr64(r[0],r[1],a[0]);
		a++; r+=2; n--;
		}
	}
['int ec_GFp_mont_group_set_curve(EC_GROUP *group, const BIGNUM *p, const BIGNUM *a, const BIGNUM *b, BN_CTX *ctx)\n\t{\n\tBN_CTX *new_ctx = NULL;\n\tBN_MONT_CTX *mont = NULL;\n\tBIGNUM *one = NULL;\n\tint ret = 0;\n\tif (group->field_data1 != NULL)\n\t\t{\n\t\tBN_MONT_CTX_free(group->field_data1);\n\t\tgroup->field_data1 = NULL;\n\t\t}\n\tif (group->field_data2 != NULL)\n\t\t{\n\t\tBN_free(group->field_data2);\n\t\tgroup->field_data2 = NULL;\n\t\t}\n\tif (ctx == NULL)\n\t\t{\n\t\tctx = new_ctx = BN_CTX_new();\n\t\tif (ctx == NULL)\n\t\t\treturn 0;\n\t\t}\n\tmont = BN_MONT_CTX_new();\n\tif (mont == NULL) goto err;\n\tif (!BN_MONT_CTX_set(mont, p, ctx))\n\t\t{\n\t\tECerr(EC_F_EC_GFP_MONT_GROUP_SET_CURVE, ERR_R_BN_LIB);\n\t\tgoto err;\n\t\t}\n\tone = BN_new();\n\tif (one == NULL) goto err;\n\tif (!BN_to_montgomery(one, BN_value_one(), mont, ctx)) goto err;\n\tgroup->field_data1 = mont;\n\tmont = NULL;\n\tgroup->field_data2 = one;\n\tone = NULL;\n\tret = ec_GFp_simple_group_set_curve(group, p, a, b, ctx);\n\tif (!ret)\n\t\t{\n\t\tBN_MONT_CTX_free(group->field_data1);\n\t\tgroup->field_data1 = NULL;\n\t\tBN_free(group->field_data2);\n\t\tgroup->field_data2 = NULL;\n\t\t}\n err:\n\tif (new_ctx != NULL)\n\t\tBN_CTX_free(new_ctx);\n\tif (mont != NULL)\n\t\tBN_MONT_CTX_free(mont);\n\treturn ret;\n\t}', 'const BIGNUM *BN_value_one(void)\n\t{\n\tstatic const BN_ULONG data_one=1L;\n\tstatic const BIGNUM const_one={(BN_ULONG *)&data_one,1,1,0,BN_FLG_STATIC_DATA};\n\treturn(&const_one);\n\t}', 'int BN_mod_mul_montgomery(BIGNUM *r, const BIGNUM *a, const BIGNUM *b,\n\t\t\t  BN_MONT_CTX *mont, BN_CTX *ctx)\n\t{\n\tBIGNUM *tmp;\n\tint ret=0;\n#if defined(OPENSSL_BN_ASM_MONT) && defined(MONT_WORD)\n\tint num = mont->N.top;\n\tif (num>1 && a->top==num && b->top==num)\n\t\t{\n\t\tif (bn_wexpand(r,num) == NULL) return(0);\n\t\tif (bn_mul_mont(r->d,a->d,b->d,mont->N.d,mont->n0,num))\n\t\t\t{\n\t\t\tr->neg = a->neg^b->neg;\n\t\t\tr->top = num;\n\t\t\tbn_correct_top(r);\n\t\t\treturn(1);\n\t\t\t}\n\t\t}\n#endif\n\tBN_CTX_start(ctx);\n\ttmp = BN_CTX_get(ctx);\n\tif (tmp == NULL) goto err;\n\tbn_check_top(tmp);\n\tif (a == b)\n\t\t{\n\t\tif (!BN_sqr(tmp,a,ctx)) goto err;\n\t\t}\n\telse\n\t\t{\n\t\tif (!BN_mul(tmp,a,b,ctx)) goto err;\n\t\t}\n#ifdef MONT_WORD\n\tif (!BN_from_montgomery_word(r,tmp,mont)) goto err;\n#else\n\tif (!BN_from_montgomery(r,tmp,mont,ctx)) goto err;\n#endif\n\tbn_check_top(r);\n\tret=1;\nerr:\n\tBN_CTX_end(ctx);\n\treturn(ret);\n\t}', 'int BN_sqr(BIGNUM *r, const BIGNUM *a, BN_CTX *ctx)\n\t{\n\tint max,al;\n\tint ret = 0;\n\tBIGNUM *tmp,*rr;\n#ifdef BN_COUNT\n\tfprintf(stderr,"BN_sqr %d * %d\\n",a->top,a->top);\n#endif\n\tbn_check_top(a);\n\tal=a->top;\n\tif (al <= 0)\n\t\t{\n\t\tr->top=0;\n\t\treturn 1;\n\t\t}\n\tBN_CTX_start(ctx);\n\trr=(a != r) ? r : BN_CTX_get(ctx);\n\ttmp=BN_CTX_get(ctx);\n\tif (!rr || !tmp) goto err;\n\tmax = 2 * al;\n\tif (bn_wexpand(rr,max) == NULL) goto err;\n\tif (al == 4)\n\t\t{\n#ifndef BN_SQR_COMBA\n\t\tBN_ULONG t[8];\n\t\tbn_sqr_normal(rr->d,a->d,4,t);\n#else\n\t\tbn_sqr_comba4(rr->d,a->d);\n#endif\n\t\t}\n\telse if (al == 8)\n\t\t{\n#ifndef BN_SQR_COMBA\n\t\tBN_ULONG t[16];\n\t\tbn_sqr_normal(rr->d,a->d,8,t);\n#else\n\t\tbn_sqr_comba8(rr->d,a->d);\n#endif\n\t\t}\n\telse\n\t\t{\n#if defined(BN_RECURSION)\n\t\tif (al < BN_SQR_RECURSIVE_SIZE_NORMAL)\n\t\t\t{\n\t\t\tBN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL*2];\n\t\t\tbn_sqr_normal(rr->d,a->d,al,t);\n\t\t\t}\n\t\telse\n\t\t\t{\n\t\t\tint j,k;\n\t\t\tj=BN_num_bits_word((BN_ULONG)al);\n\t\t\tj=1<<(j-1);\n\t\t\tk=j+j;\n\t\t\tif (al == j)\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(tmp,k*2) == NULL) goto err;\n\t\t\t\tbn_sqr_recursive(rr->d,a->d,al,tmp->d);\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tif (bn_wexpand(tmp,max) == NULL) goto err;\n\t\t\t\tbn_sqr_normal(rr->d,a->d,al,tmp->d);\n\t\t\t\t}\n\t\t\t}\n#else\n\t\tif (bn_wexpand(tmp,max) == NULL) goto err;\n\t\tbn_sqr_normal(rr->d,a->d,al,tmp->d);\n#endif\n\t\t}\n\trr->neg=0;\n\tif(a->d[al - 1] == (a->d[al - 1] & BN_MASK2l))\n\t\trr->top = max - 1;\n\telse\n\t\trr->top = max;\n\tif (rr != r) BN_copy(r,rr);\n\tret = 1;\n err:\n\tbn_check_top(rr);\n\tbn_check_top(tmp);\n\tBN_CTX_end(ctx);\n\treturn(ret);\n\t}', 'void bn_sqr_normal(BN_ULONG *r, const BN_ULONG *a, int n, BN_ULONG *tmp)\n\t{\n\tint i,j,max;\n\tconst BN_ULONG *ap;\n\tBN_ULONG *rp;\n\tmax=n*2;\n\tap=a;\n\trp=r;\n\trp[0]=rp[max-1]=0;\n\trp++;\n\tj=n;\n\tif (--j > 0)\n\t\t{\n\t\tap++;\n\t\trp[j]=bn_mul_words(rp,ap,j,ap[-1]);\n\t\trp+=2;\n\t\t}\n\tfor (i=n-2; i>0; i--)\n\t\t{\n\t\tj--;\n\t\tap++;\n\t\trp[j]=bn_mul_add_words(rp,ap,j,ap[-1]);\n\t\trp+=2;\n\t\t}\n\tbn_add_words(r,r,r,max);\n\tbn_sqr_words(tmp,a,n);\n\tbn_add_words(r,r,tmp,max);\n\t}', 'void bn_sqr_words(BN_ULONG *r, const BN_ULONG *a, size_t n)\n        {\n\tassert(n >= 0);\n\tif (n <= 0) return;\n#ifndef OPENSSL_SMALL_FOOTPRINT\n\twhile (n&~3)\n\t\t{\n\t\tsqr64(r[0],r[1],a[0]);\n\t\tsqr64(r[2],r[3],a[1]);\n\t\tsqr64(r[4],r[5],a[2]);\n\t\tsqr64(r[6],r[7],a[3]);\n\t\ta+=4; r+=8; n-=4;\n\t\t}\n#endif\n\twhile (n)\n\t\t{\n\t\tsqr64(r[0],r[1],a[0]);\n\t\ta++; r+=2; n--;\n\t\t}\n\t}']