diff options
author | t3sserakt <t3ss@posteo.de> | 2020-10-16 17:31:21 +0200 |
---|---|---|
committer | t3sserakt <t3ss@posteo.de> | 2020-10-16 17:40:12 +0200 |
commit | cde9403a6cc6bc03e571c872cdee205bbd838c31 (patch) | |
tree | 431929de91b2da817816370f9caf98b646d2745e /src/gns/plugin_gnsrecord_gns.c | |
parent | 4b69b0866d7f29efeb92176e518ddbb6a9052033 (diff) | |
parent | e8b0bc481b8a30c325faf55a964cac2cd151f999 (diff) | |
download | gnunet-cde9403a6cc6bc03e571c872cdee205bbd838c31.tar.gz gnunet-cde9403a6cc6bc03e571c872cdee205bbd838c31.zip |
Merge branch 'master' of ssh://gnunet.org/gnunet
Diffstat (limited to 'src/gns/plugin_gnsrecord_gns.c')
-rw-r--r-- | src/gns/plugin_gnsrecord_gns.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/gns/plugin_gnsrecord_gns.c b/src/gns/plugin_gnsrecord_gns.c index 81f2b9eff..0bd1d047f 100644 --- a/src/gns/plugin_gnsrecord_gns.c +++ b/src/gns/plugin_gnsrecord_gns.c | |||
@@ -50,13 +50,16 @@ gns_value_to_string (void *cls, | |||
50 | size_t data_size) | 50 | size_t data_size) |
51 | { | 51 | { |
52 | const char *cdata; | 52 | const char *cdata; |
53 | struct GNUNET_IDENTITY_PublicKey pk; | ||
53 | 54 | ||
54 | switch (type) | 55 | switch (type) |
55 | { | 56 | { |
56 | case GNUNET_GNSRECORD_TYPE_PKEY: | 57 | case GNUNET_GNSRECORD_TYPE_PKEY: |
57 | if (data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) | 58 | if (data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) |
58 | return NULL; | 59 | return NULL; |
59 | return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); | 60 | pk.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
61 | memcpy (&pk.ecdsa_key, data, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); | ||
62 | return GNUNET_IDENTITY_public_key_to_string (&pk); | ||
60 | 63 | ||
61 | case GNUNET_GNSRECORD_TYPE_NICK: | 64 | case GNUNET_GNSRECORD_TYPE_NICK: |
62 | return GNUNET_strndup (data, data_size); | 65 | return GNUNET_strndup (data, data_size); |
@@ -154,6 +157,7 @@ gns_string_to_value (void *cls, | |||
154 | size_t *data_size) | 157 | size_t *data_size) |
155 | { | 158 | { |
156 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 159 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
160 | struct GNUNET_IDENTITY_PublicKey pk; | ||
157 | 161 | ||
158 | if (NULL == s) | 162 | if (NULL == s) |
159 | return GNUNET_SYSERR; | 163 | return GNUNET_SYSERR; |
@@ -161,7 +165,7 @@ gns_string_to_value (void *cls, | |||
161 | { | 165 | { |
162 | case GNUNET_GNSRECORD_TYPE_PKEY: | 166 | case GNUNET_GNSRECORD_TYPE_PKEY: |
163 | if (GNUNET_OK != | 167 | if (GNUNET_OK != |
164 | GNUNET_CRYPTO_ecdsa_public_key_from_string (s, strlen (s), &pkey)) | 168 | GNUNET_IDENTITY_public_key_from_string (s, &pk)) |
165 | { | 169 | { |
166 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 170 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
167 | _ ("Unable to parse PKEY record `%s'\n"), | 171 | _ ("Unable to parse PKEY record `%s'\n"), |
@@ -169,7 +173,7 @@ gns_string_to_value (void *cls, | |||
169 | return GNUNET_SYSERR; | 173 | return GNUNET_SYSERR; |
170 | } | 174 | } |
171 | *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); | 175 | *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); |
172 | GNUNET_memcpy (*data, &pkey, sizeof(pkey)); | 176 | GNUNET_memcpy (*data, &pk.ecdsa_key, sizeof(pkey)); |
173 | *data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); | 177 | *data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); |
174 | return GNUNET_OK; | 178 | return GNUNET_OK; |
175 | 179 | ||