summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2020-11-05 22:14:22 +0100
committerTheJackiMonster <thejackimonster@gmail.com>2020-11-05 22:14:22 +0100
commita4d89a695198036b2f8a2bc4a131295227d7d014 (patch)
tree4c109f1ce5a1fb7b4f653459e54a5be7ecae2fca /src
parentbd73336f5d7168f92574cf19703ec242c97e6062 (diff)
ensured compacted writing and reading
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/identity/identity_api.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index 242527c23..a277d8877 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -1015,13 +1015,13 @@ GNUNET_IDENTITY_read_key_from_buffer (struct GNUNET_IDENTITY_PublicKey *key,
{
if (len < sizeof (key->type))
return -1;
- GNUNET_memcpy(& (key->type), buffer, sizeof (key->type));
+ GNUNET_memcpy(&(key->type), buffer, sizeof (key->type));
const ssize_t length = GNUNET_IDENTITY_key_get_length(key);
if (len < length)
return -1;
if (length < 0)
return -2;
- GNUNET_memcpy(key, buffer, length);
+ GNUNET_memcpy(&(key->ecdsa_key), buffer + sizeof (key->type), length - sizeof (key->type));
return length;
}
@@ -1036,7 +1036,8 @@ GNUNET_IDENTITY_write_key_to_buffer (const struct GNUNET_IDENTITY_PublicKey *key
return -1;
if (length < 0)
return -2;
- GNUNET_memcpy(buffer, key, length);
+ GNUNET_memcpy(buffer, &(key->type), sizeof (key->type));
+ GNUNET_memcpy(buffer + sizeof (key->type), &(key->ecdsa_key), length - sizeof (key->type));
return length;
}