/**
* Hash of the public key of our zone.
*/
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
/**
* Private key for the our zone.
}
GNUNET_CRYPTO_rsa_key_get_public (zone_pkey,
&pub);
- GNUNET_CRYPTO_hash (&pub, sizeof (pub), &zone);
+ GNUNET_CRYPTO_short_hash (&pub, sizeof (pub), &zone);
ns = GNUNET_NAMESTORE_connect (cfg);
if (NULL == ns)
int has_zone;
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
uint64_t request_id;
uint32_t offset;
{
char * filename;
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
struct GNUNET_CRYPTO_RsaPrivateKey *privkey;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *pubkey;
};
if (GNUNET_YES == GNUNET_DISK_file_test (filename))
{
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
if (privkey == NULL)
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("File zone `%s' but corrupt content already exists, failed to write! \n"), GNUNET_h2s (&zone));
+ _("File zone `%s' but corrupt content already exists, failed to write! \n"), GNUNET_short_h2s (&zone));
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
- GNUNET_CRYPTO_hash(&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
- GNUNET_CRYPTO_rsa_key_free(privkey);
+ GNUNET_CRYPTO_rsa_key_get_public (privkey, &pubkey);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
+ GNUNET_CRYPTO_rsa_key_free (privkey);
if (0 == memcmp (&zone, &c->zone, sizeof(zone)))
{
GNUNET_log (GNUNET_ERROR_TYPE_INFO,
- _("File zone `%s' containing this key already exists\n"), GNUNET_h2s (&zone));
+ _("File zone `%s' containing this key already exists\n"), GNUNET_short_h2s (&zone));
return GNUNET_OK;
}
else
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
- _("File zone `%s' but different zone key already exists, failed to write! \n"), GNUNET_h2s (&zone));
+ _("File zone `%s' but different zone key already exists, failed to write! \n"), GNUNET_short_h2s (&zone));
return GNUNET_OK;
}
}
GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- _("Stored zonekey for zone `%s' in file `%s'\n"), GNUNET_h2s(&c->zone), c->filename);
+ _("Stored zonekey for zone `%s' in file `%s'\n"), GNUNET_short_h2s(&c->zone), c->filename);
return GNUNET_OK;
}
int zone_to_disk_it (void *cls,
- const GNUNET_HashCode * key,
+ const GNUNET_HashCode *key,
void *value)
{
struct GNUNET_NAMESTORE_CryptoContainer * c = value;
write_key_to_file(c->filename, c);
else
{
- GNUNET_asprintf(&c->filename, "%s/%s.zkey", zonefile_directory, GNUNET_h2s_full (&c->zone));
+ GNUNET_asprintf(&c->filename, "%s/%s.zkey", zonefile_directory, GNUNET_short_h2s (&c->zone));
write_key_to_file(c->filename, c);
}
- GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value);;
+
+ GNUNET_CONTAINER_multihashmap_remove (zonekeys, key, value);
GNUNET_CRYPTO_rsa_key_free(c->privkey);
GNUNET_free (c->pubkey);
GNUNET_free(c->filename);
struct GNUNET_NAMESTORE_Client *nc;
uint32_t request_id;
uint32_t record_type;
- GNUNET_HashCode *zone;
+ struct GNUNET_CRYPTO_ShortHashCode *zone;
char * name;
};
const struct GNUNET_NAMESTORE_RecordData *rd,
const struct GNUNET_CRYPTO_RsaSignature *signature)
{
- GNUNET_HashCode zone_hash;
+ struct GNUNET_CRYPTO_ShortHashCode zone_hash;
int * stop = cls;
if (NULL != zone_key)
{
- GNUNET_CRYPTO_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting zone `%s'\n", GNUNET_h2s (&zone_hash));
+ GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_hash);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Deleting zone `%s'\n", GNUNET_short_h2s (&zone_hash));
GSN_database->delete_zone (GSN_database->cls, &zone_hash);
}
else
struct GNUNET_NAMESTORE_CryptoContainer *cc;
struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
struct GNUNET_TIME_Absolute e;
- GNUNET_HashCode zone_key_hash;
+ struct GNUNET_CRYPTO_ShortHashCode zone_key_hash;
+ GNUNET_HashCode long_hash;
char *rd_tmp;
char *name_tmp;
size_t rd_ser_len;
if (rd[c].record_type == lnc->record_type)
copied_elements++; /* found matching record */
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records with type %u for name `%s' in zone `%s'\n",
- copied_elements, lnc->record_type, lnc->name, GNUNET_h2s(lnc->zone));
+ copied_elements, lnc->record_type, lnc->name, GNUNET_short_h2s(lnc->zone));
rd_selected = GNUNET_malloc (copied_elements * sizeof (struct GNUNET_NAMESTORE_RecordData));
copied_elements = 0;
for (c = 0; c < rd_count; c ++)
GNUNET_NAMESTORE_records_serialize(copied_elements, rd_selected, rd_ser_len, rd_ser);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found %u records for name `%s' in zone `%s'\n",
- copied_elements, lnc->name, GNUNET_h2s(lnc->zone));
+ copied_elements, lnc->name, GNUNET_short_h2s(lnc->zone));
if ((copied_elements == rd_count) && (NULL != signature))
contains_signature = GNUNET_YES; /* returning all records, so include signature */
if ((NULL != zone_key) && (copied_elements == rd_count))
{
- GNUNET_CRYPTO_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
- if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &zone_key_hash))
+ GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
+ GNUNET_CRYPTO_short_hash_double (&zone_key_hash, &long_hash);
+ if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash))
{
- cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &zone_key_hash);
+ cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash);
e = get_block_expiration_time(rd_count, rd);
signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, rd, rd_count);
GNUNET_assert (signature_new != NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for name `%s' with %u records in zone `%s'\n",name, copied_elements, GNUNET_h2s(&zone_key_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for name `%s' with %u records in zone `%s'\n",name, copied_elements, GNUNET_short_h2s(&zone_key_hash));
authoritative = GNUNET_YES;
}
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am not authoritative for name `%s' in zone `%s'\n",name, GNUNET_h2s(&zone_key_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "I am not authoritative for name `%s' in zone `%s'\n",name, GNUNET_short_h2s(&zone_key_hash));
}
r_size = sizeof (struct LookupNameResponseMessage) +
}
if (0 == type)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' in zone `%s'\n", name, GNUNET_h2s(&ln_msg->zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up all records for name `%s' in zone `%s'\n", name, GNUNET_short_h2s(&ln_msg->zone));
else
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for name `%s' in zone `%s'\n", type, name, GNUNET_h2s(&ln_msg->zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up records with type %u for name `%s' in zone `%s'\n", type, name, GNUNET_short_h2s(&ln_msg->zone));
/* do the actual lookup */
lnc.request_id = rid;
goto send;
}
- GNUNET_HashCode zone_hash;
- GNUNET_CRYPTO_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash);
+ struct GNUNET_CRYPTO_ShortHashCode zone_hash;
+ GNUNET_CRYPTO_short_hash (&rp_msg->public_key, sizeof (rp_msg->public_key), &zone_hash);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in zone `%s'\n", rd_count, name, GNUNET_h2s(&zone_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Putting %u record for name `%s' in zone `%s'\n", rd_count, name, GNUNET_short_h2s(&zone_hash));
/* Database operation */
res = GSN_database->put_records(GSN_database->cls,
struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
struct RecordCreateResponseMessage rcr_msg;
- GNUNET_HashCode pubkey_hash;
+ struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
+ GNUNET_HashCode long_hash;
size_t name_len;
size_t msg_size;
size_t msg_size_exp;
pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
GNUNET_assert (pkey != NULL);
GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
- GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+ GNUNET_CRYPTO_short_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+ GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash);
- if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &pubkey_hash))
+ if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_h2s(&pubkey_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_short_h2s(&pubkey_hash));
cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer));
cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
cc->pubkey = GNUNET_malloc(sizeof (pub));
memcpy (cc->pubkey, &pub, sizeof(pub));
cc->zone = pubkey_hash;
-
- GNUNET_CONTAINER_multihashmap_put(zonekeys, &pubkey_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
}
crc.expire = GNUNET_TIME_absolute_ntoh(rp_msg->expire);
crc.rd = rd;
crc.name = name_tmp;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone `%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating record for name `%s' in zone `%s'\n", name_tmp, GNUNET_short_h2s(&pubkey_hash));
/* Get existing records for name */
res = GSN_database->iterate_records(GSN_database->cls, &pubkey_hash, name_tmp, 0, &handle_create_record_it, &crc);
struct GNUNET_CRYPTO_RsaPrivateKey *pkey;
struct GNUNET_NAMESTORE_CryptoContainer *cc = NULL;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pub;
- GNUNET_HashCode pubkey_hash;
+ struct GNUNET_CRYPTO_ShortHashCode pubkey_hash;
+ GNUNET_HashCode long_hash;
char * pkey_tmp = NULL;
char * name_tmp = NULL;
char * rd_ser = NULL;
pkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
GNUNET_assert (pkey != NULL);
GNUNET_CRYPTO_rsa_key_get_public(pkey, &pub);
- GNUNET_CRYPTO_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+ GNUNET_CRYPTO_short_hash (&pub, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &pubkey_hash);
+ GNUNET_CRYPTO_short_hash_double (&pubkey_hash, &long_hash);
- if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &pubkey_hash))
+ if (GNUNET_NO == GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash))
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_h2s(&pubkey_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Received new private key for zone `%s'\n",GNUNET_short_h2s(&pubkey_hash));
cc = GNUNET_malloc (sizeof (struct GNUNET_NAMESTORE_CryptoContainer));
cc->privkey = GNUNET_CRYPTO_rsa_decode_key((char *) pkey_tmp, key_len);
cc->pubkey = GNUNET_malloc(sizeof (pub));
memcpy (cc->pubkey, &pub, sizeof(pub));
cc->zone = pubkey_hash;
- GNUNET_CONTAINER_multihashmap_put(zonekeys, &pubkey_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, cc, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
}
struct GNUNET_NAMESTORE_RecordData rd[rd_count];
rrc.rd = rd;
rrc.pkey = pkey;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for name `%s' in zone `%s'\n", name_tmp, GNUNET_h2s(&pubkey_hash));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Removing record for name `%s' in zone `%s'\n", name_tmp, GNUNET_short_h2s(&pubkey_hash));
/* Database operation */
res = GSN_database->iterate_records (GSN_database->cls,
ztn_ctx.rid = rid;
ztn_ctx.nc = nc;
- char * z_tmp = strdup (GNUNET_h2s (&ztn_msg->zone));
+ char * z_tmp = strdup (GNUNET_short_h2s (&ztn_msg->zone));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Looking up name for zone `%s' in zone `%s'\n",
z_tmp,
- GNUNET_h2s (&ztn_msg->value_zone));
+ GNUNET_short_h2s (&ztn_msg->value_zone));
GNUNET_free (z_tmp);
GSN_database->zone_to_name (GSN_database->cls, &ztn_msg->zone, &ztn_msg->value_zone, &handle_zone_to_name_it, &ztn_ctx);
struct GNUNET_NAMESTORE_CryptoContainer * cc;
struct GNUNET_CRYPTO_RsaSignature *signature_new = NULL;
struct GNUNET_TIME_Absolute e;
- GNUNET_HashCode zone_key_hash;
+ struct GNUNET_CRYPTO_ShortHashCode zone_key_hash;
+ GNUNET_HashCode long_hash;
int authoritative = GNUNET_NO;
if ((zone_key == NULL) && (name == NULL))
{
struct ZoneIterationResponseMessage zir_msg;
if (zi->has_zone == GNUNET_YES)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", GNUNET_h2s(&zi->zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for zone `%s'\n", GNUNET_short_h2s(&zi->zone));
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "No more results for all zones\n");
struct ZoneIterationResponseMessage *zir_msg;
if (zi->has_zone == GNUNET_YES)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over zone `%s'\n",
- name, GNUNET_h2s(&zi->zone));
+ name, GNUNET_short_h2s(&zi->zone));
if (zi->has_zone == GNUNET_NO)
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending name `%s' for iteration over all zones\n",
name);
name_tmp = (char *) &zir_msg[1];
rd_tmp = &name_tmp[name_len];
- GNUNET_CRYPTO_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
- if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &zone_key_hash))
+ GNUNET_CRYPTO_short_hash(zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone_key_hash);
+ GNUNET_CRYPTO_short_hash_double(&zone_key_hash, &long_hash);
+ if (GNUNET_CONTAINER_multihashmap_contains(zonekeys, &long_hash))
{
- cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &zone_key_hash);
+ cc = GNUNET_CONTAINER_multihashmap_get(zonekeys, &long_hash);
e = get_block_expiration_time(rd_count, rd);
expire = e;
signature_new = GNUNET_NAMESTORE_create_signature(cc->privkey, e, name, rd, rd_count);
GNUNET_assert (signature_new != NULL);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", name, GNUNET_h2s(&zone_key_hash), rd_count, e.abs_value);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Creating signature for `%s' in zone `%s' with %u records and expiration %llu\n", name, GNUNET_short_h2s(&zone_key_hash), rd_count, e.abs_value);
authoritative = GNUNET_YES;
}
zi->client = nc;
zi->zone = zis_msg->zone;
- GNUNET_HashCode dummy;
- GNUNET_HashCode *zone_tmp;
+ struct GNUNET_CRYPTO_ShortHashCode dummy;
+ struct GNUNET_CRYPTO_ShortHashCode *zone_tmp;
memset (&dummy, '\0', sizeof (dummy));
if (0 == memcmp (&dummy, &zis_msg->zone, sizeof (dummy)))
{
}
else
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone `%s'\n", GNUNET_h2s (&zis_msg->zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Starting to iterate over zone `%s'\n", GNUNET_short_h2s (&zis_msg->zone));
zi->has_zone = GNUNET_YES;
zone_tmp = &zis_msg->zone;
}
GNUNET_CONTAINER_DLL_remove(nc->op_head, nc->op_tail, zi);
if (GNUNET_YES == zi->has_zone)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone `%s'\n", GNUNET_h2s (&zi->zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration for zone `%s'\n", GNUNET_short_h2s (&zi->zone));
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Stopped zone iteration all zones\n");
GNUNET_free (zi);
struct GNUNET_NAMESTORE_Client *nc;
struct GNUNET_NAMESTORE_ZoneIteration *zi;
- GNUNET_HashCode *zone_tmp;
+ struct GNUNET_CRYPTO_ShortHashCode *zone_tmp;
struct ZoneIterationStopMessage * zis_msg = (struct ZoneIterationStopMessage *) message;
uint32_t rid;
int zonekey_file_it (void *cls, const char *filename)
{
+ GNUNET_HashCode long_hash;
int *counter = cls;
if ((filename != NULL) && (NULL != strstr(filename, ".zkey")))
{
c->pubkey = GNUNET_malloc(sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded));
c->privkey = privkey;
GNUNET_CRYPTO_rsa_key_get_public(privkey, c->pubkey);
- GNUNET_CRYPTO_hash(c->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone);
-
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", GNUNET_h2s (&c->zone));
+ GNUNET_CRYPTO_short_hash(c->pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &c->zone);
- GNUNET_CONTAINER_multihashmap_put(zonekeys, &c->zone, c, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
+ //GNUNET_CRYPTO_short_hash_to_enc (&name_hase, &name_enc);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found zonefile for zone `%s'\n", GNUNET_short_h2s (&c->zone));
+ GNUNET_CRYPTO_short_hash_double (&c->zone, &long_hash);
+ GNUNET_CONTAINER_multihashmap_put(zonekeys, &long_hash, c, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY);
(*counter) ++;
}
return GNUNET_OK;
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_NEXT 447
#define GNUNET_MESSAGE_TYPE_NAMESTORE_ZONE_ITERATION_STOP 448
+/**
+ * Convert a short hash to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param hc the short hash code
+ * @return string form; will be overwritten by next call to GNUNET_h2s.
+ */
+const char *
+GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc);
+
/**
* Sign name and records
*
/**
* The zone
*/
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
/**
* Requested record type
/**
* The hash of public key of the zone to look up in
*/
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
/**
* The hash of the public key of the target zone
*/
- GNUNET_HashCode value_zone;
+ struct GNUNET_CRYPTO_ShortHashCode value_zone;
};
/**
/**
* Zone hash
*/
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
/**
* Which flags must be included
struct GNUNET_NAMESTORE_Handle *h;
GNUNET_NAMESTORE_RecordProcessor proc;
void* proc_cls;
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
uint32_t no_flags;
uint32_t flags;
int has_zone;
struct GNUNET_NAMESTORE_SimpleRecord *prev;
const char *name;
- const GNUNET_HashCode *zone;
+ const struct GNUNET_CRYPTO_ShortHashCode *zone;
uint32_t record_type;
struct GNUNET_TIME_Absolute expiration;
enum GNUNET_NAMESTORE_RecordFlags flags;
*/
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_lookup_record (struct GNUNET_NAMESTORE_Handle *h,
- const GNUNET_HashCode *zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
const char *name,
uint32_t record_type,
GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls)
*/
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
- const GNUNET_HashCode *zone,
- const GNUNET_HashCode *value_zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *value_zone,
GNUNET_NAMESTORE_RecordProcessor proc, void *proc_cls)
{
struct GNUNET_NAMESTORE_QueueEntry *qe;
msg->zone = *zone;
msg->value_zone = *value_zone;
- char * z_tmp = strdup (GNUNET_h2s (zone));
+ char * z_tmp = strdup (GNUNET_short_h2s (zone));
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s' in zone `%s'\n",
"NAMESTORE_ZONE_TO_NAME",
z_tmp,
- GNUNET_h2s (value_zone));
+ GNUNET_short_h2s (value_zone));
GNUNET_free (z_tmp);
/* transmit message */
*/
struct GNUNET_NAMESTORE_ZoneIterator *
GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h,
- const GNUNET_HashCode *zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
enum GNUNET_NAMESTORE_RecordFlags must_have_flags,
enum GNUNET_NAMESTORE_RecordFlags must_not_have_flags,
GNUNET_NAMESTORE_RecordProcessor proc,
msg->gns_header.r_id = htonl (rid);
if (NULL != zone)
{
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_START", GNUNET_h2s(zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_START", GNUNET_short_h2s(zone));
msg->zone = *zone;
}
else
msg->gns_header.r_id = htonl (it->op_id);
if (GNUNET_YES == it->has_zone)
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_STOP", GNUNET_h2s(&it->zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for zone `%s'\n", "ZONE_ITERATION_STOP", GNUNET_short_h2s(&it->zone));
else
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Sending `%s' message for all zones\n", "ZONE_ITERATION_STOP");
};
+
+/**
+ * Convert a short hash to a string (for printing debug messages).
+ * This is one of the very few calls in the entire API that is
+ * NOT reentrant!
+ *
+ * @param hc the short hash code
+ * @return string form; will be overwritten by next call to GNUNET_h2s.
+ */
+const char *
+GNUNET_short_h2s (const struct GNUNET_CRYPTO_ShortHashCode * hc)
+{
+ static struct GNUNET_CRYPTO_ShortHashAsciiEncoded ret;
+
+ GNUNET_CRYPTO_short_hash_to_enc (hc, &ret);
+ return (const char *) &ret;
+}
+
+
/**
* Calculate how many bytes we will need to serialize the given
* records.
*/
static int
namestore_sqlite_remove_records (void *cls,
- const GNUNET_HashCode *zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
const char *name)
{
struct Plugin *plugin = cls;
- GNUNET_HashCode nh;
+ struct GNUNET_CRYPTO_ShortHashCode nh;
size_t name_len;
int n;
-
name_len = strlen (name);
- GNUNET_CRYPTO_hash (name, name_len, &nh);
+ GNUNET_CRYPTO_short_hash (name, name_len, &nh);
- if ((SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 1, zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) ||
- (SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 2, &nh, sizeof (GNUNET_HashCode), SQLITE_STATIC)))
+ if ((SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 1, zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
+ (SQLITE_OK != sqlite3_bind_blob (plugin->remove_records, 2, &nh, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)))
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_bind_XXXX");
{
struct Plugin *plugin = cls;
int n;
- GNUNET_HashCode zone;
- GNUNET_HashCode zone_delegation;
- GNUNET_HashCode nh;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone_delegation;
+ struct GNUNET_CRYPTO_ShortHashCode nh;
size_t name_len;
uint64_t rvalue;
size_t data_size;
unsigned int i;
- GNUNET_CRYPTO_hash (zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
+ GNUNET_CRYPTO_short_hash (zone_key, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &zone);
(void) namestore_sqlite_remove_records (plugin, &zone, name);
name_len = strlen (name);
- GNUNET_CRYPTO_hash (name, name_len, &nh);
+ GNUNET_CRYPTO_short_hash (name, name_len, &nh);
memset (&zone_delegation, 0, sizeof (zone_delegation));
for (i=0;i<rd_count;i++)
if (rd[i].record_type == GNUNET_NAMESTORE_TYPE_PKEY)
{
- GNUNET_assert (sizeof (GNUNET_HashCode) == rd[i].data_size);
+ GNUNET_assert (sizeof (struct GNUNET_CRYPTO_ShortHashCode) == rd[i].data_size);
memcpy (&zone_delegation,
rd[i].data,
- sizeof (GNUNET_HashCode));
+ sizeof (struct GNUNET_CRYPTO_ShortHashCode));
break;
}
rvalue = GNUNET_CRYPTO_random_u64 (GNUNET_CRYPTO_QUALITY_WEAK, UINT64_MAX);
(SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 4, data, data_size, SQLITE_STATIC)) ||
(SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 5, expire.abs_value)) ||
(SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 6, signature, sizeof (struct GNUNET_CRYPTO_RsaSignature), SQLITE_STATIC)) ||
- (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, &zone_delegation, sizeof (GNUNET_HashCode), SQLITE_STATIC)) ||
- (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof (GNUNET_HashCode), SQLITE_STATIC)) ||
- (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 9, &nh, sizeof (GNUNET_HashCode), SQLITE_STATIC)) ||
+ (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 7, &zone_delegation, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
+ (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 8, &zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
+ (SQLITE_OK != sqlite3_bind_blob (plugin->put_records, 9, &nh, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC)) ||
(SQLITE_OK != sqlite3_bind_int64 (plugin->put_records, 10, rvalue)) )
{
LOG_SQLITE (plugin,
*/
static int
namestore_sqlite_iterate_records (void *cls,
- const GNUNET_HashCode *zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
const char *name,
uint64_t offset,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
{
struct Plugin *plugin = cls;
sqlite3_stmt *stmt;
- GNUNET_HashCode name_hase;
+ struct GNUNET_CRYPTO_ShortHashCode name_hase;
unsigned int boff;
if (NULL == zone)
stmt = plugin->iterate_all;
else
{
- GNUNET_CRYPTO_hash (name, strlen(name), &name_hase);
+ GNUNET_CRYPTO_short_hash (name, strlen(name), &name_hase);
stmt = plugin->iterate_by_name;
}
else
stmt = plugin->iterate_by_zone;
else
{
- GNUNET_CRYPTO_hash (name, strlen(name), &name_hase);
+ GNUNET_CRYPTO_short_hash (name, strlen(name), &name_hase);
stmt = plugin->iterate_records;
}
boff = 0;
if ( (NULL != zone) &&
(SQLITE_OK != sqlite3_bind_blob (stmt, ++boff,
- zone, sizeof (GNUNET_HashCode),
+ zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode),
SQLITE_STATIC)) )
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
}
if ( (NULL != name) &&
(SQLITE_OK != sqlite3_bind_blob (stmt, ++boff,
- &name_hase, sizeof (GNUNET_HashCode),
+ &name_hase, sizeof (struct GNUNET_CRYPTO_ShortHashCode),
SQLITE_STATIC)) )
{
- GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ITERATE NAME HASH: `%s'", GNUNET_h2s_full(&name_hase));
+ GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "ITERATE NAME HASH: `%8s'", GNUNET_short_h2s(&name_hase));
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_bind_XXXX");
if (SQLITE_OK != sqlite3_reset (stmt))
*/
static int
namestore_sqlite_zone_to_name (void *cls,
- const GNUNET_HashCode *zone,
- const GNUNET_HashCode *value_zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *zone,
+ const struct GNUNET_CRYPTO_ShortHashCode *value_zone,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
{
struct Plugin *plugin = cls;
stmt = plugin->zone_to_name;
if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1,
- zone, sizeof (GNUNET_HashCode),
+ zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode),
SQLITE_STATIC)) ||
(SQLITE_OK != sqlite3_bind_blob (stmt, 2,
- value_zone, sizeof (GNUNET_HashCode),
+ value_zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode),
SQLITE_STATIC)) )
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
*/
static void
namestore_sqlite_delete_zone (void *cls,
- const GNUNET_HashCode *zone)
+ const struct GNUNET_CRYPTO_ShortHashCode *zone)
{
struct Plugin *plugin = cls;
sqlite3_stmt *stmt = plugin->delete_zone;
int n;
- if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (GNUNET_HashCode), SQLITE_STATIC))
+ if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, zone, sizeof (struct GNUNET_CRYPTO_ShortHashCode), SQLITE_STATIC))
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
"sqlite3_bind_XXXX");
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
static int res;
GNUNET_assert (privkey != NULL);
GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
- GNUNET_CRYPTO_hash_create_random (GNUNET_CRYPTO_QUALITY_WEAK, &zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone);
struct GNUNET_CRYPTO_RsaSignature signature;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaSignature *s_signature;
struct GNUNET_CRYPTO_RsaSignature *s_signature_updated;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
struct GNUNET_NAMESTORE_RecordData *s_first_record;
struct GNUNET_NAMESTORE_RecordData *s_second_record;
static char *s_name;
s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1);
/* create random zone hash */
- GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_h2s_full(&s_zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone));
start_arm (cfgfile);
GNUNET_assert (arm != NULL);
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaSignature *s_signature;
struct GNUNET_CRYPTO_RsaSignature *s_signature_updated;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
struct GNUNET_NAMESTORE_RecordData *s_first_record;
struct GNUNET_NAMESTORE_RecordData *s_second_record;
static char *s_name;
s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_first_record->expiration, s_name, s_first_record, 1);
/* create random zone hash */
- GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_h2s_full(&s_zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone));
start_arm (cfgfile);
GNUNET_assert (arm != NULL);
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
struct GNUNET_NAMESTORE_RecordData *s_rd;
static char *s_name;
s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS);
/* create random zone hash */
- GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
start_arm (cfgfile);
GNUNET_assert (arm != NULL);
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
struct GNUNET_NAMESTORE_RecordData *s_rd;
static char *s_name;
s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[RECORDS -1].expiration, s_name, s_rd, RECORDS);
/* create random zone hash */
- GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
start_arm (cfgfile);
GNUNET_assert (arm != NULL);
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
struct GNUNET_CRYPTO_RsaSignature *s_signature;
-static GNUNET_HashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
struct GNUNET_NAMESTORE_RecordData *s_rd;
static char *s_name;
s_signature = GNUNET_NAMESTORE_create_signature(privkey, s_rd[0].expiration, s_name, s_rd, RECORDS);
/* create random zone hash */
- GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_h2s_full(&s_zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Name: `%s' Zone: `%s' \n", s_name, GNUNET_short_h2s (&s_zone));
start_arm (cfgfile);
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey;
-static GNUNET_HashCode zone;
+static struct GNUNET_CRYPTO_ShortHashCode zone;
static struct GNUNET_CRYPTO_RsaPrivateKey * privkey2;
static struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pubkey2;
-static GNUNET_HashCode zone2;
+static struct GNUNET_CRYPTO_ShortHashCode zone2;
static struct GNUNET_NAMESTORE_ZoneIterator *zi;
static int res;
const struct GNUNET_CRYPTO_RsaSignature *signature)
{
int failed = GNUNET_NO;
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_h2s (&zone));
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Callback for zone `%s'\n", GNUNET_short_h2s (&zone));
if ((zone_key == NULL) && (name == NULL))
{
GNUNET_break (2 == returned_records);
res = 1;
returned_records = 0;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All records created, starting iteration over zone `%s'\n",
- GNUNET_h2s(&zone));
+ GNUNET_short_h2s(&zone));
zi = GNUNET_NAMESTORE_zone_iteration_start(nsh,
&zone,
GNUNET_NAMESTORE_RF_NONE,
GNUNET_free (hostkey_file);
GNUNET_assert (privkey != NULL);
GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
- GNUNET_CRYPTO_hash(&pubkey, sizeof (pubkey), &zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (pubkey), &zone);
GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "KJI3AL00K91EDPFJF58DAJM7H61D189TLP70N56JL8SVDCJE1SJ3SNNBOQPPONTL37FMHPS39SMK2NMVC0GQMGA6QCMHITT78O8GF80.zkey");
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file);
GNUNET_free (hostkey_file);
GNUNET_assert (privkey2 != NULL);
GNUNET_CRYPTO_rsa_key_get_public(privkey2, &pubkey2);
- GNUNET_CRYPTO_hash(&pubkey2, sizeof (pubkey), &zone2);
+ GNUNET_CRYPTO_short_hash (&pubkey2, sizeof (pubkey), &zone2);
start_arm (cfgfile);
struct GNUNET_TIME_Absolute expire;
-static GNUNET_HashCode s_zone;
-static GNUNET_HashCode s_zone_value;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone;
+static struct GNUNET_CRYPTO_ShortHashCode s_zone_value;
char * s_name;
GNUNET_CRYPTO_rsa_key_get_public(privkey, &pubkey);
/* zone hash */
- GNUNET_CRYPTO_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
- GNUNET_CRYPTO_hash (s_name, strlen (s_name) + 1, &s_zone_value);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), &s_zone);
+ GNUNET_CRYPTO_short_hash (s_name, strlen (s_name) + 1, &s_zone_value);
struct GNUNET_NAMESTORE_RecordData rd;
rd.expiration = GNUNET_TIME_absolute_get();
{
struct GNUNET_NAMESTORE_PluginFunctions *nsp;
struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded zone_key;
- GNUNET_HashCode zone;
+ struct GNUNET_CRYPTO_ShortHashCode zone;
ok = 0;
nsp = load_plugin (cfg);
"Failed to initialize namestore. Database likely not setup, skipping test.\n");
return;
}
+
put_record (nsp, 1);
+
get_record (nsp, 1);
memset (&zone_key, 1, sizeof (zone_key));
- GNUNET_CRYPTO_hash (&zone_key, sizeof (zone_key), &zone);
+ GNUNET_CRYPTO_short_hash (&zone_key, sizeof (zone_key), &zone);
nsp->delete_zone (nsp->cls, &zone);
unload_plugin (nsp);
+
}