aboutsummaryrefslogtreecommitdiffstats
path: root/src/charon/credentials/sets
diff options
context:
space:
mode:
Diffstat (limited to 'src/charon/credentials/sets')
-rw-r--r--src/charon/credentials/sets/auth_cfg_wrapper.c24
-rw-r--r--src/charon/credentials/sets/auth_cfg_wrapper.h2
-rw-r--r--src/charon/credentials/sets/cert_cache.c44
-rw-r--r--src/charon/credentials/sets/cert_cache.h6
-rw-r--r--src/charon/credentials/sets/ocsp_response_wrapper.c14
-rw-r--r--src/charon/credentials/sets/ocsp_response_wrapper.h2
6 files changed, 46 insertions, 46 deletions
diff --git a/src/charon/credentials/sets/auth_cfg_wrapper.c b/src/charon/credentials/sets/auth_cfg_wrapper.c
index b2cf5d960..82e33d283 100644
--- a/src/charon/credentials/sets/auth_cfg_wrapper.c
+++ b/src/charon/credentials/sets/auth_cfg_wrapper.c
@@ -29,7 +29,7 @@ struct private_auth_cfg_wrapper_t {
* public functions
*/
auth_cfg_wrapper_t public;
-
+
/**
* wrapped auth info
*/
@@ -67,10 +67,10 @@ static bool fetch_cert(wrapper_enumerator_t *enumerator,
/* fetching the certificate previously failed */
return FALSE;
}
-
+
chunk_t data;
certificate_t *cert;
-
+
DBG1(DBG_CFG, " fetching certificate from '%s' ...", url);
if (lib->fetcher->fetch(lib->fetcher, url, &data, FETCH_END) != SUCCESS)
{
@@ -80,11 +80,11 @@ static bool fetch_cert(wrapper_enumerator_t *enumerator,
*rule, NULL);
return FALSE;
}
-
+
cert = lib->creds->create(lib->creds, CRED_CERTIFICATE, CERT_X509,
BUILD_BLOB_ASN1_DER, data, BUILD_END);
free(data.ptr);
-
+
if (!cert)
{
DBG1(DBG_CFG, " parsing fetched certificate failed");
@@ -93,10 +93,10 @@ static bool fetch_cert(wrapper_enumerator_t *enumerator,
*rule, NULL);
return FALSE;
}
-
+
DBG1(DBG_CFG, " fetched certificate \"%Y\"", cert->get_subject(cert));
charon->credentials->cache_cert(charon->credentials, cert);
-
+
if (*rule == AUTH_HELPER_IM_HASH_URL)
{
*rule = AUTH_HELPER_IM_CERT;
@@ -174,11 +174,11 @@ static void wrapper_enumerator_destroy(wrapper_enumerator_t *this)
* implementation of auth_cfg_wrapper_t.set.create_cert_enumerator
*/
static enumerator_t *create_enumerator(private_auth_cfg_wrapper_t *this,
- certificate_type_t cert, key_type_t key,
+ certificate_type_t cert, key_type_t key,
identification_t *id, bool trusted)
{
wrapper_enumerator_t *enumerator;
-
+
if (trusted)
{
return NULL;
@@ -208,16 +208,16 @@ static void destroy(private_auth_cfg_wrapper_t *this)
auth_cfg_wrapper_t *auth_cfg_wrapper_create(auth_cfg_t *auth)
{
private_auth_cfg_wrapper_t *this = malloc_thing(private_auth_cfg_wrapper_t);
-
+
this->public.set.create_private_enumerator = (void*)return_null;
this->public.set.create_cert_enumerator = (void*)create_enumerator;
this->public.set.create_shared_enumerator = (void*)return_null;
this->public.set.create_cdp_enumerator = (void*)return_null;
this->public.set.cache_cert = (void*)nop;
this->public.destroy = (void(*)(auth_cfg_wrapper_t*))destroy;
-
+
this->auth = auth;
-
+
return &this->public;
}
diff --git a/src/charon/credentials/sets/auth_cfg_wrapper.h b/src/charon/credentials/sets/auth_cfg_wrapper.h
index dd5e0fff6..1d9824182 100644
--- a/src/charon/credentials/sets/auth_cfg_wrapper.h
+++ b/src/charon/credentials/sets/auth_cfg_wrapper.h
@@ -35,7 +35,7 @@ struct auth_cfg_wrapper_t {
* implements credential_set_t
*/
credential_set_t set;
-
+
/**
* Destroy a auth_cfg_wrapper instance.
*/
diff --git a/src/charon/credentials/sets/cert_cache.c b/src/charon/credentials/sets/cert_cache.c
index dee0463e6..de8994b82 100644
--- a/src/charon/credentials/sets/cert_cache.c
+++ b/src/charon/credentials/sets/cert_cache.c
@@ -35,22 +35,22 @@ typedef struct relation_t relation_t;
* A trusted relation between subject and issuer
*/
struct relation_t {
-
+
/**
* subject of this relation
*/
certificate_t *subject;
-
+
/**
* issuer of this relation
*/
certificate_t *issuer;
-
+
/**
* Cache hits
*/
u_int hits;
-
+
/**
* Lock for this relation
*/
@@ -61,12 +61,12 @@ struct relation_t {
* private data of cert_cache
*/
struct private_cert_cache_t {
-
+
/**
* public functions
*/
cert_cache_t public;
-
+
/**
* array of trusted subject-issuer relations
*/
@@ -82,12 +82,12 @@ static void cache(private_cert_cache_t *this,
relation_t *rel;
int i, offset, try;
u_int total_hits = 0;
-
+
/* check for a unused relation slot first */
for (i = 0; i < CACHE_SIZE; i++)
{
rel = &this->relations[i];
-
+
if (!rel->subject && rel->lock->try_write_lock(rel->lock))
{
/* double-check having lock */
@@ -109,7 +109,7 @@ static void cache(private_cert_cache_t *this,
for (i = 0; i < CACHE_SIZE; i++)
{
rel = &this->relations[(i + offset) % CACHE_SIZE];
-
+
if (rel->hits > total_hits / CACHE_SIZE)
{ /* skip often used slots */
continue;
@@ -140,11 +140,11 @@ static bool issued_by(private_cert_cache_t *this,
{
relation_t *found = NULL, *current;
int i;
-
+
for (i = 0; i < CACHE_SIZE; i++)
{
current = &this->relations[i];
-
+
current->lock->read_lock(current->lock);
if (current->subject)
{
@@ -203,14 +203,14 @@ static bool cert_enumerate(cert_enumerator_t *this, certificate_t **out)
{
public_key_t *public;
relation_t *rel;
-
+
if (this->locked >= 0)
{
rel = &this->relations[this->locked];
rel->lock->unlock(rel->lock);
this->locked = -1;
}
-
+
while (++this->index < CACHE_SIZE)
{
rel = &this->relations[this->index];
@@ -219,7 +219,7 @@ static bool cert_enumerate(cert_enumerator_t *this, certificate_t **out)
if (rel->subject)
{
/* CRL lookup is done using issuer/authkeyidentifier */
- if (this->key == KEY_ANY && this->id &&
+ if (this->key == KEY_ANY && this->id &&
(this->cert == CERT_ANY || this->cert == CERT_X509_CRL) &&
rel->subject->get_type(rel->subject) == CERT_X509_CRL &&
rel->subject->has_issuer(rel->subject, this->id))
@@ -261,7 +261,7 @@ static bool cert_enumerate(cert_enumerator_t *this, certificate_t **out)
static void cert_enumerator_destroy(cert_enumerator_t *this)
{
relation_t *rel;
-
+
if (this->locked >= 0)
{
rel = &this->relations[this->locked];
@@ -274,11 +274,11 @@ static void cert_enumerator_destroy(cert_enumerator_t *this)
* implementation of credential_set_t.create_cert_enumerator
*/
static enumerator_t *create_enumerator(private_cert_cache_t *this,
- certificate_type_t cert, key_type_t key,
+ certificate_type_t cert, key_type_t key,
identification_t *id, bool trusted)
{
cert_enumerator_t *enumerator;
-
+
if (trusted)
{
return NULL;
@@ -292,7 +292,7 @@ static enumerator_t *create_enumerator(private_cert_cache_t *this,
enumerator->relations = this->relations;
enumerator->index = -1;
enumerator->locked = -1;
-
+
return &enumerator->public;
}
@@ -303,7 +303,7 @@ static void flush(private_cert_cache_t *this, certificate_type_t type)
{
relation_t *rel;
int i;
-
+
for (i = 0; i < CACHE_SIZE; i++)
{
rel = &this->relations[i];
@@ -346,7 +346,7 @@ static void destroy(private_cert_cache_t *this)
{
relation_t *rel;
int i;
-
+
for (i = 0; i < CACHE_SIZE; i++)
{
rel = &this->relations[i];
@@ -367,7 +367,7 @@ cert_cache_t *cert_cache_create()
{
private_cert_cache_t *this;
int i;
-
+
this = malloc_thing(private_cert_cache_t);
this->public.set.create_private_enumerator = (void*)return_null;
this->public.set.create_cert_enumerator = (void*)create_enumerator;
@@ -377,7 +377,7 @@ cert_cache_t *cert_cache_create()
this->public.issued_by = (bool(*)(cert_cache_t*, certificate_t *subject, certificate_t *issuer))issued_by;
this->public.flush = (void(*)(cert_cache_t*, certificate_type_t type))flush;
this->public.destroy = (void(*)(cert_cache_t*))destroy;
-
+
for (i = 0; i < CACHE_SIZE; i++)
{
this->relations[i].subject = NULL;
diff --git a/src/charon/credentials/sets/cert_cache.h b/src/charon/credentials/sets/cert_cache.h
index a2cae367c..d2721866e 100644
--- a/src/charon/credentials/sets/cert_cache.h
+++ b/src/charon/credentials/sets/cert_cache.h
@@ -39,7 +39,7 @@ struct cert_cache_t {
* Implements credential_set_t.
*/
credential_set_t set;
-
+
/**
* Caching wrapper around certificate_t.issued_by.
*
@@ -49,14 +49,14 @@ struct cert_cache_t {
*/
bool (*issued_by)(cert_cache_t *this,
certificate_t *subject, certificate_t *issuer);
-
+
/**
* Flush the certificate cache.
*
* @param type type of certificate to flush, or CERT_ANY
*/
void (*flush)(cert_cache_t *this, certificate_type_t type);
-
+
/**
* Destroy a cert_cache instance.
*/
diff --git a/src/charon/credentials/sets/ocsp_response_wrapper.c b/src/charon/credentials/sets/ocsp_response_wrapper.c
index e9faec472..82079209a 100644
--- a/src/charon/credentials/sets/ocsp_response_wrapper.c
+++ b/src/charon/credentials/sets/ocsp_response_wrapper.c
@@ -26,7 +26,7 @@ struct private_ocsp_response_wrapper_t {
* public functions
*/
ocsp_response_wrapper_t public;
-
+
/**
* wrapped OCSP response
*/
@@ -98,16 +98,16 @@ static void enumerator_destroy(wrapper_enumerator_t *this)
* implementation of ocsp_response_wrapper_t.set.create_cert_enumerator
*/
static enumerator_t *create_enumerator(private_ocsp_response_wrapper_t *this,
- certificate_type_t cert, key_type_t key,
+ certificate_type_t cert, key_type_t key,
identification_t *id, bool trusted)
{
wrapper_enumerator_t *enumerator;
-
+
if (trusted)
{
return NULL;
}
-
+
enumerator = malloc_thing(wrapper_enumerator_t);
enumerator->cert = cert;
enumerator->key = key;
@@ -132,16 +132,16 @@ static void destroy(private_ocsp_response_wrapper_t *this)
ocsp_response_wrapper_t *ocsp_response_wrapper_create(ocsp_response_t *response)
{
private_ocsp_response_wrapper_t *this = malloc_thing(private_ocsp_response_wrapper_t);
-
+
this->public.set.create_private_enumerator = (void*)return_null;
this->public.set.create_cert_enumerator = (void*)create_enumerator;
this->public.set.create_shared_enumerator = (void*)return_null;
this->public.set.create_cdp_enumerator = (void*)return_null;
this->public.set.cache_cert = (void*)nop;
this->public.destroy = (void(*)(ocsp_response_wrapper_t*))destroy;
-
+
this->response = response;
-
+
return &this->public;
}
diff --git a/src/charon/credentials/sets/ocsp_response_wrapper.h b/src/charon/credentials/sets/ocsp_response_wrapper.h
index 8f141f7a1..bf746320a 100644
--- a/src/charon/credentials/sets/ocsp_response_wrapper.h
+++ b/src/charon/credentials/sets/ocsp_response_wrapper.h
@@ -35,7 +35,7 @@ struct ocsp_response_wrapper_t {
* implements credential_set_t
*/
credential_set_t set;
-
+
/**
* Destroy a ocsp_response_wrapper instance.
*/