From 58b8518100c8b306d5b6a3d87b4a83a1ae383a09 Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Sat, 6 Sep 2014 01:33:26 +0200 Subject: Move UNUSED attribute to the start of arguments to help editors understand the syntax --- src/methods/cipher_test/cipher_test.c | 2 +- src/methods/composed_gmac/composed_gmac.c | 2 +- src/methods/composed_umac/composed_umac.c | 2 +- src/methods/generic_gmac/generic_gmac.c | 2 +- src/methods/generic_poly1305/generic_poly1305.c | 2 +- src/methods/generic_umac/generic_umac.c | 2 +- src/methods/null/null.c | 14 +++++++------- src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c | 10 +++++----- 8 files changed, 18 insertions(+), 18 deletions(-) (limited to 'src/methods') diff --git a/src/methods/cipher_test/cipher_test.c b/src/methods/cipher_test/cipher_test.c index 8ff57c6..056aaea 100644 --- a/src/methods/cipher_test/cipher_test.c +++ b/src/methods/cipher_test/cipher_test.c @@ -132,7 +132,7 @@ static void method_session_free(fastd_method_session_state_t *session) { /** Encrypts a packet and adds the common method header */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len; *out = fastd_buffer_alloc(in.len, alignto(COMMON_HEADBYTES, 16), sizeof(fastd_block128_t)+tail_len); diff --git a/src/methods/composed_gmac/composed_gmac.c b/src/methods/composed_gmac/composed_gmac.c index 86ae66b..cac24d6 100644 --- a/src/methods/composed_gmac/composed_gmac.c +++ b/src/methods/composed_gmac/composed_gmac.c @@ -206,7 +206,7 @@ static inline void put_size(fastd_block128_t *out, size_t len) { } /** Encrypts and authenticates a packet */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len; *out = fastd_buffer_alloc(sizeof(fastd_block128_t)+in.len, alignto(COMMON_HEADBYTES, 16), sizeof(fastd_block128_t)+tail_len); diff --git a/src/methods/composed_umac/composed_umac.c b/src/methods/composed_umac/composed_umac.c index 6c01bff..ed8225f 100644 --- a/src/methods/composed_umac/composed_umac.c +++ b/src/methods/composed_umac/composed_umac.c @@ -175,7 +175,7 @@ static void method_session_free(fastd_method_session_state_t *session) { } /** Encrypts and authenticates a packet */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { size_t tail_len = in.len ? alignto(in.len, 2 * sizeof(fastd_block128_t))-in.len : (2 * sizeof(fastd_block128_t)); *out = fastd_buffer_alloc(sizeof(fastd_block128_t)+in.len, alignto(COMMON_HEADBYTES, 16), sizeof(fastd_block128_t)+tail_len); diff --git a/src/methods/generic_gmac/generic_gmac.c b/src/methods/generic_gmac/generic_gmac.c index 519c354..0e68f7e 100644 --- a/src/methods/generic_gmac/generic_gmac.c +++ b/src/methods/generic_gmac/generic_gmac.c @@ -177,7 +177,7 @@ static inline void put_size(fastd_block128_t *out, size_t len) { /** Encrypts and authenticates a packet */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { fastd_buffer_pull_head_zero(&in, sizeof(fastd_block128_t)); size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len; diff --git a/src/methods/generic_poly1305/generic_poly1305.c b/src/methods/generic_poly1305/generic_poly1305.c index a9b1673..881ec7f 100644 --- a/src/methods/generic_poly1305/generic_poly1305.c +++ b/src/methods/generic_poly1305/generic_poly1305.c @@ -142,7 +142,7 @@ static void method_session_free(fastd_method_session_state_t *session) { /** Encrypts and authenticates a packet */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { fastd_buffer_pull_head_zero(&in, KEYBYTES); size_t tail_len = alignto(in.len, sizeof(fastd_block128_t))-in.len; diff --git a/src/methods/generic_umac/generic_umac.c b/src/methods/generic_umac/generic_umac.c index 167ee79..3355fdb 100644 --- a/src/methods/generic_umac/generic_umac.c +++ b/src/methods/generic_umac/generic_umac.c @@ -146,7 +146,7 @@ static void method_session_free(fastd_method_session_state_t *session) { } /** Encrypts and authenticates a packet */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { size_t tail_len = in.len ? alignto(in.len, 2 * sizeof(fastd_block128_t))-in.len : (2 * sizeof(fastd_block128_t)); fastd_buffer_pull_head_zero(&in, sizeof(fastd_block128_t)); diff --git a/src/methods/null/null.c b/src/methods/null/null.c index 13b2dbd..f84cf6c 100644 --- a/src/methods/null/null.c +++ b/src/methods/null/null.c @@ -40,21 +40,21 @@ struct fastd_method_session_state { /** Returns true if the name is "null" */ -static bool method_create_by_name(const char *name, fastd_method_t **method UNUSED) { +static bool method_create_by_name(const char *name, UNUSED fastd_method_t **method) { return !strcmp(name, "null"); } /** Does nothing as the null provider provides only a single method */ -static void method_destroy(fastd_method_t *method UNUSED) { +static void method_destroy(UNUSED fastd_method_t *method) { } /** Returns 0 */ -static size_t method_key_length(const fastd_method_t *method UNUSED) { +static size_t method_key_length(UNUSED const fastd_method_t *method) { return 0; } /** 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(UNUSED 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); session->valid = true; @@ -64,7 +64,7 @@ static fastd_method_session_state_t * method_session_init(const fastd_method_t * } /** 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, UNUSED size_t length, bool initiator) { return method_session_init(method, secret, initiator); } @@ -79,7 +79,7 @@ static bool method_session_is_initiator(fastd_method_session_state_t *session) { } /** Returns false */ -static bool method_session_want_refresh(fastd_method_session_state_t *session UNUSED) { +static bool method_session_want_refresh(UNUSED fastd_method_session_state_t *session) { return false; } @@ -99,7 +99,7 @@ static void method_session_free(fastd_method_session_state_t *session) { } /** Just returns the input buffer as the output */ -static bool method_passthrough(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session UNUSED, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_passthrough(UNUSED fastd_peer_t *peer, UNUSED fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { *out = in; return true; } diff --git a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c index 4b2f60d..ee44200 100644 --- a/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c +++ b/src/methods/xsalsa20_poly1305/xsalsa20_poly1305.c @@ -50,21 +50,21 @@ struct fastd_method_session_state { /** Matches the method name "xsalsa20-poly1305" */ -static bool method_create_by_name(const char *name, fastd_method_t **method UNUSED) { +static bool method_create_by_name(const char *name, UNUSED fastd_method_t **method) { return !strcmp(name, "xsalsa20-poly1305"); } /** Does nothing as this provider has only a single method */ -static void method_destroy(fastd_method_t *method UNUSED) { +static void method_destroy(UNUSED fastd_method_t *method) { } /** Returns the key length used by xsalsa20-poly1305 */ -static size_t method_key_length(const fastd_method_t *method UNUSED) { +static size_t method_key_length(UNUSED const fastd_method_t *method) { return crypto_secretbox_xsalsa20poly1305_KEYBYTES; } /** 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(UNUSED 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); @@ -147,7 +147,7 @@ static inline bool handle_header(const fastd_method_common_t *session, fastd_buf /** Performs encryption and authentication of a packet */ -static bool method_encrypt(fastd_peer_t *peer UNUSED, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { +static bool method_encrypt(UNUSED fastd_peer_t *peer, fastd_method_session_state_t *session, fastd_buffer_t *out, fastd_buffer_t in) { fastd_buffer_pull_head_zero(&in, crypto_secretbox_xsalsa20poly1305_ZEROBYTES); *out = fastd_buffer_alloc(in.len, 0, 0); -- cgit v1.2.3