MCPcopy Create free account
hub / github.com/apache/trafficserver / stapling_cache_response

Function stapling_cache_response

src/iocore/net/OCSPStapling.cc:804–833  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

802}
803
804static bool
805stapling_cache_response(TS_OCSP_RESPONSE *rsp, certinfo *cinf)
806{
807 unsigned char resp_der[MAX_STAPLING_DER];
808 unsigned char *p;
809 unsigned int resp_derlen;
810
811 p = resp_der;
812 resp_derlen = i2d_TS_OCSP_RESPONSE(rsp, &p);
813
814 if (resp_derlen == 0) {
815 Error("stapling_cache_response: cannot decode OCSP response for %s", cinf->certname);
816 return false;
817 }
818
819 if (resp_derlen > MAX_STAPLING_DER) {
820 Error("stapling_cache_response: OCSP response too big (%u bytes) for %s", resp_derlen, cinf->certname);
821 return false;
822 }
823
824 ink_mutex_acquire(&cinf->stapling_mutex);
825 memcpy(cinf->resp_der, resp_der, resp_derlen);
826 cinf->resp_derlen = resp_derlen;
827 cinf->is_expire = false;
828 cinf->expire_time = time(nullptr) + SSLConfigParams::ssl_ocsp_cache_timeout;
829 ink_mutex_release(&cinf->stapling_mutex);
830
831 Dbg(dbg_ctl_ssl_ocsp, "stapling_cache_response: success to cache response");
832 return true;
833}
834
835bool
836ssl_stapling_init_cert(SSL_CTX *ctx, X509 *cert, const char *certname, const char *rsp_file)

Callers 2

ssl_stapling_init_certFunction · 0.85

Calls 4

ink_mutex_acquireFunction · 0.85
ink_mutex_releaseFunction · 0.85
ErrorClass · 0.50
memcpyFunction · 0.50

Tested by

no test coverage detected