if(!p7) { PKCS7err(PKCS7_F_PKCS7_IGET_SIGNERS,PKCS7_R_INVALID_NULL_POINTER); return NULL; }
STACK_OF(X509) *PKCS7_iget_signers(PKCS7 *p7, STACK_OF(X509) *certs, int flags){	STACK_OF(X509) *signers;	STACK_OF(PKCS7_SIGNER_INFO) *sinfos;	PKCS7_SIGNER_INFO *si;	PKCS7_ISSUER_AND_SERIAL *ias;	X509 *signer;	int i;	if(!PKCS7_type_is_signed(p7)) {		PKCS7err(PKCS7_F_PKCS7_IGET_SIGNERS,PKCS7_R_WRONG_CONTENT_TYPE);		return NULL;	}	if(!(signers = sk_X509_new(NULL))) {		PKCS7err(PKCS7_F_PKCS7_IGET_SIGNERS,ERR_R_MALLOC_FAILURE);		return NULL;	}	/* Collect all the signers together */	sinfos = PKCS7_get_signer_info(p7);	if(sk_PKCS7_SIGNER_INFO_num(sinfos) <= 0) {		PKCS7err(PKCS7_F_PKCS7_IGET_SIGNERS,PKCS7_R_NO_SIGNERS);		return 0;	}	for (i = 0; i < sk_PKCS7_SIGNER_INFO_num(sinfos); i++)	{	    si = sk_PKCS7_SIGNER_INFO_value(sinfos, i);	    ias = si->issuer_and_serial;	    signer = NULL;		/* If any certificates passed they take priority */	    if (certs) signer = X509_find_by_issuer_and_serial (certs,					 	ias->issuer, ias->serial);	    if (!signer && !(flags & PKCS7_NOINTERN)			&& p7->d.sign->cert) signer =		              X509_find_by_issuer_and_serial (p7->d.sign->cert,					      	ias->issuer, ias->serial);	    if (!signer) {			PKCS7err(PKCS7_F_PKCS7_IGET_SIGNERS,PKCS7_R_SIGNER_CERTIFICATE_NOT_FOUND);			sk_X509_free(signers);			return 0;	    }	    sk_X509_push(signers, signer);	}	return signers;}