diff --git a/src/acl.c b/src/acl.c index d5479eea..713da62f 100644 --- a/src/acl.c +++ b/src/acl.c @@ -74,7 +74,8 @@ init_iptables() if (geteuid() != 0) return -1; char cli[256]; - sprintf(cli, "iptables -N SHADOWSOCKS_LIBEV; \ + sprintf(cli, + "iptables -N SHADOWSOCKS_LIBEV; \ iptables -F SHADOWSOCKS_LIBEV; \ iptables -A OUTPUT -p tcp --tcp-flags RST RST -j SHADOWSOCKS_LIBEV"); return run_cmd(cli); @@ -86,7 +87,8 @@ clean_iptables() if (geteuid() != 0) return -1; char cli[256]; - sprintf(cli, "iptables -D OUTPUT -p tcp --tcp-flags RST RST -j SHADOWSOCKS_LIBEV; \ + sprintf(cli, + "iptables -D OUTPUT -p tcp --tcp-flags RST RST -j SHADOWSOCKS_LIBEV; \ iptables -F SHADOWSOCKS_LIBEV; \ iptables -X SHADOWSOCKS_LIBEV"); return run_cmd(cli); @@ -126,7 +128,6 @@ free_block_list() cache_clear(block_list, 0); // Remove all items } - int remove_from_block_list(char *addr) { diff --git a/src/encrypt.c b/src/encrypt.c index c91c31f9..9534bb28 100644 --- a/src/encrypt.c +++ b/src/encrypt.c @@ -498,9 +498,10 @@ bytes_to_key(const cipher_t *cipher, const digest_type_t *md, int addmd; unsigned int i, j, mds; - mds = 16; + mds = 16; nkey = cipher_key_size(cipher); - if (pass == NULL) return nkey; + if (pass == NULL) + return nkey; memset(&c, 0, sizeof(MD5_CTX)); for (j = 0, addmd = 0; j < nkey; addmd++) { @@ -512,7 +513,8 @@ bytes_to_key(const cipher_t *cipher, const digest_type_t *md, MD5_Final(md_buf, &c); for (i = 0; i < mds; i++, j++) { - if (j >= nkey) break; + if (j >= nkey) + break; key[j] = md_buf[i]; } } @@ -530,8 +532,10 @@ bytes_to_key(const cipher_t *cipher, const digest_type_t *md, mds = md_get_size(md); memset(&c, 0, sizeof(md_context_t)); - if (pass == NULL) return nkey; - if (md_init_ctx(&c, md)) return 0; + if (pass == NULL) + return nkey; + if (md_init_ctx(&c, md)) + return 0; for (j = 0, addmd = 0; j < nkey; addmd++) { md_starts(&c); @@ -542,7 +546,8 @@ bytes_to_key(const cipher_t *cipher, const digest_type_t *md, md_finish(&c, md_buf); for (i = 0; i < mds; i++, j++) { - if (j >= nkey) break; + if (j >= nkey) + break; key[j] = md_buf[i]; } } @@ -562,8 +567,10 @@ bytes_to_key(const cipher_t *cipher, const digest_type_t *md, mds = mbedtls_md_get_size(md); memset(&c, 0, sizeof(mbedtls_md_context_t)); - if (pass == NULL) return nkey; - if (mbedtls_md_setup(&c, md, 1)) return 0; + if (pass == NULL) + return nkey; + if (mbedtls_md_setup(&c, md, 1)) + return 0; for (j = 0, addmd = 0; j < nkey; addmd++) { mbedtls_md_starts(&c); @@ -574,7 +581,8 @@ bytes_to_key(const cipher_t *cipher, const digest_type_t *md, mbedtls_md_finish(&c, &(md_buf[0])); for (i = 0; i < mds; i++, j++) { - if (j >= nkey) break; + if (j >= nkey) + break; key[j] = md_buf[i]; } } @@ -684,7 +692,6 @@ cipher_context_init(cipher_ctx_t *ctx, int method, int enc) } #endif - const cipher_kt_t *cipher = get_cipher_type(method); #if defined(USE_CRYPTO_OPENSSL) @@ -1294,14 +1301,14 @@ enc_key_init(int method, const char *pass) cipher.iv_len = supported_ciphers_iv_size[method]; #endif #if defined(USE_CRYPTO_POLARSSL) - cipher.info = &cipher_info; + cipher.info = &cipher_info; cipher.info->base = NULL; cipher.info->key_length = supported_ciphers_key_size[method] * 8; cipher.info->iv_size = supported_ciphers_iv_size[method]; #endif #if defined(USE_CRYPTO_MBEDTLS) // XXX: key_length changed to key_bitlen in mbed TLS 2.0.0 - cipher.info = &cipher_info; + cipher.info = &cipher_info; cipher.info->base = NULL; cipher.info->key_bitlen = supported_ciphers_key_size[method] * 8; cipher.info->iv_size = supported_ciphers_iv_size[method];