diff options
author | Christian Grothoff <christian@grothoff.org> | 2018-03-03 22:05:37 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2018-03-03 22:05:37 +0100 |
commit | 65377c3d9087635696f66b2444ef1d7eb39d4cd0 (patch) | |
tree | 14ff5999de78cf717e6e7b4541f469d1b24b243d /src/gnsrecord | |
parent | cd2b8b467b218dfdd2d5124ad2d835161f3a2b1a (diff) | |
download | gnunet-65377c3d9087635696f66b2444ef1d7eb39d4cd0.tar.gz gnunet-65377c3d9087635696f66b2444ef1d7eb39d4cd0.zip |
eliminate .gnu from GNS
Diffstat (limited to 'src/gnsrecord')
-rw-r--r-- | src/gnsrecord/gnsrecord_misc.c | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index 4c3bf6fa8..3c1ead437 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -241,7 +241,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | |||
241 | pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); | 241 | pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); |
242 | GNUNET_snprintf (ret, | 242 | GNUNET_snprintf (ret, |
243 | sizeof (ret), | 243 | sizeof (ret), |
244 | "%s.zkey", | 244 | "%s", |
245 | pkeys); | 245 | pkeys); |
246 | GNUNET_free (pkeys); | 246 | GNUNET_free (pkeys); |
247 | return ret; | 247 | return ret; |
@@ -249,10 +249,10 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | |||
249 | 249 | ||
250 | 250 | ||
251 | /** | 251 | /** |
252 | * Convert an absolute domain name in the ".zkey" pTLD to the | 252 | * Convert an absolute domain name to the |
253 | * respective public key. | 253 | * respective public key. |
254 | * | 254 | * |
255 | * @param zkey string "X.zkey" where X is the coordinates of the public | 255 | * @param zkey string encoding the coordinates of the public |
256 | * key in an encoding suitable for DNS labels. | 256 | * key in an encoding suitable for DNS labels. |
257 | * @param pkey set to a public key on the eliptic curve | 257 | * @param pkey set to a public key on the eliptic curve |
258 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax | 258 | * @return #GNUNET_SYSERR if @a zkey has the wrong syntax |
@@ -261,29 +261,12 @@ int | |||
261 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | 261 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, |
262 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 262 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) |
263 | { | 263 | { |
264 | char *cpy; | ||
265 | char *dot; | ||
266 | const char *x; | ||
267 | |||
268 | cpy = GNUNET_strdup (zkey); | ||
269 | x = cpy; | ||
270 | if (NULL == (dot = strchr (x, (int) '.'))) | ||
271 | goto error; | ||
272 | *dot = '\0'; | ||
273 | if (0 != strcasecmp (dot + 1, | ||
274 | "zkey")) | ||
275 | goto error; | ||
276 | |||
277 | if (GNUNET_OK != | 264 | if (GNUNET_OK != |
278 | GNUNET_CRYPTO_ecdsa_public_key_from_string (x, | 265 | GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey, |
279 | strlen (x), | 266 | strlen (zkey), |
280 | pkey)) | 267 | pkey)) |
281 | goto error; | 268 | return GNUNET_SYSERR; |
282 | GNUNET_free (cpy); | ||
283 | return GNUNET_OK; | 269 | return GNUNET_OK; |
284 | error: | ||
285 | GNUNET_free (cpy); | ||
286 | return GNUNET_SYSERR; | ||
287 | } | 270 | } |
288 | 271 | ||
289 | 272 | ||