M_ASN1_I2D_put_EXP_opt(&a.session_id_context,i2d_ASN1_OCTET_STRING,4, v4);
int i2d_SSL_SESSION(in,pp)SSL_SESSION *in;unsigned char **pp;	{#define LSIZE2 (sizeof(long)*2)	int v1=0,v2=0,v3=0;	unsigned char buf[4],ibuf1[LSIZE2],ibuf2[LSIZE2];	unsigned char ibuf3[LSIZE2],ibuf4[LSIZE2];	long l;	SSL_SESSION_ASN1 a;	M_ASN1_I2D_vars(in);	if ((in == NULL) || ((in->cipher == NULL) && (in->cipher_id == 0)))		return(0);	/* Note that I cheat in the following 2 assignments.  I know	 * that if the ASN1_INTERGER passed to ASN1_INTEGER_set	 * is > sizeof(long)+1, the buffer will not be re-Malloc()ed.	 * This is a bit evil but makes things simple, no dynamic allocation	 * to clean up :-) */	a.version.length=LSIZE2;	a.version.type=V_ASN1_INTEGER;	a.version.data=ibuf1;	ASN1_INTEGER_set(&(a.version),SSL_SESSION_ASN1_VERSION);	a.ssl_version.length=LSIZE2;	a.ssl_version.type=V_ASN1_INTEGER;	a.ssl_version.data=ibuf2;	ASN1_INTEGER_set(&(a.ssl_version),in->ssl_version);	a.cipher.type=V_ASN1_OCTET_STRING;	a.cipher.data=buf;	if (in->cipher == NULL)		l=in->cipher_id;	else		l=in->cipher->id;	if (in->ssl_version == SSL2_VERSION)		{		a.cipher.length=3;		buf[0]=((unsigned char)(l>>16L))&0xff;		buf[1]=((unsigned char)(l>> 8L))&0xff;		buf[2]=((unsigned char)(l     ))&0xff;		}	else		{		a.cipher.length=2;		buf[0]=((unsigned char)(l>>8L))&0xff;		buf[1]=((unsigned char)(l    ))&0xff;		}	a.master_key.length=in->master_key_length;	a.master_key.type=V_ASN1_OCTET_STRING;	a.master_key.data=in->master_key;	a.session_id.length=in->session_id_length;	a.session_id.type=V_ASN1_OCTET_STRING;	a.session_id.data=in->session_id;	a.key_arg.length=in->key_arg_length;	a.key_arg.type=V_ASN1_OCTET_STRING;	a.key_arg.data=in->key_arg;	if (in->time != 0L)		{		a.time.length=LSIZE2;		a.time.type=V_ASN1_INTEGER;		a.time.data=ibuf3;		ASN1_INTEGER_set(&(a.time),in->time);		}	if (in->timeout != 0L)		{		a.timeout.length=LSIZE2;		a.timeout.type=V_ASN1_INTEGER;		a.timeout.data=ibuf4;		ASN1_INTEGER_set(&(a.timeout),in->timeout);		}	M_ASN1_I2D_len(&(a.version),		i2d_ASN1_INTEGER);	M_ASN1_I2D_len(&(a.ssl_version),	i2d_ASN1_INTEGER);	M_ASN1_I2D_len(&(a.cipher),		i2d_ASN1_OCTET_STRING);	M_ASN1_I2D_len(&(a.session_id),		i2d_ASN1_OCTET_STRING);	M_ASN1_I2D_len(&(a.master_key),		i2d_ASN1_OCTET_STRING);	if (in->key_arg_length > 0)		M_ASN1_I2D_len_IMP_opt(&(a.key_arg),i2d_ASN1_OCTET_STRING);	if (in->time != 0L)		M_ASN1_I2D_len_EXP_opt(&(a.time),i2d_ASN1_INTEGER,1,v1);	if (in->timeout != 0L)		M_ASN1_I2D_len_EXP_opt(&(a.timeout),i2d_ASN1_INTEGER,2,v2);	if (in->peer != NULL)		M_ASN1_I2D_len_EXP_opt(in->peer,i2d_X509,3,v3);	M_ASN1_I2D_seq_total();	M_ASN1_I2D_put(&(a.version),		i2d_ASN1_INTEGER);	M_ASN1_I2D_put(&(a.ssl_version),	i2d_ASN1_INTEGER);	M_ASN1_I2D_put(&(a.cipher),		i2d_ASN1_OCTET_STRING);	M_ASN1_I2D_put(&(a.session_id),		i2d_ASN1_OCTET_STRING);	M_ASN1_I2D_put(&(a.master_key),		i2d_ASN1_OCTET_STRING);	if (in->key_arg_length > 0)		M_ASN1_I2D_put_IMP_opt(&(a.key_arg),i2d_ASN1_OCTET_STRING,0);	if (in->time != 0L)		M_ASN1_I2D_put_EXP_opt(&(a.time),i2d_ASN1_INTEGER,1,v1);	if (in->timeout != 0L)		M_ASN1_I2D_put_EXP_opt(&(a.timeout),i2d_ASN1_INTEGER,2,v2);	if (in->peer != NULL)		M_ASN1_I2D_put_EXP_opt(in->peer,i2d_X509,3,v3);	M_ASN1_I2D_finish();	}