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
ed4f3426
Commit
ed4f3426
authored
Nov 08, 2014
by
Pieter Hintjens
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1252 from c-rack/master
Problem: return code of sodium_init() is not checked.
parents
6dc9db1e
479db211
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
6 deletions
+8
-6
curve_client.cpp
src/curve_client.cpp
+4
-3
curve_server.cpp
src/curve_server.cpp
+4
-3
No files found.
src/curve_client.cpp
View file @
ed4f3426
...
...
@@ -38,6 +38,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
);
...
...
@@ -47,12 +48,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
);
}
...
...
src/curve_server.cpp
View file @
ed4f3426
...
...
@@ -42,6 +42,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
);
...
...
@@ -50,12 +51,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
);
}
...
...
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