if (!bags) return 0;
if (!bags) goto err;
int dump_certs_keys_p12 (BIO *out, PKCS12 *p12, char *pass,	     int passlen, int options, char *pempass){	STACK_OF(PKCS7) *asafes;	STACK_OF(PKCS12_SAFEBAG) *bags;	int i, bagnid;	PKCS7 *p7;	if (!( asafes = PKCS12_unpack_authsafes(p12))) return 0;	for (i = 0; i < sk_PKCS7_num (asafes); i++) {		p7 = sk_PKCS7_value (asafes, i);		bagnid = OBJ_obj2nid (p7->type);		if (bagnid == NID_pkcs7_data) {			bags = PKCS12_unpack_p7data(p7);			if (options & INFO) BIO_printf (bio_err, "PKCS7 Data\n");		} else if (bagnid == NID_pkcs7_encrypted) {			if (options & INFO) {				BIO_printf(bio_err, "PKCS7 Encrypted data: ");				alg_print(bio_err, 					p7->d.encrypted->enc_data->algorithm);			}			bags = PKCS12_unpack_p7encdata(p7, pass, passlen);		} else continue;		if (!bags) return 0;	    	if (!dump_certs_pkeys_bags (out, bags, pass, passlen, 						 options, pempass)) {			sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free);			return 0;		}		sk_PKCS12_SAFEBAG_pop_free (bags, PKCS12_SAFEBAG_free);	}	sk_PKCS7_pop_free (asafes, PKCS7_free);	return 1;}