mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-17 16:43:58 +00:00
Merge pull request #30 from hintjens/master
Cherry picking fixes from libzmq
This commit is contained in:
commit
806f57e7f6
9
.gitignore
vendored
9
.gitignore
vendored
@ -70,6 +70,15 @@ tests/test_linger
|
|||||||
tests/test_security_null
|
tests/test_security_null
|
||||||
tests/test_security_plain
|
tests/test_security_plain
|
||||||
tests/test_abstract_ipc
|
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*.log
|
||||||
tests/test*.trs
|
tests/test*.trs
|
||||||
src/platform.hpp*
|
src/platform.hpp*
|
||||||
|
6
NEWS
6
NEWS
@ -4,9 +4,13 @@
|
|||||||
Bug Fixes
|
Bug Fixes
|
||||||
---------
|
---------
|
||||||
|
|
||||||
|
* Fixed LIBZMQ-578 - z85_decode was extremely slow
|
||||||
|
|
||||||
* Fixed LIBZMQ-569 - Socket server crashes with random client data
|
* Fixed LIBZMQ-569 - Socket server crashes with random client data
|
||||||
|
|
||||||
* Fixed LIBZMQ-571 - test_stream failing in some cases
|
* Fixed LIBZMQ-571 - test_stream failing in some cases
|
||||||
* Pulled expected failing test_linger.cpp from release.
|
|
||||||
|
* Pulled expected failing test_linger.cpp from release
|
||||||
|
|
||||||
|
|
||||||
0MQ version 4.0.1 stable, released on 2013/10/08
|
0MQ version 4.0.1 stable, released on 2013/10/08
|
||||||
|
@ -40,6 +40,7 @@ EXAMPLE
|
|||||||
-------
|
-------
|
||||||
.Receiving a multi-frame message
|
.Receiving a multi-frame message
|
||||||
----
|
----
|
||||||
|
zmq_msg_t frame;
|
||||||
while (true) {
|
while (true) {
|
||||||
// Create an empty 0MQ message to hold the message frame
|
// Create an empty 0MQ message to hold the message frame
|
||||||
int rc = zmq_msg_init (&frame);
|
int rc = zmq_msg_init (&frame);
|
||||||
@ -53,7 +54,7 @@ while (true) {
|
|||||||
fprintf (stderr, "end\n");
|
fprintf (stderr, "end\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
zmq_msg_close (frame);
|
zmq_msg_close (&frame);
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ while (true) {
|
|||||||
fprintf (stderr, "end\n");
|
fprintf (stderr, "end\n");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
zmq_msg_close (part);
|
zmq_msg_close (&part);
|
||||||
}
|
}
|
||||||
----
|
----
|
||||||
|
|
||||||
|
@ -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)
|
uint8_t *zmq_z85_decode (uint8_t *dest, char *string)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (strlen (string) % 5 != 0) {
|
if (strlen (string) % 5 != 0) {
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
unsigned int byte_nbr = 0;
|
unsigned int byte_nbr = 0;
|
||||||
unsigned int char_nbr = 0;
|
unsigned int char_nbr = 0;
|
||||||
|
unsigned int string_len = strlen (string);
|
||||||
uint32_t value = 0;
|
uint32_t value = 0;
|
||||||
while (char_nbr < strlen (string)) {
|
while (char_nbr < string_len) {
|
||||||
// Accumulate value in base 85
|
// Accumulate value in base 85
|
||||||
value = value * 85 + decoder [(uint8_t) string [char_nbr++] - 32];
|
value = value * 85 + decoder [(uint8_t) string [char_nbr++] - 32];
|
||||||
if (char_nbr % 5 == 0) {
|
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.
|
// Returns 0 on success, -1 on failure, setting errno.
|
||||||
// Sets errno = ENOTSUP in the absence of libsodium.
|
// 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
|
#ifdef HAVE_LIBSODIUM
|
||||||
# if crypto_box_PUBLICKEYBYTES != 32 \
|
# 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];
|
uint8_t secret_key [32];
|
||||||
|
|
||||||
int rc = crypto_box_keypair (public_key, secret_key);
|
int rc = crypto_box_keypair (public_key, secret_key);
|
||||||
// is there a sensible errno to set here?
|
// Is there a sensible errno to set here?
|
||||||
if (rc) return rc;
|
if (rc)
|
||||||
|
return rc;
|
||||||
|
|
||||||
zmq_z85_encode (z85_public_key, public_key, 32);
|
zmq_z85_encode (z85_public_key, public_key, 32);
|
||||||
zmq_z85_encode (z85_secret_key, secret_key, 32);
|
zmq_z85_encode (z85_secret_key, secret_key, 32);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user