aboutsummaryrefslogtreecommitdiff
path: root/src/namestore/plugin_namestore_postgres.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2013-05-29 08:18:55 +0000
committerChristian Grothoff <christian@grothoff.org>2013-05-29 08:18:55 +0000
commit022002438e4047d235a688cfd9da7b63ab990103 (patch)
tree8d0cb444a3ab376b5a8f614fb87bdeb31e7b3327 /src/namestore/plugin_namestore_postgres.c
parentb62eb443ee3af84f87030fad9fd11a948b1a2503 (diff)
downloadgnunet-022002438e4047d235a688cfd9da7b63ab990103.tar.gz
gnunet-022002438e4047d235a688cfd9da7b63ab990103.zip
-switching GNS from RSA to ECC
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r--src/namestore/plugin_namestore_postgres.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c
index 3cddc952d..070549b33 100644
--- a/src/namestore/plugin_namestore_postgres.c
+++ b/src/namestore/plugin_namestore_postgres.c
@@ -269,12 +269,12 @@ namestore_postgres_remove_records (void *cls,
269 */ 269 */
270static int 270static int
271namestore_postgres_put_records (void *cls, 271namestore_postgres_put_records (void *cls,
272 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key, 272 const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key,
273 struct GNUNET_TIME_Absolute expire, 273 struct GNUNET_TIME_Absolute expire,
274 const char *name, 274 const char *name,
275 unsigned int rd_count, 275 unsigned int rd_count,
276 const struct GNUNET_NAMESTORE_RecordData *rd, 276 const struct GNUNET_NAMESTORE_RecordData *rd,
277 const struct GNUNET_CRYPTO_RsaSignature *signature) 277 const struct GNUNET_CRYPTO_EccSignature *signature)
278{ 278{
279 struct Plugin *plugin = cls; 279 struct Plugin *plugin = cls;
280 PGresult *ret; 280 PGresult *ret;
@@ -287,7 +287,7 @@ namestore_postgres_put_records (void *cls,
287 unsigned int i; 287 unsigned int i;
288 288
289 GNUNET_CRYPTO_short_hash (zone_key, 289 GNUNET_CRYPTO_short_hash (zone_key,
290 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 290 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
291 &zone); 291 &zone);
292 (void) namestore_postgres_remove_records (plugin, &zone, name); 292 (void) namestore_postgres_remove_records (plugin, &zone, name);
293 name_len = strlen (name); 293 name_len = strlen (name);
@@ -327,12 +327,12 @@ namestore_postgres_put_records (void *cls,
327 (const char *) &rvalue_be 327 (const char *) &rvalue_be
328 }; 328 };
329 int paramLengths[] = { 329 int paramLengths[] = {
330 sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded), 330 sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded),
331 name_len, 331 name_len,
332 sizeof (uint32_t), 332 sizeof (uint32_t),
333 data_size, 333 data_size,
334 sizeof (uint64_t), 334 sizeof (uint64_t),
335 sizeof (struct GNUNET_CRYPTO_RsaSignature), 335 sizeof (struct GNUNET_CRYPTO_EccSignature),
336 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 336 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
337 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 337 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
338 sizeof (struct GNUNET_CRYPTO_ShortHashCode), 338 sizeof (struct GNUNET_CRYPTO_ShortHashCode),
@@ -378,8 +378,8 @@ get_record_and_call_iterator (struct Plugin *plugin,
378{ 378{
379 unsigned int record_count; 379 unsigned int record_count;
380 size_t data_size; 380 size_t data_size;
381 const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *zone_key; 381 const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *zone_key;
382 const struct GNUNET_CRYPTO_RsaSignature *sig; 382 const struct GNUNET_CRYPTO_EccSignature *sig;
383 struct GNUNET_TIME_Absolute expiration; 383 struct GNUNET_TIME_Absolute expiration;
384 const char *data; 384 const char *data;
385 const char *name; 385 const char *name;
@@ -406,16 +406,16 @@ get_record_and_call_iterator (struct Plugin *plugin,
406 } 406 }
407 GNUNET_assert (1 == cnt); 407 GNUNET_assert (1 == cnt);
408 if ((6 != PQnfields (res)) || 408 if ((6 != PQnfields (res)) ||
409 (sizeof (struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded) != PQgetlength (res, 0, 0)) || 409 (sizeof (struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded) != PQgetlength (res, 0, 0)) ||
410 (sizeof (uint32_t) != PQfsize (res, 2)) || 410 (sizeof (uint32_t) != PQfsize (res, 2)) ||
411 (sizeof (uint64_t) != PQfsize (res, 4)) || 411 (sizeof (uint64_t) != PQfsize (res, 4)) ||
412 (sizeof (struct GNUNET_CRYPTO_RsaSignature) != PQgetlength (res, 0, 5))) 412 (sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5)))
413 { 413 {
414 GNUNET_break (0); 414 GNUNET_break (0);
415 PQclear (res); 415 PQclear (res);
416 return GNUNET_SYSERR; 416 return GNUNET_SYSERR;
417 } 417 }
418 zone_key = (const struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded *) PQgetvalue (res, 0, 0); 418 zone_key = (const struct GNUNET_CRYPTO_EccPublicKeyBinaryEncoded *) PQgetvalue (res, 0, 0);
419 name = PQgetvalue (res, 0, 1); 419 name = PQgetvalue (res, 0, 1);
420 name_len = PQgetlength (res, 0, 1); 420 name_len = PQgetlength (res, 0, 1);
421 record_count = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2)); 421 record_count = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2));
@@ -423,7 +423,7 @@ get_record_and_call_iterator (struct Plugin *plugin,
423 data = PQgetvalue (res, 0, 3); 423 data = PQgetvalue (res, 0, 3);
424 expiration.abs_value = 424 expiration.abs_value =
425 GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 4)); 425 GNUNET_ntohll (*(uint64_t *) PQgetvalue (res, 0, 4));
426 sig = (const struct GNUNET_CRYPTO_RsaSignature*) PQgetvalue (res, 0, 5); 426 sig = (const struct GNUNET_CRYPTO_EccSignature*) PQgetvalue (res, 0, 5);
427 if (record_count > 64 * 1024) 427 if (record_count > 64 * 1024)
428 { 428 {
429 /* sanity check, don't stack allocate far too much just 429 /* sanity check, don't stack allocate far too much just