Skip to content

Commit

Permalink
Add recipes for zeromq 3.2 and 4.1
Browse files Browse the repository at this point in the history
  • Loading branch information
bernd committed Nov 7, 2015
1 parent 7a192b3 commit 3d04978
Show file tree
Hide file tree
Showing 3 changed files with 94 additions and 3 deletions.
8 changes: 5 additions & 3 deletions zeromq/recipe.rb → zeromq/3.2.rb
Expand Up @@ -2,10 +2,12 @@ class ZeroMQ < FPM::Cookery::Recipe
description 'The Intelligent Transport Layer'

name 'zeromq'
version '3.2.0.rc1'
version '3.2.5'
revision '1'

homepage 'http://www.zeromq.org'
source 'http://download.zeromq.org/zeromq-3.2.0-rc1.tar.gz'
sha256 '6418523f281f618b9da677b8b640c158049a4f7e6f9f391909101b242e4cc991'
source "http://download.zeromq.org/zeromq-#{version}.tar.gz"
sha256 '09653e56a466683edb2f87ee025c4de55b8740df69481b9d7da98748f0c92124'

conflicts 'libzmq1'
replaces 'libzmq1'
Expand Down
28 changes: 28 additions & 0 deletions zeromq/4.1.rb
@@ -0,0 +1,28 @@
class ZeroMQ < FPM::Cookery::Recipe
description 'The Intelligent Transport Layer'

name 'zeromq'
version '4.1.3'
revision '1'

homepage 'http://www.zeromq.org'
source "http://download.zeromq.org/zeromq-#{version}.tar.gz"
sha256 '61b31c830db377777e417235a24d3660a4bcc3f40d303ee58df082fcd68bf411'

conflicts 'libzmq1'
replaces 'libzmq1'

build_depends 'pkg-config', 'libsodium'

def build
patch workdir('patches/libsodium-1.0.6.diff')

configure :prefix => prefix

make
end

def install
make :install, 'DESTDIR' => destdir
end
end
61 changes: 61 additions & 0 deletions zeromq/patches/libsodium-1.0.6.diff
@@ -0,0 +1,61 @@
Fix compatibility with libsodium 1.0.6.

See:
https://github.com/zeromq/zeromq4-1/commit/89d4e995ef92d5cb3d0f0373ec7d80c2ad7fa0d3

diff --git a/src/curve_client.cpp b/src/curve_client.cpp
index 842e504..0b25b32 100644
--- src/curve_client.cpp
+++ src/curve_client.cpp
@@ -48,6 +48,7 @@ zmq::curve_client_t::curve_client_t (const options_t &options_) :
cn_peer_nonce(1),
sync()
{
+ int rc;
memcpy (public_key, options_.curve_public_key, crypto_box_PUBLICKEYBYTES);
memcpy (secret_key, options_.curve_secret_key, crypto_box_SECRETKEYBYTES);
memcpy (server_key, options_.curve_server_key, crypto_box_PUBLICKEYBYTES);
@@ -57,12 +58,12 @@ zmq::curve_client_t::curve_client_t (const options_t &options_) :
unsigned char tmpbytes[4];
randombytes(tmpbytes, 4);
#else
- // todo check return code
- sodium_init();
+ rc = sodium_init ();
+ zmq_assert (rc != -1);
#endif

// Generate short-term key pair
- const int rc = crypto_box_keypair (cn_public, cn_secret);
+ rc = crypto_box_keypair (cn_public, cn_secret);
zmq_assert (rc == 0);
}

diff --git a/src/curve_server.cpp b/src/curve_server.cpp
index 7bdd8a9..e85b10b 100644
--- src/curve_server.cpp
+++ src/curve_server.cpp
@@ -52,6 +52,7 @@ zmq::curve_server_t::curve_server_t (session_base_t *session_,
cn_peer_nonce(1),
sync()
{
+ int rc;
// Fetch our secret key from socket options
memcpy (secret_key, options_.curve_secret_key, crypto_box_SECRETKEYBYTES);
scoped_lock_t lock (sync);
@@ -60,12 +61,12 @@ zmq::curve_server_t::curve_server_t (session_base_t *session_,
unsigned char tmpbytes[4];
randombytes(tmpbytes, 4);
#else
- // todo check return code
- sodium_init();
+ rc = sodium_init ();
+ zmq_assert (rc != -1);
#endif

// Generate short-term key pair
- const int rc = crypto_box_keypair (cn_public, cn_secret);
+ rc = crypto_box_keypair (cn_public, cn_secret);
zmq_assert (rc == 0);
}

0 comments on commit 3d04978

Please sign in to comment.