}
static int check_chain_purpose(X509_STORE_CTX *ctx){#ifdef NO_CHAIN_VERIFY	return 1;#else	int i, ok=0;	X509 *x;	int (*cb)();	cb=ctx->verify_cb;	if (cb == NULL) cb=null_callback;	/* Check all untrusted certificates */	for(i = 0; i < ctx->last_untrusted; i++) {		x = sk_X509_value(ctx->chain, i);		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}