X-Git-Url: https://git.openssl.org/?p=openssl.git;a=blobdiff_plain;f=include%2Fopenssl%2Fct.h;h=e753fc94b8ba403aa79ef4bc149a97bab73767d8;hp=3b011cc932c1cd0c579acd59c3e717a498d16d41;hb=5a7ad1f08bfccbdad0f20920f9c284bba036fb70;hpb=69588edbaa424beb71c6a9b1be416588232cb78c diff --git a/include/openssl/ct.h b/include/openssl/ct.h index 3b011cc932..e753fc94b8 100644 --- a/include/openssl/ct.h +++ b/include/openssl/ct.h @@ -64,27 +64,35 @@ DEFINE_STACK_OF(CTLOG) /* Creates a new, empty policy evaluation context */ CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void); -/* Deletes a policy evaluation context */ +/* Deletes a policy evaluation context and anything it owns. */ void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx); /* Gets the peer certificate that the SCTs are for */ X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx); -/* Sets the certificate associated with the received SCTs */ -void CT_POLICY_EVAL_CTX_set0_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert); +/* + * Sets the certificate associated with the received SCTs. + * Incremenets the reference count of cert. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert); /* Gets the issuer of the aforementioned certificate */ X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx); -/* Sets the issuer of the certificate associated with the received SCTs */ -void CT_POLICY_EVAL_CTX_set0_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer); +/* + * Sets the issuer of the certificate associated with the received SCTs. + * Increments the reference count of issuer. + * Returns 1 on success, 0 otherwise. + */ +int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer); /* Gets the CT logs that are trusted sources of SCTs */ const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx); -/* Sets the log store that is in use */ -void CT_POLICY_EVAL_CTX_set0_log_store(CT_POLICY_EVAL_CTX *ctx, - CTLOG_STORE *log_store); +/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */ +void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx, + CTLOG_STORE *log_store); /***************** * SCT functions * @@ -408,18 +416,15 @@ __owur int o2i_SCT_signature(SCT *sct, const unsigned char **in, size_t len); /* * Creates a new CT log instance with the given |public_key| and |name|. + * Returns NULL if malloc fails or if |public_key| cannot be converted to DER. * Should be deleted by the caller using CTLOG_free when no longer needed. */ CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name); /* - * Creates a new, blank CT log instance. - * Should be deleted by the caller using CTLOG_free when no longer needed. - */ -CTLOG *CTLOG_new_null(void); - -/* - * Creates a new CT |ct_log| instance with the given base64 public_key and |name|. + * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER + * in |pkey_base64|. The |name| is a string to help users identify this log. + * Returns 1 on success, 0 on failure. * Should be deleted by the caller using CTLOG_free when no longer needed. */ int CTLOG_new_from_base64(CTLOG ** ct_log,