- case GNUNET_GNSRECORD_TYPE_REVERSE:
- {
- struct GNUNET_GNSRECORD_ReverseRecord *rev;
- char known_by[253 + 1];
- struct GNUNET_TIME_Absolute expiration;
-
- /* TODO: From crypto_ecc.c
- * Why is this not a constant???
- */
- size_t enclen = (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) * 8;
- if (enclen % 5 > 0)
- enclen += 5 - enclen % 5;
- enclen /= 5; /* 260/5 = 52 */
- char pkey_str[enclen + 1];
-
- if (3 != SSCANF (s,
- "%253s %52s %"SCNu64,
- known_by,
- pkey_str,
- &expiration.abs_value_us))
- {
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("Unable to parse REVERSE record string `%s'\n"),
- s);
- return GNUNET_SYSERR;
- }
- *data_size = sizeof (struct GNUNET_GNSRECORD_ReverseRecord) + strlen (known_by) + 1;
- *data = rev = GNUNET_malloc (*data_size);
- if (GNUNET_OK !=
- GNUNET_CRYPTO_ecdsa_public_key_from_string (pkey_str,
- strlen (pkey_str),
- &rev->pkey))
- {
- GNUNET_free (rev);
- return GNUNET_SYSERR;
- }
- rev->expiration = expiration;
- GNUNET_memcpy (&rev[1],
- known_by,
- strlen (known_by));
- return GNUNET_OK;
- }