crypto/engine/hw_sureware.c:853: error: UNINITIALIZED_VALUE
  The value read from tlen was never initialized.
Showing all 1 steps of the trace


crypto/engine/hw_sureware.c:853:3: 
851.   	if (buf)
852.   	{
853. > 		memset(buf,0,tlen);
854.   		OPENSSL_free(buf);
855.   	}

static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to,
			RSA *rsa,int padding)
{
	int ret=0,tlen;
	char *buf=NULL,*hptr=NULL;
	char msg[64]="ENGINE_rsa_priv_dec";
	if (!p_surewarehk_Rsa_Priv_Dec)
	{
		SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ENGINE_R_NOT_INITIALISED);
	}
	else if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx)))
	{
		SUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,SUREWARE_R_MISSING_KEY_COMPONENTS);
		goto err;
	}
	if (padding==RSA_PKCS1_PADDING)
	{
		ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD);
		surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret);
		if (ret!=1)
			goto err;
		ret=tlen;
	}
	else
	{
		ret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_NO_PAD);
		surewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret);
		if (ret!=1)
			goto err;
		if ((buf=OPENSSL_malloc(tlen)) == NULL)
		{
			RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ERR_R_MALLOC_FAILURE);
			goto err;
		}
		memcpy(buf,to,tlen);
		switch (padding)
		{
#ifndef NO_SHA
		case RSA_PKCS1_OAEP_PADDING:
			ret=RSA_padding_check_PKCS1_OAEP(to,tlen,(unsigned char *)buf,tlen,tlen,NULL,0);
			break;
#endif
 		case RSA_SSLV23_PADDING:
			ret=RSA_padding_check_SSLv23(to,tlen,(unsigned char *)buf,flen,tlen);
			break;
		case RSA_NO_PADDING:
			ret=RSA_padding_check_none(to,tlen,(unsigned char *)buf,flen,tlen);
			break;
		default:
			RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_UNKNOWN_PADDING_TYPE);
			goto err;
		}
		if (ret < 0)
			RSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_PADDING_CHECK_FAILED);
	}
err:
	if (buf)
	{
		memset(buf,0,tlen);
		OPENSSL_free(buf);
	}
	return ret;
}
['static int surewarehk_rsa_priv_dec(int flen,const unsigned char *from,unsigned char *to,\n\t\t\tRSA *rsa,int padding)\n{\n\tint ret=0,tlen;\n\tchar *buf=NULL,*hptr=NULL;\n\tchar msg[64]="ENGINE_rsa_priv_dec";\n\tif (!p_surewarehk_Rsa_Priv_Dec)\n\t{\n\t\tSUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ENGINE_R_NOT_INITIALISED);\n\t}\n\telse if (!(hptr=RSA_get_ex_data(rsa, rsaHndidx)))\n\t{\n\t\tSUREWAREerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,SUREWARE_R_MISSING_KEY_COMPONENTS);\n\t\tgoto err;\n\t}\n\tif (padding==RSA_PKCS1_PADDING)\n\t{\n\t\tret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_PKCS1_PAD);\n\t\tsurewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret);\n\t\tif (ret!=1)\n\t\t\tgoto err;\n\t\tret=tlen;\n\t}\n\telse\n\t{\n\t\tret=p_surewarehk_Rsa_Priv_Dec(msg,flen,(unsigned char *)from,&tlen,to,hptr,SUREWARE_NO_PAD);\n\t\tsurewarehk_error_handling(msg,SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ret);\n\t\tif (ret!=1)\n\t\t\tgoto err;\n\t\tif ((buf=OPENSSL_malloc(tlen)) == NULL)\n\t\t{\n\t\t\tRSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,ERR_R_MALLOC_FAILURE);\n\t\t\tgoto err;\n\t\t}\n\t\tmemcpy(buf,to,tlen);\n\t\tswitch (padding)\n\t\t{\n#ifndef NO_SHA\n\t\tcase RSA_PKCS1_OAEP_PADDING:\n\t\t\tret=RSA_padding_check_PKCS1_OAEP(to,tlen,(unsigned char *)buf,tlen,tlen,NULL,0);\n\t\t\tbreak;\n#endif\n \t\tcase RSA_SSLV23_PADDING:\n\t\t\tret=RSA_padding_check_SSLv23(to,tlen,(unsigned char *)buf,flen,tlen);\n\t\t\tbreak;\n\t\tcase RSA_NO_PADDING:\n\t\t\tret=RSA_padding_check_none(to,tlen,(unsigned char *)buf,flen,tlen);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tRSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_UNKNOWN_PADDING_TYPE);\n\t\t\tgoto err;\n\t\t}\n\t\tif (ret < 0)\n\t\t\tRSAerr(SUREWARE_F_SUREWAREHK_RSA_PRIV_DEC,RSA_R_PADDING_CHECK_FAILED);\n\t}\nerr:\n\tif (buf)\n\t{\n\t\tmemset(buf,0,tlen);\n\t\tOPENSSL_free(buf);\n\t}\n\treturn ret;\n}']