diff options
author | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-10-14 19:47:32 +0200 |
---|---|---|
committer | Martin Schanzenbach <mschanzenbach@posteo.de> | 2020-10-15 12:11:18 +0200 |
commit | 96c802b46be51e5c45f34e2de823f787d26c2929 (patch) | |
tree | 457ccfd8f9a61563af86318739c4a8f964a57025 /src/namestore/gnunet-namestore.c | |
parent | c14e3a2769ff0f15fdbb32797e37e43ce2344fa3 (diff) | |
download | gnunet-96c802b46be51e5c45f34e2de823f787d26c2929.tar.gz gnunet-96c802b46be51e5c45f34e2de823f787d26c2929.zip |
- towards crypto agility; wip
Diffstat (limited to 'src/namestore/gnunet-namestore.c')
-rw-r--r-- | src/namestore/gnunet-namestore.c | 35 |
1 files changed, 18 insertions, 17 deletions
diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 07d045b90..345d76910 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c | |||
@@ -59,7 +59,7 @@ static struct GNUNET_NAMESTORE_Handle *ns; | |||
59 | /** | 59 | /** |
60 | * Private key for the our zone. | 60 | * Private key for the our zone. |
61 | */ | 61 | */ |
62 | static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey; | 62 | static struct GNUNET_IDENTITY_PrivateKey zone_pkey; |
63 | 63 | ||
64 | /** | 64 | /** |
65 | * Handle to identity lookup. | 65 | * Handle to identity lookup. |
@@ -496,7 +496,7 @@ display_record (const char *rname, | |||
496 | */ | 496 | */ |
497 | static void | 497 | static void |
498 | display_record_iterator (void *cls, | 498 | display_record_iterator (void *cls, |
499 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 499 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
500 | const char *rname, | 500 | const char *rname, |
501 | unsigned int rd_len, | 501 | unsigned int rd_len, |
502 | const struct GNUNET_GNSRECORD_Data *rd) | 502 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -519,7 +519,7 @@ display_record_iterator (void *cls, | |||
519 | */ | 519 | */ |
520 | static void | 520 | static void |
521 | display_record_monitor (void *cls, | 521 | display_record_monitor (void *cls, |
522 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 522 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
523 | const char *rname, | 523 | const char *rname, |
524 | unsigned int rd_len, | 524 | unsigned int rd_len, |
525 | const struct GNUNET_GNSRECORD_Data *rd) | 525 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -542,7 +542,7 @@ display_record_monitor (void *cls, | |||
542 | */ | 542 | */ |
543 | static void | 543 | static void |
544 | display_record_lookup (void *cls, | 544 | display_record_lookup (void *cls, |
545 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 545 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
546 | const char *rname, | 546 | const char *rname, |
547 | unsigned int rd_len, | 547 | unsigned int rd_len, |
548 | const struct GNUNET_GNSRECORD_Data *rd) | 548 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -622,7 +622,7 @@ add_error_cb (void *cls) | |||
622 | */ | 622 | */ |
623 | static void | 623 | static void |
624 | get_existing_record (void *cls, | 624 | get_existing_record (void *cls, |
625 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 625 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
626 | const char *rec_name, | 626 | const char *rec_name, |
627 | unsigned int rd_count, | 627 | unsigned int rd_count, |
628 | const struct GNUNET_GNSRECORD_Data *rd) | 628 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -781,7 +781,7 @@ reverse_error_cb (void *cls) | |||
781 | */ | 781 | */ |
782 | static void | 782 | static void |
783 | handle_reverse_lookup (void *cls, | 783 | handle_reverse_lookup (void *cls, |
784 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 784 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
785 | const char *label, | 785 | const char *label, |
786 | unsigned int rd_count, | 786 | unsigned int rd_count, |
787 | const struct GNUNET_GNSRECORD_Data *rd) | 787 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -826,7 +826,7 @@ del_lookup_error_cb (void *cls) | |||
826 | */ | 826 | */ |
827 | static void | 827 | static void |
828 | del_monitor (void *cls, | 828 | del_monitor (void *cls, |
829 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 829 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
830 | const char *label, | 830 | const char *label, |
831 | unsigned int rd_count, | 831 | unsigned int rd_count, |
832 | const struct GNUNET_GNSRECORD_Data *rd) | 832 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -1187,12 +1187,11 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1187 | } | 1187 | } |
1188 | if (NULL != reverse_pkey) | 1188 | if (NULL != reverse_pkey) |
1189 | { | 1189 | { |
1190 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 1190 | struct GNUNET_IDENTITY_PublicKey pubkey; |
1191 | 1191 | ||
1192 | if (GNUNET_OK != | 1192 | if (GNUNET_OK != |
1193 | GNUNET_CRYPTO_ecdsa_public_key_from_string (reverse_pkey, | 1193 | GNUNET_IDENTITY_public_key_from_string (reverse_pkey, |
1194 | strlen (reverse_pkey), | 1194 | &pubkey)) |
1195 | &pubkey)) | ||
1196 | { | 1195 | { |
1197 | fprintf (stderr, | 1196 | fprintf (stderr, |
1198 | _ ("Invalid public key for reverse lookup `%s'\n"), | 1197 | _ ("Invalid public key for reverse lookup `%s'\n"), |
@@ -1211,12 +1210,12 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1211 | { | 1210 | { |
1212 | char sh[105]; | 1211 | char sh[105]; |
1213 | char sname[64]; | 1212 | char sname[64]; |
1214 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 1213 | struct GNUNET_IDENTITY_PublicKey pkey; |
1215 | 1214 | ||
1216 | GNUNET_STRINGS_utf8_tolower (uri, uri); | 1215 | GNUNET_STRINGS_utf8_tolower (uri, uri); |
1217 | if ((2 != (sscanf (uri, "gnunet://gns/%52s/%63s", sh, sname))) || | 1216 | if ((2 != (sscanf (uri, "gnunet://gns/%52s/%63s", sh, sname))) || |
1218 | (GNUNET_OK != | 1217 | (GNUNET_OK != |
1219 | GNUNET_CRYPTO_ecdsa_public_key_from_string (sh, strlen (sh), &pkey))) | 1218 | GNUNET_IDENTITY_public_key_from_string (sh, &pkey))) |
1220 | { | 1219 | { |
1221 | fprintf (stderr, _ ("Invalid URI `%s'\n"), uri); | 1220 | fprintf (stderr, _ ("Invalid URI `%s'\n"), uri); |
1222 | GNUNET_SCHEDULER_shutdown (); | 1221 | GNUNET_SCHEDULER_shutdown (); |
@@ -1242,8 +1241,8 @@ run_with_zone_pkey (const struct GNUNET_CONFIGURATION_Handle *cfg) | |||
1242 | } | 1241 | } |
1243 | memset (&rd, 0, sizeof(rd)); | 1242 | memset (&rd, 0, sizeof(rd)); |
1244 | rd.data = &pkey; | 1243 | rd.data = &pkey; |
1245 | rd.data_size = sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey); | 1244 | rd.data_size = GNUNET_IDENTITY_key_get_length (&pkey); |
1246 | rd.record_type = GNUNET_GNSRECORD_TYPE_PKEY; | 1245 | rd.record_type = ntohl (pkey.type); |
1247 | rd.expiration_time = etime; | 1246 | rd.expiration_time = etime; |
1248 | if (GNUNET_YES == etime_is_rel) | 1247 | if (GNUNET_YES == etime_is_rel) |
1249 | rd.flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 1248 | rd.flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
@@ -1704,11 +1703,13 @@ main (int argc, char *const *argv) | |||
1704 | NULL))) | 1703 | NULL))) |
1705 | { | 1704 | { |
1706 | GNUNET_free_nz ((void *) argv); | 1705 | GNUNET_free_nz ((void *) argv); |
1707 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | 1706 | //FIXME |
1707 | //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | ||
1708 | return lret; | 1708 | return lret; |
1709 | } | 1709 | } |
1710 | GNUNET_free_nz ((void *) argv); | 1710 | GNUNET_free_nz ((void *) argv); |
1711 | GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | 1711 | //FIXME |
1712 | //GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); | ||
1712 | return ret; | 1713 | return ret; |
1713 | } | 1714 | } |
1714 | 1715 | ||