Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
L
libzmq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
libzmq
Commits
c71bb5fd
Commit
c71bb5fd
authored
Mar 29, 2016
by
Joe Eli McIlvain
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1872 from edigaryev/fix-urandom-chroot
Problem: CURVE mechanism is unusable with chroot()
parents
c39741dd
884e00cb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
25 deletions
+15
-25
ctx.cpp
src/ctx.cpp
+11
-0
ctx.hpp
src/ctx.hpp
+2
-0
curve_client.cpp
src/curve_client.cpp
+1
-11
curve_client.hpp
src/curve_client.hpp
+0
-2
curve_server.cpp
src/curve_server.cpp
+1
-11
curve_server.hpp
src/curve_server.hpp
+0
-1
No files found.
src/ctx.cpp
View file @
c71bb5fd
...
...
@@ -93,6 +93,17 @@ zmq::ctx_t::ctx_t () :
vmci_fd
=
-
1
;
vmci_family
=
-
1
;
#endif
crypto_sync
.
lock
();
#if defined (ZMQ_USE_TWEETNACL)
// allow opening of /dev/urandom
unsigned
char
tmpbytes
[
4
];
randombytes
(
tmpbytes
,
4
);
#else
int
rc
=
sodium_init
();
zmq_assert
(
rc
!=
-
1
);
#endif
crypto_sync
.
unlock
();
}
bool
zmq
::
ctx_t
::
check_tag
()
...
...
src/ctx.hpp
View file @
c71bb5fd
...
...
@@ -233,6 +233,8 @@ namespace zmq
int
vmci_family
;
mutex_t
vmci_sync
;
#endif
mutex_t
crypto_sync
;
};
}
...
...
src/curve_client.cpp
View file @
c71bb5fd
...
...
@@ -47,22 +47,12 @@ zmq::curve_client_t::curve_client_t (const options_t &options_) :
mechanism_t
(
options_
),
state
(
send_hello
),
cn_nonce
(
1
),
cn_peer_nonce
(
1
),
sync
()
cn_peer_nonce
(
1
)
{
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
);
scoped_lock_t
lock
(
sync
);
#if defined (ZMQ_USE_TWEETNACL)
// allow opening of /dev/urandom
unsigned
char
tmpbytes
[
4
];
randombytes
(
tmpbytes
,
4
);
#else
rc
=
sodium_init
();
zmq_assert
(
rc
!=
-
1
);
#endif
// Generate short-term key pair
rc
=
crypto_box_keypair
(
cn_public
,
cn_secret
);
...
...
src/curve_client.hpp
View file @
c71bb5fd
...
...
@@ -33,7 +33,6 @@
#ifdef ZMQ_HAVE_CURVE
#include "platform.hpp"
#include "mutex.hpp"
#if defined (ZMQ_USE_TWEETNACL)
# include "tweetnacl.h"
...
...
@@ -119,7 +118,6 @@ namespace zmq
int
produce_initiate
(
msg_t
*
msg_
);
int
process_ready
(
const
uint8_t
*
cmd_data
,
size_t
data_size
);
int
process_error
(
const
uint8_t
*
cmd_data
,
size_t
data_size
);
mutex_t
sync
;
};
}
...
...
src/curve_server.cpp
View file @
c71bb5fd
...
...
@@ -51,21 +51,11 @@ zmq::curve_server_t::curve_server_t (session_base_t *session_,
peer_address
(
peer_address_
),
state
(
expect_hello
),
cn_nonce
(
1
),
cn_peer_nonce
(
1
),
sync
()
cn_peer_nonce
(
1
)
{
int
rc
;
// Fetch our secret key from socket options
memcpy
(
secret_key
,
options_
.
curve_secret_key
,
crypto_box_SECRETKEYBYTES
);
scoped_lock_t
lock
(
sync
);
#if defined (ZMQ_USE_TWEETNACL)
// allow opening of /dev/urandom
unsigned
char
tmpbytes
[
4
];
randombytes
(
tmpbytes
,
4
);
#else
rc
=
sodium_init
();
zmq_assert
(
rc
!=
-
1
);
#endif
// Generate short-term key pair
rc
=
crypto_box_keypair
(
cn_public
,
cn_secret
);
...
...
src/curve_server.hpp
View file @
c71bb5fd
...
...
@@ -129,7 +129,6 @@ namespace zmq
void
send_zap_request
(
const
uint8_t
*
key
);
int
receive_and_process_zap_reply
();
mutex_t
sync
;
};
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment