This reverts commit
8986df802db9b5338d9d50a54232ebae4dbcf6dd.
Windows does not guarantee a particular certificate ordering, even
though TLS may have its own ordering/relationship guarantees. Recent
versions of Windows 11 reversed the ordering of ceritifcates returned by
CertEnumCertificatesInStore, therefore this commit no longer works as
initially intended. libcurl makes no guarantees about certificate
ordering if the operating system can't.
Ref: https://github.com/curl/curl/issues/9706
Closes https://github.com/curl/curl/pull/11536
struct Curl_easy *data;
CURLcode result;
int idx;
- int certs_count;
};
static bool
if(valid_cert_encoding(ccert_context)) {
const char *beg = (const char *) ccert_context->pbCertEncoded;
const char *end = beg + ccert_context->cbCertEncoded;
- int insert_index = (args->certs_count - 1) - args->idx;
- args->result = Curl_extract_certinfo(args->data, insert_index,
- beg, end);
- args->idx++;
+ args->result = Curl_extract_certinfo(args->data, (args->idx)++, beg, end);
}
return args->result == CURLE_OK;
}
struct Adder_args args;
args.data = data;
args.idx = 0;
- args.certs_count = certs_count;
traverse_cert_store(ccert_context, add_cert_to_certinfo, &args);
result = args.result;
}