selected_certs_set(session, pcert, pcert_length,
ocsp, ocsp_length,
local_key, flags&GNUTLS_CERT_RETR_DEINIT_ALL?1:0,
- NULL, NULL);
+ cred->glob_ocsp_func, cred->glob_ocsp_func_ptr);
return 0;
} else {
*/
finished:
if (idx >= 0) {
- if (cred->certs[idx].ocsp_func) {
- selected_certs_set(session,
- &cred->certs[idx].cert_list[0],
- cred->certs[idx].cert_list_length,
- NULL, 0,
- cred->certs[idx].pkey, 0,
- cred->certs[idx].ocsp_func,
- cred->certs[idx].ocsp_func_ptr);
- } else {
- selected_certs_set(session,
- &cred->certs[idx].cert_list[0],
- cred->certs[idx].cert_list_length,
- &cred->certs[idx].ocsp_data[0],
- cred->certs[idx].ocsp_data_length,
- cred->certs[idx].pkey, 0,
- NULL, NULL);
+ gnutls_status_request_ocsp_func ocsp_func = NULL;
+ void *ocsp_ptr = NULL;
+ gnutls_ocsp_data_st *ocsp = NULL;
+ unsigned nocsp = 0;
+
+ if (cred->certs[idx].ocsp_data_length > 0) {
+ ocsp = &cred->certs[idx].ocsp_data[0];
+ nocsp = cred->certs[idx].ocsp_data_length;
+ } else if (cred->glob_ocsp_func != NULL) {
+ ocsp_func = cred->glob_ocsp_func;
+ ocsp_ptr = cred->glob_ocsp_func_ptr;
+ } else if (cred->certs[idx].ocsp_func != NULL) {
+ ocsp_func = cred->certs[idx].ocsp_func;
+ ocsp_ptr = cred->certs[idx].ocsp_func_ptr;
}
+
+ selected_certs_set(session,
+ &cred->certs[idx].cert_list[0],
+ cred->certs[idx].cert_list_length,
+ ocsp, nocsp,
+ cred->certs[idx].pkey, 0,
+ ocsp_func,
+ ocsp_ptr);
} else {
gnutls_assert();
/* Certificate does not support REQUESTED_ALGO. */
gnutls_datum_t resp;
unsigned free_resp = 0;
- assert(session->internals.selected_ocsp_func != NULL || ctx->cred->glob_ocsp_func != NULL ||
+ assert(session->internals.selected_ocsp_func != NULL ||
session->internals.selected_ocsp_length != 0);
/* The global ocsp callback function can only be used to return
} else {
return 0;
}
- } else if (ctx->cred->glob_ocsp_func) {
- if (ctx->cert_index == 0) {
- ret = ctx->cred->glob_ocsp_func(session, ctx->cred->glob_ocsp_func_ptr, &resp);
- free_resp = 1;
- } else {
- return 0;
- }
} else
return 0;
#ifdef ENABLE_OCSP
if ((session->internals.selected_ocsp_length > 0 ||
- session->internals.selected_ocsp_func ||
- cred->glob_ocsp_func) &&
+ session->internals.selected_ocsp_func) &&
_gnutls_hello_ext_is_present(session, GNUTLS_EXTENSION_STATUS_REQUEST)) {
/* append status response if available */
ret = _gnutls_extv_append_init(&buf);