SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);
SSLerr(SSL_F_DTLS1_WRITE_APP_DATA_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);
dtls1_write_app_data_bytes(SSL *s, int type, const void *buf_, int len)	{	unsigned int n,tot;	int i;	if (SSL_in_init(s) && !s->in_handshake)		{		i=s->handshake_func(s);		if (i < 0) return(i);		if (i == 0)			{			SSLerr(SSL_F_SSL3_WRITE_BYTES,SSL_R_SSL_HANDSHAKE_FAILURE);			return -1;			}		}	tot = s->s3->wnum;	n = len - tot;	while( n)		{		/* dtls1_write_bytes sends one record at a time, sized according to 		 * the currently known MTU */		i = dtls1_write_bytes(s, type, buf_, len);		if (i <= 0) return i;				if ((i == (int)n) ||			(type == SSL3_RT_APPLICATION_DATA &&				(s->mode & SSL_MODE_ENABLE_PARTIAL_WRITE)))			{			/* next chunk of data should get another prepended empty fragment			 * in ciphersuites with known-IV weakness: */			s->s3->empty_fragment_done = 0;			return tot+i;			}		tot += i;		n-=i;		}	return tot;	}