summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-11-11 22:35:07 -0500
committerJason A. Donenfeld <Jason@zx2c4.com>2018-11-13 00:34:16 -0800
commit8813c7d8d2608aca8d451b3cb4d7f3285c043691 (patch)
tree9cdb98932f9679f50942b3da2fdf3d8a89271615
parent30322cc25c31a20503d8a162a95eeff3baa44416 (diff)
global: various formatting tweeks
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
-rw-r--r--src/allowedips.c11
-rw-r--r--src/allowedips.h4
-rw-r--r--src/cookie.c6
-rw-r--r--src/cookie.h4
-rw-r--r--src/crypto/zinc/chacha20/chacha20-mips-glue.c1
-rw-r--r--src/crypto/zinc/curve25519/curve25519-fiat32.c2
-rw-r--r--src/messages.h8
-rw-r--r--src/noise.c1
-rw-r--r--src/receive.c4
9 files changed, 19 insertions, 22 deletions
diff --git a/src/allowedips.c b/src/allowedips.c
index b99078d..2de752d 100644
--- a/src/allowedips.c
+++ b/src/allowedips.c
@@ -39,7 +39,7 @@ static void copy_and_assign_cidr(struct allowedips_node *node, const u8 *src,
node->bit_at_b = 7U - (cidr % 8U);
memcpy(node->bits, src, bits / 8U);
}
-#define CHOOSE_NODE(parent, key) \
+#define CHOOSE_NODE(parent, key) \
parent->bit[(key[parent->bit_at_a] >> parent->bit_at_b) & 1]
static void node_free_rcu(struct rcu_head *rcu)
@@ -338,8 +338,7 @@ void wg_allowedips_free(struct allowedips *table, struct mutex *lock)
}
int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
- u8 cidr, struct wg_peer *peer,
- struct mutex *lock)
+ u8 cidr, struct wg_peer *peer, struct mutex *lock)
{
/* Aligned so it can be passed to fls */
u8 key[4] __aligned(__alignof(u32));
@@ -350,8 +349,7 @@ int wg_allowedips_insert_v4(struct allowedips *table, const struct in_addr *ip,
}
int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
- u8 cidr, struct wg_peer *peer,
- struct mutex *lock)
+ u8 cidr, struct wg_peer *peer, struct mutex *lock)
{
/* Aligned so it can be passed to fls64 */
u8 key[16] __aligned(__alignof(u64));
@@ -362,8 +360,7 @@ int wg_allowedips_insert_v6(struct allowedips *table, const struct in6_addr *ip,
}
void wg_allowedips_remove_by_peer(struct allowedips *table,
- struct wg_peer *peer,
- struct mutex *lock)
+ struct wg_peer *peer, struct mutex *lock)
{
++table->seq;
walk_remove_by_peer(&table->root4, peer, lock);
diff --git a/src/allowedips.h b/src/allowedips.h
index d920dc2..8e63f63 100644
--- a/src/allowedips.h
+++ b/src/allowedips.h
@@ -43,9 +43,9 @@ int wg_allowedips_walk_by_peer(struct allowedips *table,
/* These return a strong reference to a peer: */
struct wg_peer *wg_allowedips_lookup_dst(struct allowedips *table,
- struct sk_buff *skb);
+ struct sk_buff *skb);
struct wg_peer *wg_allowedips_lookup_src(struct allowedips *table,
- struct sk_buff *skb);
+ struct sk_buff *skb);
#ifdef DEBUG
bool wg_allowedips_selftest(void);
diff --git a/src/cookie.c b/src/cookie.c
index b1e650d..a6fa077 100644
--- a/src/cookie.c
+++ b/src/cookie.c
@@ -203,9 +203,9 @@ void wg_cookie_message_consume(struct message_handshake_cookie *src,
bool ret;
if (unlikely(!wg_index_hashtable_lookup(&wg->index_hashtable,
- INDEX_HASHTABLE_HANDSHAKE |
- INDEX_HASHTABLE_KEYPAIR,
- src->receiver_index, &peer)))
+ INDEX_HASHTABLE_HANDSHAKE |
+ INDEX_HASHTABLE_KEYPAIR,
+ src->receiver_index, &peer)))
return;
down_read(&peer->latest_cookie.lock);
diff --git a/src/cookie.h b/src/cookie.h
index 856ede8..c403645 100644
--- a/src/cookie.h
+++ b/src/cookie.h
@@ -51,8 +51,8 @@ void wg_cookie_add_mac_to_packet(void *message, size_t len,
struct wg_peer *peer);
void wg_cookie_message_create(struct message_handshake_cookie *src,
- struct sk_buff *skb, __le32 index,
- struct cookie_checker *checker);
+ struct sk_buff *skb, __le32 index,
+ struct cookie_checker *checker);
void wg_cookie_message_consume(struct message_handshake_cookie *src,
struct wg_device *wg);
diff --git a/src/crypto/zinc/chacha20/chacha20-mips-glue.c b/src/crypto/zinc/chacha20/chacha20-mips-glue.c
index 917d8fa..0559321 100644
--- a/src/crypto/zinc/chacha20/chacha20-mips-glue.c
+++ b/src/crypto/zinc/chacha20/chacha20-mips-glue.c
@@ -18,7 +18,6 @@ static inline bool chacha20_arch(struct chacha20_ctx *ctx, u8 *dst,
return true;
}
-
static inline bool hchacha20_arch(u32 derived_key[CHACHA20_KEY_WORDS],
const u8 nonce[HCHACHA20_NONCE_SIZE],
const u8 key[HCHACHA20_KEY_SIZE],
diff --git a/src/crypto/zinc/curve25519/curve25519-fiat32.c b/src/crypto/zinc/curve25519/curve25519-fiat32.c
index 6076c06..50e6f3f 100644
--- a/src/crypto/zinc/curve25519/curve25519-fiat32.c
+++ b/src/crypto/zinc/curve25519/curve25519-fiat32.c
@@ -618,7 +618,7 @@ static __always_inline void fe_invert(fe *out, const fe *z)
static __always_inline void fe_cswap(fe *f, fe *g, unsigned int b)
{
unsigned i;
- b = 0-b;
+ b = 0 - b;
for (i = 0; i < 10; i++) {
u32 x = f->v[i] ^ g->v[i];
x &= b;
diff --git a/src/messages.h b/src/messages.h
index c4061cb..aa700e5 100644
--- a/src/messages.h
+++ b/src/messages.h
@@ -109,7 +109,7 @@ struct message_data {
u8 encrypted_data[];
};
-#define message_data_len(plain_len) \
+#define message_data_len(plain_len) \
(noise_encrypted_len(plain_len) + sizeof(struct message_data))
enum message_alignments {
@@ -117,10 +117,10 @@ enum message_alignments {
MESSAGE_MINIMUM_LENGTH = message_data_len(0)
};
-#define SKB_HEADER_LEN \
- (max(sizeof(struct iphdr), sizeof(struct ipv6hdr)) + \
+#define SKB_HEADER_LEN \
+ (max(sizeof(struct iphdr), sizeof(struct ipv6hdr)) + \
sizeof(struct udphdr) + NET_SKB_PAD)
-#define DATA_PACKET_HEAD_ROOM \
+#define DATA_PACKET_HEAD_ROOM \
ALIGN(sizeof(struct message_data) + SKB_HEADER_LEN, 4)
enum { HANDSHAKE_DSCP = 0x88 /* AF41, plus 00 ECN */ };
diff --git a/src/noise.c b/src/noise.c
index d0a337a..8581f7e 100644
--- a/src/noise.c
+++ b/src/noise.c
@@ -125,6 +125,7 @@ static void keypair_free_kref(struct kref *kref)
{
struct noise_keypair *keypair =
container_of(kref, struct noise_keypair, refcount);
+
net_dbg_ratelimited("%s: Keypair %llu destroyed for peer %llu\n",
keypair->entry.peer->device->dev->name,
keypair->internal_id,
diff --git a/src/receive.c b/src/receive.c
index 5417ab9..09ff506 100644
--- a/src/receive.c
+++ b/src/receive.c
@@ -85,7 +85,7 @@ static int prepare_skb_header(struct sk_buff *skb, struct wg_device *wg)
return -EINVAL;
skb_pull(skb, data_offset);
if (unlikely(skb->len != data_len))
- /* Final len does not agree with calculated len */
+ /* Final len does not agree with calculated len */
return -EINVAL;
header_len = validate_header_len(skb);
if (unlikely(!header_len))
@@ -179,7 +179,7 @@ static void wg_receive_handshake_packet(struct wg_device *wg,
wg->dev->name, peer->internal_id,
&peer->endpoint.addr);
if (wg_noise_handshake_begin_session(&peer->handshake,
- &peer->keypairs)) {
+ &peer->keypairs)) {
wg_timers_session_derived(peer);
wg_timers_handshake_complete(peer);
/* Calling this function will either send any existing