crypto/des/destest.c:823: error: BUFFER_OVERRUN_L2
  Offset: [-3, 26] Size: 16 by call to `des_cfb_encrypt`.
Showing all 10 steps of the trace


crypto/des/destest.c:816:1: Array declaration
814.   #ifndef LIBDES_LIT
815.   
816. > static int cfb_test(int bits, unsigned char *cfb_cipher)
817.   	{
818.   	des_key_schedule ks;

crypto/des/destest.c:823:2: Call
821.   	des_key_sched(cfb_key,ks);
822.   	memcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));
823.   	des_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,cfb_tmp,
        ^
824.   			DES_ENCRYPT);
825.   	if (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)

crypto/des/cfb_enc.c:67:1: Parameter `*schedule`
  65.    * byte.
  66.    */
  67. > void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,
  68.   	     long length, des_key_schedule schedule, des_cblock ivec, int enc)
  69.   	{

crypto/des/cfb_enc.c:103:4: Call
  101.   			ti[0]=v0;
  102.   			ti[1]=v1;
  103.   			des_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT);
            ^
  104.   			c2ln(in,d0,d1,n);
  105.   			in+=n;

crypto/des/des_enc.c:139:8: <Offset trace>
137.   		D_ENCRYPT(r,l, 0); /*  1 */
138.   #else
139.   		for (i=30; i>0; i-=8)
              ^
140.   			{
141.   			D_ENCRYPT(l,r,i-0); /* 16 */

crypto/des/des_enc.c:139:8: Assignment
    137.   		D_ENCRYPT(r,l, 0); /*  1 */
    138.   #else
    139.   		for (i=30; i>0; i-=8)
                  ^
    140.   			{
    141.   			D_ENCRYPT(l,r,i-0); /* 16 */

crypto/des/des_enc.c:61:1: <Length trace>
59.   #include "des_locl.h"
60.   
61. > void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc)
62.   	{
63.   	register DES_LONG l,r,t,u;

crypto/des/des_enc.c:61:1: Parameter `*ks`
    59.   #include "des_locl.h"
    60.   
    61. > void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc)
    62.   	{
    63.   	register DES_LONG l,r,t,u;

crypto/des/des_enc.c:87:2: Assignment
    85.   	l=ROTATE(l,29)&0xffffffffL;
    86.   
    87.   	s=(DES_LONG *)ks;
           ^
    88.   	/* I don't know if it is worth the effort of loop unrolling the
    89.   	 * inner loop */

crypto/des/des_enc.c:143:4: Array access: Offset: [-3, 26] Size: 16 by call to `des_cfb_encrypt` 
    141.   			D_ENCRYPT(l,r,i-0); /* 16 */
    142.   			D_ENCRYPT(r,l,i-2); /* 15 */
    143.   			D_ENCRYPT(l,r,i-4); /* 14 */
              ^
    144.   			D_ENCRYPT(r,l,i-6); /* 13 */
    145.   			}

void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc)
	{
	register DES_LONG l,r,t,u;
#ifdef DES_PTR
	register const unsigned char *des_SP=(const unsigned char *)des_SPtrans;
#endif
#ifndef DES_UNROLL
	register int i;
#endif
	register DES_LONG *s;
	r=data[0];
	l=data[1];
	IP(r,l);
	r=ROTATE(r,29)&0xffffffffL;
	l=ROTATE(l,29)&0xffffffffL;
	s=(DES_LONG *)ks;
	if (enc)
		{
#ifdef DES_UNROLL
		D_ENCRYPT(l,r, 0);
		D_ENCRYPT(r,l, 2);
		D_ENCRYPT(l,r, 4);
		D_ENCRYPT(r,l, 6);
		D_ENCRYPT(l,r, 8);
		D_ENCRYPT(r,l,10);
		D_ENCRYPT(l,r,12);
		D_ENCRYPT(r,l,14);
		D_ENCRYPT(l,r,16);
		D_ENCRYPT(r,l,18);
		D_ENCRYPT(l,r,20);
		D_ENCRYPT(r,l,22);
		D_ENCRYPT(l,r,24);
		D_ENCRYPT(r,l,26);
		D_ENCRYPT(l,r,28);
		D_ENCRYPT(r,l,30);
#else
		for (i=0; i<32; i+=8)
			{
			D_ENCRYPT(l,r,i+0);
			D_ENCRYPT(r,l,i+2);
			D_ENCRYPT(l,r,i+4);
			D_ENCRYPT(r,l,i+6);
			}
#endif
		}
	else
		{
#ifdef DES_UNROLL
		D_ENCRYPT(l,r,30);
		D_ENCRYPT(r,l,28);
		D_ENCRYPT(l,r,26);
		D_ENCRYPT(r,l,24);
		D_ENCRYPT(l,r,22);
		D_ENCRYPT(r,l,20);
		D_ENCRYPT(l,r,18);
		D_ENCRYPT(r,l,16);
		D_ENCRYPT(l,r,14);
		D_ENCRYPT(r,l,12);
		D_ENCRYPT(l,r,10);
		D_ENCRYPT(r,l, 8);
		D_ENCRYPT(l,r, 6);
		D_ENCRYPT(r,l, 4);
		D_ENCRYPT(l,r, 2);
		D_ENCRYPT(r,l, 0);
#else
		for (i=30; i>0; i-=8)
			{
			D_ENCRYPT(l,r,i-0);
			D_ENCRYPT(r,l,i-2);
			D_ENCRYPT(l,r,i-4);
			D_ENCRYPT(r,l,i-6);
			}
#endif
		}
	l=ROTATE(l,3)&0xffffffffL;
	r=ROTATE(r,3)&0xffffffffL;
	FP(r,l);
	data[0]=l;
	data[1]=r;
	l=r=t=u=0;
	}
['static int cfb_test(int bits, unsigned char *cfb_cipher)\n\t{\n\tdes_key_schedule ks;\n\tint i,err=0;\n\tdes_key_sched(cfb_key,ks);\n\tmemcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));\n\tdes_cfb_encrypt(plain,cfb_buf1,bits,sizeof(plain),ks,cfb_tmp,\n\t\t\tDES_ENCRYPT);\n\tif (memcmp(cfb_cipher,cfb_buf1,sizeof(plain)) != 0)\n\t\t{\n\t\terr=1;\n\t\tprintf("cfb_encrypt encrypt error\\n");\n\t\tfor (i=0; i<24; i+=8)\n\t\t\tprintf("%s\\n",pt(&(cfb_buf1[i])));\n\t\t}\n\tmemcpy(cfb_tmp,cfb_iv,sizeof(cfb_iv));\n\tdes_cfb_encrypt(cfb_buf1,cfb_buf2,bits,sizeof(plain),ks,cfb_tmp,\n\t\t\tDES_DECRYPT);\n\tif (memcmp(plain,cfb_buf2,sizeof(plain)) != 0)\n\t\t{\n\t\terr=1;\n\t\tprintf("cfb_encrypt decrypt error\\n");\n\t\tfor (i=0; i<24; i+=8)\n\t\t\tprintf("%s\\n",pt(&(cfb_buf1[i])));\n\t\t}\n\treturn(err);\n\t}', 'void des_cfb_encrypt(const unsigned char *in, unsigned char *out, int numbits,\n\t     long length, des_key_schedule schedule, des_cblock ivec, int enc)\n\t{\n\tregister DES_LONG d0,d1,v0,v1,n=(numbits+7)/8;\n\tregister DES_LONG mask0,mask1;\n\tregister unsigned long l=length;\n\tregister int num=numbits;\n\tDES_LONG ti[2];\n\tunsigned char *iv;\n\tif (num > 64) return;\n\tif (num > 32)\n\t\t{\n\t\tmask0=0xffffffffL;\n\t\tif (num == 64)\n\t\t\tmask1=mask0;\n\t\telse\tmask1=(1L<<(num-32))-1;\n\t\t}\n\telse\n\t\t{\n\t\tif (num == 32)\n\t\t\tmask0=0xffffffffL;\n\t\telse\tmask0=(1L<<num)-1;\n\t\tmask1=0x00000000L;\n\t\t}\n\tiv=ivec;\n\tc2l(iv,v0);\n\tc2l(iv,v1);\n\tif (enc)\n\t\t{\n\t\twhile (l >= n)\n\t\t\t{\n\t\t\tl-=n;\n\t\t\tti[0]=v0;\n\t\t\tti[1]=v1;\n\t\t\tdes_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT);\n\t\t\tc2ln(in,d0,d1,n);\n\t\t\tin+=n;\n\t\t\td0=(d0^ti[0])&mask0;\n\t\t\td1=(d1^ti[1])&mask1;\n\t\t\tl2cn(d0,d1,out,n);\n\t\t\tout+=n;\n\t\t\tif (num == 32)\n\t\t\t\t{ v0=v1; v1=d0; }\n\t\t\telse if (num == 64)\n\t\t\t\t{ v0=d0; v1=d1; }\n\t\t\telse if (num > 32)\n\t\t\t\t{\n\t\t\t\tv0=((v1>>(num-32))|(d0<<(64-num)))&0xffffffffL;\n\t\t\t\tv1=((d0>>(num-32))|(d1<<(64-num)))&0xffffffffL;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tv0=((v0>>num)|(v1<<(32-num)))&0xffffffffL;\n\t\t\t\tv1=((v1>>num)|(d0<<(32-num)))&0xffffffffL;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\twhile (l >= n)\n\t\t\t{\n\t\t\tl-=n;\n\t\t\tti[0]=v0;\n\t\t\tti[1]=v1;\n\t\t\tdes_encrypt((DES_LONG *)ti,schedule,DES_ENCRYPT);\n\t\t\tc2ln(in,d0,d1,n);\n\t\t\tin+=n;\n\t\t\tif (num == 32)\n\t\t\t\t{ v0=v1; v1=d0; }\n\t\t\telse if (num == 64)\n\t\t\t\t{ v0=d0; v1=d1; }\n\t\t\telse if (num > 32)\n\t\t\t\t{\n\t\t\t\tv0=((v1>>(num-32))|(d0<<(64-num)))&0xffffffffL;\n\t\t\t\tv1=((d0>>(num-32))|(d1<<(64-num)))&0xffffffffL;\n\t\t\t\t}\n\t\t\telse\n\t\t\t\t{\n\t\t\t\tv0=((v0>>num)|(v1<<(32-num)))&0xffffffffL;\n\t\t\t\tv1=((v1>>num)|(d0<<(32-num)))&0xffffffffL;\n\t\t\t\t}\n\t\t\td0=(d0^ti[0])&mask0;\n\t\t\td1=(d1^ti[1])&mask1;\n\t\t\tl2cn(d0,d1,out,n);\n\t\t\tout+=n;\n\t\t\t}\n\t\t}\n\tiv=ivec;\n\tl2c(v0,iv);\n\tl2c(v1,iv);\n\tv0=v1=d0=d1=ti[0]=ti[1]=0;\n\t}', 'void des_encrypt(DES_LONG *data, des_key_schedule ks, int enc)\n\t{\n\tregister DES_LONG l,r,t,u;\n#ifdef DES_PTR\n\tregister const unsigned char *des_SP=(const unsigned char *)des_SPtrans;\n#endif\n#ifndef DES_UNROLL\n\tregister int i;\n#endif\n\tregister DES_LONG *s;\n\tr=data[0];\n\tl=data[1];\n\tIP(r,l);\n\tr=ROTATE(r,29)&0xffffffffL;\n\tl=ROTATE(l,29)&0xffffffffL;\n\ts=(DES_LONG *)ks;\n\tif (enc)\n\t\t{\n#ifdef DES_UNROLL\n\t\tD_ENCRYPT(l,r, 0);\n\t\tD_ENCRYPT(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