if (!X509_check_purpose(x, ctx->purpose, i))
ret = X509_check_purpose(x, ctx->purpose, i); if ((ret == 0) || ((ctx->flags & X509_V_FLAG_X509_STRICT) && (ret != 1)))
static int check_chain_purpose(X509_STORE_CTX *ctx){#ifdef OPENSSL_NO_CHAIN_VERIFY	return 1;#else	int i, ok=0;	X509 *x;	int (*cb)();	cb=ctx->verify_cb;	/* Check all untrusted certificates */	for (i = 0; i < ctx->last_untrusted; i++)		{		x = sk_X509_value(ctx->chain, i);		if (!(ctx->flags & X509_V_FLAG_IGNORE_CRITICAL)			&& (x->ex_flags & EXFLAG_CRITICAL))			{			ctx->error = X509_V_ERR_UNHANDLED_CRITICAL_EXTENSION;			ctx->error_depth = i;			ctx->current_cert = x;			ok=cb(0,ctx);			if (!ok) goto end;			}		if (!X509_check_purpose(x, ctx->purpose, i))			{			if (i)				ctx->error = X509_V_ERR_INVALID_CA;			else				ctx->error = X509_V_ERR_INVALID_PURPOSE;			ctx->error_depth = i;			ctx->current_cert = x;			ok=cb(0,ctx);			if (!ok) goto end;			}		/* Check pathlen */		if ((i > 1) && (x->ex_pathlen != -1)			   && (i > (x->ex_pathlen + 1)))			{			ctx->error = X509_V_ERR_PATH_LENGTH_EXCEEDED;			ctx->error_depth = i;			ctx->current_cert = x;			ok=cb(0,ctx);			if (!ok) goto end;			}		}	ok = 1; end:	return ok;#endif}