NetSurf
|
helpers for X509 certificate chains More...
#include <stdlib.h>
#include <stdint.h>
#include <string.h>
#include <nsutils/base64.h>
#include "utils/errors.h"
#include "utils/log.h"
#include "utils/nsurl.h"
#include "netsurf/ssl_certs.h"
Go to the source code of this file.
Macros | |
#define | MIN_CERT_LEN 64 |
Functions | |
nserror | cert_chain_alloc (size_t depth, struct cert_chain **chain_out) |
create new certificate chain More... | |
nserror | cert_chain_dup_into (const struct cert_chain *src, struct cert_chain *dst) |
duplicate a certificate chain into an existing chain More... | |
nserror | cert_chain_dup (const struct cert_chain *src, struct cert_chain **dst_out) |
duplicate a certificate chain More... | |
static nserror | process_query_section (const char *str, size_t len, struct cert_chain *chain) |
process a part of a query extracting the certificate of an error code More... | |
nserror | cert_chain_from_query (struct nsurl *url, struct cert_chain **chain_out) |
create a certificate chain from a fetch query string More... | |
nserror | cert_chain_to_query (struct cert_chain *chain, struct nsurl **url_out) |
create a fetch query string from a certificate chain More... | |
nserror | cert_chain_free (struct cert_chain *chain) |
free a certificate chain More... | |
size_t | cert_chain_size (const struct cert_chain *chain) |
total number of data bytes in a chain More... | |
helpers for X509 certificate chains
Definition in file ssl_certs.c.
#define MIN_CERT_LEN 64 |
Definition at line 133 of file ssl_certs.c.
nserror cert_chain_alloc | ( | size_t | depth, |
struct cert_chain ** | chain_out | ||
) |
create new certificate chain
dpth | the depth to set in the new chain. |
chain_out | A pointer to recive the new chain. |
Definition at line 41 of file ssl_certs.c.
References cert_chain::depth, NSERROR_NOMEM, and NSERROR_OK.
Referenced by cert_chain_dup(), cert_chain_from_query(), curl_fetch_ssl_value_alloc(), and llcache_process_metadata().
nserror cert_chain_dup | ( | const struct cert_chain * | src, |
struct cert_chain ** | dst_out | ||
) |
duplicate a certificate chain
src | The certificate chain to copy from |
dst_out | A pointer to recive the duplicated chain |
Definition at line 101 of file ssl_certs.c.
References cert_chain_alloc(), cert_chain_free(), cert_chain::certs, cert_chain::depth, cert_chain::der, cert_chain::der_length, cert_chain::err, NSERROR_NOMEM, and NSERROR_OK.
Referenced by browser_window_callback(), llcache_fetch_callback(), and llcache_object_snapshot().
nserror cert_chain_dup_into | ( | const struct cert_chain * | src, |
struct cert_chain * | dst | ||
) |
duplicate a certificate chain into an existing chain
src | The certificate chain to copy from |
dst | The chain to overwrite with a copy of src |
NOTE: if this returns NSERROR_NOMEM then the destination chain will have some amount of content and should be cleaned up with cert_chain_free.
Definition at line 64 of file ssl_certs.c.
References cert_chain::certs, cert_chain::depth, cert_chain::der, cert_chain::der_length, cert_chain::err, NSERROR_NOMEM, and NSERROR_OK.
nserror cert_chain_free | ( | struct cert_chain * | chain | ) |
free a certificate chain
chain | The certificate chain to free |
Definition at line 317 of file ssl_certs.c.
References cert_chain::certs, cert_chain::depth, cert_chain::der, and NSERROR_OK.
Referenced by browser_window_callback(), browser_window_content_ready(), browser_window_destroy_internal(), cert_chain_dup(), curl_fetch_ssl_value_destroy(), llcache_fetch_callback(), llcache_object_destroy(), llcache_process_metadata(), and navigate_internal_real().
nserror cert_chain_from_query | ( | struct nsurl * | url, |
struct cert_chain ** | chain_out | ||
) |
create a certificate chain from a fetch query string
url | The url to convert the query from |
dst_out | A pointer to recive the duplicated chain |
Definition at line 169 of file ssl_certs.c.
References cert_chain_alloc(), cert_chain::depth, MIN_CERT_LEN, NSERROR_INVALID, NSERROR_NEED_DATA, NSERROR_OK, nsurl_get(), NSURL_QUERY, and process_query_section().
size_t cert_chain_size | ( | const struct cert_chain * | chain | ) |
total number of data bytes in a chain
chain | The chain to size |
Definition at line 340 of file ssl_certs.c.
References cert_chain::certs, cert_chain::depth, cert_chain::der, and cert_chain::der_length.
Referenced by total_object_size().
nserror cert_chain_to_query | ( | struct cert_chain * | chain, |
struct nsurl ** | url_out | ||
) |
create a fetch query string from a certificate chain
Definition at line 226 of file ssl_certs.c.
References cert_chain::certs, cert_chain::depth, cert_chain::der, cert_chain::der_length, cert_chain::err, NSERROR_NOMEM, NSERROR_OK, NSERROR_UNKNOWN, nsurl_create(), and SSL_CERT_ERR_OK.
Referenced by browser_window__handle_bad_certs(), and browser_window_show_certificates().
|
static |
process a part of a query extracting the certificate of an error code
Definition at line 139 of file ssl_certs.c.
References cert_chain::certs, cert_chain::depth, cert_chain::der, cert_chain::der_length, cert_chain::err, MIN_CERT_LEN, and NSERROR_OK.
Referenced by cert_chain_from_query().