Lines Matching refs:sct
24 SCT *sct = OPENSSL_zalloc(sizeof(*sct)); in SCT_new() local
26 if (sct == NULL) in SCT_new()
29 sct->entry_type = CT_LOG_ENTRY_TYPE_NOT_SET; in SCT_new()
30 sct->version = SCT_VERSION_NOT_SET; in SCT_new()
31 return sct; in SCT_new()
34 void SCT_free(SCT *sct) in SCT_free() argument
36 if (sct == NULL) in SCT_free()
39 OPENSSL_free(sct->log_id); in SCT_free()
40 OPENSSL_free(sct->ext); in SCT_free()
41 OPENSSL_free(sct->sig); in SCT_free()
42 OPENSSL_free(sct->sct); in SCT_free()
43 OPENSSL_free(sct); in SCT_free()
51 int SCT_set_version(SCT *sct, sct_version_t version) in SCT_set_version() argument
57 sct->version = version; in SCT_set_version()
58 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set_version()
62 int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type) in SCT_set_log_entry_type() argument
64 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set_log_entry_type()
69 sct->entry_type = entry_type; in SCT_set_log_entry_type()
78 int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len) in SCT_set0_log_id() argument
80 if (sct->version == SCT_VERSION_V1 && log_id_len != CT_V1_HASHLEN) { in SCT_set0_log_id()
85 OPENSSL_free(sct->log_id); in SCT_set0_log_id()
86 sct->log_id = log_id; in SCT_set0_log_id()
87 sct->log_id_len = log_id_len; in SCT_set0_log_id()
88 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set0_log_id()
92 int SCT_set1_log_id(SCT *sct, const unsigned char *log_id, size_t log_id_len) in SCT_set1_log_id() argument
94 if (sct->version == SCT_VERSION_V1 && log_id_len != CT_V1_HASHLEN) { in SCT_set1_log_id()
99 OPENSSL_free(sct->log_id); in SCT_set1_log_id()
100 sct->log_id = NULL; in SCT_set1_log_id()
101 sct->log_id_len = 0; in SCT_set1_log_id()
102 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set1_log_id()
105 sct->log_id = OPENSSL_memdup(log_id, log_id_len); in SCT_set1_log_id()
106 if (sct->log_id == NULL) in SCT_set1_log_id()
108 sct->log_id_len = log_id_len; in SCT_set1_log_id()
114 void SCT_set_timestamp(SCT *sct, uint64_t timestamp) in SCT_set_timestamp() argument
116 sct->timestamp = timestamp; in SCT_set_timestamp()
117 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set_timestamp()
120 int SCT_set_signature_nid(SCT *sct, int nid) in SCT_set_signature_nid() argument
124 sct->hash_alg = TLSEXT_hash_sha256; in SCT_set_signature_nid()
125 sct->sig_alg = TLSEXT_signature_rsa; in SCT_set_signature_nid()
126 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set_signature_nid()
129 sct->hash_alg = TLSEXT_hash_sha256; in SCT_set_signature_nid()
130 sct->sig_alg = TLSEXT_signature_ecdsa; in SCT_set_signature_nid()
131 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set_signature_nid()
139 void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len) in SCT_set0_extensions() argument
141 OPENSSL_free(sct->ext); in SCT_set0_extensions()
142 sct->ext = ext; in SCT_set0_extensions()
143 sct->ext_len = ext_len; in SCT_set0_extensions()
144 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set0_extensions()
147 int SCT_set1_extensions(SCT *sct, const unsigned char *ext, size_t ext_len) in SCT_set1_extensions() argument
149 OPENSSL_free(sct->ext); in SCT_set1_extensions()
150 sct->ext = NULL; in SCT_set1_extensions()
151 sct->ext_len = 0; in SCT_set1_extensions()
152 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set1_extensions()
155 sct->ext = OPENSSL_memdup(ext, ext_len); in SCT_set1_extensions()
156 if (sct->ext == NULL) in SCT_set1_extensions()
158 sct->ext_len = ext_len; in SCT_set1_extensions()
163 void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len) in SCT_set0_signature() argument
165 OPENSSL_free(sct->sig); in SCT_set0_signature()
166 sct->sig = sig; in SCT_set0_signature()
167 sct->sig_len = sig_len; in SCT_set0_signature()
168 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set0_signature()
171 int SCT_set1_signature(SCT *sct, const unsigned char *sig, size_t sig_len) in SCT_set1_signature() argument
173 OPENSSL_free(sct->sig); in SCT_set1_signature()
174 sct->sig = NULL; in SCT_set1_signature()
175 sct->sig_len = 0; in SCT_set1_signature()
176 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set1_signature()
179 sct->sig = OPENSSL_memdup(sig, sig_len); in SCT_set1_signature()
180 if (sct->sig == NULL) in SCT_set1_signature()
182 sct->sig_len = sig_len; in SCT_set1_signature()
187 sct_version_t SCT_get_version(const SCT *sct) in SCT_get_version() argument
189 return sct->version; in SCT_get_version()
192 ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct) in SCT_get_log_entry_type() argument
194 return sct->entry_type; in SCT_get_log_entry_type()
197 size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id) in SCT_get0_log_id() argument
199 *log_id = sct->log_id; in SCT_get0_log_id()
200 return sct->log_id_len; in SCT_get0_log_id()
203 uint64_t SCT_get_timestamp(const SCT *sct) in SCT_get_timestamp() argument
205 return sct->timestamp; in SCT_get_timestamp()
208 int SCT_get_signature_nid(const SCT *sct) in SCT_get_signature_nid() argument
210 if (sct->version == SCT_VERSION_V1) { in SCT_get_signature_nid()
211 if (sct->hash_alg == TLSEXT_hash_sha256) { in SCT_get_signature_nid()
212 switch (sct->sig_alg) { in SCT_get_signature_nid()
225 size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext) in SCT_get0_extensions() argument
227 *ext = sct->ext; in SCT_get0_extensions()
228 return sct->ext_len; in SCT_get0_extensions()
231 size_t SCT_get0_signature(const SCT *sct, unsigned char **sig) in SCT_get0_signature() argument
233 *sig = sct->sig; in SCT_get0_signature()
234 return sct->sig_len; in SCT_get0_signature()
237 int SCT_is_complete(const SCT *sct) in SCT_is_complete() argument
239 switch (sct->version) { in SCT_is_complete()
243 return sct->log_id != NULL && SCT_signature_is_complete(sct); in SCT_is_complete()
245 return sct->sct != NULL; /* Just need cached encoding */ in SCT_is_complete()
249 int SCT_signature_is_complete(const SCT *sct) in SCT_signature_is_complete() argument
251 return SCT_get_signature_nid(sct) != NID_undef && in SCT_signature_is_complete()
252 sct->sig != NULL && sct->sig_len > 0; in SCT_signature_is_complete()
255 sct_source_t SCT_get_source(const SCT *sct) in SCT_get_source() argument
257 return sct->source; in SCT_get_source()
260 int SCT_set_source(SCT *sct, sct_source_t source) in SCT_set_source() argument
262 sct->source = source; in SCT_set_source()
263 sct->validation_status = SCT_VALIDATION_STATUS_NOT_SET; in SCT_set_source()
267 return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_X509); in SCT_set_source()
269 return SCT_set_log_entry_type(sct, CT_LOG_ENTRY_TYPE_PRECERT); in SCT_set_source()
277 sct_validation_status_t SCT_get_validation_status(const SCT *sct) in SCT_get_validation_status() argument
279 return sct->validation_status; in SCT_get_validation_status()
282 int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx) in SCT_validate() argument
293 if (sct->version != SCT_VERSION_V1) { in SCT_validate()
294 sct->validation_status = SCT_VALIDATION_STATUS_UNKNOWN_VERSION; in SCT_validate()
299 sct->log_id, sct->log_id_len); in SCT_validate()
303 sct->validation_status = SCT_VALIDATION_STATUS_UNKNOWN_LOG; in SCT_validate()
316 if (SCT_get_log_entry_type(sct) == CT_LOG_ENTRY_TYPE_PRECERT) { in SCT_validate()
320 sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED; in SCT_validate()
353 sct->validation_status = SCT_VALIDATION_STATUS_UNVERIFIED; in SCT_validate()
355 sct->validation_status = SCT_CTX_verify(sctx, sct) == 1 ? in SCT_validate()
359 is_sct_valid = sct->validation_status == SCT_VALIDATION_STATUS_VALID; in SCT_validate()
376 SCT *sct = sk_SCT_value(scts, i); in SCT_LIST_validate() local
378 if (sct == NULL) in SCT_LIST_validate()
381 is_sct_valid = SCT_validate(sct, ctx); in SCT_LIST_validate()