M_ASN1_I2D_INF_seq_end();
int i2d_PKCS7(PKCS7 *a, unsigned char **pp)	{	M_ASN1_I2D_vars(a);	if (a->asn1 != NULL)		{		if (pp == NULL)			return((int)a->length);		memcpy(*pp,a->asn1,(int)a->length);		*pp+=a->length;		return((int)a->length);		}	ret+=4; /* sequence, BER header plus '0 0' end padding */	M_ASN1_I2D_len(a->type,i2d_ASN1_OBJECT);	if (a->d.ptr != NULL)		{		ret+=4; /* explicit tag [ 0 ] BER plus '0 0' */		switch (OBJ_obj2nid(a->type))			{		case NID_pkcs7_data:			M_ASN1_I2D_len(a->d.data,i2d_ASN1_OCTET_STRING);			break;		case NID_pkcs7_signed:			M_ASN1_I2D_len(a->d.sign,i2d_PKCS7_SIGNED);			break;		case NID_pkcs7_enveloped:			M_ASN1_I2D_len(a->d.enveloped,i2d_PKCS7_ENVELOPE);			break;		case NID_pkcs7_signedAndEnveloped:			M_ASN1_I2D_len(a->d.signed_and_enveloped,				i2d_PKCS7_SIGN_ENVELOPE);			break;		case NID_pkcs7_digest:			M_ASN1_I2D_len(a->d.digest,i2d_PKCS7_DIGEST);			break;		case NID_pkcs7_encrypted:			M_ASN1_I2D_len(a->d.encrypted,i2d_PKCS7_ENCRYPT);			break;		default:			break;			}		}	r=ret;	if (pp == NULL) return(r);	p= *pp;	M_ASN1_I2D_INF_seq_start(V_ASN1_SEQUENCE,V_ASN1_UNIVERSAL);	M_ASN1_I2D_put(a->type,i2d_ASN1_OBJECT);	if (a->d.ptr != NULL)		{		M_ASN1_I2D_INF_seq_start(0,V_ASN1_CONTEXT_SPECIFIC);		switch (OBJ_obj2nid(a->type))			{		case NID_pkcs7_data:			M_ASN1_I2D_put(a->d.data,i2d_ASN1_OCTET_STRING);			break;		case NID_pkcs7_signed:			M_ASN1_I2D_put(a->d.sign,i2d_PKCS7_SIGNED);			break;		case NID_pkcs7_enveloped:			M_ASN1_I2D_put(a->d.enveloped,i2d_PKCS7_ENVELOPE);			break;		case NID_pkcs7_signedAndEnveloped:			M_ASN1_I2D_put(a->d.signed_and_enveloped,				i2d_PKCS7_SIGN_ENVELOPE);			break;		case NID_pkcs7_digest:			M_ASN1_I2D_put(a->d.digest,i2d_PKCS7_DIGEST);			break;		case NID_pkcs7_encrypted:			M_ASN1_I2D_put(a->d.encrypted,i2d_PKCS7_ENCRYPT);			break;		default:			break;			}		M_ASN1_I2D_INF_seq_end();		}	M_ASN1_I2D_INF_seq_end();	M_ASN1_I2D_finish();	}