static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,
			X509 **pissuer, int *pscore, unsigned int *preasons,
			STACK_OF(X509_CRL) *crls)
	{
	int i, crl_score, best_score = *pscore;
	unsigned int reasons, best_reasons;
	X509 *x = ctx->current_cert;
	X509_CRL *crl, *best_crl = NULL;
	X509 *crl_issuer, *best_crl_issuer = NULL;
	for (i = 0; i < sk_X509_CRL_num(crls); i++)
		{
		crl = sk_X509_CRL_value(crls, i);
		reasons = *preasons;
		crl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x);
		if (crl_score > best_score)
			{
			best_crl = crl;
			best_crl_issuer = crl_issuer;
			best_score = crl_score;
			best_reasons = reasons;
			}
		}
	if (best_crl)
		{
		if (*pcrl)
			X509_CRL_free(*pcrl);
		*pcrl = best_crl;
		*pissuer = best_crl_issuer;
		*pscore = best_score;
		*preasons = best_reasons;
		CRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL);
		if (*pdcrl)
			{
			X509_CRL_free(*pdcrl);
			*pdcrl = NULL;
			}
		get_delta_sk(ctx, pdcrl, pscore, best_crl, crls);
		}
	if (best_score >= CRL_SCORE_VALID)
		return 1;
	return 0;
	}
['static int get_crl_sk(X509_STORE_CTX *ctx, X509_CRL **pcrl, X509_CRL **pdcrl,\n\t\t\tX509 **pissuer, int *pscore, unsigned int *preasons,\n\t\t\tSTACK_OF(X509_CRL) *crls)\n\t{\n\tint i, crl_score, best_score = *pscore;\n\tunsigned int reasons, best_reasons;\n\tX509 *x = ctx->current_cert;\n\tX509_CRL *crl, *best_crl = NULL;\n\tX509 *crl_issuer, *best_crl_issuer = NULL;\n\tfor (i = 0; i < sk_X509_CRL_num(crls); i++)\n\t\t{\n\t\tcrl = sk_X509_CRL_value(crls, i);\n\t\treasons = *preasons;\n\t\tcrl_score = get_crl_score(ctx, &crl_issuer, &reasons, crl, x);\n\t\tif (crl_score > best_score)\n\t\t\t{\n\t\t\tbest_crl = crl;\n\t\t\tbest_crl_issuer = crl_issuer;\n\t\t\tbest_score = crl_score;\n\t\t\tbest_reasons = reasons;\n\t\t\t}\n\t\t}\n\tif (best_crl)\n\t\t{\n\t\tif (*pcrl)\n\t\t\tX509_CRL_free(*pcrl);\n\t\t*pcrl = best_crl;\n\t\t*pissuer = best_crl_issuer;\n\t\t*pscore = best_score;\n\t\t*preasons = best_reasons;\n\t\tCRYPTO_add(&best_crl->references, 1, CRYPTO_LOCK_X509_CRL);\n\t\tif (*pdcrl)\n\t\t\t{\n\t\t\tX509_CRL_free(*pdcrl);\n\t\t\t*pdcrl = NULL;\n\t\t\t}\n\t\tget_delta_sk(ctx, pdcrl, pscore, best_crl, crls);\n\t\t}\n\tif (best_score >= CRL_SCORE_VALID)\n\t\treturn 1;\n\treturn 0;\n\t}']