diff options
| author | Anton <anton@picapica> | 2016-06-24 22:37:56 +0400 |
|---|---|---|
| committer | Anton <anton@picapica> | 2016-06-24 22:37:56 +0400 |
| commit | 398a4e5cc4431430537dc3039f920cdf6bb4b305 (patch) | |
| tree | d00fc26b3847f2857e3d82894a1702faf5966065 /PICA_node.c | |
| parent | 4c9c3beee4bc540d592d7be1c332bb68827f97f0 (diff) | |
| download | pica-pica-398a4e5cc4431430537dc3039f920cdf6bb4b305.tar.gz pica-pica-398a4e5cc4431430537dc3039f920cdf6bb4b305.zip | |
use pseudorandom bytes in short fixed-length protocol messages instead of random in order to not drain entropy pool
Diffstat (limited to 'PICA_node.c')
| -rw-r--r-- | PICA_node.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/PICA_node.c b/PICA_node.c index 6b63b71..1d04f4c 100644 --- a/PICA_node.c +++ b/PICA_node.c @@ -353,7 +353,7 @@ unsigned int procmsg_NODECONNREQ(unsigned char* buf, unsigned int size, void* pt return 0; } - return 1; + return ; } @@ -522,7 +522,7 @@ unsigned int procmsg_PINGREQ_client(unsigned char* buf, unsigned int size, void* if ((mp = client_wbuf_push(c, PICA_PROTO_PINGREP, PICA_PROTO_PINGREP_SIZE))) { - RAND_bytes(mp->tail, 2); + RAND_pseudo_bytes(mp->tail, 2); } else return 0; @@ -551,7 +551,7 @@ unsigned int procmsg_PINGREQ_node(unsigned char* buf, unsigned int size, void* p if ((mp = nodelink_wbuf_push(n, PICA_PROTO_PINGREP, PICA_PROTO_PINGREP_SIZE))) { - RAND_bytes(mp->tail, 2); + RAND_pseudo_bytes(mp->tail, 2); } else return 0; @@ -597,7 +597,7 @@ unsigned int procmsg_NODERESP(unsigned char* buf, unsigned int size, void* ptr) mp = nodelink_wbuf_push(n, PICA_PROTO_NODELISTREQ, PICA_PROTO_NODELISTREQ_SIZE); if (mp) { - RAND_bytes(mp->tail, 2); + RAND_pseudo_bytes(mp->tail, 2); } else return 0; @@ -2002,7 +2002,7 @@ void process_timeouts_c2n() if ((mp = client_wbuf_push(i_ptr, PICA_PROTO_PINGREQ, PICA_PROTO_PINGREQ_SIZE))) { PICA_debug3("sending PINGREQ to %p", i_ptr); - RAND_bytes(mp->tail, 2); + RAND_pseudo_bytes(mp->tail, 2); i_ptr->tmst = time(0); i_ptr->disconnect_ticking = 1; @@ -2061,7 +2061,7 @@ void process_timeouts_n2n() if ((mp = nodelink_wbuf_push(i_ptr, PICA_PROTO_PINGREQ, PICA_PROTO_PINGREQ_SIZE))) { PICA_debug3("sending PINGREQ to node %p", i_ptr); - RAND_bytes(mp->tail, 2); + RAND_pseudo_bytes(mp->tail, 2); i_ptr->tmst = time(0); i_ptr->disconnect_ticking = 1; |
