if(X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x)))
if(!X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x)))
static void x509v3_cache_extensions(X509 *x){	BASIC_CONSTRAINTS *bs;	ASN1_BIT_STRING *usage;	ASN1_BIT_STRING *ns;	STACK_OF(ASN1_OBJECT) *extusage;	int i;	if(x->ex_flags & EXFLAG_SET) return;	X509_digest(x, EVP_sha1(), x->sha1_hash, NULL);	/* Does subject name match issuer ? */	if(X509_NAME_cmp(X509_get_subject_name(x), X509_get_issuer_name(x)))			 x->ex_flags |= EXFLAG_SS;	/* V1 should mean no extensions ... */	if(!X509_get_version(x)) x->ex_flags |= EXFLAG_V1;	/* Handle basic constraints */	if((bs=X509V3_X509_get_d2i(x, NID_basic_constraints, NULL, NULL))) {		if(bs->ca) x->ex_flags |= EXFLAG_CA;		if(bs->pathlen) {			if((bs->pathlen->type == V_ASN1_NEG_INTEGER)						|| !bs->ca) {				x->ex_flags |= EXFLAG_INVALID;				x->ex_pathlen = 0;			} else x->ex_pathlen = ASN1_INTEGER_get(bs->pathlen);		} else x->ex_pathlen = -1;		BASIC_CONSTRAINTS_free(bs);		x->ex_flags |= EXFLAG_BCONS;	}	/* Handle key usage */	if((usage=X509V3_X509_get_d2i(x, NID_key_usage, NULL, NULL))) {		if(usage->length > 0) {			x->ex_kusage = usage->data[0];			if(usage->length > 1) 				x->ex_kusage |= usage->data[1] << 8;		} else x->ex_kusage = 0;		x->ex_flags |= EXFLAG_KUSAGE;		ASN1_BIT_STRING_free(usage);	}	x->ex_xkusage = 0;	if((extusage=X509V3_X509_get_d2i(x, NID_ext_key_usage, NULL, NULL))) {		x->ex_flags |= EXFLAG_XKUSAGE;		for(i = 0; i < sk_ASN1_OBJECT_num(extusage); i++) {			switch(OBJ_obj2nid(sk_ASN1_OBJECT_value(extusage,i))) {				case NID_server_auth:				x->ex_xkusage |= XKU_SSL_SERVER;				break;				case NID_client_auth:				x->ex_xkusage |= XKU_SSL_CLIENT;				break;				case NID_email_protect:				x->ex_xkusage |= XKU_SMIME;				break;				case NID_code_sign:				x->ex_xkusage |= XKU_CODE_SIGN;				break;				case NID_ms_sgc:				case NID_ns_sgc:				x->ex_xkusage |= XKU_SGC;			}		}		sk_ASN1_OBJECT_pop_free(extusage, ASN1_OBJECT_free);	}	if((ns=X509V3_X509_get_d2i(x, NID_netscape_cert_type, NULL, NULL))) {		if(ns->length > 0) x->ex_nscert = ns->data[0];		else x->ex_nscert = 0;		x->ex_flags |= EXFLAG_NSCERT;		ASN1_BIT_STRING_free(ns);	}	x->ex_flags |= EXFLAG_SET;}