MCPcopy Create free account
hub / github.com/apache/httpd / stapling_get_cached_response

Function stapling_get_cached_response

modules/ssl/ssl_util_stapling.c:324–372  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

322}
323
324static void stapling_get_cached_response(server_rec *s, OCSP_RESPONSE **prsp,
325 BOOL *pok, certinfo *cinf,
326 apr_pool_t *pool)
327{
328 SSLModConfigRec *mc = myModConfig(s);
329 apr_status_t rv;
330 OCSP_RESPONSE *rsp;
331 unsigned char resp_der[MAX_STAPLING_DER];
332 const unsigned char *p;
333 unsigned int resp_derlen = MAX_STAPLING_DER;
334
335 if (mc->stapling_cache->flags & AP_SOCACHE_FLAG_NOTMPSAFE)
336 stapling_cache_mutex_on(s);
337 rv = mc->stapling_cache->retrieve(mc->stapling_cache_context, s,
338 cinf->idx, sizeof(cinf->idx),
339 resp_der, &resp_derlen, pool);
340 if (mc->stapling_cache->flags & AP_SOCACHE_FLAG_NOTMPSAFE)
341 stapling_cache_mutex_off(s);
342 if (rv != APR_SUCCESS) {
343 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01930)
344 "stapling_get_cached_response: cache miss");
345 return;
346 }
347 if (resp_derlen <= 1) {
348 /* should-not-occur; must have at least valid-when-stored flag +
349 * OCSPResponseStatus
350 */
351 ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(01931)
352 "stapling_get_cached_response: response length invalid??");
353 return;
354 }
355 p = resp_der;
356 if (*p) /* valid when stored */
357 *pok = TRUE;
358 else
359 *pok = FALSE;
360 p++;
361 resp_derlen--;
362 rsp = d2i_OCSP_RESPONSE(NULL, &p, resp_derlen);
363 if (!rsp) {
364 ap_log_error(APLOG_MARK, APLOG_ERR, 0, s, APLOGNO(01932)
365 "stapling_get_cached_response: response parse error??");
366 return;
367 }
368 ap_log_error(APLOG_MARK, APLOG_DEBUG, 0, s, APLOGNO(01933)
369 "stapling_get_cached_response: cache hit");
370
371 *prsp = rsp;
372}
373
374static int stapling_set_response(SSL *ssl, OCSP_RESPONSE *rsp)
375{

Callers 1

Calls 3

stapling_cache_mutex_onFunction · 0.85
stapling_cache_mutex_offFunction · 0.85
ap_log_errorFunction · 0.50

Tested by

no test coverage detected