diff options
| author | 2025-09-14 22:56:09 +0330 | |
|---|---|---|
| committer | 2025-09-14 22:56:09 +0330 | |
| commit | dae22b776a8322029a3f2b33fbb6738c848dd4a3 (patch) | |
| tree | 27109873037214e10705f06967ccc712cb1cda5d /client | |
| parent | stuff (diff) | |
🎶 iiiii waaas goinggg insaaaaaaaane
Diffstat (limited to 'client')
| -rw-r--r-- | client/3rd-party/client.ts | 2 | ||||
| -rw-r--r-- | client/client.c | 17 | ||||
| -rw-r--r-- | client/client.h | 7 |
3 files changed, 13 insertions, 13 deletions
diff --git a/client/3rd-party/client.ts b/client/3rd-party/client.ts index 34bfc91..aac49c5 100644 --- a/client/3rd-party/client.ts +++ b/client/3rd-party/client.ts @@ -3,7 +3,7 @@ const MAX_BUFFER = 1 << 18; const MAX_BODY = 1 << 22; const MAX_RECIPIENTS = 32; -const PACKET_SIZE = 4 + 32 + (1 + 8 + 32 + 32 + 1 + (32 * MAX_RECIPIENTS) + 65536 + 64); +const PACKET_SIZE = 4 + 32 + (1 + 8 + 32 + 32 + 1 + (64 * MAX_RECIPIENTS) + 65536 + 64); const RELAY_NEIGHBOR_WIRE_LEN = 1 + 1 + 1 + 4 + 16 + 2; enum MpClientError { diff --git a/client/client.c b/client/client.c index 155d895..c7a2836 100644 --- a/client/client.c +++ b/client/client.c @@ -423,7 +423,7 @@ struct data_packet mp_create_packet_from_bytes( const byte *input, size_t input_len, byte recipient_count, - hash *recipients, + recipient *recipients, keypair author_keys) { struct data_packet packet; memset(&packet, 0, sizeof(packet)); @@ -434,7 +434,7 @@ struct data_packet mp_create_packet_from_bytes( packet.contents.recipient_count = recipient_count > MAX_RECIPIENTS ? MAX_RECIPIENTS : recipient_count; if (recipients) - memcpy(packet.contents.recipients, recipients, packet.contents.recipient_count * 32); + memcpy(packet.contents.recipients, recipients, packet.contents.recipient_count * 64); packet.contents.created_time_ms = get_current_time_ms(); @@ -442,7 +442,6 @@ struct data_packet mp_create_packet_from_bytes( memcpy(packet.contents.author_signing_pub, author_keys.signing_pub, sizeof(public_key)); packet.contents.encrypted = false; - // Create signature size_t msg_len = CONTENTS_SIZE - sizeof(signature); byte *msg_buf = malloc(msg_len); if (msg_buf) { @@ -451,8 +450,8 @@ struct data_packet mp_create_packet_from_bytes( memcpy(msg_buf + 9, packet.contents.author, 32); memcpy(msg_buf + 41, packet.contents.author_signing_pub, 32); msg_buf[ 73 ] = packet.contents.recipient_count; - memcpy(msg_buf + 74, packet.contents.recipients, 32 * MAX_RECIPIENTS); - memcpy(msg_buf + 74 + 32 * MAX_RECIPIENTS, packet.contents.data, 65536); + memcpy(msg_buf + 74, packet.contents.recipients, 64 * MAX_RECIPIENTS); + memcpy(msg_buf + 74 + 64 * MAX_RECIPIENTS, packet.contents.data, 65536); crypto_sign_detached( packet.contents.signature, NULL, msg_buf, msg_len, author_keys.signing_priv); free(msg_buf); @@ -464,7 +463,7 @@ struct data_packet mp_create_packet_from_bytes( mp_client_error_t mp_create_packet_from_file( const char *filename, byte recipient_count, - hash *recipients, + recipient *recipients, keypair author_keys, struct data_packet *out_packet) { FILE *file = fopen(filename, "rb"); @@ -509,9 +508,9 @@ struct data_packet mp_run_pow(struct data_packet packet, byte leading_zeros) { memcpy(contents_buffer + 9, packet.contents.author, 32); memcpy(contents_buffer + 41, packet.contents.author_signing_pub, 32); contents_buffer[ 73 ] = packet.contents.recipient_count; - memcpy(contents_buffer + 74, packet.contents.recipients, 32 * MAX_RECIPIENTS); - memcpy(contents_buffer + 74 + 32 * MAX_RECIPIENTS, packet.contents.data, 65536); - memcpy(contents_buffer + 74 + 32 * MAX_RECIPIENTS + 65536, packet.contents.signature, 64); + memcpy(contents_buffer + 74, packet.contents.recipients, 64 * MAX_RECIPIENTS); + memcpy(contents_buffer + 74 + 64 * MAX_RECIPIENTS, packet.contents.data, 65536); + memcpy(contents_buffer + 74 + 64 * MAX_RECIPIENTS + 65536, packet.contents.signature, 64); packet.nonce = 0; while (true) { diff --git a/client/client.h b/client/client.h index ee94d21..a2a6a28 100644 --- a/client/client.h +++ b/client/client.h @@ -8,6 +8,7 @@ typedef uint8_t byte; typedef byte hash[ 32 ]; typedef byte public_key[ 32 ]; typedef byte private_key[ 32 ]; +typedef byte recipient[ 64 ]; typedef byte signature[ 64 ]; typedef byte ipv4[ 4 ]; typedef byte ipv6[ 16 ]; @@ -48,7 +49,7 @@ struct data_packet { public_key author; public_key author_signing_pub; uint8_t recipient_count; - public_key recipients[ 32 ]; + recipient recipients[ 32 ]; byte data[ 65536 ]; signature signature; } contents; @@ -165,7 +166,7 @@ struct data_packet mp_create_packet_from_bytes( const byte* input, size_t input_len, byte recipient_count, - hash* recipients, + recipient* recipients, keypair author_keys); /** @@ -180,7 +181,7 @@ struct data_packet mp_create_packet_from_bytes( mp_client_error_t mp_create_packet_from_file( const char* filename, byte recipient_count, - hash* recipients, + recipient* recipients, keypair author_keys, struct data_packet* out_packet); |
