return 0;
}
+int set_ocsp_chain(canl_ocsprequest_t *ocspreq, STACK_OF(X509) *chain)
+{
+ if (!ocspreq)
+ ocspreq = calloc(1, sizeof(*ocspreq));
+ if (!ocspreq)
+ return 1;
+ if (chain)
+ ocspreq->cert_chain = chain;
+ return 0;
+}
+
static canl_x509store_t *
store_dup(canl_x509store_t *store_from)
{
ASN1_GENERALIZEDTIME *producedAt, *thisUpdate, *nextUpdate;
int timeout = -1; // -1 means no timeout - use blocking I/O
unsigned long verify_flags = 0;
- STACK_OF(X509) *verify_other = NULL;
if (!data || !data->cert) { // TODO || !data->issuer ?
result = EINVAL; //TODO error code
goto end;
/* The last param. may be used when OCSP API is fully defined*/
- rc = OCSP_basic_verify(basic, verify_other, store, verify_flags);
+ rc = OCSP_basic_verify(basic, data->cert_chain, store, verify_flags);
if (rc < 0)
rc = OCSP_basic_verify(basic, NULL, store, 0);
if (rc <= 0) {
OCSP_BASICRESP_free(basic);
if (chosenurl)
free(chosenurl);
- if (verify_other)
- sk_X509_pop_free(verify_other, X509_free);
if (store)
X509_STORE_free(store);
char *url;
X509 *cert;
X509 *issuer;
+ STACK_OF(X509) *cert_chain;
canl_x509store_t *store;
X509 *sign_cert;
EVP_PKEY *sign_key;
int set_ocsp_url(canl_ocsprequest_t *ocspreq, char *url);
int set_ocsp_issuer(canl_ocsprequest_t *ocspreq, X509 *issuer);
int set_ocsp_store(canl_ocsprequest_t *ocspreq, canl_x509store_t *store);
+int set_ocsp_chain(canl_ocsprequest_t *ocspreq, STACK_OF(X509) *chain);
int ocsprequest_init(canl_ocsprequest_t **ocspreq);
void ocsprequest_free(canl_ocsprequest_t *or);
if (cert_dir){
canl_x509store_t *c_store = NULL;
if (!canl_x509store_init(&c_store)) {
- /* TODO This is obviously wrong, cert_dir is not ca_cert_dir*/
c_store->ca_dir = strdup(cert_dir);
set_ocsp_store(ocsp_data, c_store);
canl_x509store_free(c_store);
}
set_ocsp_skew(ocsp_data, MAX_VALIDITY_PERIOD);
set_ocsp_maxage(ocsp_data, -1);
+ set_ocsp_chain(ocsp_data, ctx->chain);
/*Timeout should be set here
set_ocsp_timeout(pvd->timeout, -1); */
do_ocsp_verify (ocsp_data);
}
return(0);
-
}
/**********************************************************************