crypto/rsa/rsa_eay.c:206: error: BUFFER_OVERRUN_L3
  Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, +oo] by call to `BN_BLINDING_convert`.
Showing all 14 steps of the trace


crypto/rsa/rsa_eay.c:201:6: Call
199.   	if (i <= 0) goto err;
200.   
201.   	if (BN_bin2bn(buf,num,&f) == NULL) goto err;
            ^
202.   
203.   	if ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))

crypto/bn/bn_lib.c:597:1: Parameter `*ret->d`
  595.   
  596.   /* ignore negative */
  597. > BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)
  598.   	{
  599.   	unsigned int i,m;

crypto/rsa/rsa_eay.c:206:8: Call
204.   		RSA_blinding_on(rsa,ctx);
205.   	if (rsa->flags & RSA_FLAG_BLINDING)
206.   		if (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;
              ^
207.   
208.   	if ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||

crypto/bn/bn_blind.c:115:1: Parameter `*n->d`
  113.   	}
  114.   
  115. > int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)
  116.   	{
  117.   	bn_check_top(n);

crypto/bn/bn_blind.c:124:9: Call
  122.   		return(0);
  123.   		}
  124.   	return(BN_mod_mul(n,n,b->A,b->mod,ctx));
                 ^
  125.   	}
  126.   

crypto/bn/bn_exp.c:66:1: Parameter `*a->d`
    64.   
    65.   /* slow but works */
    66. > int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)
    67.   	{
    68.   	BIGNUM *t;

crypto/bn/bn_exp.c:77:10: Call
    75.   	t= &(ctx->bn[ctx->tos++]);
    76.   	if (a == b)
    77.   		{ if (!BN_sqr(t,a,ctx)) goto err; }
                   ^
    78.   	else
    79.   		{ if (!BN_mul(t,a,b,ctx)) goto err; }

crypto/bn/bn_sqr.c:65:1: Parameter `*a->d`
      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, BIGNUM *a, BN_CTX *ctx)
      66.   	{
      67.   	int max,al;

crypto/bn/bn_sqr.c:112:4: Call
      110.   			{
      111.   			BN_ULONG t[BN_SQR_RECURSIVE_SIZE_NORMAL*2];
      112.   			bn_sqr_normal(rr->d,a->d,al,t);
                ^
      113.   			}
      114.   		else

crypto/bn/bn_sqr.c:146:1: Parameter `*a`
        144.   
        145.   /* tmp must have 2*n words */
        146. > void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp)
        147.   	{
        148.   	int i,j,max;

crypto/bn/bn_sqr.c:177:2: Call
        175.   	/* There will not be a carry */
        176.   
        177.   	bn_sqr_words(tmp,a,n);
                ^
        178.   
        179.   	bn_add_words(r,r,tmp,max);

crypto/bn/bn_asm.c:198:1: <Length trace>
196.   	} 
197.   
198. > void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
199.           {
200.   	bn_check_num(n);

crypto/bn/bn_asm.c:198:1: Parameter `*a`
          196.   	} 
          197.   
          198. > void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
          199.           {
          200.   	bn_check_num(n);

crypto/bn/bn_asm.c:213:3: Array access: Offset: [3, +oo] (⇐ [0, +oo] + 3) Size: [0, +oo] by call to `BN_BLINDING_convert` 
          211.   		if (--n == 0) break;
          212.   
          213.   		sqr64(r[6],r[7],a[3]);
                   ^
          214.   		if (--n == 0) break;
          215.   

void bn_sqr_words(BN_ULONG *r, BN_ULONG *a, int n)
        {
	bn_check_num(n);
	if (n <= 0) return;
	for (;;)
		{
		sqr64(r[0],r[1],a[0]);
		if (--n == 0) break;
		sqr64(r[2],r[3],a[1]);
		if (--n == 0) break;
		sqr64(r[4],r[5],a[2]);
		if (--n == 0) break;
		sqr64(r[6],r[7],a[3]);
		if (--n == 0) break;
		a+=4;
		r+=8;
		}
	}
['static int RSA_eay_private_encrypt(int flen, unsigned char *from,\n\t     unsigned char *to, RSA *rsa, int padding)\n\t{\n\tBIGNUM f,ret;\n\tint i,j,k,num=0,r= -1;\n\tunsigned char *buf=NULL;\n\tBN_CTX *ctx=NULL;\n\tBN_init(&f);\n\tBN_init(&ret);\n\tif ((ctx=BN_CTX_new()) == NULL) goto err;\n\tnum=BN_num_bytes(rsa->n);\n\tif ((buf=(unsigned char *)Malloc(num)) == NULL)\n\t\t{\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,ERR_R_MALLOC_FAILURE);\n\t\tgoto err;\n\t\t}\n\tswitch (padding)\n\t\t{\n\tcase RSA_PKCS1_PADDING:\n\t\ti=RSA_padding_add_PKCS1_type_1(buf,num,from,flen);\n\t\tbreak;\n\tcase RSA_NO_PADDING:\n\t\ti=RSA_padding_add_none(buf,num,from,flen);\n\t\tbreak;\n\tcase RSA_SSLV23_PADDING:\n\tdefault:\n\t\tRSAerr(RSA_F_RSA_EAY_PRIVATE_ENCRYPT,RSA_R_UNKNOWN_PADDING_TYPE);\n\t\tgoto err;\n\t\t}\n\tif (i <= 0) goto err;\n\tif (BN_bin2bn(buf,num,&f) == NULL) goto err;\n\tif ((rsa->flags & RSA_FLAG_BLINDING) && (rsa->blinding == NULL))\n\t\tRSA_blinding_on(rsa,ctx);\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_convert(&f,rsa->blinding,ctx)) goto err;\n\tif ( (rsa->flags & RSA_FLAG_EXT_PKEY) ||\n\t\t((rsa->p != NULL) &&\n\t\t(rsa->q != NULL) &&\n\t\t(rsa->dmp1 != NULL) &&\n\t\t(rsa->dmq1 != NULL) &&\n\t\t(rsa->iqmp != NULL)) )\n\t\t{ if (!rsa->meth->rsa_mod_exp(&ret,&f,rsa)) goto err; }\n\telse\n\t\t{\n\t\tif (!rsa->meth->bn_mod_exp(&ret,&f,rsa->d,rsa->n,ctx,NULL)) goto err;\n\t\t}\n\tif (rsa->flags & RSA_FLAG_BLINDING)\n\t\tif (!BN_BLINDING_invert(&ret,rsa->blinding,ctx)) goto err;\n\tj=BN_num_bytes(&ret);\n\ti=BN_bn2bin(&ret,&(to[num-j]));\n\tfor (k=0; k<(num-i); k++)\n\t\tto[k]=0;\n\tr=num;\nerr:\n\tif (ctx != NULL) BN_CTX_free(ctx);\n\tBN_clear_free(&ret);\n\tBN_clear_free(&f);\n\tif (buf != NULL)\n\t\t{\n\t\tmemset(buf,0,num);\n\t\tFree(buf);\n\t\t}\n\treturn(r);\n\t}', 'BIGNUM *BN_bin2bn(const unsigned char *s, int len, BIGNUM *ret)\n\t{\n\tunsigned int i,m;\n\tunsigned int n;\n\tBN_ULONG l;\n\tif (ret == NULL) ret=BN_new();\n\tif (ret == NULL) return(NULL);\n\tl=0;\n\tn=len;\n\tif (n == 0)\n\t\t{\n\t\tret->top=0;\n\t\treturn(ret);\n\t\t}\n\tif (bn_expand(ret,(int)(n+2)*8) == NULL)\n\t\treturn(NULL);\n\ti=((n-1)/BN_BYTES)+1;\n\tm=((n-1)%(BN_BYTES));\n\tret->top=i;\n\twhile (n-- > 0)\n\t\t{\n\t\tl=(l<<8L)| *(s++);\n\t\tif (m-- == 0)\n\t\t\t{\n\t\t\tret->d[--i]=l;\n\t\t\tl=0;\n\t\t\tm=BN_BYTES-1;\n\t\t\t}\n\t\t}\n\tbn_fix_top(ret);\n\treturn(ret);\n\t}', 'int BN_BLINDING_convert(BIGNUM *n, BN_BLINDING *b, BN_CTX *ctx)\n\t{\n\tbn_check_top(n);\n\tif ((b->A == NULL) || (b->Ai == NULL))\n\t\t{\n\t\tBNerr(BN_F_BN_BLINDING_CONVERT,BN_R_NOT_INITIALIZED);\n\t\treturn(0);\n\t\t}\n\treturn(BN_mod_mul(n,n,b->A,b->mod,ctx));\n\t}', 'int BN_mod_mul(BIGNUM *ret, BIGNUM *a, BIGNUM *b, const BIGNUM *m, BN_CTX *ctx)\n\t{\n\tBIGNUM *t;\n\tint r=0;\n\tbn_check_top(a);\n\tbn_check_top(b);\n\tbn_check_top(m);\n\tt= &(ctx->bn[ctx->tos++]);\n\tif (a == b)\n\t\t{ if (!BN_sqr(t,a,ctx)) goto err; }\n\telse\n\t\t{ if (!BN_mul(t,a,b,ctx)) goto err; }\n\tif (!BN_mod(ret,t,m,ctx)) goto err;\n\tr=1;\nerr:\n\tctx->tos--;\n\treturn(r);\n\t}', 'int BN_sqr(BIGNUM *r, BIGNUM *a, BN_CTX *ctx)\n\t{\n\tint max,al;\n\tBIGNUM *tmp,*rr;\n#ifdef BN_COUNT\nprintf("BN_sqr %d * %d\\n",a->top,a->top);\n#endif\n\tbn_check_top(a);\n\ttmp= &(ctx->bn[ctx->tos]);\n\trr=(a != r)?r: (&ctx->bn[ctx->tos+1]);\n\tal=a->top;\n\tif (al <= 0)\n\t\t{\n\t\tr->top=0;\n\t\treturn(1);\n\t\t}\n\tmax=(al+al);\n\tif (bn_wexpand(rr,max+1) == NULL) return(0);\n\tr->neg=0;\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(a,k*2) == NULL) return(0);\n\t\t\t\tif (bn_wexpand(tmp,k*2) == NULL) return(0);\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) return(0);\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) return(0);\n\t\tbn_sqr_normal(rr->d,a->d,al,tmp->d);\n#endif\n\t\t}\n\trr->top=max;\n\tif ((max > 0) && (rr->d[max-1] == 0)) rr->top--;\n\tif (rr != r) BN_copy(r,rr);\n\treturn(1);\n\t}', 'void bn_sqr_normal(BN_ULONG *r, BN_ULONG *a, int n, BN_ULONG *tmp)\n\t{\n\tint i,j,max;\n\tBN_ULONG *ap,*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, BN_ULONG *a, int n)\n        {\n\tbn_check_num(n);\n\tif (n <= 0) return;\n\tfor (;;)\n\t\t{\n\t\tsqr64(r[0],r[1],a[0]);\n\t\tif (--n == 0) break;\n\t\tsqr64(r[2],r[3],a[1]);\n\t\tif (--n == 0) break;\n\t\tsqr64(r[4],r[5],a[2]);\n\t\tif (--n == 0) break;\n\t\tsqr64(r[6],r[7],a[3]);\n\t\tif (--n == 0) break;\n\t\ta+=4;\n\t\tr+=8;\n\t\t}\n\t}']