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 -27
View File
@@ -23,7 +23,7 @@ typedef struct private_xcbc_t private_xcbc_t;
/**
* Private data of a xcbc_t object.
*
*
* The variable names are the same as in the RFC.
*/
struct private_xcbc_t {
@@ -31,42 +31,42 @@ struct private_xcbc_t {
* Public xcbc_t interface.
*/
xcbc_t xcbc;
/**
* Block size, in bytes
*/
u_int8_t b;
/**
* crypter using k1
*/
crypter_t *k1;
/**
* k2
*/
u_int8_t *k2;
/**
* k3
*/
u_int8_t *k3;
/**
* E
*/
u_int8_t *e;
/**
* remaining, unprocessed bytes in append mode
*/
u_int8_t *remaining;
/**
* number of bytes in remaining
*/
int remaining_bytes;
/**
* TRUE if we have zero bytes to xcbc in final()
*/
@@ -79,34 +79,34 @@ struct private_xcbc_t {
static void update(private_xcbc_t *this, chunk_t data)
{
chunk_t iv;
if (data.len)
{
this->zero = FALSE;
}
if (this->remaining_bytes + data.len <= this->b)
{ /* no complete block, just copy into remaining */
memcpy(this->remaining + this->remaining_bytes, data.ptr, data.len);
this->remaining_bytes += data.len;
return;
}
iv = chunk_alloca(this->b);
memset(iv.ptr, 0, iv.len);
/* (3) For each block M[i], where i = 1 ... n-1:
* XOR M[i] with E[i-1], then encrypt the result with Key K1,
* yielding E[i].
*/
/* append data to remaining bytes, process block M[1] */
memcpy(this->remaining + this->remaining_bytes, data.ptr,
this->b - this->remaining_bytes);
data = chunk_skip(data, this->b - this->remaining_bytes);
memxor(this->e, this->remaining, this->b);
this->k1->encrypt(this->k1, chunk_create(this->e, this->b), iv, NULL);
/* process blocks M[2] ... M[n-1] */
while (data.len > this->b)
{
@@ -115,7 +115,7 @@ static void update(private_xcbc_t *this, chunk_t data)
memxor(this->e, this->remaining, this->b);
this->k1->encrypt(this->k1, chunk_create(this->e, this->b), iv, NULL);
}
/* store remaining bytes of block M[n] */
memcpy(this->remaining, data.ptr, data.len);
this->remaining_bytes = data.len;
@@ -127,10 +127,10 @@ static void update(private_xcbc_t *this, chunk_t data)
static void final(private_xcbc_t *this, u_int8_t *out)
{
chunk_t iv;
iv = chunk_alloca(this->b);
memset(iv.ptr, 0, iv.len);
/* (4) For block M[n]: */
if (this->remaining_bytes == this->b && !this->zero)
{
@@ -165,9 +165,9 @@ static void final(private_xcbc_t *this, u_int8_t *out)
memxor(this->e, this->k3, this->b);
this->k1->encrypt(this->k1, chunk_create(this->e, this->b), iv, NULL);
}
memcpy(out, this->e, this->b);
/* (2) Define E[0] = 0x00000000000000000000000000000000 */
memset(this->e, 0, this->b);
this->remaining_bytes = 0;
@@ -181,13 +181,13 @@ static void get_mac(private_xcbc_t *this, chunk_t data, u_int8_t *out)
{
/* update E, do not process last block */
update(this, data);
if (out)
{ /* if not in append mode, process last block and output result */
final(this, out);
}
}
/**
* Implementation of xcbc_t.get_block_size.
*/
@@ -225,8 +225,8 @@ static void set_key(private_xcbc_t *this, chunk_t key)
k1 = chunk_alloca(this->b);
iv = chunk_alloca(this->b);
memset(iv.ptr, 0, iv.len);
/*
/*
* (1) Derive 3 128-bit keys (K1, K2 and K3) from the 128-bit secret
* key K, as follows:
* K1 = 0x01010101010101010101010101010101 encrypted with Key K
@@ -263,7 +263,7 @@ xcbc_t *xcbc_create(encryption_algorithm_t algo, size_t key_size)
{
private_xcbc_t *this;
crypter_t *crypter;
crypter = lib->crypto->create_crypter(lib->crypto, algo, key_size);
if (!crypter)
{
@@ -275,13 +275,13 @@ xcbc_t *xcbc_create(encryption_algorithm_t algo, size_t key_size)
crypter->destroy(crypter);
return NULL;
}
this = malloc_thing(private_xcbc_t);
this->xcbc.get_mac = (void (*)(xcbc_t *,chunk_t,u_int8_t*))get_mac;
this->xcbc.get_block_size = (size_t (*)(xcbc_t *))get_block_size;
this->xcbc.set_key = (void (*)(xcbc_t *,chunk_t))set_key;
this->xcbc.destroy = (void (*)(xcbc_t *))destroy;
this->b = crypter->get_block_size(crypter);
this->k1 = crypter;
this->k2 = malloc(this->b);
+10 -10
View File
@@ -32,34 +32,34 @@ typedef struct xcbc_t xcbc_t;
* described in RFC3566.
*/
struct xcbc_t {
/**
* Generate message authentication code.
*
*
* If buffer is NULL, no result is given back. A next call will
* append the data to already supplied data. If buffer is not NULL,
* append the data to already supplied data. If buffer is not NULL,
* the mac of all apended data is calculated, returned and the
* state of the xcbc_t is reseted.
*
*
* @param data chunk of data to authenticate
* @param buffer pointer where the generated bytes will be written
*/
void (*get_mac) (xcbc_t *this, chunk_t data, u_int8_t *buffer);
/**
* Get the block size of this xcbc_t object.
*
*
* @return block size in bytes
*/
size_t (*get_block_size) (xcbc_t *this);
/**
* Set the key for this xcbc_t object.
*
*
* @param key key to set
*/
void (*set_key) (xcbc_t *this, chunk_t key);
/**
* Destroys a xcbc_t object.
*/
@@ -68,7 +68,7 @@ struct xcbc_t {
/**
* Creates a new xcbc_t object.
*
*
* @param algo underlying crypto algorithm
* @param key_size key size to use, if required for algorithm
* @return xcbc_t object, NULL if not supported
+4 -4
View File
@@ -50,12 +50,12 @@ static void destroy(private_xcbc_plugin_t *this)
plugin_t *plugin_create()
{
private_xcbc_plugin_t *this = malloc_thing(private_xcbc_plugin_t);
this->public.plugin.destroy = (void(*)(plugin_t*))destroy;
lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC,
lib->crypto->add_prf(lib->crypto, PRF_AES128_XCBC,
(prf_constructor_t)xcbc_prf_create);
lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96,
lib->crypto->add_signer(lib->crypto, AUTH_AES_XCBC_96,
(signer_constructor_t)xcbc_signer_create);
return &this->public.plugin;
+6 -6
View File
@@ -27,8 +27,8 @@ struct private_xcbc_prf_t {
/**
* Public xcbc_prf_t interface.
*/
xcbc_prf_t public;
xcbc_prf_t public;
/**
* xcbc to use for generation.
*/
@@ -100,7 +100,7 @@ xcbc_prf_t *xcbc_prf_create(pseudo_random_function_t algo)
{
private_xcbc_prf_t *this;
xcbc_t *xcbc;
switch (algo)
{
case PRF_AES128_XCBC:
@@ -113,17 +113,17 @@ xcbc_prf_t *xcbc_prf_create(pseudo_random_function_t algo)
{
return NULL;
}
this = malloc_thing(private_xcbc_prf_t);
this->xcbc = xcbc;
this->public.prf_interface.get_bytes = (void (*) (prf_t *,chunk_t,u_int8_t*))get_bytes;
this->public.prf_interface.allocate_bytes = (void (*) (prf_t*,chunk_t,chunk_t*))allocate_bytes;
this->public.prf_interface.get_block_size = (size_t (*) (prf_t*))get_block_size;
this->public.prf_interface.get_key_size = (size_t (*) (prf_t*))get_key_size;
this->public.prf_interface.set_key = (void (*) (prf_t *,chunk_t))set_key;
this->public.prf_interface.destroy = (void (*) (prf_t *))destroy;
return &this->public;
}
+3 -3
View File
@@ -27,12 +27,12 @@ typedef struct xcbc_prf_t xcbc_prf_t;
/**
* Implementation of prf_t on CBC block cipher using XCBC, RFC3664/RFC4434.
*
*
* This simply wraps a xcbc_t in a prf_t. More a question of
* interface matching.
*/
struct xcbc_prf_t {
/**
* Generic prf_t interface for this xcbc_prf_t class.
*/
@@ -41,7 +41,7 @@ struct xcbc_prf_t {
/**
* Creates a new xcbc_prf_t object.
*
*
* @param algo algorithm to implement
* @return xcbc_prf_t object, NULL if hash not supported
*/
+11 -11
View File
@@ -29,12 +29,12 @@ struct private_xcbc_signer_t {
* Public interface of xcbc_signer_t.
*/
xcbc_signer_t public;
/**
* Assigned xcbc function.
*/
xcbc_t *xcbc;
/**
* Block size (truncation of XCBC MAC)
*/
@@ -54,7 +54,7 @@ static void get_signature(private_xcbc_signer_t *this,
else
{
u_int8_t mac[this->xcbc->get_block_size(this->xcbc)];
this->xcbc->get_mac(this->xcbc, data, mac);
memcpy(buffer, mac, this->block_size);
}
@@ -73,12 +73,12 @@ static void allocate_signature (private_xcbc_signer_t *this,
else
{
u_int8_t mac[this->xcbc->get_block_size(this->xcbc)];
this->xcbc->get_mac(this->xcbc, data, mac);
chunk->ptr = malloc(this->block_size);
chunk->len = this->block_size;
memcpy(chunk->ptr, mac, this->block_size);
}
}
@@ -90,12 +90,12 @@ static bool verify_signature(private_xcbc_signer_t *this,
chunk_t data, chunk_t signature)
{
u_int8_t mac[this->xcbc->get_block_size(this->xcbc)];
if (signature.len != this->block_size)
{
return FALSE;
}
this->xcbc->get_mac(this->xcbc, data, mac);
return memeq(signature.ptr, mac, this->block_size);
}
@@ -142,7 +142,7 @@ xcbc_signer_t *xcbc_signer_create(integrity_algorithm_t algo)
private_xcbc_signer_t *this;
size_t trunc;
xcbc_t *xcbc;
switch (algo)
{
case AUTH_AES_XCBC_96:
@@ -156,11 +156,11 @@ xcbc_signer_t *xcbc_signer_create(integrity_algorithm_t algo)
{
return NULL;
}
this = malloc_thing(private_xcbc_signer_t);
this->xcbc = xcbc;
this->block_size = min(trunc, xcbc->get_block_size(xcbc));
/* interface functions */
this->public.signer_interface.get_signature = (void (*) (signer_t*, chunk_t, u_int8_t*))get_signature;
this->public.signer_interface.allocate_signature = (void (*) (signer_t*, chunk_t, chunk_t*))allocate_signature;
@@ -169,7 +169,7 @@ xcbc_signer_t *xcbc_signer_create(integrity_algorithm_t algo)
this->public.signer_interface.get_block_size = (size_t (*) (signer_t*))get_block_size;
this->public.signer_interface.set_key = (void (*) (signer_t*,chunk_t))set_key;
this->public.signer_interface.destroy = (void (*) (signer_t*))destroy;
return &this->public;
}
+1 -1
View File
@@ -29,7 +29,7 @@ typedef struct xcbc_signer_t xcbc_signer_t;
* Implementation of signer_t based on CBC symmetric cypher. XCBC, RFC3566.
*/
struct xcbc_signer_t {
/**
* generic signer_t interface for this signer
*/