diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-10-10 14:38:55 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-10-10 14:38:55 +0000 |
commit | 9351b1e9bdf2b067b6db06562c26ba658cff42b8 (patch) | |
tree | 68dc4ab447e7e8b6a20a706858cd36238c1c7c5f /src/namestore/plugin_namestore_postgres.c | |
parent | 8beabcd96c0cf1e1873c0b5ff96e537f1beb0b34 (diff) | |
download | gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.tar.gz gnunet-9351b1e9bdf2b067b6db06562c26ba658cff42b8.zip |
separating ECC crypto into functions/structs for ECDHE, ECDSA and EDDSA
Diffstat (limited to 'src/namestore/plugin_namestore_postgres.c')
-rw-r--r-- | src/namestore/plugin_namestore_postgres.c | 28 |
1 files changed, 14 insertions, 14 deletions
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 7be06b2f5..6a1dc6f2c 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c | |||
@@ -337,8 +337,8 @@ namestore_postgres_cache_block (void *cls, | |||
337 | struct Plugin *plugin = cls; | 337 | struct Plugin *plugin = cls; |
338 | struct GNUNET_HashCode query; | 338 | struct GNUNET_HashCode query; |
339 | size_t block_size = ntohl (block->purpose.size) + | 339 | size_t block_size = ntohl (block->purpose.size) + |
340 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + | 340 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + |
341 | sizeof (struct GNUNET_CRYPTO_EccSignature); | 341 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature); |
342 | const char *paramValues[] = { | 342 | const char *paramValues[] = { |
343 | (const char *) &query, | 343 | (const char *) &query, |
344 | (const char *) block, | 344 | (const char *) block, |
@@ -354,7 +354,7 @@ namestore_postgres_cache_block (void *cls, | |||
354 | 354 | ||
355 | namestore_postgres_expire_blocks (plugin); | 355 | namestore_postgres_expire_blocks (plugin); |
356 | GNUNET_CRYPTO_hash (&block->derived_key, | 356 | GNUNET_CRYPTO_hash (&block->derived_key, |
357 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 357 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
358 | &query); | 358 | &query); |
359 | if (block_size > 64 * 65536) | 359 | if (block_size > 64 * 65536) |
360 | { | 360 | { |
@@ -433,8 +433,8 @@ namestore_postgres_lookup_block (void *cls, | |||
433 | block = (const struct GNUNET_NAMESTORE_Block *) PQgetvalue (res, 0, 0); | 433 | block = (const struct GNUNET_NAMESTORE_Block *) PQgetvalue (res, 0, 0); |
434 | if ( (bsize < sizeof (*block)) || | 434 | if ( (bsize < sizeof (*block)) || |
435 | (bsize != ntohl (block->purpose.size) + | 435 | (bsize != ntohl (block->purpose.size) + |
436 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + | 436 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + |
437 | sizeof (struct GNUNET_CRYPTO_EccSignature)) ) | 437 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) ) |
438 | { | 438 | { |
439 | GNUNET_break (0); | 439 | GNUNET_break (0); |
440 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 440 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
@@ -461,13 +461,13 @@ namestore_postgres_lookup_block (void *cls, | |||
461 | */ | 461 | */ |
462 | static int | 462 | static int |
463 | namestore_postgres_store_records (void *cls, | 463 | namestore_postgres_store_records (void *cls, |
464 | const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, | 464 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
465 | const char *label, | 465 | const char *label, |
466 | unsigned int rd_count, | 466 | unsigned int rd_count, |
467 | const struct GNUNET_NAMESTORE_RecordData *rd) | 467 | const struct GNUNET_NAMESTORE_RecordData *rd) |
468 | { | 468 | { |
469 | struct Plugin *plugin = cls; | 469 | struct Plugin *plugin = cls; |
470 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; | 470 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
471 | uint64_t rvalue; | 471 | uint64_t rvalue; |
472 | uint32_t rd_count_nbo = htonl ((uint32_t) rd_count); | 472 | uint32_t rd_count_nbo = htonl ((uint32_t) rd_count); |
473 | size_t data_size; | 473 | size_t data_size; |
@@ -477,7 +477,7 @@ namestore_postgres_store_records (void *cls, | |||
477 | for (i=0;i<rd_count;i++) | 477 | for (i=0;i<rd_count;i++) |
478 | if (GNUNET_NAMESTORE_TYPE_PKEY == rd[i].record_type) | 478 | if (GNUNET_NAMESTORE_TYPE_PKEY == rd[i].record_type) |
479 | { | 479 | { |
480 | GNUNET_break (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) == rd[i].data_size); | 480 | GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size); |
481 | memcpy (&pkey, | 481 | memcpy (&pkey, |
482 | rd[i].data, | 482 | rd[i].data, |
483 | rd[i].data_size); | 483 | rd[i].data_size); |
@@ -549,7 +549,7 @@ namestore_postgres_store_records (void *cls, | |||
549 | static int | 549 | static int |
550 | get_record_and_call_iterator (struct Plugin *plugin, | 550 | get_record_and_call_iterator (struct Plugin *plugin, |
551 | PGresult *res, | 551 | PGresult *res, |
552 | const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, | 552 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, |
553 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) | 553 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) |
554 | { | 554 | { |
555 | const char *data; | 555 | const char *data; |
@@ -580,13 +580,13 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
580 | GNUNET_assert (3 + ((NULL == zone_key) ? 1 : 0) == PQnfields (res)); | 580 | GNUNET_assert (3 + ((NULL == zone_key) ? 1 : 0) == PQnfields (res)); |
581 | if (NULL == zone_key) | 581 | if (NULL == zone_key) |
582 | { | 582 | { |
583 | if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != PQgetlength (res, 0, 3)) | 583 | if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) != PQgetlength (res, 0, 3)) |
584 | { | 584 | { |
585 | GNUNET_break (0); | 585 | GNUNET_break (0); |
586 | PQclear (res); | 586 | PQclear (res); |
587 | return GNUNET_SYSERR; | 587 | return GNUNET_SYSERR; |
588 | } | 588 | } |
589 | zone_key = (const struct GNUNET_CRYPTO_EccPrivateKey *) PQgetvalue (res, 0, 3); | 589 | zone_key = (const struct GNUNET_CRYPTO_EcdsaPrivateKey *) PQgetvalue (res, 0, 3); |
590 | } | 590 | } |
591 | if (sizeof (uint32_t) != PQfsize (res, 0)) | 591 | if (sizeof (uint32_t) != PQfsize (res, 0)) |
592 | { | 592 | { |
@@ -642,7 +642,7 @@ get_record_and_call_iterator (struct Plugin *plugin, | |||
642 | */ | 642 | */ |
643 | static int | 643 | static int |
644 | namestore_postgres_iterate_records (void *cls, | 644 | namestore_postgres_iterate_records (void *cls, |
645 | const struct GNUNET_CRYPTO_EccPrivateKey *zone, | 645 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
646 | uint64_t offset, | 646 | uint64_t offset, |
647 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) | 647 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) |
648 | { | 648 | { |
@@ -707,8 +707,8 @@ namestore_postgres_iterate_records (void *cls, | |||
707 | */ | 707 | */ |
708 | static int | 708 | static int |
709 | namestore_postgres_zone_to_name (void *cls, | 709 | namestore_postgres_zone_to_name (void *cls, |
710 | const struct GNUNET_CRYPTO_EccPrivateKey *zone, | 710 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
711 | const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, | 711 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, |
712 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) | 712 | GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) |
713 | { | 713 | { |
714 | struct Plugin *plugin = cls; | 714 | struct Plugin *plugin = cls; |