CFLAGS_DEL=-Wall -g -I${top_srcdir}/src -I.
 LFLAGS_DEL=-L. -lcanl_c -lcrypto 
 
-HEAD_CANL=canl.h canl_locl.h canl_err.h canl_cred.h canl_ssl.h canl_mech_ssl.h
+HEAD_CANL=canl.h canl_locl.h canl_err.h canl_cred.h canl_ssl.h canl_mech_ssl.h canl_ocsp.h
 
 SRC_CLI=canl_sample_client.c
 HEAD_CLI=canl.h
 
     }
 
     /*get url from cert or use some implicit value*/
+    /*TODO duplicate the value*/
     if (data->url)
-        host = data->url;
+        chosenurl = strdup(data->url);
     else
-        if (!get_ocsp_url_from_aia(data->cert, &host)) {
+        if (!get_ocsp_url_from_aia(data->cert, &chosenurl)) {
             result = CANL_OCSPRESULT_ERROR_NOAIAOCSPURI;
             goto end;
         }
     if (req) OCSP_REQUEST_free(req);
     if (resp) OCSP_RESPONSE_free(resp);
     if (basic) OCSP_BASICRESP_free(basic);
+    if (chosenurl)
+        free(chosenurl);
     if (verify_other)
         sk_X509_pop_free(verify_other, X509_free);
     if (store)
 
 int canl_x509store_init(canl_x509store_t **cs);
 void canl_x509store_free(canl_x509store_t *cs);
 
+int do_ocsp_verify (canl_ocsprequest_t *data);
+
 #endif
 
     /*
        OCSP check
      */
-//    do_ocsp_verify (ocsp_data);
+    if (!ocsp_data)
+        ocsprequest_init(&ocsp_data);
+    if (ocsp_data) {
+        if (ctx->current_cert)
+            set_ocsp_cert(ocsp_data, ctx->current_cert);
+        if (ctx->current_issuer)
+            set_ocsp_issuer(ocsp_data, ctx->current_issuer);
+        do_ocsp_verify (ocsp_data);
+        /* TODO sign key and cert */
+    }
 
     EVP_PKEY_free(key);