[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [tor-dev] Call for testing/review: obfsclient



Fabian Keil <freebsd-listen@xxxxxxxxxxxxx> wrote:

> Yawning Angel <yawning@xxxxxxxxxxxxxxx> wrote:
> 
> > On Fri, 14 Feb 2014 16:17:59 +0000
> > Yawning Angel <yawning@xxxxxxxxxxxxxxx> wrote:
> > 
> > > What the.  Ok.  I'll look at that, though it is a "this should never
> > > happen" sort of situation. I think I'll end up setting up a FreeBSD VM
> > > since my FreeBSD box is on 9.1p10.
> > 
> > Fixed in commit 600af0991cd3ec66d45399a9496186ae58ab7ace
> 
> Awesome. FreeBSD ports are in progress ...

What I have so far is:
http://www.fabiankeil.de/sourcecode/freebsd/liballium-0.0.1.shar
http://www.fabiankeil.de/sourcecode/freebsd/obfsclient-0.0.1.shar

obfsclient seems to build on platforms that use clang to fulfil
the c++11-lib dependency, but if gcc47 is used the build fails:
https://redports.org/~fk/20140217105018-69178-176436/obfsclient-0.0.1.log

I attached a couple of patches that seem to help, but I ran out
of time for now and there are still a bunch of errors left,
for example:
####
--- src/schwanenlied/pt/scramblesuit/obfsclient-uniform_dh_handshake.o ---
src/schwanenlied/pt/scramblesuit/uniform_dh_handshake.cc: In member function 'bool schwanenlied::pt::scramblesuit::UniformDHHandshake::send_handshake_msg(bufferevent*)':
src/schwanenlied/pt/scramblesuit/uniform_dh_handshake.cc:102:17: error: 'to_string' is not a member of 'std'
*** [src/schwanenlied/pt/scramblesuit/obfsclient-uniform_dh_handshake.o] Error code 1
####

Were you able to build it on your FreeBSD 9.1p10 system using
gcc?

Fabian
From e1a2c7042cab3e02e7f0536a7c7567f115750fc7 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@xxxxxxxxxxxxx>
Date: Mon, 17 Feb 2014 13:34:14 +0100
Subject: [PATCH 1/5] Add white-space to make gcc47 happy

Should fix:
./src/schwanenlied/crypto/aes.h:159:15: error: '<::' cannot begin a template-argument list [-fpermissive]
./src/schwanenlied/crypto/aes.h:159:15: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
./src/schwanenlied/crypto/aes.h:159:15: note: (if you use '-fpermissive' G++ will accept your code)
./src/schwanenlied/crypto/aes.h:161:15: error: '<::' cannot begin a template-argument list [-fpermissive]
./src/schwanenlied/crypto/aes.h:161:15: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
./src/schwanenlied/crypto/aes.h:163:15: error: '<::' cannot begin a template-argument list [-fpermissive]
./src/schwanenlied/crypto/aes.h:163:15: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
mv -f src/schwanenlied/crypto/.deps/obfsclient-base32.Tpo src/schwanenlied/crypto/.deps/obfsclient-base32.Po
src/main.cc:72:32: error: '<::' cannot begin a template-argument list [-fpermissive]
src/main.cc:72:32: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
src/main.cc:73:32: error: '<::' cannot begin a template-argument list [-fpermissive]
src/main.cc:73:32: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
src/main.cc: In function 'int main(int, char**)':
src/main.cc:109:14: error: '<::' cannot begin a template-argument list [-fpermissive]
src/main.cc:109:14: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
src/main.cc:110:14: error: '<::' cannot begin a template-argument list [-fpermissive]
src/main.cc:110:14: note: '<:' is an alternate spelling for '['. Insert whitespace between '<' and '::'
---
 src/main.cc                   | 10 +++++-----
 src/schwanenlied/crypto/aes.h |  6 +++---
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/main.cc b/src/main.cc
index 7073047..3f56456 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -69,9 +69,9 @@ static bool init_libevent() {
 template<class Factory>
 static bool init_pt(const allium_ptcfg* cfg,
                     const char* name,
-                    ::std::list<::std::unique_ptr<Socks5Factory>>& factories,
-                    ::std::list<::std::unique_ptr<Socks5Server>>& listeners) {
-  if (::allium_ptcfg_method_requested(cfg, name) != 1)
+                    ::std::list< ::std::unique_ptr<Socks5Factory>>& factories,
+                    ::std::list< ::std::unique_ptr<Socks5Server>>& listeners) {
+  if (::allium_ptcfg_method_requested(cfg, kObfs3MethodName) != 1)
     return false;
 
   if (!init_libevent()) {
@@ -106,8 +106,8 @@ out_free:
 }
 
 int main(int argc, char* argv[]) {
-  ::std::list<::std::unique_ptr<Socks5Factory>> factories;
-  ::std::list<::std::unique_ptr<Socks5Server>> listeners;
+  ::std::list< ::std::unique_ptr<Socks5Factory>> factories;
+  ::std::list< ::std::unique_ptr<Socks5Server>> listeners;
   allium_ptcfg* cfg;
 
   cfg = ::allium_ptcfg_init();
diff --git a/src/schwanenlied/crypto/aes.h b/src/schwanenlied/crypto/aes.h
index 1517461..5721579 100644
--- a/src/schwanenlied/crypto/aes.h
+++ b/src/schwanenlied/crypto/aes.h
@@ -156,11 +156,11 @@ constexpr size_t kAes192KeyLength = 24; /**< AES-192 key length */
 constexpr size_t kAes256KeyLength = 32; /**< AES-256 key length */
 
 /** AES-128-ECB */
-typedef AesEcb<::EVP_aes_128_ecb, kAes128KeyLength> Aes128Ecb;
+typedef AesEcb< ::EVP_aes_128_ecb, kAes128KeyLength> Aes128Ecb;
 /** AES-192-ECB */
-typedef AesEcb<::EVP_aes_192_ecb, kAes192KeyLength> Aes192Ecb;
+typedef AesEcb< ::EVP_aes_192_ecb, kAes192KeyLength> Aes192Ecb;
 /** AES-256-ECB */
-typedef AesEcb<::EVP_aes_256_ecb, kAes256KeyLength> Aes256Ecb;
+typedef AesEcb< ::EVP_aes_256_ecb, kAes256KeyLength> Aes256Ecb;
 
 /** AES-128-CTR */
 typedef Ctr<Aes128Ecb> Aes128Ctr;
-- 
1.8.5.4

From c9b7ba8c8f4b961168ae456728d7a159d975f0b6 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@xxxxxxxxxxxxx>
Date: Mon, 17 Feb 2014 13:40:27 +0100
Subject: [PATCH 2/5] Add casts to make gcc47 happy

Should fix:
src/schwanenlied/crypto/uniform_dh.cc: In constructor 'schwanenlied::crypto::UniformDH::UniformDH()':
src/schwanenlied/crypto/uniform_dh.cc:95:3: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
src/schwanenlied/crypto/uniform_dh.cc:125:3: error: comparison between signed and unsigned integer expressions [-Werror=sign-compare]
*** [src/obfsclient-main.o] Error code 1
---
 src/schwanenlied/crypto/uniform_dh.cc | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/schwanenlied/crypto/uniform_dh.cc b/src/schwanenlied/crypto/uniform_dh.cc
index a1a4957..2077403 100644
--- a/src/schwanenlied/crypto/uniform_dh.cc
+++ b/src/schwanenlied/crypto/uniform_dh.cc
@@ -92,7 +92,7 @@ UniformDH::UniformDH() :
   SL_ASSERT(ctx_->p != nullptr);
   SL_ASSERT(ctx_->g != nullptr);
   SL_ASSERT(ctx_->priv_key != nullptr);
-  SL_ASSERT(::DH_size(ctx_) == kKeyLength);
+  SL_ASSERT(static_cast<size_t>(::DH_size(ctx_)) == kKeyLength);
 
   /*
    * To pick a private UniformDH key, we pick a random 1536-bit number,
@@ -122,7 +122,7 @@ UniformDH::UniformDH() :
   const int offset = public_key_.size() - BN_num_bytes(ctx_->pub_key);
   ret = ::BN_bn2bin(ctx_->pub_key, reinterpret_cast<unsigned
                     char*>(&public_key_[offset]));
-  SL_ASSERT(ret + offset == kKeyLength);
+  SL_ASSERT(static_cast<size_t>(ret + offset) == kKeyLength);
 }
 
 UniformDH::~UniformDH() {
-- 
1.8.5.4

From 5930956ae31f6cd6caebb68bf3b3dc98cf0c7b03 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@xxxxxxxxxxxxx>
Date: Mon, 17 Feb 2014 13:47:20 +0100
Subject: [PATCH 3/5] Include errno.h to make gcc47 happy

Should fix:
src/schwanenlied/socks5_server.cc: In member function 'void schwanenlied::Socks5Server::Session::outgoing_connect_cb(short int)':
src/schwanenlied/socks5_server.cc:495:13: error: 'errno' was not declared in this scope
src/schwanenlied/socks5_server.cc:496:10: error: 'ENETUNREACH' was not declared in this scope
src/schwanenlied/socks5_server.cc:499:10: error: 'EHOSTUNREACH' was not declared in this scope
src/schwanenlied/socks5_server.cc:502:10: error: 'ECONNREFUSED' was not declared in this scope
---
 src/schwanenlied/socks5_server.cc | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/schwanenlied/socks5_server.cc b/src/schwanenlied/socks5_server.cc
index 97de3a0..356d996 100644
--- a/src/schwanenlied/socks5_server.cc
+++ b/src/schwanenlied/socks5_server.cc
@@ -31,6 +31,7 @@
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
+#include <errno.h>
 #include <cstring>
 
 #include <event2/buffer.h>
-- 
1.8.5.4

From cdd1d11169ecc545022189d546d853d425a49065 Mon Sep 17 00:00:00 2001
From: Fabian Keil <fk@xxxxxxxxxxxxx>
Date: Mon, 17 Feb 2014 15:11:13 +0100
Subject: [PATCH 4/5] Add a couple of casts for gcc47

---
 src/schwanenlied/pt/obfs2/client.cc        | 2 +-
 src/schwanenlied/pt/scramblesuit/client.cc | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/schwanenlied/pt/obfs2/client.cc b/src/schwanenlied/pt/obfs2/client.cc
index 57daff4..579fad9 100644
--- a/src/schwanenlied/pt/obfs2/client.cc
+++ b/src/schwanenlied/pt/obfs2/client.cc
@@ -157,7 +157,7 @@ void Client::on_outgoing_data_connecting() {
       return;
 
     // Obtain RESP_SEED, and derive RESP_PAD_KEY
-    if (kSeedLength != ::evbuffer_remove(buf, &resp_seed_[0],
+    if (static_cast<uint32_t>(kSeedLength) != ::evbuffer_remove(buf, &resp_seed_[0],
                                          resp_seed_.size())) {
 out_error:
       send_socks5_response(Reply::kGENERAL_FAILURE);
diff --git a/src/schwanenlied/pt/scramblesuit/client.cc b/src/schwanenlied/pt/scramblesuit/client.cc
index c68a704..8a35427 100644
--- a/src/schwanenlied/pt/scramblesuit/client.cc
+++ b/src/schwanenlied/pt/scramblesuit/client.cc
@@ -181,7 +181,7 @@ void Client::on_outgoing_data() {
         return;
 
       // Copy the header into the decode buffer
-      if (kHeaderLength != ::evbuffer_remove(buf, decode_buf_.data(),
+      if (static_cast<uint32_t>(kHeaderLength) != ::evbuffer_remove(buf, decode_buf_.data(),
                                              kHeaderLength)) {
 out_error:
         delete this;
-- 
1.8.5.4

Attachment: signature.asc
Description: PGP signature

_______________________________________________
tor-dev mailing list
tor-dev@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-dev