Commit Graph

19 Commits (master)

Author SHA1 Message Date
Yawning Angel 19f5a37fe4 build: Update the dependencies (again)
golang.org/x/tools pulling in some third party markdown parser from
github is spooky, but as far as I can tell, is ok (and not actually
used).
8 months ago
Yawning Angel efdc692691 obfs4: Clean up and modernize the codebase
While the thought of dealing with this codebase makes me reach for the
Benzodiazepines, I might as well clean this up.
10 months ago
David Fifield 5fcbb0e140 Do not clamp the private key before Elligator inverse map.
The Elligator inverse map uses the least significant bits of the private
key, which clamping sets to 0, to choose a random low-order point to add
to the public key, to ensure uniformity of representatives.

The other ways that the private key is used, namely in calls to
curve25519.ScalarMult and curve25519.ScalarBaseMult, do their own
clamping when necessary and are documented to accept a uniformly random
scalar.
2 years ago
David Fifield 586fbf4375 Test that public keys are not always on the prime-order subgroup.
See discussion under "Step 2" at https://elligator.org/key-exchange.
2 years ago
Yawning Angel 393aca86cc internal/x25519ell2: Initial import
Replace agl's Elligator2 implementation with a different one, that fixes
the various distinguishers stemming from bugs in the original
implementation and "The Elligator paper is extremely hard to read".

All releases prior to this commit are trivially distinguishable with
simple math, so upgrading is strongly recommended.  The upgrade is fully
backward-compatible with existing implementations, however the
non-upgraded side will emit traffic that is trivially distinguishable
from random.

Special thanks to Loup Vaillant for his body of work on this primitive,
and for motivating me to fix it.
2 years ago
Philipp Winter f638c33f6c
Actually support unsafe logging.
Obfs4proxy implements the -unsafeLogging switch but it's been ignored so
far.  This patch makes it work.
3 years ago
Yawning Angel 2d8f3c8bbf common: Replace the extra25519 import with an internal package
I really didn't want to do this, but this should make `go get` work
again, and maybe people will leave me alone.
4 years ago
Yawning Angel a8288437e3 Update my e-mail address (no functional changes) 5 years ago
Yawning Angel 5b4397bff8 Clean up static analysis warnings
Mostly but not entirely discarding error return values of things that
can not possibly fail despite the API returning errors.
5 years ago
Yawning Angel 70d0e90c86 Change the canonical upstream repo location to gitlab
This commit changes the upstream repo location to:
  https://gitlab.com/yawning/obfs4.git

Additionally all the non-`main` sub-packages now have an import
comment annotation.  As a matter of courtesy, I will continue to
push to both the existing github.com and git.torproject.org repos
for the foreseeable future, though I reserve the right to stop
doing so at any time.
5 years ago
David Fifield cf4dd074fa Fix doc comment for log.Debugf. 9 years ago
Yawning Angel a8d7134f10 Use a built in SOCKS 5 server instead of goptlibs.
Differences from my goptlib branch:
 * Instead of exposing a net.Listener, just expose a Handshake() routine
   that takes an existing net.Conn. (#14135 is irrelevant to this socks
   server.
 * There's an extra routine for sending back sensible errors on Dial
   failure instead of "General failure".
 * The code is slightly cleaner (IMO).

Gotchas:
 * If the goptlib pt.Args datatype or external interface changes,
   args.go will need to be updated.

Tested with obfs3 and obfs4, including IPv6.
9 years ago
Yawning Angel 8996cb2646 Add routines for querying the log module state.
Unless you have very good reason to do so, there should be no reason to
actually call these ever, since the log messages are only generated if
they will result in output being written to a log file.
9 years ago
Yawning Angel df42657079 Move logging wrappers into common/log, and add a DEBUG log level.
Implements feature #15576.
9 years ago
Daniel Martí 08647ec580 Run go fmt 9 years ago
Yawning Angel 0066cfc393 Add support for acting as a ScrambleSuit client.
This allows obfs4proxy to be used as a ScrambleSuit client that is wire
compatible with the obfs4proxy implementation, including session ticket
support, and length obfuscation.

The current implementation has the following limitations:
 * IAT obfuscation is not supported (and is disabled in all other
   ScrambleSuit implementations by default).
 * The length distribution and probabilites are different from those
   generated by obfsproxy and obfsclient due to a different DRBG.
 * Server support is missing and is unlikely to be implemented.
9 years ago
Yawning Angel cdeda57241 Change the import path for go.crypto.
The Go developers decided to move the go.crypto repository to
golang.org/x/crypto, and also to transition from hg to git.  The tip of
tree code.google.com copy of the code is broken due to the import paths
pointing at the new repository.

While the change here is simple (just update the import location), this
affects packagers as it now expects the updated package.  Sorry for the
inconveneince, I blame the Go people.
9 years ago
Yawning Angel 1e574942d5 Change all the arguments to use base16 from base64.
WARNING: THIS BREAKS BACKWARD COMPATIBILITY.

This is primarily to work around bug #12930.  Base16 was chosen over
unpadded Base64 because the go runtime Base64 decoder does not handle
omitting the padding.

May $deity have mercy on anyone who needs to hand-enter an obfs4 bridge
line because I will not.
10 years ago
Yawning Angel 339c63f0c8 Massive cleanup/code reorg.
* Changed obfs4proxy to be more like obfsproxy in terms of design,
   including being an easy framework for developing new TCP/IP style
   pluggable transports.
 * Added support for also acting as an obfs2/obfs3 client or bridge
   as a transition measure (and because the code itself is trivial).
 * Massively cleaned up the obfs4 and related code to be easier to
   read, and more idiomatic Go-like in style.
 * To ease deployment, obfs4proxy will now autogenerate the node-id,
   curve25519 keypair, and drbg seed if none are specified, and save
   them to a JSON file in the pt_state directory (Fixes Tor bug #12605).
10 years ago