ssl/s3_pkt.c:802: error: UNINITIALIZED_VALUE
  The value read from eivlen was never initialized.
Showing all 1 steps of the trace


ssl/s3_pkt.c:802:3: 
800.   	/*	if (RAND_pseudo_bytes(p, eivlen) <= 0)
801.   			goto err; */
802. > 		wr->length += eivlen;
803.   		}
804.   

static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,
			 unsigned int len, int create_empty_fragment)
	{
	unsigned char *p,*plen;
	int i,mac_size,clear=0;
	int prefix_len=0;
	int eivlen;
	long align=0;
	SSL3_RECORD *wr;
	SSL3_BUFFER *wb=&(s->s3->wbuf);
	SSL_SESSION *sess;
 	if (wb->buf == NULL)
		if (!ssl3_setup_write_buffer(s))
			return -1;
	if (wb->left != 0)
		return(ssl3_write_pending(s,type,buf,len));
	if (s->s3->alert_dispatch)
		{
		i=s->method->ssl_dispatch_alert(s);
		if (i <= 0)
			return(i);
		}
	if (len == 0 && !create_empty_fragment)
		return 0;
	wr= &(s->s3->wrec);
	sess=s->session;
	if (	(sess == NULL) ||
		(s->enc_write_ctx == NULL) ||
		(EVP_MD_CTX_md(s->write_hash) == NULL))
		clear=1;
	if (clear)
		mac_size=0;
	else
		{
		mac_size=EVP_MD_CTX_size(s->write_hash);
		if (mac_size < 0)
			goto err;
		}
	if (!clear && !create_empty_fragment && !s->s3->empty_fragment_done)
		{
		if (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA)
			{
			prefix_len = do_ssl3_write(s, type, buf, 0, 1);
			if (prefix_len <= 0)
				goto err;
			if (prefix_len >
		(SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD))
				{
				SSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR);
				goto err;
				}
			}
		s->s3->empty_fragment_done = 1;
		}
	if (create_empty_fragment)
		{
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
		align = (long)wb->buf + 2*SSL3_RT_HEADER_LENGTH;
		align = (-align)&(SSL3_ALIGN_PAYLOAD-1);
#endif
		p = wb->buf + align;
		wb->offset  = align;
		}
	else if (prefix_len)
		{
		p = wb->buf + wb->offset + prefix_len;
		}
	else
		{
#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0
		align = (long)wb->buf + SSL3_RT_HEADER_LENGTH;
		align = (-align)&(SSL3_ALIGN_PAYLOAD-1);
#endif
		p = wb->buf + align;
		wb->offset  = align;
		}
	*(p++)=type&0xff;
	wr->type=type;
	*(p++)=(s->version>>8);
	*(p++)=s->version&0xff;
	plen=p;
	p+=2;
	if (s->enc_write_ctx && s->version >= TLS1_1_VERSION)
		{
		int mode = EVP_CIPHER_CTX_mode(s->enc_write_ctx);
		if (mode == EVP_CIPH_CBC_MODE)
			{
			eivlen = EVP_CIPHER_CTX_iv_length(s->enc_write_ctx);
			if (eivlen <= 1)
				eivlen = 0;
			}
		else if (mode == EVP_CIPH_GCM_MODE)
			eivlen = EVP_GCM_TLS_EXPLICIT_IV_LEN;
		}
	else
		eivlen = 0;
	wr->data=p + eivlen;
	wr->length=(int)len;
	wr->input=(unsigned char *)buf;
	if (s->compress != NULL)
		{
		if (!ssl3_do_compress(s))
			{
			SSLerr(SSL_F_DO_SSL3_WRITE,SSL_R_COMPRESSION_FAILURE);
			goto err;
			}
		}
	else
		{
		memcpy(wr->data,wr->input,wr->length);
		wr->input=wr->data;
		}
	if (mac_size != 0)
		{
		if (s->method->ssl3_enc->mac(s,&(p[wr->length + eivlen]),1) < 0)
			goto err;
		wr->length+=mac_size;
		}
	wr->input=p;
	wr->data=p;
	if (eivlen)
		{
		wr->length += eivlen;
		}
	s->method->ssl3_enc->enc(s,1);
	s2n(wr->length,plen);
	wr->type=type;
	wr->length+=SSL3_RT_HEADER_LENGTH;
	if (create_empty_fragment)
		{
		return wr->length;
		}
	wb->left = prefix_len + wr->length;
	s->s3->wpend_tot=len;
	s->s3->wpend_buf=buf;
	s->s3->wpend_type=type;
	s->s3->wpend_ret=len;
	return ssl3_write_pending(s,type,buf,len);
err:
	return -1;
	}
['static int do_ssl3_write(SSL *s, int type, const unsigned char *buf,\n\t\t\t unsigned int len, int create_empty_fragment)\n\t{\n\tunsigned char *p,*plen;\n\tint i,mac_size,clear=0;\n\tint prefix_len=0;\n\tint eivlen;\n\tlong align=0;\n\tSSL3_RECORD *wr;\n\tSSL3_BUFFER *wb=&(s->s3->wbuf);\n\tSSL_SESSION *sess;\n \tif (wb->buf == NULL)\n\t\tif (!ssl3_setup_write_buffer(s))\n\t\t\treturn -1;\n\tif (wb->left != 0)\n\t\treturn(ssl3_write_pending(s,type,buf,len));\n\tif (s->s3->alert_dispatch)\n\t\t{\n\t\ti=s->method->ssl_dispatch_alert(s);\n\t\tif (i <= 0)\n\t\t\treturn(i);\n\t\t}\n\tif (len == 0 && !create_empty_fragment)\n\t\treturn 0;\n\twr= &(s->s3->wrec);\n\tsess=s->session;\n\tif (\t(sess == NULL) ||\n\t\t(s->enc_write_ctx == NULL) ||\n\t\t(EVP_MD_CTX_md(s->write_hash) == NULL))\n\t\tclear=1;\n\tif (clear)\n\t\tmac_size=0;\n\telse\n\t\t{\n\t\tmac_size=EVP_MD_CTX_size(s->write_hash);\n\t\tif (mac_size < 0)\n\t\t\tgoto err;\n\t\t}\n\tif (!clear && !create_empty_fragment && !s->s3->empty_fragment_done)\n\t\t{\n\t\tif (s->s3->need_empty_fragments && type == SSL3_RT_APPLICATION_DATA)\n\t\t\t{\n\t\t\tprefix_len = do_ssl3_write(s, type, buf, 0, 1);\n\t\t\tif (prefix_len <= 0)\n\t\t\t\tgoto err;\n\t\t\tif (prefix_len >\n\t\t(SSL3_RT_HEADER_LENGTH + SSL3_RT_SEND_MAX_ENCRYPTED_OVERHEAD))\n\t\t\t\t{\n\t\t\t\tSSLerr(SSL_F_DO_SSL3_WRITE, ERR_R_INTERNAL_ERROR);\n\t\t\t\tgoto err;\n\t\t\t\t}\n\t\t\t}\n\t\ts->s3->empty_fragment_done = 1;\n\t\t}\n\tif (create_empty_fragment)\n\t\t{\n#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0\n\t\talign = (long)wb->buf + 2*SSL3_RT_HEADER_LENGTH;\n\t\talign = (-align)&(SSL3_ALIGN_PAYLOAD-1);\n#endif\n\t\tp = wb->buf + align;\n\t\twb->offset  = align;\n\t\t}\n\telse if (prefix_len)\n\t\t{\n\t\tp = wb->buf + wb->offset + prefix_len;\n\t\t}\n\telse\n\t\t{\n#if defined(SSL3_ALIGN_PAYLOAD) && SSL3_ALIGN_PAYLOAD!=0\n\t\talign = (long)wb->buf + SSL3_RT_HEADER_LENGTH;\n\t\talign = (-align)&(SSL3_ALIGN_PAYLOAD-1);\n#endif\n\t\tp = wb->buf + align;\n\t\twb->offset  = align;\n\t\t}\n\t*(p++)=type&0xff;\n\twr->type=type;\n\t*(p++)=(s->version>>8);\n\t*(p++)=s->version&0xff;\n\tplen=p;\n\tp+=2;\n\tif (s->enc_write_ctx && s->version >= TLS1_1_VERSION)\n\t\t{\n\t\tint mode = EVP_CIPHER_CTX_mode(s->enc_write_ctx);\n\t\tif (mode == EVP_CIPH_CBC_MODE)\n\t\t\t{\n\t\t\teivlen = EVP_CIPHER_CTX_iv_length(s->enc_write_ctx);\n\t\t\tif (eivlen <= 1)\n\t\t\t\teivlen = 0;\n\t\t\t}\n\t\telse if (mode == EVP_CIPH_GCM_MODE)\n\t\t\teivlen = EVP_GCM_TLS_EXPLICIT_IV_LEN;\n\t\t}\n\telse\n\t\teivlen = 0;\n\twr->data=p + eivlen;\n\twr->length=(int)len;\n\twr->input=(unsigned char *)buf;\n\tif (s->compress != NULL)\n\t\t{\n\t\tif (!ssl3_do_compress(s))\n\t\t\t{\n\t\t\tSSLerr(SSL_F_DO_SSL3_WRITE,SSL_R_COMPRESSION_FAILURE);\n\t\t\tgoto err;\n\t\t\t}\n\t\t}\n\telse\n\t\t{\n\t\tmemcpy(wr->data,wr->input,wr->length);\n\t\twr->input=wr->data;\n\t\t}\n\tif (mac_size != 0)\n\t\t{\n\t\tif (s->method->ssl3_enc->mac(s,&(p[wr->length + eivlen]),1) < 0)\n\t\t\tgoto err;\n\t\twr->length+=mac_size;\n\t\t}\n\twr->input=p;\n\twr->data=p;\n\tif (eivlen)\n\t\t{\n\t\twr->length += eivlen;\n\t\t}\n\ts->method->ssl3_enc->enc(s,1);\n\ts2n(wr->length,plen);\n\twr->type=type;\n\twr->length+=SSL3_RT_HEADER_LENGTH;\n\tif (create_empty_fragment)\n\t\t{\n\t\treturn wr->length;\n\t\t}\n\twb->left = prefix_len + wr->length;\n\ts->s3->wpend_tot=len;\n\ts->s3->wpend_buf=buf;\n\ts->s3->wpend_type=type;\n\ts->s3->wpend_ret=len;\n\treturn ssl3_write_pending(s,type,buf,len);\nerr:\n\treturn -1;\n\t}']