This commit is contained in:
jeka committed 2026-03-08 17:19:38 +03:00
1 parent 8880db0ca2
commit 5816fbea70
7 files changed
+14 -8

No files matched your search

+1 -1
View File
@@ -78,7 +78,7 @@ struct ETCP_CONN {
// Crypto and state
struct secure_channel crypto_ctx;
struct pn_pair* normalizer;
struct PKTNORM* normalizer;
// Peer info
uint64_t peer_node_id; // Peer node ID
+6 -4
View File
@@ -4,6 +4,8 @@
#include <config.h>
#endif
#define OPENSSL_API_COMPAT 0x10100000L
#include "secure_channel.h"
#include "../lib/debug_config.h"
#include "../lib/platform_compat.h"
@@ -141,7 +143,7 @@ static int sc_rng(uint8_t *dest, unsigned size) {
pid_t pid = getpid();
#endif
struct timeval tv;
gettimeofday(&tv, NULL);
utun_gettimeofday(&tv, NULL);
for (unsigned i = 0; i < size; i++) {
dest[i] ^= ((pid >> (i % (sizeof(pid) * 8))) & 0xFF);
dest[i] ^= ((tv.tv_sec >> (i % (sizeof(tv.tv_sec) * 8))) & 0xFF);
@@ -336,7 +338,7 @@ static void sc_build_nonce(uint64_t counter, uint8_t *nonce_out) {
if (!sc_urandom_initialized) {
sc_init_random_seed();
}
gettimeofday(&tv, NULL);
utun_gettimeofday(&tv, NULL);
memcpy(data, sc_urandom_seed, 8);
data[8] = (counter >> 0) & 0xFF;
data[9] = (counter >> 8) & 0xFF;
@@ -515,7 +517,7 @@ static int sc_rng(uint8_t *dest, unsigned size)
pid_t pid = getpid();
#endif
struct timeval tv;
gettimeofday(&tv, NULL);
utun_gettimeofday(&tv, NULL);
for (unsigned i = 0; i < size; i++) {
dest[i] ^= ((pid >> (i % (sizeof(pid) * 8))) & 0xFF);
dest[i] ^= ((tv.tv_sec >> (i % (sizeof(tv.tv_sec) * 8))) & 0xFF);
@@ -666,7 +668,7 @@ static void sc_build_nonce(uint64_t counter, uint8_t *nonce_out)
sc_init_random_seed();
}
gettimeofday(&tv, NULL);
utun_gettimeofday(&tv, NULL);
memcpy(data, sc_urandom_seed, 8);
data[8] = (counter >> 0) & 0xFF;