Problem: use of libsodium vs. tweetnacl is confused

It's unclear which we need and in the source code, conditional code
treats tweetnacl as a subclass of libsodium, which is inaccurate.

Solution: redesign the configure/cmake API for this:

* tweetnacl is present by default and cannot be enabled
* libsodium can be enabled using --with-libsodium, which replaces
  the built-in tweetnacl
* CURVE encryption can be disabled entirely using --enable-curve=no

The macros we define in platform.hpp are:

    ZMQ_HAVE_CURVE    1        //  When CURVE is enabled
    HAVE_LIBSODIUM    1        //  When we are using libsodium
    HAVE_TWEETNACL    1        //  When we're using tweetnacl (default)

As of this patch, the default build of libzmq always has CURVE
security, and always uses tweetnacl.
This commit is contained in:
Pieter Hintjens
2016-02-11 13:32:01 +01:00
parent 42ab88e486
commit b49a60410a
16 changed files with 610 additions and 610 deletions

View File

@@ -1211,7 +1211,8 @@ int zmq_poller_wait (void *poller_, zmq_poller_event_t *event, long timeout_)
return -1;
}
zmq::socket_poller_t::event_t e = {};
zmq::socket_poller_t::event_t e;
memset (&e, 0, sizeof (e));
int rc = ((zmq::socket_poller_t*)poller_)->wait (&e, timeout_);
@@ -1360,7 +1361,7 @@ int zmq_has (const char *capability)
if (strcmp (capability, "norm") == 0)
return true;
#endif
#if defined (HAVE_LIBSODIUM)
#if defined (ZMQ_HAVE_CURVE)
if (strcmp (capability, "curve") == 0)
return true;
#endif