removed trailing spaces ([[:space:]]+$)

This commit is contained in:
Martin Willi
2009-09-04 13:46:09 +02:00
parent 7d1b030446
commit 7daf5226b7
703 changed files with 10633 additions and 10633 deletions
@@ -27,22 +27,22 @@ typedef struct private_key_encoding_t private_key_encoding_t;
* Private data of an key_encoding_t object.
*/
struct private_key_encoding_t {
/**
* Public key_encoding_t interface.
*/
key_encoding_t public;
/**
* cached encodings, a table for each encoding_type_t, containing chunk_t*
*/
hashtable_t *cache[KEY_ENCODING_MAX];
/**
* Registered encoding fuctions, key_encoder_t
*/
linked_list_t *encoders;
/**
* lock to access cache/encoders
*/
@@ -56,14 +56,14 @@ bool key_encoding_args(va_list args, ...)
{
va_list parts, copy;
bool failed = FALSE;
va_start(parts, args);
while (!failed)
{
key_encoding_part_t current, target;
chunk_t *out, data;
/* get the part we are looking for */
target = va_arg(parts, key_encoding_part_t);
if (target == KEY_PART_END)
@@ -71,7 +71,7 @@ bool key_encoding_args(va_list args, ...)
break;
}
out = va_arg(parts, chunk_t*);
va_copy(copy, args);
while (!failed)
{
@@ -117,7 +117,7 @@ static bool get_cache(private_key_encoding_t *this, key_encoding_type_t type,
void *cache, chunk_t *encoding)
{
chunk_t *chunk;
if (type >= KEY_ENCODING_MAX || type < 0)
{
return FALSE;
@@ -143,7 +143,7 @@ static bool encode(private_key_encoding_t *this, key_encoding_type_t type,
key_encoder_t encode;
bool success = FALSE;
chunk_t *chunk;
if (type >= KEY_ENCODING_MAX || type < 0)
{
return FALSE;
@@ -192,7 +192,7 @@ static void cache(private_key_encoding_t *this, key_encoding_type_t type,
void *cache, chunk_t encoding)
{
chunk_t *chunk;
if (type >= KEY_ENCODING_MAX || type < 0)
{
return free(encoding.ptr);
@@ -217,7 +217,7 @@ static void clear_cache(private_key_encoding_t *this, void *cache)
{
key_encoding_type_t type;
chunk_t *chunk;
this->lock->write_lock(this->lock);
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
@@ -257,7 +257,7 @@ static void remove_encoder(private_key_encoding_t *this, key_encoder_t encoder)
static void destroy(private_key_encoding_t *this)
{
key_encoding_type_t type;
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
/* We explicitly do not free remaining encodings. All keys should
@@ -278,7 +278,7 @@ key_encoding_t *key_encoding_create()
{
private_key_encoding_t *this = malloc_thing(private_key_encoding_t);
key_encoding_type_t type;
this->public.encode = (bool(*)(key_encoding_t*, key_encoding_type_t type, void *cache, chunk_t *encoding, ...))encode;
this->public.get_cache = (bool(*)(key_encoding_t*, key_encoding_type_t type, void *cache, chunk_t *encoding))get_cache;
this->public.cache = (void(*)(key_encoding_t*, key_encoding_type_t type, void *cache, chunk_t encoding))cache;
@@ -286,14 +286,14 @@ key_encoding_t *key_encoding_create()
this->public.add_encoder = (void(*)(key_encoding_t*, key_encoder_t encoder))add_encoder;
this->public.remove_encoder = (void(*)(key_encoding_t*, key_encoder_t encoder))remove_encoder;
this->public.destroy = (void(*)(key_encoding_t*))destroy;
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
this->cache[type] = hashtable_create(hash, equals, 8);
}
this->encoders = linked_list_create();
this->lock = rwlock_create(RWLOCK_TYPE_DEFAULT);
return &this->public;
}
@@ -71,7 +71,7 @@ enum key_encoding_type_t {
KEY_ID_PGPV3,
/** PGPv4 fingerprint */
KEY_ID_PGPV4,
/** PKCS#1 and similar ASN.1 key encoding */
KEY_PUB_ASN1_DER,
KEY_PRIV_ASN1_DER,
@@ -83,7 +83,7 @@ enum key_encoding_type_t {
/** PGP key encoding */
KEY_PUB_PGP,
KEY_PRIV_PGP,
KEY_ENCODING_MAX,
};
@@ -115,7 +115,7 @@ enum key_encoding_part_t {
KEY_PART_ECDSA_PUB_ASN1_DER,
/** a DER encoded ECDSA private key */
KEY_PART_ECDSA_PRIV_ASN1_DER,
KEY_PART_END,
};
@@ -141,14 +141,14 @@ struct key_encoding_t {
*/
bool (*encode)(key_encoding_t *this, key_encoding_type_t type, void *cache,
chunk_t *encoding, ...);
/**
* Clear all cached encodings of a given cache key.
*
* @param cache key used in encode() for caching
*/
void (*clear_cache)(key_encoding_t *this, void *cache);
/**
* Check for a cached encoding.
*
@@ -159,7 +159,7 @@ struct key_encoding_t {
*/
bool (*get_cache)(key_encoding_t *this, key_encoding_type_t type,
void *cache, chunk_t *encoding);
/**
* Cache a key encoding created externally.
*
@@ -172,21 +172,21 @@ struct key_encoding_t {
*/
void (*cache)(key_encoding_t *this, key_encoding_type_t type, void *cache,
chunk_t encoding);
/**
* Register a key encoder function.
*
* @param encoder key encoder function to add
*/
void (*add_encoder)(key_encoding_t *this, key_encoder_t encoder);
/**
* Unregister a previously registered key encoder function.
*
* @param encoder key encoder function to remove
*/
void (*remove_encoder)(key_encoding_t *this, key_encoder_t encoder);
/**
* Destroy a key_encoding_t.
*/
@@ -22,12 +22,12 @@ bool private_key_equals(private_key_t *this, private_key_t *other)
{
key_encoding_type_t type;
chunk_t a, b;
if (this == other)
{
return TRUE;
}
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
if (this->get_fingerprint(this, type, &a) &&
@@ -46,7 +46,7 @@ bool private_key_belongs_to(private_key_t *private, public_key_t *public)
{
key_encoding_type_t type;
chunk_t a, b;
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
if (private->get_fingerprint(private, type, &a) &&
@@ -12,7 +12,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup private_key private_key
* @{ @ingroup keys
@@ -29,14 +29,14 @@ typedef struct private_key_t private_key_t;
* Abstract private key interface.
*/
struct private_key_t {
/**
* Get the key type.
*
* @return type of the key
*/
key_type_t (*get_type)(private_key_t *this);
/**
* Create a signature over a chunk of data.
*
@@ -45,7 +45,7 @@ struct private_key_t {
* @param signature where to allocate created signature
* @return TRUE if signature created
*/
bool (*sign)(private_key_t *this, signature_scheme_t scheme,
bool (*sign)(private_key_t *this, signature_scheme_t scheme,
chunk_t data, chunk_t *signature);
/**
* Decrypt a chunk of data.
@@ -55,37 +55,37 @@ struct private_key_t {
* @return TRUE if data decrypted and plaintext allocated
*/
bool (*decrypt)(private_key_t *this, chunk_t crypto, chunk_t *plain);
/**
* Get the strength of the key in bytes.
*
*
* @return strength of the key in bytes
*/
size_t (*get_keysize) (private_key_t *this);
/**
* Get the public part from the private key.
*
* @return public key
*/
public_key_t* (*get_public_key)(private_key_t *this);
/**
* Check if two private keys are equal.
*
*
* @param other other private key
* @return TRUE, if equality
*/
bool (*equals) (private_key_t *this, private_key_t *other);
/**
* Check if a private key belongs to a public key.
*
*
* @param public public key
* @return TRUE, if keys belong together
*/
bool (*belongs_to) (private_key_t *this, public_key_t *public);
/**
* Get the fingerprint of the key.
*
@@ -95,7 +95,7 @@ struct private_key_t {
*/
bool (*get_fingerprint)(private_key_t *this, key_encoding_type_t type,
chunk_t *fp);
/**
* Get the key in an encoded form as a chunk.
*
@@ -105,14 +105,14 @@ struct private_key_t {
*/
bool (*get_encoding)(private_key_t *this, key_encoding_type_t type,
chunk_t *encoding);
/**
* Increase the refcount to this private key.
*
* @return this, with an increased refcount
*/
private_key_t* (*get_ref)(private_key_t *this);
/**
* Decrease refcount, destroy private_key if no more references.
*/
@@ -49,12 +49,12 @@ bool public_key_equals(public_key_t *this, public_key_t *other)
{
key_encoding_type_t type;
chunk_t a, b;
if (this == other)
{
return TRUE;
}
for (type = 0; type < KEY_ENCODING_MAX; type++)
{
if (this->get_fingerprint(this, type, &a) &&
+13 -13
View File
@@ -12,7 +12,7 @@
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* for more details.
*/
/**
* @defgroup public_key public_key
* @{ @ingroup keys
@@ -53,7 +53,7 @@ extern enum_name_t *key_type_names;
* Signature scheme for signature creation
*
* EMSA-PKCS1 signatures are defined in PKCS#1 standard.
* A prepended ASN.1 encoded digestInfo field contains the
* A prepended ASN.1 encoded digestInfo field contains the
* OID of the used hash algorithm.
*/
enum signature_scheme_t {
@@ -107,7 +107,7 @@ struct public_key_t {
* @return type of the key
*/
key_type_t (*get_type)(public_key_t *this);
/**
* Verifies a signature against a chunk of data.
*
@@ -116,9 +116,9 @@ struct public_key_t {
* @param signature signature to check
* @return TRUE if signature matches
*/
bool (*verify)(public_key_t *this, signature_scheme_t scheme,
bool (*verify)(public_key_t *this, signature_scheme_t scheme,
chunk_t data, chunk_t signature);
/**
* Encrypt a chunk of data.
*
@@ -127,10 +127,10 @@ struct public_key_t {
* @return TRUE if data successfully encrypted
*/
bool (*encrypt)(public_key_t *this, chunk_t plain, chunk_t *crypto);
/**
* Check if two public keys are equal.
*
*
* @param other other public key
* @return TRUE, if equality
*/
@@ -138,11 +138,11 @@ struct public_key_t {
/**
* Get the strength of the key in bytes.
*
*
* @return strength of the key in bytes
*/
size_t (*get_keysize) (public_key_t *this);
/**
* Get the fingerprint of the key.
*
@@ -152,7 +152,7 @@ struct public_key_t {
*/
bool (*get_fingerprint)(public_key_t *this, key_encoding_type_t type,
chunk_t *fp);
/**
* Get the key in an encoded form as a chunk.
*
@@ -162,14 +162,14 @@ struct public_key_t {
*/
bool (*get_encoding)(public_key_t *this, key_encoding_type_t type,
chunk_t *encoding);
/**
* Increase the refcount of the key.
*
* @return this with an increased refcount
*/
public_key_t* (*get_ref)(public_key_t *this);
/**
* Destroy a public_key instance.
*/
@@ -187,7 +187,7 @@ bool public_key_equals(public_key_t *this, public_key_t *other);
/**
* Conversion of ASN.1 signature or hash OID to signature scheme.
*
*
* @param oid ASN.1 OID
* @return signature_scheme, SIGN_UNKNOWN if OID is unsupported
*/
@@ -34,17 +34,17 @@ struct private_shared_key_t {
* public functions
*/
shared_key_t public;
/**
* type of this shared key
*/
shared_key_type_t type;
/**
* associated shared key data
*/
chunk_t key;
/**
* reference counter
*/
@@ -94,16 +94,16 @@ static void destroy(private_shared_key_t *this)
shared_key_t *shared_key_create(shared_key_type_t type, chunk_t key)
{
private_shared_key_t *this = malloc_thing(private_shared_key_t);
this->public.get_type = (shared_key_type_t (*)(shared_key_t *this))get_type;
this->public.get_key = (chunk_t (*)(shared_key_t *this))get_key;
this->public.get_ref = (shared_key_t* (*)(shared_key_t *this))get_ref;
this->public.destroy = (void(*)(shared_key_t*))destroy;
this->type = type;
this->key = key;
this->ref = 1;
return &this->public;
}
@@ -55,28 +55,28 @@ extern enum_name_t *shared_key_type_names;
* reading.
*/
struct shared_key_t {
/**
* Get the kind of this key.
*
* @return type of the key
*/
shared_key_type_t (*get_type)(shared_key_t *this);
/**
* Get the shared key data.
*
* @return chunk pointing to the internal key
*/
chunk_t (*get_key)(shared_key_t *this);
/**
/**
* Increase refcount of the key.
*
* @return this with an increased refcount
* @return this with an increased refcount
*/
shared_key_t* (*get_ref)(shared_key_t *this);
/**
* Destroy a shared_key instance if all references are gone.
*/