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
ec620973
Commit
ec620973
authored
Mar 01, 2016
by
Luca Boccassi
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1832 from hintjens/master
Problem: can't be sure crypto_box always returns 0
parents
708c2060
5b7bf750
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
9 additions
and
6 deletions
+9
-6
curve_client.cpp
src/curve_client.cpp
+6
-4
curve_server.cpp
src/curve_server.cpp
+2
-1
test_security_curve.cpp
tests/test_security_curve.cpp
+1
-1
No files found.
src/curve_client.cpp
View file @
ec620973
...
...
@@ -202,7 +202,6 @@ int zmq::curve_client_t::decode (msg_t *msg_)
}
cn_peer_nonce
=
nonce
;
const
size_t
clen
=
crypto_box_BOXZEROBYTES
+
(
msg_
->
size
()
-
16
);
uint8_t
*
message_plaintext
=
static_cast
<
uint8_t
*>
(
malloc
(
clen
));
...
...
@@ -270,7 +269,8 @@ int zmq::curve_client_t::produce_hello (msg_t *msg_)
int
rc
=
crypto_box
(
hello_box
,
hello_plaintext
,
sizeof
hello_plaintext
,
hello_nonce
,
server_key
,
cn_secret
);
zmq_assert
(
rc
==
0
);
if
(
rc
==
-
1
)
return
-
1
;
rc
=
msg_
->
init_size
(
200
);
errno_assert
(
rc
==
0
);
...
...
@@ -349,7 +349,8 @@ int zmq::curve_client_t::produce_initiate (msg_t *msg_)
int
rc
=
crypto_box
(
vouch_box
,
vouch_plaintext
,
sizeof
vouch_plaintext
,
vouch_nonce
,
cn_server
,
secret_key
);
zmq_assert
(
rc
==
0
);
if
(
rc
==
-
1
)
return
-
1
;
// Assume here that metadata is limited to 256 bytes
uint8_t
initiate_nonce
[
crypto_box_NONCEBYTES
];
...
...
@@ -385,7 +386,8 @@ int zmq::curve_client_t::produce_initiate (msg_t *msg_)
rc
=
crypto_box
(
initiate_box
,
initiate_plaintext
,
mlen
,
initiate_nonce
,
cn_server
,
cn_secret
);
zmq_assert
(
rc
==
0
);
if
(
rc
==
-
1
)
return
-
1
;
rc
=
msg_
->
init_size
(
113
+
mlen
-
crypto_box_BOXZEROBYTES
);
errno_assert
(
rc
==
0
);
...
...
src/curve_server.cpp
View file @
ec620973
...
...
@@ -382,7 +382,8 @@ int zmq::curve_server_t::produce_welcome (msg_t *msg_)
rc
=
crypto_box
(
welcome_ciphertext
,
welcome_plaintext
,
sizeof
welcome_plaintext
,
welcome_nonce
,
cn_client
,
secret_key
);
zmq_assert
(
rc
==
0
);
if
(
rc
==
-
1
)
return
-
1
;
rc
=
msg_
->
init_size
(
168
);
errno_assert
(
rc
==
0
);
...
...
tests/test_security_curve.cpp
View file @
ec620973
...
...
@@ -155,7 +155,7 @@ int main (void)
// Check CURVE security with a garbage server key
// This will be caught by the curve_server class, not passed to ZAP
char
garbage_key
[]
=
"0000
111122223333444455556666777788889999
"
;
char
garbage_key
[]
=
"0000
000000000000000000000000000000000000
"
;
client
=
zmq_socket
(
ctx
,
ZMQ_DEALER
);
assert
(
client
);
rc
=
zmq_setsockopt
(
client
,
ZMQ_CURVE_SERVERKEY
,
garbage_key
,
41
);
...
...
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