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

Function md_cert_get_ct_scts

modules/md/md_crypt.c:2137–2180  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2135}
2136
2137apr_status_t md_cert_get_ct_scts(apr_array_header_t *scts, apr_pool_t *p, const md_cert_t *cert)
2138{
2139#if MD_HAVE_CT
2140 int nid, i, idx, critical;
2141 STACK_OF(SCT) *sct_list;
2142 SCT *sct_handle;
2143 md_sct *sct;
2144 size_t len;
2145 const char *data;
2146
2147 nid = get_ct_scts_nid();
2148 if (NID_undef == nid) return APR_ENOTIMPL;
2149
2150 idx = -1;
2151 while (1) {
2152 sct_list = X509_get_ext_d2i(cert->x509, nid, &critical, &idx);
2153 if (sct_list) {
2154 for (i = 0; i < sk_SCT_num(sct_list); i++) {
2155 sct_handle = sk_SCT_value(sct_list, i);
2156 if (sct_handle) {
2157 sct = apr_pcalloc(p, sizeof(*sct));
2158 sct->version = SCT_get_version(sct_handle);
2159 sct->timestamp = apr_time_from_msec(SCT_get_timestamp(sct_handle));
2160 len = SCT_get0_log_id(sct_handle, (unsigned char**)&data);
2161 sct->logid = md_data_make_pcopy(p, data, len);
2162 sct->signature_type_nid = SCT_get_signature_nid(sct_handle);
2163 len = SCT_get0_signature(sct_handle, (unsigned char**)&data);
2164 sct->signature = md_data_make_pcopy(p, data, len);
2165
2166 APR_ARRAY_PUSH(scts, md_sct*) = sct;
2167 }
2168 }
2169 }
2170 if (idx < 0) break;
2171 }
2172 md_log_perror(MD_LOG_MARK, MD_LOG_TRACE3, 0, p, "ct_sct, found %d SCT extensions", scts->nelts);
2173 return APR_SUCCESS;
2174#else
2175 (void)scts;
2176 (void)p;
2177 (void)cert;
2178 return APR_ENOTIMPL;
2179#endif
2180}
2181
2182apr_status_t md_cert_get_ocsp_responder_url(const char **purl, apr_pool_t *p, const md_cert_t *cert)
2183{

Callers 1

md_status.cFile · 0.85

Calls 3

get_ct_scts_nidFunction · 0.85
md_data_make_pcopyFunction · 0.85
md_log_perrorFunction · 0.85

Tested by

no test coverage detected