Blame include/openssl/ct.h

Packit c4476c
/*
Packit c4476c
 * Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
Packit c4476c
 *
Packit c4476c
 * Licensed under the OpenSSL license (the "License").  You may not use
Packit c4476c
 * this file except in compliance with the License.  You can obtain a copy
Packit c4476c
 * in the file LICENSE in the source distribution or at
Packit c4476c
 * https://www.openssl.org/source/license.html
Packit c4476c
 */
Packit c4476c
Packit c4476c
#ifndef HEADER_CT_H
Packit c4476c
# define HEADER_CT_H
Packit c4476c
Packit c4476c
# include <openssl/opensslconf.h>
Packit c4476c
Packit c4476c
# ifndef OPENSSL_NO_CT
Packit c4476c
# include <openssl/ossl_typ.h>
Packit c4476c
# include <openssl/safestack.h>
Packit c4476c
# include <openssl/x509.h>
Packit c4476c
# include <openssl/cterr.h>
Packit c4476c
# ifdef  __cplusplus
Packit c4476c
extern "C" {
Packit c4476c
# endif
Packit c4476c
Packit c4476c
Packit c4476c
/* Minimum RSA key size, from RFC6962 */
Packit c4476c
# define SCT_MIN_RSA_BITS 2048
Packit c4476c
Packit c4476c
/* All hashes are SHA256 in v1 of Certificate Transparency */
Packit c4476c
# define CT_V1_HASHLEN SHA256_DIGEST_LENGTH
Packit c4476c
Packit c4476c
typedef enum {
Packit c4476c
    CT_LOG_ENTRY_TYPE_NOT_SET = -1,
Packit c4476c
    CT_LOG_ENTRY_TYPE_X509 = 0,
Packit c4476c
    CT_LOG_ENTRY_TYPE_PRECERT = 1
Packit c4476c
} ct_log_entry_type_t;
Packit c4476c
Packit c4476c
typedef enum {
Packit c4476c
    SCT_VERSION_NOT_SET = -1,
Packit c4476c
    SCT_VERSION_V1 = 0
Packit c4476c
} sct_version_t;
Packit c4476c
Packit c4476c
typedef enum {
Packit c4476c
    SCT_SOURCE_UNKNOWN,
Packit c4476c
    SCT_SOURCE_TLS_EXTENSION,
Packit c4476c
    SCT_SOURCE_X509V3_EXTENSION,
Packit c4476c
    SCT_SOURCE_OCSP_STAPLED_RESPONSE
Packit c4476c
} sct_source_t;
Packit c4476c
Packit c4476c
typedef enum {
Packit c4476c
    SCT_VALIDATION_STATUS_NOT_SET,
Packit c4476c
    SCT_VALIDATION_STATUS_UNKNOWN_LOG,
Packit c4476c
    SCT_VALIDATION_STATUS_VALID,
Packit c4476c
    SCT_VALIDATION_STATUS_INVALID,
Packit c4476c
    SCT_VALIDATION_STATUS_UNVERIFIED,
Packit c4476c
    SCT_VALIDATION_STATUS_UNKNOWN_VERSION
Packit c4476c
} sct_validation_status_t;
Packit c4476c
Packit c4476c
DEFINE_STACK_OF(SCT)
Packit c4476c
DEFINE_STACK_OF(CTLOG)
Packit c4476c
Packit c4476c
/******************************************
Packit c4476c
 * CT policy evaluation context functions *
Packit c4476c
 ******************************************/
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Creates a new, empty policy evaluation context.
Packit c4476c
 * The caller is responsible for calling CT_POLICY_EVAL_CTX_free when finished
Packit c4476c
 * with the CT_POLICY_EVAL_CTX.
Packit c4476c
 */
Packit c4476c
CT_POLICY_EVAL_CTX *CT_POLICY_EVAL_CTX_new(void);
Packit c4476c
Packit c4476c
/* Deletes a policy evaluation context and anything it owns. */
Packit c4476c
void CT_POLICY_EVAL_CTX_free(CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
/* Gets the peer certificate that the SCTs are for */
Packit c4476c
X509* CT_POLICY_EVAL_CTX_get0_cert(const CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Sets the certificate associated with the received SCTs.
Packit c4476c
 * Increments the reference count of cert.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
int CT_POLICY_EVAL_CTX_set1_cert(CT_POLICY_EVAL_CTX *ctx, X509 *cert);
Packit c4476c
Packit c4476c
/* Gets the issuer of the aforementioned certificate */
Packit c4476c
X509* CT_POLICY_EVAL_CTX_get0_issuer(const CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Sets the issuer of the certificate associated with the received SCTs.
Packit c4476c
 * Increments the reference count of issuer.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
int CT_POLICY_EVAL_CTX_set1_issuer(CT_POLICY_EVAL_CTX *ctx, X509 *issuer);
Packit c4476c
Packit c4476c
/* Gets the CT logs that are trusted sources of SCTs */
Packit c4476c
const CTLOG_STORE *CT_POLICY_EVAL_CTX_get0_log_store(const CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
/* Sets the log store that is in use. It must outlive the CT_POLICY_EVAL_CTX. */
Packit c4476c
void CT_POLICY_EVAL_CTX_set_shared_CTLOG_STORE(CT_POLICY_EVAL_CTX *ctx,
Packit c4476c
                                               CTLOG_STORE *log_store);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Gets the time, in milliseconds since the Unix epoch, that will be used as the
Packit c4476c
 * current time when checking whether an SCT was issued in the future.
Packit c4476c
 * Such SCTs will fail validation, as required by RFC6962.
Packit c4476c
 */
Packit c4476c
uint64_t CT_POLICY_EVAL_CTX_get_time(const CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Sets the time to evaluate SCTs against, in milliseconds since the Unix epoch.
Packit c4476c
 * If an SCT's timestamp is after this time, it will be interpreted as having
Packit c4476c
 * been issued in the future. RFC6962 states that "TLS clients MUST reject SCTs
Packit c4476c
 * whose timestamp is in the future", so an SCT will not validate in this case.
Packit c4476c
 */
Packit c4476c
void CT_POLICY_EVAL_CTX_set_time(CT_POLICY_EVAL_CTX *ctx, uint64_t time_in_ms);
Packit c4476c
Packit c4476c
/*****************
Packit c4476c
 * SCT functions *
Packit c4476c
 *****************/
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Creates a new, blank SCT.
Packit c4476c
 * The caller is responsible for calling SCT_free when finished with the SCT.
Packit c4476c
 */
Packit c4476c
SCT *SCT_new(void);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Creates a new SCT from some base64-encoded strings.
Packit c4476c
 * The caller is responsible for calling SCT_free when finished with the SCT.
Packit c4476c
 */
Packit c4476c
SCT *SCT_new_from_base64(unsigned char version,
Packit c4476c
                         const char *logid_base64,
Packit c4476c
                         ct_log_entry_type_t entry_type,
Packit c4476c
                         uint64_t timestamp,
Packit c4476c
                         const char *extensions_base64,
Packit c4476c
                         const char *signature_base64);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Frees the SCT and the underlying data structures.
Packit c4476c
 */
Packit c4476c
void SCT_free(SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Free a stack of SCTs, and the underlying SCTs themselves.
Packit c4476c
 * Intended to be compatible with X509V3_EXT_FREE.
Packit c4476c
 */
Packit c4476c
void SCT_LIST_free(STACK_OF(SCT) *a);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Returns the version of the SCT.
Packit c4476c
 */
Packit c4476c
sct_version_t SCT_get_version(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the version of an SCT.
Packit c4476c
 * Returns 1 on success, 0 if the version is unrecognized.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set_version(SCT *sct, sct_version_t version);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Returns the log entry type of the SCT.
Packit c4476c
 */
Packit c4476c
ct_log_entry_type_t SCT_get_log_entry_type(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the log entry type of an SCT.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set_log_entry_type(SCT *sct, ct_log_entry_type_t entry_type);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Gets the ID of the log that an SCT came from.
Packit c4476c
 * Ownership of the log ID remains with the SCT.
Packit c4476c
 * Returns the length of the log ID.
Packit c4476c
 */
Packit c4476c
size_t SCT_get0_log_id(const SCT *sct, unsigned char **log_id);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the log ID of an SCT to point directly to the *log_id specified.
Packit c4476c
 * The SCT takes ownership of the specified pointer.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set0_log_id(SCT *sct, unsigned char *log_id, size_t log_id_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the log ID of an SCT.
Packit c4476c
 * This makes a copy of the log_id.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set1_log_id(SCT *sct, const unsigned char *log_id,
Packit c4476c
                           size_t log_id_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Returns the timestamp for the SCT (epoch time in milliseconds).
Packit c4476c
 */
Packit c4476c
uint64_t SCT_get_timestamp(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the timestamp of an SCT (epoch time in milliseconds).
Packit c4476c
 */
Packit c4476c
void SCT_set_timestamp(SCT *sct, uint64_t timestamp);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Return the NID for the signature used by the SCT.
Packit c4476c
 * For CT v1, this will be either NID_sha256WithRSAEncryption or
Packit c4476c
 * NID_ecdsa_with_SHA256 (or NID_undef if incorrect/unset).
Packit c4476c
 */
Packit c4476c
int SCT_get_signature_nid(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the signature type of an SCT
Packit c4476c
 * For CT v1, this should be either NID_sha256WithRSAEncryption or
Packit c4476c
 * NID_ecdsa_with_SHA256.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set_signature_nid(SCT *sct, int nid);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set *ext to point to the extension data for the SCT. ext must not be NULL.
Packit c4476c
 * The SCT retains ownership of this pointer.
Packit c4476c
 * Returns length of the data pointed to.
Packit c4476c
 */
Packit c4476c
size_t SCT_get0_extensions(const SCT *sct, unsigned char **ext);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the extensions of an SCT to point directly to the *ext specified.
Packit c4476c
 * The SCT takes ownership of the specified pointer.
Packit c4476c
 */
Packit c4476c
void SCT_set0_extensions(SCT *sct, unsigned char *ext, size_t ext_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the extensions of an SCT.
Packit c4476c
 * This takes a copy of the ext.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set1_extensions(SCT *sct, const unsigned char *ext,
Packit c4476c
                               size_t ext_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set *sig to point to the signature for the SCT. sig must not be NULL.
Packit c4476c
 * The SCT retains ownership of this pointer.
Packit c4476c
 * Returns length of the data pointed to.
Packit c4476c
 */
Packit c4476c
size_t SCT_get0_signature(const SCT *sct, unsigned char **sig);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the signature of an SCT to point directly to the *sig specified.
Packit c4476c
 * The SCT takes ownership of the specified pointer.
Packit c4476c
 */
Packit c4476c
void SCT_set0_signature(SCT *sct, unsigned char *sig, size_t sig_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the signature of an SCT to be a copy of the *sig specified.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set1_signature(SCT *sct, const unsigned char *sig,
Packit c4476c
                              size_t sig_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * The origin of this SCT, e.g. TLS extension, OCSP response, etc.
Packit c4476c
 */
Packit c4476c
sct_source_t SCT_get_source(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Set the origin of this SCT, e.g. TLS extension, OCSP response, etc.
Packit c4476c
 * Returns 1 on success, 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int SCT_set_source(SCT *sct, sct_source_t source);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Returns a text string describing the validation status of |sct|.
Packit c4476c
 */
Packit c4476c
const char *SCT_validation_status_string(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Pretty-prints an |sct| to |out|.
Packit c4476c
 * It will be indented by the number of spaces specified by |indent|.
Packit c4476c
 * If |logs| is not NULL, it will be used to lookup the CT log that the SCT came
Packit c4476c
 * from, so that the log name can be printed.
Packit c4476c
 */
Packit c4476c
void SCT_print(const SCT *sct, BIO *out, int indent, const CTLOG_STORE *logs);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Pretty-prints an |sct_list| to |out|.
Packit c4476c
 * It will be indented by the number of spaces specified by |indent|.
Packit c4476c
 * SCTs will be delimited by |separator|.
Packit c4476c
 * If |logs| is not NULL, it will be used to lookup the CT log that each SCT
Packit c4476c
 * came from, so that the log names can be printed.
Packit c4476c
 */
Packit c4476c
void SCT_LIST_print(const STACK_OF(SCT) *sct_list, BIO *out, int indent,
Packit c4476c
                    const char *separator, const CTLOG_STORE *logs);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Gets the last result of validating this SCT.
Packit c4476c
 * If it has not been validated yet, returns SCT_VALIDATION_STATUS_NOT_SET.
Packit c4476c
 */
Packit c4476c
sct_validation_status_t SCT_get_validation_status(const SCT *sct);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Validates the given SCT with the provided context.
Packit c4476c
 * Sets the "validation_status" field of the SCT.
Packit c4476c
 * Returns 1 if the SCT is valid and the signature verifies.
Packit c4476c
 * Returns 0 if the SCT is invalid or could not be verified.
Packit c4476c
 * Returns -1 if an error occurs.
Packit c4476c
 */
Packit c4476c
__owur int SCT_validate(SCT *sct, const CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Validates the given list of SCTs with the provided context.
Packit c4476c
 * Sets the "validation_status" field of each SCT.
Packit c4476c
 * Returns 1 if there are no invalid SCTs and all signatures verify.
Packit c4476c
 * Returns 0 if at least one SCT is invalid or could not be verified.
Packit c4476c
 * Returns a negative integer if an error occurs.
Packit c4476c
 */
Packit c4476c
__owur int SCT_LIST_validate(const STACK_OF(SCT) *scts,
Packit c4476c
                             CT_POLICY_EVAL_CTX *ctx);
Packit c4476c
Packit c4476c
Packit c4476c
/*********************************
Packit c4476c
 * SCT parsing and serialisation *
Packit c4476c
 *********************************/
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Serialize (to TLS format) a stack of SCTs and return the length.
Packit c4476c
 * "a" must not be NULL.
Packit c4476c
 * If "pp" is NULL, just return the length of what would have been serialized.
Packit c4476c
 * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
Packit c4476c
 * for data that caller is responsible for freeing (only if function returns
Packit c4476c
 * successfully).
Packit c4476c
 * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
Packit c4476c
 * that "*pp" is large enough to accept all of the serialized data.
Packit c4476c
 * Returns < 0 on error, >= 0 indicating bytes written (or would have been)
Packit c4476c
 * on success.
Packit c4476c
 */
Packit c4476c
__owur int i2o_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Convert TLS format SCT list to a stack of SCTs.
Packit c4476c
 * If "a" or "*a" is NULL, a new stack will be created that the caller is
Packit c4476c
 * responsible for freeing (by calling SCT_LIST_free).
Packit c4476c
 * "**pp" and "*pp" must not be NULL.
Packit c4476c
 * Upon success, "*pp" will point to after the last bytes read, and a stack
Packit c4476c
 * will be returned.
Packit c4476c
 * Upon failure, a NULL pointer will be returned, and the position of "*pp" is
Packit c4476c
 * not defined.
Packit c4476c
 */
Packit c4476c
STACK_OF(SCT) *o2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
Packit c4476c
                            size_t len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Serialize (to DER format) a stack of SCTs and return the length.
Packit c4476c
 * "a" must not be NULL.
Packit c4476c
 * If "pp" is NULL, just returns the length of what would have been serialized.
Packit c4476c
 * If "pp" is not NULL and "*pp" is null, function will allocate a new pointer
Packit c4476c
 * for data that caller is responsible for freeing (only if function returns
Packit c4476c
 * successfully).
Packit c4476c
 * If "pp" is NULL and "*pp" is not NULL, caller is responsible for ensuring
Packit c4476c
 * that "*pp" is large enough to accept all of the serialized data.
Packit c4476c
 * Returns < 0 on error, >= 0 indicating bytes written (or would have been)
Packit c4476c
 * on success.
Packit c4476c
 */
Packit c4476c
__owur int i2d_SCT_LIST(const STACK_OF(SCT) *a, unsigned char **pp);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Parses an SCT list in DER format and returns it.
Packit c4476c
 * If "a" or "*a" is NULL, a new stack will be created that the caller is
Packit c4476c
 * responsible for freeing (by calling SCT_LIST_free).
Packit c4476c
 * "**pp" and "*pp" must not be NULL.
Packit c4476c
 * Upon success, "*pp" will point to after the last bytes read, and a stack
Packit c4476c
 * will be returned.
Packit c4476c
 * Upon failure, a NULL pointer will be returned, and the position of "*pp" is
Packit c4476c
 * not defined.
Packit c4476c
 */
Packit c4476c
STACK_OF(SCT) *d2i_SCT_LIST(STACK_OF(SCT) **a, const unsigned char **pp,
Packit c4476c
                            long len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Serialize (to TLS format) an |sct| and write it to |out|.
Packit c4476c
 * If |out| is null, no SCT will be output but the length will still be returned.
Packit c4476c
 * If |out| points to a null pointer, a string will be allocated to hold the
Packit c4476c
 * TLS-format SCT. It is the responsibility of the caller to free it.
Packit c4476c
 * If |out| points to an allocated string, the TLS-format SCT will be written
Packit c4476c
 * to it.
Packit c4476c
 * The length of the SCT in TLS format will be returned.
Packit c4476c
 */
Packit c4476c
__owur int i2o_SCT(const SCT *sct, unsigned char **out);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Parses an SCT in TLS format and returns it.
Packit c4476c
 * If |psct| is not null, it will end up pointing to the parsed SCT. If it
Packit c4476c
 * already points to a non-null pointer, the pointer will be free'd.
Packit c4476c
 * |in| should be a pointer to a string containing the TLS-format SCT.
Packit c4476c
 * |in| will be advanced to the end of the SCT if parsing succeeds.
Packit c4476c
 * |len| should be the length of the SCT in |in|.
Packit c4476c
 * Returns NULL if an error occurs.
Packit c4476c
 * If the SCT is an unsupported version, only the SCT's 'sct' and 'sct_len'
Packit c4476c
 * fields will be populated (with |in| and |len| respectively).
Packit c4476c
 */
Packit c4476c
SCT *o2i_SCT(SCT **psct, const unsigned char **in, size_t len);
Packit c4476c
Packit c4476c
/********************
Packit c4476c
 * CT log functions *
Packit c4476c
 ********************/
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Creates a new CT log instance with the given |public_key| and |name|.
Packit c4476c
 * Takes ownership of |public_key| but copies |name|.
Packit c4476c
 * Returns NULL if malloc fails or if |public_key| cannot be converted to DER.
Packit c4476c
 * Should be deleted by the caller using CTLOG_free when no longer needed.
Packit c4476c
 */
Packit c4476c
CTLOG *CTLOG_new(EVP_PKEY *public_key, const char *name);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Creates a new CTLOG instance with the base64-encoded SubjectPublicKeyInfo DER
Packit c4476c
 * in |pkey_base64|. The |name| is a string to help users identify this log.
Packit c4476c
 * Returns 1 on success, 0 on failure.
Packit c4476c
 * Should be deleted by the caller using CTLOG_free when no longer needed.
Packit c4476c
 */
Packit c4476c
int CTLOG_new_from_base64(CTLOG ** ct_log,
Packit c4476c
                          const char *pkey_base64, const char *name);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Deletes a CT log instance and its fields.
Packit c4476c
 */
Packit c4476c
void CTLOG_free(CTLOG *log);
Packit c4476c
Packit c4476c
/* Gets the name of the CT log */
Packit c4476c
const char *CTLOG_get0_name(const CTLOG *log);
Packit c4476c
/* Gets the ID of the CT log */
Packit c4476c
void CTLOG_get0_log_id(const CTLOG *log, const uint8_t **log_id,
Packit c4476c
                       size_t *log_id_len);
Packit c4476c
/* Gets the public key of the CT log */
Packit c4476c
EVP_PKEY *CTLOG_get0_public_key(const CTLOG *log);
Packit c4476c
Packit c4476c
/**************************
Packit c4476c
 * CT log store functions *
Packit c4476c
 **************************/
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Creates a new CT log store.
Packit c4476c
 * Should be deleted by the caller using CTLOG_STORE_free when no longer needed.
Packit c4476c
 */
Packit c4476c
CTLOG_STORE *CTLOG_STORE_new(void);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Deletes a CT log store and all of the CT log instances held within.
Packit c4476c
 */
Packit c4476c
void CTLOG_STORE_free(CTLOG_STORE *store);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Finds a CT log in the store based on its log ID.
Packit c4476c
 * Returns the CT log, or NULL if no match is found.
Packit c4476c
 */
Packit c4476c
const CTLOG *CTLOG_STORE_get0_log_by_id(const CTLOG_STORE *store,
Packit c4476c
                                        const uint8_t *log_id,
Packit c4476c
                                        size_t log_id_len);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Loads a CT log list into a |store| from a |file|.
Packit c4476c
 * Returns 1 if loading is successful, or 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int CTLOG_STORE_load_file(CTLOG_STORE *store, const char *file);
Packit c4476c
Packit c4476c
/*
Packit c4476c
 * Loads the default CT log list into a |store|.
Packit c4476c
 * Returns 1 if loading is successful, or 0 otherwise.
Packit c4476c
 */
Packit c4476c
__owur int CTLOG_STORE_load_default_file(CTLOG_STORE *store);
Packit c4476c
Packit c4476c
#  ifdef  __cplusplus
Packit c4476c
}
Packit c4476c
#  endif
Packit c4476c
# endif
Packit c4476c
#endif