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
0d5ffd5a
Commit
0d5ffd5a
authored
Nov 04, 2013
by
Richard Newton
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #734 from hintjens/master
Fixed issue 578
parents
75af9ddb
5e6aa58a
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
5 deletions
+15
-5
.gitignore
.gitignore
+9
-0
zmq_utils.cpp
src/zmq_utils.cpp
+6
-5
No files found.
.gitignore
View file @
0d5ffd5a
...
...
@@ -72,6 +72,15 @@ tests/test_security_null
tests/test_security_plain
tests/test_proxy
tests/test_abstract_ipc
tests/test_connect_delay_tipc
tests/test_pair_tipc
tests/test_reqrep_device_tipc
tests/test_reqrep_tipc
tests/test_router_handover
tests/test_router_mandatory_tipc
tests/test_shutdown_stress_tipc
tests/test_sub_forward_tipc
tests/test_term_endpoint_tipc
tests/test*.log
tests/test*.trs
src/platform.hpp*
...
...
src/zmq_utils.cpp
View file @
0d5ffd5a
...
...
@@ -142,15 +142,15 @@ char *zmq_z85_encode (char *dest, uint8_t *data, size_t size)
uint8_t
*
zmq_z85_decode
(
uint8_t
*
dest
,
char
*
string
)
{
if
(
strlen
(
string
)
%
5
!=
0
)
{
errno
=
EINVAL
;
return
NULL
;
}
unsigned
int
byte_nbr
=
0
;
unsigned
int
char_nbr
=
0
;
unsigned
int
string_len
=
strlen
(
string
);
uint32_t
value
=
0
;
while
(
char_nbr
<
str
len
(
string
)
)
{
while
(
char_nbr
<
str
ing_len
)
{
// Accumulate value in base 85
value
=
value
*
85
+
decoder
[(
uint8_t
)
string
[
char_nbr
++
]
-
32
];
if
(
char_nbr
%
5
==
0
)
{
...
...
@@ -173,7 +173,7 @@ uint8_t *zmq_z85_decode (uint8_t *dest, char *string)
// Returns 0 on success, -1 on failure, setting errno.
// Sets errno = ENOTSUP in the absence of libsodium.
int
zmq_curve_keypair
(
char
*
z85_public_key
,
char
*
z85_secret_key
)
int
zmq_curve_keypair
(
char
*
z85_public_key
,
char
*
z85_secret_key
)
{
#ifdef HAVE_LIBSODIUM
# if crypto_box_PUBLICKEYBYTES != 32 \
...
...
@@ -185,8 +185,9 @@ int zmq_curve_keypair (char* z85_public_key, char *z85_secret_key)
uint8_t
secret_key
[
32
];
int
rc
=
crypto_box_keypair
(
public_key
,
secret_key
);
// is there a sensible errno to set here?
if
(
rc
)
return
rc
;
// Is there a sensible errno to set here?
if
(
rc
)
return
rc
;
zmq_z85_encode
(
z85_public_key
,
public_key
,
32
);
zmq_z85_encode
(
z85_secret_key
,
secret_key
,
32
);
...
...
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