1
0
mirror of https://github.com/libssh2/libssh2.git synced 2025-11-02 10:53:16 +03:00

use actual random data with KEX_INIT cookie and packet padding

This commit is contained in:
Sara Golemon
2004-12-27 20:38:44 +00:00
parent 143c6bf97f
commit 596b62c027
3 changed files with 6 additions and 3 deletions

View File

@@ -40,6 +40,7 @@
#include <fcntl.h>
#include <unistd.h>
#include <openssl/evp.h>
#include <openssl/rand.h>
/* {{{ libssh2_packet_new
* Create a new packet and attach it to the brigade
@@ -627,7 +628,7 @@ int libssh2_packet_write(LIBSSH2_SESSION *session, unsigned char *data, unsigned
/* Copy packet to encoding buffer */
memcpy(encbuf, buf, 5);
memcpy(encbuf + 5, data, data_len);
memcpy(encbuf + 5 + data_len, buf + 5, padding_length);
RAND_bytes(encbuf + 5 + data_len, padding_length);
if (free_data) {
LIBSSH2_FREE(session, data);
}