From 9855a34f48acf6ae3aaeba9ec37756da41507e64 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sun, 24 Aug 2014 21:06:09 +0200 Subject: Coding style: always add a space between a pointer's type and the * --- src/crypto.h | 12 ++++++------ .../aes128_ctr/nacl/cipher_aes128_ctr_nacl.c | 4 ++-- .../cipher/aes128_ctr/openssl/aes128_ctr_openssl.c | 8 ++++---- src/crypto/cipher/ciphers.c.in | 4 ++-- src/crypto/cipher/null/memcpy/null_memcpy.c | 2 +- src/crypto/cipher/salsa20/nacl/salsa20_nacl.c | 2 +- src/crypto/cipher/salsa20/xmm/salsa20_xmm.c | 2 +- src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c | 2 +- src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c | 2 +- src/crypto/mac/ghash/builtin/ghash_builtin.c | 4 ++-- src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h | 2 +- .../mac/ghash/pclmulqdq/ghash_pclmulqdq_impl.c | 4 ++-- src/crypto/mac/macs.c.in | 4 ++-- src/fastd.c | 2 +- src/fastd.h | 14 +++++++------- src/handshake.c | 22 +++++++++++----------- src/handshake.h | 6 +++--- src/hash.h | 2 +- src/hkdf_sha256.c | 4 ++-- src/lex.c | 4 ++-- src/lex.h | 2 +- src/log.c | 16 ++++++++-------- src/method.h | 6 +++--- src/methods/cipher_test/cipher_test.c | 2 +- src/methods/composed_gmac/composed_gmac.c | 2 +- src/methods/generic_gmac/generic_gmac.c | 2 +- src/methods/generic_poly1305/generic_poly1305.c | 2 +- src/methods/null/null.c | 4 ++-- src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c | 4 ++-- src/options.c | 2 +- src/peer.c | 4 ++-- src/peer.h | 4 ++-- src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c | 2 +- src/protocols/ec25519_fhmqvc/handshake.c | 2 +- src/random.c | 2 +- src/receive.c | 8 ++++---- src/resolve.c | 4 ++-- src/send.c | 8 ++++---- src/sha256.c | 8 ++++---- src/shell.c | 2 +- src/socket.c | 2 +- src/tuntap.c | 2 +- src/vector.h | 8 ++++---- 43 files changed, 102 insertions(+), 102 deletions(-) diff --git a/src/crypto.h b/src/crypto.h index 861db5f..f522c21 100644 --- a/src/crypto.h +++ b/src/crypto.h @@ -50,7 +50,7 @@ struct fastd_cipher { bool (*available)(void); /** Initializes a cipher context with the given key */ - fastd_cipher_state_t* (*init)(const uint8_t *key); + fastd_cipher_state_t * (*init)(const uint8_t *key); /** Encrypts or decrypts data */ bool (*crypt)(const fastd_cipher_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t len, const uint8_t *iv); /** Frees a cipher context */ @@ -69,7 +69,7 @@ struct fastd_mac { bool (*available)(void); /** Initializes a MAC context with the given key */ - fastd_mac_state_t* (*init)(const uint8_t *key); + fastd_mac_state_t * (*init)(const uint8_t *key); /** Computes the MAC of data blocks */ bool (*hash)(const fastd_mac_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t n_blocks); /** Frees a MAC context */ @@ -80,14 +80,14 @@ struct fastd_mac { void fastd_cipher_init(void); bool fastd_cipher_config(const char *name, const char *impl); -const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name); -const fastd_cipher_t* fastd_cipher_get(const fastd_cipher_info_t *info); +const fastd_cipher_info_t * fastd_cipher_info_get_by_name(const char *name); +const fastd_cipher_t * fastd_cipher_get(const fastd_cipher_info_t *info); void fastd_mac_init(void); bool fastd_mac_config(const char *name, const char *impl); -const fastd_mac_info_t* fastd_mac_info_get_by_name(const char *name); -const fastd_mac_t* fastd_mac_get(const fastd_mac_info_t *info); +const fastd_mac_info_t * fastd_mac_info_get_by_name(const char *name); +const fastd_mac_t * fastd_mac_get(const fastd_mac_info_t *info); /** Sets a range of memory to zero, ensuring the operation can't be optimized out by the compiler */ diff --git a/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c b/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c index 797572c..c9adfcd 100644 --- a/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c +++ b/src/crypto/cipher/aes128_ctr/nacl/cipher_aes128_ctr_nacl.c @@ -42,12 +42,12 @@ struct __attribute__((aligned(16))) fastd_cipher_state { /** Initializes the cipher state */ -static fastd_cipher_state_t* aes128_ctr_init(const uint8_t *key) { +static fastd_cipher_state_t * aes128_ctr_init(const uint8_t *key) { fastd_block128_t k; memcpy(k.b, key, sizeof(fastd_block128_t)); fastd_cipher_state_t *state; - if (posix_memalign((void**)&state, 16, sizeof(fastd_cipher_state_t))) + if (posix_memalign((void **)&state, 16, sizeof(fastd_cipher_state_t))) abort(); crypto_stream_aes128ctr_beforenm(state->d, k.b); diff --git a/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c b/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c index cbf1ed5..cfb824d 100644 --- a/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c +++ b/src/crypto/cipher/aes128_ctr/openssl/aes128_ctr_openssl.c @@ -43,11 +43,11 @@ struct fastd_cipher_state { /** Initializes the cipher state */ -static fastd_cipher_state_t* aes128_ctr_init(const uint8_t *key) { +static fastd_cipher_state_t * aes128_ctr_init(const uint8_t *key) { fastd_cipher_state_t *state = fastd_new(fastd_cipher_state_t); state->aes = EVP_CIPHER_CTX_new(); - EVP_EncryptInit(state->aes, EVP_aes_128_ctr(), (const unsigned char*)key, NULL); + EVP_EncryptInit(state->aes, EVP_aes_128_ctr(), (const unsigned char *)key, NULL); return state; } @@ -59,10 +59,10 @@ static bool aes128_ctr_crypt(const fastd_cipher_state_t *state, fastd_block128_t if (!EVP_EncryptInit(state->aes, NULL, NULL, iv)) return false; - if (!EVP_EncryptUpdate(state->aes, (unsigned char*)out, &clen, (const unsigned char*)in, len)) + if (!EVP_EncryptUpdate(state->aes, (unsigned char *)out, &clen, (const unsigned char *)in, len)) return false; - if (!EVP_EncryptFinal(state->aes, ((unsigned char*)out) + clen, &clen2)) + if (!EVP_EncryptFinal(state->aes, ((unsigned char *)out) + clen, &clen2)) return false; if ((size_t)(clen+clen2) != len) diff --git a/src/crypto/cipher/ciphers.c.in b/src/crypto/cipher/ciphers.c.in index 7816bca..6822efc 100644 --- a/src/crypto/cipher/ciphers.c.in +++ b/src/crypto/cipher/ciphers.c.in @@ -101,7 +101,7 @@ bool fastd_cipher_config(const char *name, const char *impl) { } /** Returns information about the cipher with the specified name if there is an implementation available */ -const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) { +const fastd_cipher_info_t * fastd_cipher_info_get_by_name(const char *name) { size_t i; for (i = 0; i < array_size(ciphers); i++) { if (strcmp(ciphers[i].name, name)) @@ -117,7 +117,7 @@ const fastd_cipher_info_t* fastd_cipher_info_get_by_name(const char *name) { } /** Returns the chosen cipher implementation for a given cipher */ -const fastd_cipher_t* fastd_cipher_get(const fastd_cipher_info_t *info) { +const fastd_cipher_t * fastd_cipher_get(const fastd_cipher_info_t *info) { size_t i; for (i = 0; i < array_size(ciphers); i++) { if (ciphers[i].info == info) diff --git a/src/crypto/cipher/null/memcpy/null_memcpy.c b/src/crypto/cipher/null/memcpy/null_memcpy.c index 089817f..1ad5784 100644 --- a/src/crypto/cipher/null/memcpy/null_memcpy.c +++ b/src/crypto/cipher/null/memcpy/null_memcpy.c @@ -34,7 +34,7 @@ /** Doesn't do anything as the null cipher doesn't use any state */ -static fastd_cipher_state_t* null_init(const uint8_t *key UNUSED) { +static fastd_cipher_state_t * null_init(const uint8_t *key UNUSED) { return NULL; } diff --git a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c index b9c2175..6960ead 100644 --- a/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c +++ b/src/crypto/cipher/salsa20/nacl/salsa20_nacl.c @@ -43,7 +43,7 @@ struct fastd_cipher_state { /** Initializes the cipher state */ -static fastd_cipher_state_t* salsa20_init(const uint8_t *key) { +static fastd_cipher_state_t * salsa20_init(const uint8_t *key) { fastd_cipher_state_t *state = fastd_new(fastd_cipher_state_t); memcpy(state->key, key, crypto_stream_salsa20_KEYBYTES); diff --git a/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c b/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c index abf717f..54fe428 100644 --- a/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c +++ b/src/crypto/cipher/salsa20/xmm/salsa20_xmm.c @@ -67,7 +67,7 @@ static bool salsa20_available(void) { } /** Initializes the cipher state */ -static fastd_cipher_state_t* salsa20_init(const uint8_t *key) { +static fastd_cipher_state_t * salsa20_init(const uint8_t *key) { fastd_cipher_state_t *state = fastd_new(fastd_cipher_state_t); memcpy(state->key, key, KEYBYTES); diff --git a/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c b/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c index 24450dc..2f601fc 100644 --- a/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c +++ b/src/crypto/cipher/salsa2012/nacl/salsa2012_nacl.c @@ -43,7 +43,7 @@ struct fastd_cipher_state { /** Initializes the cipher state */ -static fastd_cipher_state_t* salsa2012_init(const uint8_t *key) { +static fastd_cipher_state_t * salsa2012_init(const uint8_t *key) { fastd_cipher_state_t *state = fastd_new(fastd_cipher_state_t); memcpy(state->key, key, crypto_stream_salsa2012_KEYBYTES); diff --git a/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c b/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c index 6180702..004d502 100644 --- a/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c +++ b/src/crypto/cipher/salsa2012/xmm/salsa2012_xmm.c @@ -67,7 +67,7 @@ static bool salsa2012_available(void) { } /** Initializes the cipher state */ -static fastd_cipher_state_t* salsa2012_init(const uint8_t *key) { +static fastd_cipher_state_t * salsa2012_init(const uint8_t *key) { fastd_cipher_state_t *state = fastd_new(fastd_cipher_state_t); memcpy(state->key, key, KEYBYTES); diff --git a/src/crypto/mac/ghash/builtin/ghash_builtin.c b/src/crypto/mac/ghash/builtin/ghash_builtin.c index 0b957a4..981b588 100644 --- a/src/crypto/mac/ghash/builtin/ghash_builtin.c +++ b/src/crypto/mac/ghash/builtin/ghash_builtin.c @@ -72,9 +72,9 @@ static inline void mulH_a(fastd_block128_t *x, const fastd_mac_state_t *cstate) /** Initializes the MAC state with the unpacked key data */ -static fastd_mac_state_t* ghash_init(const uint8_t *key) { +static fastd_mac_state_t * ghash_init(const uint8_t *key) { fastd_mac_state_t *state; - if (posix_memalign((void**)&state, 16, sizeof(fastd_mac_state_t))) + if (posix_memalign((void **)&state, 16, sizeof(fastd_mac_state_t))) abort(); fastd_block128_t Hbase[4]; diff --git a/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h b/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h index 51ef5da..bd10de4 100644 --- a/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h +++ b/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq.h @@ -35,6 +35,6 @@ #include "../../../../crypto.h" -fastd_mac_state_t* fastd_ghash_pclmulqdq_init(const uint8_t *key); +fastd_mac_state_t * fastd_ghash_pclmulqdq_init(const uint8_t *key); bool fastd_ghash_pclmulqdq_hash(const fastd_mac_state_t *state, fastd_block128_t *out, const fastd_block128_t *in, size_t n_blocks); void fastd_ghash_pclmulqdq_free(fastd_mac_state_t *state); diff --git a/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq_impl.c b/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq_impl.c index 49c036a..17e7aa2 100644 --- a/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq_impl.c +++ b/src/crypto/mac/ghash/pclmulqdq/ghash_pclmulqdq_impl.c @@ -76,9 +76,9 @@ static inline __m128i byteswap(__m128i v) { /** Initializes the state used by this GHASH implementation */ -fastd_mac_state_t* fastd_ghash_pclmulqdq_init(const uint8_t *key) { +fastd_mac_state_t * fastd_ghash_pclmulqdq_init(const uint8_t *key) { fastd_mac_state_t *state; - if (posix_memalign((void**)&state, 16, sizeof(fastd_mac_state_t))) + if (posix_memalign((void **)&state, 16, sizeof(fastd_mac_state_t))) abort(); memcpy(&state->H, key, sizeof(__m128i)); diff --git a/src/crypto/mac/macs.c.in b/src/crypto/mac/macs.c.in index cf29e8d..c4cbecc 100644 --- a/src/crypto/mac/macs.c.in +++ b/src/crypto/mac/macs.c.in @@ -101,7 +101,7 @@ bool fastd_mac_config(const char *name, const char *impl) { } /** Returns information about the MAC with the specified name if there is an implementation available */ -const fastd_mac_info_t* fastd_mac_info_get_by_name(const char *name) { +const fastd_mac_info_t * fastd_mac_info_get_by_name(const char *name) { size_t i; for (i = 0; i < array_size(macs); i++) { if (strcmp(macs[i].name, name)) @@ -117,7 +117,7 @@ const fastd_mac_info_t* fastd_mac_info_get_by_name(const char *name) { } /** Returns the chosen MAC implementation for a given cipher */ -const fastd_mac_t* fastd_mac_get(const fastd_mac_info_t *info) { +const fastd_mac_t * fastd_mac_get(const fastd_mac_info_t *info) { size_t i; for (i = 0; i < array_size(macs); i++) { if (macs[i].info == info) diff --git a/src/fastd.c b/src/fastd.c index 8c58718..de3f2df 100644 --- a/src/fastd.c +++ b/src/fastd.c @@ -399,7 +399,7 @@ static inline void notify_systemd(void) { if (sa.sun_path[0] == '@') sa.sun_path[0] = 0; - if (connect(fd, (struct sockaddr*)&sa, offsetof(struct sockaddr_un, sun_path) + strnlen(notify_socket, sizeof(sa.sun_path))) < 0) { + if (connect(fd, (struct sockaddr *)&sa, offsetof(struct sockaddr_un, sun_path) + strnlen(notify_socket, sizeof(sa.sun_path))) < 0) { pr_debug_errno("unable to connect to notify socket: connect"); close(fd); return; diff --git a/src/fastd.h b/src/fastd.h index 61d10f1..3fe193b 100644 --- a/src/fastd.h +++ b/src/fastd.h @@ -238,7 +238,7 @@ struct fastd_context { int64_t now; /**< The current monotonous timestamp in microseconds after an arbitrary point in time */ uint64_t next_peer_id; /**< An monotonously increasing ID peers are identified with in some components */ - VECTOR(fastd_peer_t*) peers; /**< The currectly active peers */ + VECTOR(fastd_peer_t *) peers; /**< The currectly active peers */ #ifdef WITH_DYNAMIC_PEERS fastd_sem_t verify_limit; /**< Keeps track of the number of verifier threads */ @@ -253,7 +253,7 @@ struct fastd_context { bool has_floating; /**< Specifies if any of the configured peers have floating remotes */ uint32_t peer_addr_ht_seed; /**< The hash seed used for peer_addr_ht */ - VECTOR(fastd_peer_t*) *peer_addr_ht; /**< An array of hash buckets for the peer hash table */ + VECTOR(fastd_peer_t *) *peer_addr_ht; /**< An array of hash buckets for the peer hash table */ fastd_dlist_head_t handshake_queue; /**< A doubly linked list of the peers currently queued for handshakes (ordered by the time of the next handshake) */ fastd_timeout_t next_maintenance; /**< The time of the next maintenance call */ @@ -307,7 +307,7 @@ void fastd_handle_receive(fastd_peer_t *peer, fastd_buffer_t buffer); void fastd_close_all_fds(void); bool fastd_socket_handle_binds(void); -fastd_socket_t* fastd_socket_open(fastd_peer_t *peer, int af); +fastd_socket_t * fastd_socket_open(fastd_peer_t *peer, int af); void fastd_socket_close(fastd_socket_t *sock); void fastd_socket_error(fastd_socket_t *sock); @@ -351,7 +351,7 @@ static inline void fastd_setnonblock(int fd) { */ #define container_of(ptr, type, member) ({ \ const __typeof__(((type *)0)->member) *_mptr = (ptr); \ - (type*)((char*)_mptr - offsetof(type, member)); \ + (type *)((char *)_mptr - offsetof(type, member)); \ }) /** @@ -393,7 +393,7 @@ static inline bool fastd_peer_address_is_v6_ll(const fastd_peer_address_t *addr) } /** Duplicates a string, creating a one-element string stack */ -static inline fastd_string_stack_t* fastd_string_stack_dup(const char *str) { +static inline fastd_string_stack_t * fastd_string_stack_dup(const char *str) { fastd_string_stack_t *ret = fastd_alloc(alignto(sizeof(fastd_string_stack_t) + strlen(str) + 1, 8)); ret->next = NULL; strcpy(ret->str, str); @@ -402,7 +402,7 @@ static inline fastd_string_stack_t* fastd_string_stack_dup(const char *str) { } /** Duplicates a string of a given maximum length, creating a one-element string stack */ -static inline fastd_string_stack_t* fastd_string_stack_dupn(const char *str, size_t len) { +static inline fastd_string_stack_t * fastd_string_stack_dupn(const char *str, size_t len) { size_t str_len = strnlen(str, len); fastd_string_stack_t *ret = fastd_alloc(alignto(sizeof(fastd_string_stack_t) + str_len + 1, 8)); ret->next = NULL; @@ -413,7 +413,7 @@ static inline fastd_string_stack_t* fastd_string_stack_dupn(const char *str, siz } /** Pushes the copy of a string onto the top of a string stack */ -static inline fastd_string_stack_t* fastd_string_stack_push(fastd_string_stack_t *stack, const char *str) { +static inline fastd_string_stack_t * fastd_string_stack_push(fastd_string_stack_t *stack, const char *str) { fastd_string_stack_t *ret = fastd_alloc(alignto(sizeof(fastd_string_stack_t) + strlen(str) + 1, 8)); ret->next = stack; strcpy(ret->str, str); diff --git a/src/handshake.c b/src/handshake.c index 23c9f4e..43f7b7a 100644 --- a/src/handshake.c +++ b/src/handshake.c @@ -58,14 +58,14 @@ static const char *const RECORD_TYPES[RECORD_MAX] = { /** Reads a TLV record as an 8bit integer */ -#define AS_UINT8(ptr) (*(uint8_t*)(ptr).data) +#define AS_UINT8(ptr) (*(uint8_t *)(ptr).data) /** Reads a TLV record as a 16bit integer (big endian) */ -#define AS_UINT16(ptr) ((*(uint8_t*)(ptr).data) + (*((uint8_t*)(ptr).data+1) << 8)) +#define AS_UINT16(ptr) ((*(uint8_t *)(ptr).data) + (*((uint8_t *)(ptr).data+1) << 8)) /** Generates a zero-separated list of supported methods */ -static uint8_t* create_method_list(size_t *len) { +static uint8_t * create_method_list(size_t *len) { *len = 0; size_t i; @@ -75,7 +75,7 @@ static uint8_t* create_method_list(size_t *len) { uint8_t *ret = fastd_alloc(*len); (*len)--; - char *ptr = (char*)ret; + char *ptr = (char *)ret; for (i = 0; conf.methods[i].name; i++) ptr = stpcpy(ptr, conf.methods[i].name) + 1; @@ -93,16 +93,16 @@ static inline bool string_equal(const char *str, const char *buf, size_t maxlen) /** Checks if a string is equal to the value of a TLV record */ static inline bool record_equal(const char *str, const fastd_handshake_record_t *record) { - return string_equal(str, (const char*)record->data, record->length); + return string_equal(str, (const char *)record->data, record->length); } /** Parses a list of zero-separated strings */ -static fastd_string_stack_t* parse_string_list(const uint8_t *data, size_t len) { +static fastd_string_stack_t * parse_string_list(const uint8_t *data, size_t len) { const uint8_t *end = data+len; fastd_string_stack_t *ret = NULL; while (data < end) { - fastd_string_stack_t *part = fastd_string_stack_dupn((char*)data, end-data); + fastd_string_stack_t *part = fastd_string_stack_dupn((char *)data, end-data); part->next = ret; ret = part; data += strlen(part->str) + 1; @@ -304,7 +304,7 @@ static inline bool check_records(fastd_socket_t *sock, const fastd_peer_address_ } /** Returns the method info with a specified name and length */ -static inline const fastd_method_info_t* get_method_by_name(const char *name, size_t n) { +static inline const fastd_method_info_t * get_method_by_name(const char *name, size_t n) { char name0[n+1]; memcpy(name0, name, n); name0[n] = 0; @@ -313,7 +313,7 @@ static inline const fastd_method_info_t* get_method_by_name(const char *name, si } /** Returns the most appropriate method to negotiate with a peer a handshake was received from */ -static inline const fastd_method_info_t* get_method(const fastd_handshake_t *handshake) { +static inline const fastd_method_info_t * get_method(const fastd_handshake_t *handshake) { if (handshake->records[RECORD_METHOD_LIST].data && handshake->records[RECORD_METHOD_LIST].length) { fastd_string_stack_t *method_list = parse_string_list(handshake->records[RECORD_METHOD_LIST].data, handshake->records[RECORD_METHOD_LIST].length); @@ -335,7 +335,7 @@ static inline const fastd_method_info_t* get_method(const fastd_handshake_t *han if (!handshake->records[RECORD_METHOD_NAME].data) return NULL; - return get_method_by_name((const char*)handshake->records[RECORD_METHOD_NAME].data, handshake->records[RECORD_METHOD_NAME].length); + return get_method_by_name((const char *)handshake->records[RECORD_METHOD_NAME].data, handshake->records[RECORD_METHOD_NAME].length); } /** Handles a handshake packet */ @@ -364,7 +364,7 @@ void fastd_handshake_handle(fastd_socket_t *sock, const fastd_peer_address_t *lo method = get_method(&handshake); if (handshake.records[RECORD_VERSION_NAME].data) - handshake.peer_version = peer_version = fastd_strndup((const char*)handshake.records[RECORD_VERSION_NAME].data, handshake.records[RECORD_VERSION_NAME].length); + handshake.peer_version = peer_version = fastd_strndup((const char *)handshake.records[RECORD_VERSION_NAME].data, handshake.records[RECORD_VERSION_NAME].length); } if (handshake.type > 1 && !method) { diff --git a/src/handshake.h b/src/handshake.h index 2be71e5..2ea7166 100644 --- a/src/handshake.h +++ b/src/handshake.h @@ -99,7 +99,7 @@ void fastd_handshake_handle(fastd_socket_t *sock, const fastd_peer_address_t *lo /** Returns the TLV data of a handshake packet in a given buffer */ -static inline void* fastd_handshake_tlv_data(const fastd_buffer_t *buffer) { +static inline void * fastd_handshake_tlv_data(const fastd_buffer_t *buffer) { fastd_handshake_packet_t *packet = buffer->data; return packet->tlv_data; } @@ -111,7 +111,7 @@ static inline uint16_t fastd_handshake_tlv_len(const fastd_buffer_t *buffer) { } /** Adds an uninitialized TLV record of given type and length to a handshake buffer */ -static inline uint8_t* fastd_handshake_extend(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { +static inline uint8_t * fastd_handshake_extend(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { uint8_t *dst = buffer->data + buffer->len; if (buffer->data + buffer->len + 4 + len > buffer->base + buffer->base_len) @@ -138,7 +138,7 @@ static inline void fastd_handshake_add(fastd_buffer_t *buffer, fastd_handshake_r } /** Adds an TLV record of given type and length initialized with zeros to a handshake buffer */ -static inline uint8_t* fastd_handshake_add_zero(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { +static inline uint8_t * fastd_handshake_add_zero(fastd_buffer_t *buffer, fastd_handshake_record_type_t type, size_t len) { uint8_t *dst = fastd_handshake_extend(buffer, type, len); memset(dst, 0, len); diff --git a/src/hash.h b/src/hash.h index 7a8c79b..d16c3c6 100644 --- a/src/hash.h +++ b/src/hash.h @@ -43,7 +43,7 @@ static inline void fastd_hash(uint32_t *hash, const void *data, size_t len) { size_t i; for (i = 0; i < len; ++i) { - *hash += ((uint8_t*)data)[i]; + *hash += ((uint8_t *)data)[i]; *hash += (*hash << 10); *hash ^= (*hash >> 6); } diff --git a/src/hkdf_sha256.c b/src/hkdf_sha256.c index f521f41..3a7d9ad 100644 --- a/src/hkdf_sha256.c +++ b/src/hkdf_sha256.c @@ -45,14 +45,14 @@ void fastd_hkdf_sha256_expand(fastd_sha256_t *out, size_t blocks, const fastd_sh memset(buf, 0, FASTD_SHA256_HASH_BYTES); memcpy(buf+FASTD_SHA256_HASH_WORDS, info, infolen); - ((uint8_t*)buf)[len-1] = 0x01; + ((uint8_t *)buf)[len-1] = 0x01; fastd_hmacsha256(out, prk->w, buf+FASTD_SHA256_HASH_WORDS, infolen + 1); while (--blocks) { memcpy(buf, out, FASTD_SHA256_HASH_BYTES); out++; - ((uint8_t*)buf)[len-1]++; + ((uint8_t *)buf)[len-1]++; fastd_hmacsha256(out, prk->w, buf, len); } diff --git a/src/lex.c b/src/lex.c index 1586538..c6b771b 100644 --- a/src/lex.c +++ b/src/lex.c @@ -158,7 +158,7 @@ static inline char current(fastd_lex_t *lex) { } /** Returns the current token as a newly allocated string */ -static char* get_token(fastd_lex_t *lex) { +static char * get_token(fastd_lex_t *lex) { return fastd_strndup(lex->buffer+lex->start, lex->tok_len); } @@ -443,7 +443,7 @@ static int parse_keyword(YYSTYPE *yylval, YYLTYPE *yylloc, fastd_lex_t *lex) { /** Initializes a new scanner for the given file */ -fastd_lex_t* fastd_lex_init(FILE *file) { +fastd_lex_t * fastd_lex_init(FILE *file) { fastd_lex_t *lex = fastd_new0(fastd_lex_t); lex->file = file; diff --git a/src/lex.h b/src/lex.h index 53ecce2..65a339b 100644 --- a/src/lex.h +++ b/src/lex.h @@ -38,7 +38,7 @@ #include -fastd_lex_t* fastd_lex_init(FILE *file); +fastd_lex_t * fastd_lex_init(FILE *file); void fastd_lex_destroy(fastd_lex_t *lex); int fastd_lex(YYSTYPE *yylval, YYLTYPE *yylloc, fastd_lex_t *lex); diff --git a/src/log.c b/src/log.c index f6b6d2d..7295ba7 100644 --- a/src/log.c +++ b/src/log.c @@ -144,15 +144,15 @@ static int fastd_vsnprintf(char *buffer, size_t size, const char *format, va_lis break; case 's': - buffer += snprintf_safe(buffer, buffer_end-buffer, "%s", va_arg(ap, char*)); + buffer += snprintf_safe(buffer, buffer_end-buffer, "%s", va_arg(ap, char *)); break; case 'p': - buffer += snprintf_safe(buffer, buffer_end-buffer, "%p", va_arg(ap, void*)); + buffer += snprintf_safe(buffer, buffer_end-buffer, "%p", va_arg(ap, void *)); break; case 'E': - eth_addr = va_arg(ap, const fastd_eth_addr_t*); + eth_addr = va_arg(ap, const fastd_eth_addr_t *); if (eth_addr) { if (conf.hide_mac_addresses) @@ -168,18 +168,18 @@ static int fastd_vsnprintf(char *buffer, size_t size, const char *format, va_lis break; case 'P': - buffer += snprint_peer_str(buffer, buffer_end-buffer, va_arg(ap, const fastd_peer_t*)); + buffer += snprint_peer_str(buffer, buffer_end-buffer, va_arg(ap, const fastd_peer_t *)); break; case 'I': case 'B': case 'L': - p = va_arg(ap, const fastd_peer_address_t*); + p = va_arg(ap, const fastd_peer_address_t *); - iface = (*format == 'L') ? va_arg(ap, const char*) : NULL; + iface = (*format == 'L') ? va_arg(ap, const char *) : NULL; if (p) - buffer += snprint_peer_address(buffer, buffer_end-buffer, (const fastd_peer_address_t*)p, iface, *format != 'I'); + buffer += snprint_peer_address(buffer, buffer_end-buffer, (const fastd_peer_address_t *)p, iface, *format != 'I'); else buffer += snprintf_safe(buffer, buffer_end-buffer, "(null)"); break; @@ -198,7 +198,7 @@ static int fastd_vsnprintf(char *buffer, size_t size, const char *format, va_lis } /** Returns a prefix string to use for log messages of a specified level */ -static inline const char* get_log_prefix(fastd_loglevel_t log_level) { +static inline const char * get_log_prefix(fastd_loglevel_t log_level) { switch(log_level) { case LL_FATAL: return "Fatal: "; diff --git a/src/method.h b/src/method.h index 4ae9e0a..fec81f9 100644 --- a/src/method.h +++ b/src/method.h @@ -59,9 +59,9 @@ struct fastd_method_provider { size_t (*key_length)(const fastd_method_t *method); /** Initiates a session */ - fastd_method_session_state_t* (*session_init)(const fastd_method_t *method, const uint8_t *secret, bool initiator); + fastd_method_session_state_t * (*session_init)(const fastd_method_t *method, const uint8_t *secret, bool initiator); /** Initiates a session in pre-v11 compatiblity mode */ - fastd_method_session_state_t* (*session_init_compat)(const fastd_method_t *method, const uint8_t *secret, size_t length, bool initiator); + fastd_method_session_state_t * (*session_init_compat)(const fastd_method_t *method, const uint8_t *secret, size_t length, bool initiator); /** Closes a session */ void (*session_free)(fastd_method_session_state_t *session); @@ -85,7 +85,7 @@ bool fastd_method_create_by_name(const char *name, const fastd_method_provider_t /** Finds the fastd_method_info_t for a configured method */ -static inline const fastd_method_info_t* fastd_method_get_by_name(const char *name) { +static inline const fastd_method_info_t * fastd_method_get_by_name(const char *name) { size_t i; for (i = 0; conf.methods[i].name; i++) { if (!strcmp(conf.methods[i].name, name)) diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c index 277671a..8ff57c6 100644 --- a/src/methods/cipher_test/cipher_test.c +++ b/src/methods/cipher_test/cipher_test.c @@ -89,7 +89,7 @@ static size_t method_key_length(const fastd_method_t *method) { } /** Initializes a session */ -static fastd_method_session_state_t* method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { +static fastd_method_session_state_t * method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t); fastd_method_common_init(&session->common, initiator); diff --git a/src/methods/composed_gmac/composed_gmac.c b/src/methods/composed_gmac/composed_gmac.c index ead3cb0..a709c3f 100644 --- a/src/methods/composed_gmac/composed_gmac.c +++ b/src/methods/composed_gmac/composed_gmac.c @@ -132,7 +132,7 @@ static size_t method_key_length(const fastd_method_t *method) { } /** Initializes a session */ -static fastd_method_session_state_t* method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { +static fastd_method_session_state_t * method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t); fastd_method_common_init(&session->common, initiator); diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c index 930e52d..5ee8427 100644 --- a/src/methods/generic_gmac/generic_gmac.c +++ b/src/methods/generic_gmac/generic_gmac.c @@ -107,7 +107,7 @@ static size_t method_key_length(const fastd_method_t *method) { } /** Initializes a session */ -static fastd_method_session_state_t* method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { +static fastd_method_session_state_t * method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t); fastd_method_common_init(&session->common, initiator); diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c index f804ba3..a9b1673 100644 --- a/src/methods/generic_poly1305/generic_poly1305.c +++ b/src/methods/generic_poly1305/generic_poly1305.c @@ -101,7 +101,7 @@ static size_t method_key_length(const fastd_method_t *method) { } /** Initializes a session */ -static fastd_method_session_state_t* method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { +static fastd_method_session_state_t * method_session_init(const fastd_method_t *method, const uint8_t *secret, bool initiator) { fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t); fastd_method_common_init(&session->common, initiator); diff --git a/src/methods/null/null.c b/src/methods/null/null.c index 71191de..13b2dbd 100644 --- a/src/methods/null/null.c +++ b/src/methods/null/null.c @@ -54,7 +54,7 @@ static size_t method_key_length(const fastd_method_t *method UNUSED) { } /** Initiates a new null session */ -static fastd_method_session_state_t* method_session_init(const fastd_method_t *method UNUSED, const uint8_t *secret UNUSED, bool initiator) { +static fastd_method_session_state_t * method_session_init(const fastd_method_t *method UNUSED, const uint8_t *secret UNUSED, bool initiator) { fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t); session->valid = true; @@ -64,7 +64,7 @@ static fastd_method_session_state_t* method_session_init(const fastd_method_t *m } /** Initiates a new null session (pre-v11 compat handshake) */ -static fastd_method_session_state_t* method_session_init_compat(const fastd_method_t *method, const uint8_t *secret, size_t length UNUSED, bool initiator) { +static fastd_method_session_state_t * method_session_init_compat(const fastd_method_t *method, const uint8_t *secret, size_t length UNUSED, bool initiator) { return method_session_init(method, secret, initiator); } diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c index 5a4966e..4b2f60d 100644 --- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c +++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c @@ -64,7 +64,7 @@ static size_t method_key_length(const fastd_method_t *method UNUSED) { } /** Initializes the session state */ -static fastd_method_session_state_t* method_session_init(const fastd_method_t *method UNUSED, const uint8_t *secret, bool initiator) { +static fastd_method_session_state_t * method_session_init(const fastd_method_t *method UNUSED, const uint8_t *secret, bool initiator) { fastd_method_session_state_t *session = fastd_new(fastd_method_session_state_t); fastd_method_common_init(&session->common, initiator); @@ -75,7 +75,7 @@ static fastd_method_session_state_t* method_session_init(const fastd_method_t *m } /** Initializes the session state (pre-v11 compat handshake) */ -static fastd_method_session_state_t* method_session_init_compat(const fastd_method_t *method, const uint8_t *secret, size_t length, bool initiator) { +static fastd_method_session_state_t * method_session_init_compat(const fastd_method_t *method, const uint8_t *secret, size_t length, bool initiator) { if (length < crypto_secretbox_xsalsa20poly1305_KEYBYTES) exit_bug("xsalsa20-poly1305: tried to init with short secret"); diff --git a/src/options.c b/src/options.c index 8593da2..0af48f4 100644 --- a/src/options.c +++ b/src/options.c @@ -394,7 +394,7 @@ static bool config_match(const char *opt, ...) { va_start(ap, opt); - while((str = va_arg(ap, const char*)) != NULL) { + while((str = va_arg(ap, const char *)) != NULL) { if (strcmp(opt, str) == 0) { match = true; break; diff --git a/src/peer.c b/src/peer.c index 5dee686..1fefa33 100644 --- a/src/peer.c +++ b/src/peer.c @@ -160,7 +160,7 @@ static inline size_t peer_index(fastd_peer_t *peer) { } /** Finds a peer with a specified ID */ -fastd_peer_t* fastd_peer_find_by_id(uint64_t id) { +fastd_peer_t * fastd_peer_find_by_id(uint64_t id) { fastd_peer_t **ret = peer_p_find_by_id(id); if (ret) @@ -884,7 +884,7 @@ void fastd_peer_eth_addr_add(fastd_peer_t *peer, fastd_eth_addr_t addr) { } /** Finds the peer that is associated with a given MAC address */ -fastd_peer_t* fastd_peer_find_by_eth_addr(const fastd_eth_addr_t addr) { +fastd_peer_t * fastd_peer_find_by_eth_addr(const fastd_eth_addr_t addr) { const fastd_peer_eth_addr_t key = {.addr = addr}; fastd_peer_eth_addr_t *peer_eth_addr = VECTOR_BSEARCH(&key, ctx.eth_addrs, peer_eth_addr_cmp); diff --git a/src/peer.h b/src/peer.h index fde5bdf..51e6ffa 100644 --- a/src/peer.h +++ b/src/peer.h @@ -168,7 +168,7 @@ bool fastd_peer_matches_address(const fastd_peer_t *peer, const fastd_peer_addre bool fastd_peer_claim_address(fastd_peer_t *peer, fastd_socket_t *sock, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *remote_addr, bool force); void fastd_peer_reset_socket(fastd_peer_t *peer); void fastd_peer_schedule_handshake(fastd_peer_t *peer, int delay); -fastd_peer_t* fastd_peer_find_by_id(uint64_t id); +fastd_peer_t * fastd_peer_find_by_id(uint64_t id); void fastd_peer_set_shell_env(fastd_shell_env_t *env, const fastd_peer_t *peer, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *peer_addr); void fastd_peer_exec_shell_command(const fastd_shell_command_t *command, const fastd_peer_t *peer, const fastd_peer_address_t *local_addr, const fastd_peer_address_t *peer_addr); @@ -266,7 +266,7 @@ static inline bool fastd_eth_addr_is_unicast(fastd_eth_addr_t addr) { } void fastd_peer_eth_addr_add(fastd_peer_t *peer, fastd_eth_addr_t addr); -fastd_peer_t* fastd_peer_find_by_eth_addr(fastd_eth_addr_t addr); +fastd_peer_t * fastd_peer_find_by_eth_addr(fastd_eth_addr_t addr); void fastd_peer_handle_handshake_queue(void); void fastd_peer_maintenance(void); diff --git a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c index 8528074..6920b5e 100644 --- a/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c +++ b/src/protocols/ec25519_fhmqvc/ec25519_fhmqvc.c @@ -58,7 +58,7 @@ static inline void check_session_refresh(fastd_peer_t *peer) { } /** Initializes the protocol-specific configuration */ -static fastd_protocol_config_t* protocol_init(void) { +static fastd_protocol_config_t * protocol_init(void) { fastd_protocol_config_t *protocol_config = fastd_new(fastd_protocol_config_t); if (!conf.secret) diff --git a/src/protocols/ec25519_fhmqvc/handshake.c b/src/protocols/ec25519_fhmqvc/handshake.c index 94aa338..7487100 100644 --- a/src/protocols/ec25519_fhmqvc/handshake.c +++ b/src/protocols/ec25519_fhmqvc/handshake.c @@ -129,7 +129,7 @@ static inline bool new_session(fastd_peer_t *peer, const fastd_method_info_t *me fastd_sha256_t secret[blocks]; derive_key(secret, blocks, salt, method->name, A, B, X, Y, sigma); - peer->protocol_state->session.method_state = method->provider->session_init(method->method, (const uint8_t*)secret, initiator); + peer->protocol_state->session.method_state = method->provider->session_init(method->method, (const uint8_t *)secret, initiator); } else { fastd_sha256_t hash; diff --git a/src/random.c b/src/random.c index 72e6c6a..904d62f 100644 --- a/src/random.c +++ b/src/random.c @@ -51,7 +51,7 @@ void fastd_random_bytes(void *buffer, size_t len, bool secure) { exit_errno("unable to open random device"); while (read_bytes < len) { - ssize_t ret = read(fd, ((char*)buffer)+read_bytes, len-read_bytes); + ssize_t ret = read(fd, ((char *)buffer)+read_bytes, len-read_bytes); if (ret < 0) exit_errno("unable to read from random device"); diff --git a/src/receive.c b/src/receive.c index f4172f8..ce20c4d 100644 --- a/src/receive.c +++ b/src/receive.c @@ -42,18 +42,18 @@ static inline void handle_socket_control(struct msghdr *message, const fastd_socket_t *sock, fastd_peer_address_t *local_addr) { memset(local_addr, 0, sizeof(fastd_peer_address_t)); - const uint8_t *end = (const uint8_t*)message->msg_control + message->msg_controllen; + const uint8_t *end = (const uint8_t *)message->msg_control + message->msg_controllen; struct cmsghdr *cmsg; for (cmsg = CMSG_FIRSTHDR(message); cmsg; cmsg = CMSG_NXTHDR(message, cmsg)) { - if ((const uint8_t*)cmsg + sizeof(*cmsg) > end) + if ((const uint8_t *)cmsg + sizeof(*cmsg) > end) return; #ifdef USE_PKTINFO if (cmsg->cmsg_level == IPPROTO_IP && cmsg->cmsg_type == IP_PKTINFO) { struct in_pktinfo pktinfo; - if ((const uint8_t*)CMSG_DATA(cmsg) + sizeof(pktinfo) > end) + if ((const uint8_t *)CMSG_DATA(cmsg) + sizeof(pktinfo) > end) return; memcpy(&pktinfo, CMSG_DATA(cmsg), sizeof(pktinfo)); @@ -69,7 +69,7 @@ static inline void handle_socket_control(struct msghdr *message, const fastd_soc if (cmsg->cmsg_level == IPPROTO_IPV6 && cmsg->cmsg_type == IPV6_PKTINFO) { struct in6_pktinfo pktinfo; - if ((uint8_t*)CMSG_DATA(cmsg) + sizeof(pktinfo) > end) + if ((uint8_t *)CMSG_DATA(cmsg) + sizeof(pktinfo) > end) return; memcpy(&pktinfo, CMSG_DATA(cmsg), sizeof(pktinfo)); diff --git a/src/resolve.c b/src/resolve.c index ba44ffe..52b5ee8 100644 --- a/src/resolve.c +++ b/src/resolve.c @@ -46,7 +46,7 @@ typedef struct resolv_arg { /** The resolver thread main routine */ -static void* resolve_peer(void *varg) { +static void * resolve_peer(void *varg) { resolv_arg_t *arg = varg; struct addrinfo *res = NULL, *res2; @@ -77,7 +77,7 @@ static void* resolve_peer(void *varg) { } uint8_t retbuf[sizeof(fastd_async_resolve_return_t) + n_addr*sizeof(fastd_peer_address_t)] __attribute__((aligned(8))); - fastd_async_resolve_return_t *ret = (fastd_async_resolve_return_t*)retbuf; + fastd_async_resolve_return_t *ret = (fastd_async_resolve_return_t *)retbuf; ret->peer_id = arg->peer_id; ret->remote = arg->remote; diff --git a/src/send.c b/src/send.c index be5c390..32e3492 100644 --- a/src/send.c +++ b/src/send.c @@ -41,7 +41,7 @@ static inline void add_pktinfo(struct msghdr *msg, const fastd_peer_address_t *l if (!local_addr) return; - struct cmsghdr *cmsg = (struct cmsghdr*)((char*)msg->msg_control + msg->msg_controllen); + struct cmsghdr *cmsg = (struct cmsghdr *)((char *)msg->msg_control + msg->msg_controllen); #ifdef USE_PKTINFO if (local_addr->sa.sa_family == AF_INET) { @@ -94,12 +94,12 @@ static void send_type(const fastd_socket_t *sock, const fastd_peer_address_t *lo switch (remote_addr->sa.sa_family) { case AF_INET: - msg.msg_name = (void*)&remote_addr->in; + msg.msg_name = (void *)&remote_addr->in; msg.msg_namelen = sizeof(struct sockaddr_in); break; case AF_INET6: - msg.msg_name = (void*)&remote_addr->in6; + msg.msg_name = (void *)&remote_addr->in6; msg.msg_namelen = sizeof(struct sockaddr_in6); break; @@ -111,7 +111,7 @@ static void send_type(const fastd_socket_t *sock, const fastd_peer_address_t *lo remote_addr6 = *remote_addr; fastd_peer_address_widen(&remote_addr6); - msg.msg_name = (void*)&remote_addr6.in6; + msg.msg_name = (void *)&remote_addr6.in6; msg.msg_namelen = sizeof(struct sockaddr_in6); } diff --git a/src/sha256.c b/src/sha256.c index a9007da..3d6401f 100644 --- a/src/sha256.c +++ b/src/sha256.c @@ -145,7 +145,7 @@ static void sha256_blocks_va(uint32_t out[FASTD_SHA256_HASH_WORDS], va_list ap) va_list ap2; va_copy(ap2, ap); - while (va_arg(ap2, const uint32_t*)) + while (va_arg(ap2, const uint32_t *)) count++; va_end(ap2); @@ -153,7 +153,7 @@ static void sha256_blocks_va(uint32_t out[FASTD_SHA256_HASH_WORDS], va_list ap) size_t i = 0; const uint32_t *block; - while ((block = va_arg(ap, const uint32_t*)) != NULL) + while ((block = va_arg(ap, const uint32_t *)) != NULL) blocks[i++] = block; sha256_list(out, blocks, count*FASTD_SHA256_BLOCK_BYTES); @@ -228,7 +228,7 @@ static void hmacsha256_blocks_va(fastd_sha256_t *out, const uint32_t key[FASTD_H va_list ap2; va_copy(ap2, ap); - while (va_arg(ap2, const uint32_t*)) + while (va_arg(ap2, const uint32_t *)) count++; va_end(ap2); @@ -236,7 +236,7 @@ static void hmacsha256_blocks_va(fastd_sha256_t *out, const uint32_t key[FASTD_H size_t i = 0; const uint32_t *block; - while ((block = va_arg(ap, const uint32_t*)) != NULL) + while ((block = va_arg(ap, const uint32_t *)) != NULL) blocks[i++] = block; hmacsha256_list(out, key, blocks, count*FASTD_SHA256_BLOCK_BYTES); diff --git a/src/shell.c b/src/shell.c index 19dc6e5..e9e026d 100644 --- a/src/shell.c +++ b/src/shell.c @@ -143,7 +143,7 @@ static bool shell_command_do_exec(const fastd_shell_command_t *command, const fa sigemptyset(&set); pthread_sigmask(SIG_SETMASK, &set, NULL); - execl("/bin/sh", "sh", "-c", command->command, (char*)NULL); + execl("/bin/sh", "sh", "-c", command->command, (char *)NULL); _exit(127); } diff --git a/src/socket.c b/src/socket.c index c01eec8..7d78b7f 100644 --- a/src/socket.c +++ b/src/socket.c @@ -227,7 +227,7 @@ bool fastd_socket_handle_binds(void) { } /** Opens a single unbound socket for the given address family */ -fastd_socket_t* fastd_socket_open(fastd_peer_t *peer, int af) { +fastd_socket_t * fastd_socket_open(fastd_peer_t *peer, int af) { const fastd_bind_address_t any_address = { .addr.sa.sa_family = af }; int fd = bind_socket(&any_address, true); diff --git a/src/tuntap.c b/src/tuntap.c index 6281405..e35858e 100644 --- a/src/tuntap.c +++ b/src/tuntap.c @@ -379,7 +379,7 @@ void fastd_tuntap_handle(void) { /** Writes a packet to the TUN/TAP device */ void fastd_tuntap_write(fastd_buffer_t buffer) { if (multiaf_tun && conf.mode == MODE_TUN) { - uint8_t version = *((uint8_t*)buffer.data) >> 4; + uint8_t version = *((uint8_t *)buffer.data) >> 4; uint32_t af; switch (version) { diff --git a/src/vector.h b/src/vector.h index 8b60f4a..a5c60d1 100644 --- a/src/vector.h +++ b/src/vector.h @@ -67,7 +67,7 @@ void _fastd_vector_delete(fastd_vector_desc_t *desc, void **data, size_t pos, si */ #define VECTOR_RESIZE(v, n) ({ \ __typeof__(v) *_v = &(v); \ - _fastd_vector_resize(&_v->desc, (void**)&_v->data, (n), sizeof(*_v->data)); \ + _fastd_vector_resize(&_v->desc, (void **)&_v->data, (n), sizeof(*_v->data)); \ }) /** @@ -106,7 +106,7 @@ void _fastd_vector_delete(fastd_vector_desc_t *desc, void **data, size_t pos, si #define VECTOR_INSERT(v, elem, pos) ({ \ __typeof__(v) *_v = &(v); \ __typeof__(*_v->data) _e = (elem); \ - _fastd_vector_insert(&_v->desc, (void**)&_v->data, &_e, (pos), sizeof(_e)); \ + _fastd_vector_insert(&_v->desc, (void **)&_v->data, &_e, (pos), sizeof(_e)); \ }) /** @@ -117,7 +117,7 @@ void _fastd_vector_delete(fastd_vector_desc_t *desc, void **data, size_t pos, si #define VECTOR_ADD(v, elem) ({ \ __typeof__(v) *_v = &(v); \ __typeof__(*_v->data) _e = (elem); \ - _fastd_vector_insert(&_v->desc, (void**)&_v->data, &_e, _v->desc.length, sizeof(_e)); \ + _fastd_vector_insert(&_v->desc, (void **)&_v->data, &_e, _v->desc.length, sizeof(_e)); \ }) /** @@ -127,7 +127,7 @@ void _fastd_vector_delete(fastd_vector_desc_t *desc, void **data, size_t pos, si */ #define VECTOR_DELETE(v, pos) ({ \ __typeof__(v) *_v = &(v); \ - _fastd_vector_delete(&_v->desc, (void**)&_v->data, (pos), sizeof(*_v->data)); \ + _fastd_vector_delete(&_v->desc, (void **)&_v->data, (pos), sizeof(*_v->data)); \ }) /** -- cgit v1.2.3