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 | |
parent | c14e3a2769ff0f15fdbb32797e37e43ce2344fa3 (diff) | |
download | gnunet-96c802b46be51e5c45f34e2de823f787d26c2929.tar.gz gnunet-96c802b46be51e5c45f34e2de823f787d26c2929.zip |
- towards crypto agility; wip
Diffstat (limited to 'src')
73 files changed, 1057 insertions, 613 deletions
diff --git a/src/fs/fs_download.c b/src/fs/fs_download.c index 6154e8be0..d4677b794 100644 --- a/src/fs/fs_download.c +++ b/src/fs/fs_download.c | |||
@@ -1050,7 +1050,7 @@ process_result_with_request (void *cls, | |||
1050 | GNUNET_asprintf ( | 1050 | GNUNET_asprintf ( |
1051 | &dc->emsg, | 1051 | &dc->emsg, |
1052 | _ ( | 1052 | _ ( |
1053 | "Internal error or bogus download URI (expected %u bytes at depth %u and offset %llu/%llu, got %u bytes)"), | 1053 | "Internal error or bogus download URI (expected %lu bytes at depth %u and offset %llu/%llu, got %lu bytes)"), |
1054 | bs, | 1054 | bs, |
1055 | dr->depth, | 1055 | dr->depth, |
1056 | (unsigned long long) dr->offset, | 1056 | (unsigned long long) dr->offset, |
diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 91fcd8f8a..518192283 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c | |||
@@ -475,6 +475,7 @@ uri_ksk_continuation (void *cls, | |||
475 | const char *emsg) | 475 | const char *emsg) |
476 | { | 476 | { |
477 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; | 477 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; |
478 | const struct GNUNET_IDENTITY_PrivateKey *pk; | ||
478 | 479 | ||
479 | if (NULL != emsg) | 480 | if (NULL != emsg) |
480 | { | 481 | { |
@@ -486,7 +487,10 @@ uri_ksk_continuation (void *cls, | |||
486 | GNUNET_SCHEDULER_shutdown (); | 487 | GNUNET_SCHEDULER_shutdown (); |
487 | return; | 488 | return; |
488 | } | 489 | } |
489 | priv = GNUNET_IDENTITY_ego_get_private_key (namespace); | 490 | pk = GNUNET_IDENTITY_ego_get_private_key (namespace); |
491 | if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (pk->type)) | ||
492 | return; | ||
493 | priv = &pk->ecdsa_key; | ||
490 | GNUNET_FS_publish_sks (ctx, | 494 | GNUNET_FS_publish_sks (ctx, |
491 | priv, | 495 | priv, |
492 | this_id, | 496 | this_id, |
@@ -569,6 +573,7 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) | |||
569 | { | 573 | { |
570 | struct GNUNET_FS_FileInformation *fi; | 574 | struct GNUNET_FS_FileInformation *fi; |
571 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; | 575 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; |
576 | const struct GNUNET_IDENTITY_PrivateKey *pk; | ||
572 | 577 | ||
573 | fi = get_file_information (directory_scan_result); | 578 | fi = get_file_information (directory_scan_result); |
574 | GNUNET_FS_share_tree_free (directory_scan_result); | 579 | GNUNET_FS_share_tree_free (directory_scan_result); |
@@ -589,7 +594,11 @@ directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) | |||
589 | if (NULL == namespace) | 594 | if (NULL == namespace) |
590 | priv = NULL; | 595 | priv = NULL; |
591 | else | 596 | else |
592 | priv = GNUNET_IDENTITY_ego_get_private_key (namespace); | 597 | { |
598 | pk = GNUNET_IDENTITY_ego_get_private_key (namespace); | ||
599 | if (GNUNET_IDENTITY_TYPE_ECDSA == ntohl (pk->type)) | ||
600 | priv = &pk->ecdsa_key; | ||
601 | } | ||
593 | pc = GNUNET_FS_publish_start (ctx, | 602 | pc = GNUNET_FS_publish_start (ctx, |
594 | fi, | 603 | fi, |
595 | priv, | 604 | priv, |
diff --git a/src/gns/gns.h b/src/gns/gns.h index a193632b7..d824742ad 100644 --- a/src/gns/gns.h +++ b/src/gns/gns.h | |||
@@ -48,7 +48,7 @@ struct LookupMessage | |||
48 | /** | 48 | /** |
49 | * Zone that is to be used for lookup | 49 | * Zone that is to be used for lookup |
50 | */ | 50 | */ |
51 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 51 | struct GNUNET_IDENTITY_PublicKey zone; |
52 | 52 | ||
53 | /** | 53 | /** |
54 | * Local options for where to look for results | 54 | * Local options for where to look for results |
diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index bf95bf340..841a0d240 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c | |||
@@ -343,7 +343,7 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) | |||
343 | struct GNUNET_GNS_LookupRequest * | 343 | struct GNUNET_GNS_LookupRequest * |
344 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | 344 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, |
345 | const char *name, | 345 | const char *name, |
346 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 346 | const struct GNUNET_IDENTITY_PublicKey *zone, |
347 | uint32_t type, | 347 | uint32_t type, |
348 | enum GNUNET_GNS_LocalOptions options, | 348 | enum GNUNET_GNS_LocalOptions options, |
349 | uint16_t recursion_depth_limit, | 349 | uint16_t recursion_depth_limit, |
@@ -411,7 +411,7 @@ GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | |||
411 | struct GNUNET_GNS_LookupRequest* | 411 | struct GNUNET_GNS_LookupRequest* |
412 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | 412 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, |
413 | const char *name, | 413 | const char *name, |
414 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 414 | const struct GNUNET_IDENTITY_PublicKey *zone, |
415 | uint32_t type, | 415 | uint32_t type, |
416 | enum GNUNET_GNS_LocalOptions options, | 416 | enum GNUNET_GNS_LocalOptions options, |
417 | GNUNET_GNS_LookupResultProcessor proc, | 417 | GNUNET_GNS_LookupResultProcessor proc, |
diff --git a/src/gns/gns_tld_api.c b/src/gns/gns_tld_api.c index 3ebf07db6..3eab6c109 100644 --- a/src/gns/gns_tld_api.c +++ b/src/gns/gns_tld_api.c | |||
@@ -167,7 +167,7 @@ process_lookup_result (void *cls, | |||
167 | */ | 167 | */ |
168 | static void | 168 | static void |
169 | lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, | 169 | lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, |
170 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 170 | const struct GNUNET_IDENTITY_PublicKey *pkey) |
171 | { | 171 | { |
172 | ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle, | 172 | ltr->lr = GNUNET_GNS_lookup (ltr->gns_handle, |
173 | ltr->name, | 173 | ltr->name, |
@@ -190,11 +190,11 @@ lookup_with_public_key (struct GNUNET_GNS_LookupWithTldRequest *ltr, | |||
190 | */ | 190 | */ |
191 | static void | 191 | static void |
192 | identity_zone_cb (void *cls, | 192 | identity_zone_cb (void *cls, |
193 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 193 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
194 | const char *ego_name) | 194 | const char *ego_name) |
195 | { | 195 | { |
196 | struct GNUNET_GNS_LookupWithTldRequest *ltr = cls; | 196 | struct GNUNET_GNS_LookupWithTldRequest *ltr = cls; |
197 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 197 | struct GNUNET_IDENTITY_PublicKey pkey; |
198 | 198 | ||
199 | ltr->id_co = NULL; | 199 | ltr->id_co = NULL; |
200 | if (NULL == priv) | 200 | if (NULL == priv) |
@@ -219,7 +219,7 @@ identity_zone_cb (void *cls, | |||
219 | ltr->options = GNUNET_GNS_LO_NO_DHT; | 219 | ltr->options = GNUNET_GNS_LO_NO_DHT; |
220 | else | 220 | else |
221 | ltr->options = GNUNET_GNS_LO_LOCAL_MASTER; | 221 | ltr->options = GNUNET_GNS_LO_LOCAL_MASTER; |
222 | GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pkey); | 222 | GNUNET_IDENTITY_key_get_public (priv, &pkey); |
223 | lookup_with_public_key (ltr, &pkey); | 223 | lookup_with_public_key (ltr, &pkey); |
224 | } | 224 | } |
225 | 225 | ||
@@ -249,7 +249,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
249 | const char *tld; | 249 | const char *tld; |
250 | char *dot_tld; | 250 | char *dot_tld; |
251 | char *zonestr; | 251 | char *zonestr; |
252 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 252 | struct GNUNET_IDENTITY_PublicKey pkey; |
253 | 253 | ||
254 | ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest); | 254 | ltr = GNUNET_new (struct GNUNET_GNS_LookupWithTldRequest); |
255 | ltr->gns_handle = handle; | 255 | ltr->gns_handle = handle; |
@@ -261,7 +261,7 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
261 | /* start with trivial case: TLD is zkey */ | 261 | /* start with trivial case: TLD is zkey */ |
262 | tld = get_tld (ltr->name); | 262 | tld = get_tld (ltr->name); |
263 | if (GNUNET_OK == | 263 | if (GNUNET_OK == |
264 | GNUNET_CRYPTO_ecdsa_public_key_from_string (tld, strlen (tld), &pkey)) | 264 | GNUNET_IDENTITY_public_key_from_string (tld, &pkey)) |
265 | { | 265 | { |
266 | eat_tld (ltr->name, tld); | 266 | eat_tld (ltr->name, tld); |
267 | lookup_with_public_key (ltr, &pkey); | 267 | lookup_with_public_key (ltr, &pkey); |
@@ -281,9 +281,8 @@ GNUNET_GNS_lookup_with_tld (struct GNUNET_GNS_Handle *handle, | |||
281 | &zonestr)) | 281 | &zonestr)) |
282 | { | 282 | { |
283 | if (GNUNET_OK != | 283 | if (GNUNET_OK != |
284 | GNUNET_CRYPTO_ecdsa_public_key_from_string (zonestr, | 284 | GNUNET_IDENTITY_public_key_from_string (zonestr, |
285 | strlen (zonestr), | 285 | &pkey)) |
286 | &pkey)) | ||
287 | { | 286 | { |
288 | GNUNET_log_config_invalid ( | 287 | GNUNET_log_config_invalid ( |
289 | GNUNET_ERROR_TYPE_ERROR, | 288 | GNUNET_ERROR_TYPE_ERROR, |
diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 8c5b2d6c4..52300ae3b 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c | |||
@@ -123,7 +123,7 @@ struct GNS_TopLevelDomain | |||
123 | /** | 123 | /** |
124 | * Public key associated with the @a tld. | 124 | * Public key associated with the @a tld. |
125 | */ | 125 | */ |
126 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 126 | struct GNUNET_IDENTITY_PublicKey pkey; |
127 | 127 | ||
128 | /** | 128 | /** |
129 | * Top-level domain as a string, including leading ".". | 129 | * Top-level domain as a string, including leading ".". |
@@ -177,7 +177,7 @@ static struct GNS_TopLevelDomain *tld_tail; | |||
177 | */ | 177 | */ |
178 | int | 178 | int |
179 | GNS_find_tld (const char *tld_str, | 179 | GNS_find_tld (const char *tld_str, |
180 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 180 | struct GNUNET_IDENTITY_PublicKey *pkey) |
181 | { | 181 | { |
182 | if ('\0' == *tld_str) | 182 | if ('\0' == *tld_str) |
183 | return GNUNET_NO; | 183 | return GNUNET_NO; |
@@ -485,7 +485,7 @@ read_service_conf (void *cls, | |||
485 | const char *option, | 485 | const char *option, |
486 | const char *value) | 486 | const char *value) |
487 | { | 487 | { |
488 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 488 | struct GNUNET_IDENTITY_PublicKey pk; |
489 | struct GNS_TopLevelDomain *tld; | 489 | struct GNS_TopLevelDomain *tld; |
490 | 490 | ||
491 | (void) cls; | 491 | (void) cls; |
diff --git a/src/gns/gnunet-service-gns.h b/src/gns/gnunet-service-gns.h index 2a432f8aa..d4fb9ec9f 100644 --- a/src/gns/gnunet-service-gns.h +++ b/src/gns/gnunet-service-gns.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #ifndef GNUNET_SERVICE_GNS_H | 26 | #ifndef GNUNET_SERVICE_GNS_H |
27 | #define GNUNET_SERVICE_GNS_H | 27 | #define GNUNET_SERVICE_GNS_H |
28 | 28 | ||
29 | #include "gnunet_identity_service.h" | ||
29 | 30 | ||
30 | /** | 31 | /** |
31 | * Find GNS zone belonging to TLD @a tld. | 32 | * Find GNS zone belonging to TLD @a tld. |
@@ -36,7 +37,7 @@ | |||
36 | */ | 37 | */ |
37 | int | 38 | int |
38 | GNS_find_tld (const char *tld_str, | 39 | GNS_find_tld (const char *tld_str, |
39 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 40 | struct GNUNET_IDENTITY_PublicKey *pkey); |
40 | 41 | ||
41 | 42 | ||
42 | /** | 43 | /** |
diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 19416a506..b53f4af6b 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c | |||
@@ -314,7 +314,7 @@ handle_dns_request (void *cls, | |||
314 | { | 314 | { |
315 | struct GNUNET_DNSPARSER_Packet *p; | 315 | struct GNUNET_DNSPARSER_Packet *p; |
316 | struct InterceptLookupHandle *ilh; | 316 | struct InterceptLookupHandle *ilh; |
317 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 317 | struct GNUNET_IDENTITY_PublicKey zone; |
318 | 318 | ||
319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 319 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
320 | "Hijacked a DNS request. Processing.\n"); | 320 | "Hijacked a DNS request. Processing.\n"); |
diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index cb75b23c7..b34402f81 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c | |||
@@ -173,7 +173,7 @@ struct AuthorityChain | |||
173 | /** | 173 | /** |
174 | * The zone of the GNS authority | 174 | * The zone of the GNS authority |
175 | */ | 175 | */ |
176 | struct GNUNET_CRYPTO_EcdsaPublicKey gns_authority; | 176 | struct GNUNET_IDENTITY_PublicKey gns_authority; |
177 | 177 | ||
178 | struct | 178 | struct |
179 | { | 179 | { |
@@ -305,7 +305,7 @@ struct GNS_ResolverHandle | |||
305 | /** | 305 | /** |
306 | * The top-level GNS authoritative zone to query | 306 | * The top-level GNS authoritative zone to query |
307 | */ | 307 | */ |
308 | struct GNUNET_CRYPTO_EcdsaPublicKey authority_zone; | 308 | struct GNUNET_IDENTITY_PublicKey authority_zone; |
309 | 309 | ||
310 | /** | 310 | /** |
311 | * called when resolution phase finishes | 311 | * called when resolution phase finishes |
@@ -1251,7 +1251,7 @@ handle_gns_cname_result (struct GNS_ResolverHandle *rh, | |||
1251 | const char *tld; | 1251 | const char *tld; |
1252 | struct AuthorityChain *ac; | 1252 | struct AuthorityChain *ac; |
1253 | int af; | 1253 | int af; |
1254 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 1254 | struct GNUNET_IDENTITY_PublicKey zone; |
1255 | 1255 | ||
1256 | nlen = strlen (cname); | 1256 | nlen = strlen (cname); |
1257 | tld = GNS_get_tld (cname); | 1257 | tld = GNS_get_tld (cname); |
@@ -1698,7 +1698,7 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh, | |||
1698 | struct AuthorityChain *ac; | 1698 | struct AuthorityChain *ac; |
1699 | 1699 | ||
1700 | /* delegation to another zone */ | 1700 | /* delegation to another zone */ |
1701 | if (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) != | 1701 | if (sizeof(struct GNUNET_IDENTITY_PublicKey) != |
1702 | rd->data_size) | 1702 | rd->data_size) |
1703 | { | 1703 | { |
1704 | GNUNET_break_op (0); | 1704 | GNUNET_break_op (0); |
@@ -1711,7 +1711,7 @@ recursive_pkey_resolution (struct GNS_ResolverHandle *rh, | |||
1711 | ac->gns_authority = GNUNET_YES; | 1711 | ac->gns_authority = GNUNET_YES; |
1712 | GNUNET_memcpy (&ac->authority_info.gns_authority, | 1712 | GNUNET_memcpy (&ac->authority_info.gns_authority, |
1713 | rd->data, | 1713 | rd->data, |
1714 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); | 1714 | sizeof(struct GNUNET_IDENTITY_PublicKey)); |
1715 | ac->label = resolver_lookup_get_next_label (rh); | 1715 | ac->label = resolver_lookup_get_next_label (rh); |
1716 | /* add AC to tail */ | 1716 | /* add AC to tail */ |
1717 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, | 1717 | GNUNET_CONTAINER_DLL_insert_tail (rh->ac_head, |
@@ -1754,7 +1754,7 @@ recursive_gns2dns_resolution (struct GNS_ResolverHandle *rh, | |||
1754 | char *n; | 1754 | char *n; |
1755 | size_t off; | 1755 | size_t off; |
1756 | struct Gns2DnsPending *gp; | 1756 | struct Gns2DnsPending *gp; |
1757 | struct GNUNET_CRYPTO_EcdsaPublicKey zone; | 1757 | struct GNUNET_IDENTITY_PublicKey zone; |
1758 | struct sockaddr_in v4; | 1758 | struct sockaddr_in v4; |
1759 | struct sockaddr_in6 v6; | 1759 | struct sockaddr_in6 v6; |
1760 | 1760 | ||
@@ -2258,9 +2258,9 @@ handle_gns_resolution_result (void *cls, | |||
2258 | 2258 | ||
2259 | case GNUNET_GNSRECORD_TYPE_PKEY: | 2259 | case GNUNET_GNSRECORD_TYPE_PKEY: |
2260 | { | 2260 | { |
2261 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 2261 | struct GNUNET_IDENTITY_PublicKey pub; |
2262 | 2262 | ||
2263 | if (rd[i].data_size != sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)) | 2263 | if (rd[i].data_size != sizeof(struct GNUNET_IDENTITY_PublicKey)) |
2264 | { | 2264 | { |
2265 | GNUNET_break_op (0); | 2265 | GNUNET_break_op (0); |
2266 | break; | 2266 | break; |
@@ -2471,7 +2471,7 @@ handle_dht_response (void *cls, | |||
2471 | block = data; | 2471 | block = data; |
2472 | if (size != | 2472 | if (size != |
2473 | ntohl (block->purpose.size) | 2473 | ntohl (block->purpose.size) |
2474 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 2474 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
2475 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature)) | 2475 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature)) |
2476 | { | 2476 | { |
2477 | /* how did this pass DHT block validation!? */ | 2477 | /* how did this pass DHT block validation!? */ |
@@ -2594,7 +2594,7 @@ handle_namecache_block_response (void *cls, | |||
2594 | struct GNS_ResolverHandle *rh = cls; | 2594 | struct GNS_ResolverHandle *rh = cls; |
2595 | struct AuthorityChain *ac = rh->ac_tail; | 2595 | struct AuthorityChain *ac = rh->ac_tail; |
2596 | const char *label = ac->label; | 2596 | const char *label = ac->label; |
2597 | const struct GNUNET_CRYPTO_EcdsaPublicKey *auth = | 2597 | const struct GNUNET_IDENTITY_PublicKey *auth = |
2598 | &ac->authority_info.gns_authority; | 2598 | &ac->authority_info.gns_authority; |
2599 | struct GNUNET_HashCode query; | 2599 | struct GNUNET_HashCode query; |
2600 | 2600 | ||
@@ -2857,7 +2857,7 @@ start_resolver_lookup (void *cls) | |||
2857 | * @return handle to cancel operation | 2857 | * @return handle to cancel operation |
2858 | */ | 2858 | */ |
2859 | struct GNS_ResolverHandle * | 2859 | struct GNS_ResolverHandle * |
2860 | GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 2860 | GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone, |
2861 | uint32_t record_type, | 2861 | uint32_t record_type, |
2862 | const char *name, | 2862 | const char *name, |
2863 | enum GNUNET_GNS_LocalOptions options, | 2863 | enum GNUNET_GNS_LocalOptions options, |
diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index 3dab3c91a..b099c5d65 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h | |||
@@ -86,7 +86,7 @@ typedef void | |||
86 | * @return handle to cancel operation | 86 | * @return handle to cancel operation |
87 | */ | 87 | */ |
88 | struct GNS_ResolverHandle * | 88 | struct GNS_ResolverHandle * |
89 | GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 89 | GNS_resolver_lookup (const struct GNUNET_IDENTITY_PublicKey *zone, |
90 | uint32_t record_type, | 90 | uint32_t record_type, |
91 | const char *name, | 91 | const char *name, |
92 | enum GNUNET_GNS_LocalOptions options, | 92 | enum GNUNET_GNS_LocalOptions options, |
diff --git a/src/gnsrecord/Makefile.am b/src/gnsrecord/Makefile.am index 2e6eca7ba..1748ad39d 100644 --- a/src/gnsrecord/Makefile.am +++ b/src/gnsrecord/Makefile.am | |||
@@ -47,6 +47,7 @@ libgnunetgnsrecord_la_SOURCES = \ | |||
47 | gnsrecord_misc.c | 47 | gnsrecord_misc.c |
48 | libgnunetgnsrecord_la_LIBADD = \ | 48 | libgnunetgnsrecord_la_LIBADD = \ |
49 | $(top_builddir)/src/util/libgnunetutil.la \ | 49 | $(top_builddir)/src/util/libgnunetutil.la \ |
50 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
50 | $(GN_LIBINTL) | 51 | $(GN_LIBINTL) |
51 | libgnunetgnsrecord_la_LDFLAGS = \ | 52 | libgnunetgnsrecord_la_LDFLAGS = \ |
52 | $(GN_LIB_LDFLAGS) \ | 53 | $(GN_LIB_LDFLAGS) \ |
diff --git a/src/gnsrecord/gnsrecord_crypto.c b/src/gnsrecord/gnsrecord_crypto.c index c8919760a..b32b148fe 100644 --- a/src/gnsrecord/gnsrecord_crypto.c +++ b/src/gnsrecord/gnsrecord_crypto.c | |||
@@ -152,7 +152,8 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
152 | label, | 152 | label, |
153 | "gns"); | 153 | "gns"); |
154 | GNUNET_CRYPTO_ecdsa_key_get_public (dkey, | 154 | GNUNET_CRYPTO_ecdsa_key_get_public (dkey, |
155 | &block->derived_key); | 155 | &block->derived_key.ecdsa_key); |
156 | block->derived_key.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); | ||
156 | derive_block_aes_key (&iv, | 157 | derive_block_aes_key (&iv, |
157 | &skey, | 158 | &skey, |
158 | label, | 159 | label, |
@@ -191,7 +192,7 @@ block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
191 | * @return NULL on error (block too large) | 192 | * @return NULL on error (block too large) |
192 | */ | 193 | */ |
193 | struct GNUNET_GNSRECORD_Block * | 194 | struct GNUNET_GNSRECORD_Block * |
194 | GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 195 | GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key, |
195 | struct GNUNET_TIME_Absolute expire, | 196 | struct GNUNET_TIME_Absolute expire, |
196 | const char *label, | 197 | const char *label, |
197 | const struct GNUNET_GNSRECORD_Data *rd, | 198 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -199,14 +200,21 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
199 | { | 200 | { |
200 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 201 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
201 | 202 | ||
202 | GNUNET_CRYPTO_ecdsa_key_get_public (key, | 203 | switch (ntohl (key->type)) |
203 | &pkey); | 204 | { |
204 | return block_create (key, | 205 | case GNUNET_GNSRECORD_TYPE_PKEY: |
205 | &pkey, | 206 | GNUNET_CRYPTO_ecdsa_key_get_public (&key->ecdsa_key, |
206 | expire, | 207 | &pkey); |
207 | label, | 208 | return block_create (&key->ecdsa_key, |
208 | rd, | 209 | &pkey, |
209 | rd_count); | 210 | expire, |
211 | label, | ||
212 | rd, | ||
213 | rd_count); | ||
214 | default: | ||
215 | GNUNET_assert (0); | ||
216 | } | ||
217 | return NULL; | ||
210 | } | 218 | } |
211 | 219 | ||
212 | 220 | ||
@@ -240,12 +248,19 @@ struct KeyCacheLine | |||
240 | * @return NULL on error (block too large) | 248 | * @return NULL on error (block too large) |
241 | */ | 249 | */ |
242 | struct GNUNET_GNSRECORD_Block * | 250 | struct GNUNET_GNSRECORD_Block * |
243 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 251 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *pkey, |
244 | struct GNUNET_TIME_Absolute expire, | 252 | struct GNUNET_TIME_Absolute expire, |
245 | const char *label, | 253 | const char *label, |
246 | const struct GNUNET_GNSRECORD_Data *rd, | 254 | const struct GNUNET_GNSRECORD_Data *rd, |
247 | unsigned int rd_count) | 255 | unsigned int rd_count) |
248 | { | 256 | { |
257 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key; | ||
258 | |||
259 | if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (pkey->type)) | ||
260 | { | ||
261 | return NULL; //FIXME | ||
262 | } | ||
263 | key = &pkey->ecdsa_key; | ||
249 | #define CSIZE 64 | 264 | #define CSIZE 64 |
250 | static struct KeyCacheLine cache[CSIZE]; | 265 | static struct KeyCacheLine cache[CSIZE]; |
251 | struct KeyCacheLine *line; | 266 | struct KeyCacheLine *line; |
@@ -277,29 +292,27 @@ GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
277 | * @param block block to verify | 292 | * @param block block to verify |
278 | * @return #GNUNET_OK if the signature is valid | 293 | * @return #GNUNET_OK if the signature is valid |
279 | */ | 294 | */ |
280 | int | 295 | enum GNUNET_GenericReturnValue |
281 | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) | 296 | GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block) |
282 | { | 297 | { |
298 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key; | ||
299 | |||
300 | if (GNUNET_GNSRECORD_TYPE_PKEY != ntohl (block->derived_key.type)) | ||
301 | { | ||
302 | GNUNET_break (0); | ||
303 | return GNUNET_NO; | ||
304 | } | ||
305 | key = &block->derived_key.ecdsa_key; | ||
306 | |||
283 | return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, | 307 | return GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, |
284 | &block->purpose, | 308 | &block->purpose, |
285 | &block->signature, | 309 | &block->signature, |
286 | &block->derived_key); | 310 | key); |
287 | } | 311 | } |
288 | 312 | ||
289 | 313 | ||
290 | /** | 314 | enum GNUNET_GenericReturnValue |
291 | * Decrypt block. | 315 | block_decrypt (const struct GNUNET_GNSRECORD_Block *block, |
292 | * | ||
293 | * @param block block to decrypt | ||
294 | * @param zone_key public key of the zone | ||
295 | * @param label the name for the records | ||
296 | * @param proc function to call with the result | ||
297 | * @param proc_cls closure for proc | ||
298 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was | ||
299 | * not well-formed | ||
300 | */ | ||
301 | int | ||
302 | GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | ||
303 | const struct | 316 | const struct |
304 | GNUNET_CRYPTO_EcdsaPublicKey *zone_key, | 317 | GNUNET_CRYPTO_EcdsaPublicKey *zone_key, |
305 | const char *label, | 318 | const char *label, |
@@ -426,6 +439,39 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
426 | 439 | ||
427 | 440 | ||
428 | /** | 441 | /** |
442 | * Decrypt block. | ||
443 | * | ||
444 | * @param block block to decrypt | ||
445 | * @param zone_key public key of the zone | ||
446 | * @param label the name for the records | ||
447 | * @param proc function to call with the result | ||
448 | * @param proc_cls closure for proc | ||
449 | * @return #GNUNET_OK on success, #GNUNET_SYSERR if the block was | ||
450 | * not well-formed | ||
451 | */ | ||
452 | enum GNUNET_GenericReturnValue | ||
453 | GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | ||
454 | const struct | ||
455 | GNUNET_IDENTITY_PublicKey *zone_key, | ||
456 | const char *label, | ||
457 | GNUNET_GNSRECORD_RecordCallback proc, | ||
458 | void *proc_cls) | ||
459 | { | ||
460 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key; | ||
461 | |||
462 | if (GNUNET_IDENTITY_TYPE_ECDSA != ntohl (zone_key->type)) | ||
463 | { | ||
464 | return GNUNET_NO; | ||
465 | } | ||
466 | key = &zone_key->ecdsa_key; | ||
467 | |||
468 | return block_decrypt (block, key, label, proc, proc_cls); | ||
469 | |||
470 | } | ||
471 | |||
472 | |||
473 | |||
474 | /** | ||
429 | * Calculate the DHT query for a given @a label in a given @a zone. | 475 | * Calculate the DHT query for a given @a label in a given @a zone. |
430 | * | 476 | * |
431 | * @param zone private key of the zone | 477 | * @param zone private key of the zone |
@@ -434,17 +480,24 @@ GNUNET_GNSRECORD_block_decrypt (const struct GNUNET_GNSRECORD_Block *block, | |||
434 | */ | 480 | */ |
435 | void | 481 | void |
436 | GNUNET_GNSRECORD_query_from_private_key (const struct | 482 | GNUNET_GNSRECORD_query_from_private_key (const struct |
437 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 483 | GNUNET_IDENTITY_PrivateKey *zone, |
438 | const char *label, | 484 | const char *label, |
439 | struct GNUNET_HashCode *query) | 485 | struct GNUNET_HashCode *query) |
440 | { | 486 | { |
441 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 487 | struct GNUNET_IDENTITY_PublicKey pub; |
442 | 488 | switch (ntohl (zone->type)) | |
443 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, | 489 | { |
444 | &pub); | 490 | case GNUNET_GNSRECORD_TYPE_PKEY: |
445 | GNUNET_GNSRECORD_query_from_public_key (&pub, | 491 | |
446 | label, | 492 | GNUNET_IDENTITY_key_get_public (zone, |
447 | query); | 493 | &pub); |
494 | GNUNET_GNSRECORD_query_from_public_key (&pub, | ||
495 | label, | ||
496 | query); | ||
497 | break; | ||
498 | default: | ||
499 | GNUNET_assert (0); | ||
500 | } | ||
448 | } | 501 | } |
449 | 502 | ||
450 | 503 | ||
@@ -457,18 +510,27 @@ GNUNET_GNSRECORD_query_from_private_key (const struct | |||
457 | */ | 510 | */ |
458 | void | 511 | void |
459 | GNUNET_GNSRECORD_query_from_public_key (const struct | 512 | GNUNET_GNSRECORD_query_from_public_key (const struct |
460 | GNUNET_CRYPTO_EcdsaPublicKey *pub, | 513 | GNUNET_IDENTITY_PublicKey *pub, |
461 | const char *label, | 514 | const char *label, |
462 | struct GNUNET_HashCode *query) | 515 | struct GNUNET_HashCode *query) |
463 | { | 516 | { |
464 | struct GNUNET_CRYPTO_EcdsaPublicKey pd; | 517 | struct GNUNET_IDENTITY_PublicKey pd; |
465 | GNUNET_CRYPTO_ecdsa_public_key_derive (pub, | 518 | |
466 | label, | 519 | switch (ntohl (pub->type)) |
467 | "gns", | 520 | { |
468 | &pd); | 521 | case GNUNET_GNSRECORD_TYPE_PKEY: |
469 | GNUNET_CRYPTO_hash (&pd, | 522 | pd.type = pub->type; |
470 | sizeof(pd), | 523 | GNUNET_CRYPTO_ecdsa_public_key_derive (&pub->ecdsa_key, |
471 | query); | 524 | label, |
525 | "gns", | ||
526 | &pd.ecdsa_key); | ||
527 | GNUNET_CRYPTO_hash (&pd, | ||
528 | sizeof(pd), | ||
529 | query); | ||
530 | break; | ||
531 | default: | ||
532 | GNUNET_assert (0); | ||
533 | } | ||
472 | } | 534 | } |
473 | 535 | ||
474 | 536 | ||
diff --git a/src/gnsrecord/gnsrecord_misc.c b/src/gnsrecord/gnsrecord_misc.c index 5061f8493..8b590e35f 100644 --- a/src/gnsrecord/gnsrecord_misc.c +++ b/src/gnsrecord/gnsrecord_misc.c | |||
@@ -62,14 +62,14 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src) | |||
62 | * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s | 62 | * @return string form; will be overwritten by next call to #GNUNET_GNSRECORD_z2s |
63 | */ | 63 | */ |
64 | const char * | 64 | const char * |
65 | GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z) | 65 | GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z) |
66 | { | 66 | { |
67 | static char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) * 8]; | 67 | static char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) * 8]; |
68 | char *end; | 68 | char *end; |
69 | 69 | ||
70 | end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, | 70 | end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, |
71 | sizeof(struct | 71 | sizeof(struct |
72 | GNUNET_CRYPTO_EcdsaPublicKey), | 72 | GNUNET_IDENTITY_PublicKey), |
73 | buf, sizeof(buf)); | 73 | buf, sizeof(buf)); |
74 | if (NULL == end) | 74 | if (NULL == end) |
75 | { | 75 | { |
@@ -99,7 +99,7 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | |||
99 | if (a->record_type != b->record_type) | 99 | if (a->record_type != b->record_type) |
100 | { | 100 | { |
101 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 101 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
102 | "Record type %lu != %lu\n", a->record_type, b->record_type); | 102 | "Record type %u != %u\n", a->record_type, b->record_type); |
103 | return GNUNET_NO; | 103 | return GNUNET_NO; |
104 | } | 104 | } |
105 | if ((a->expiration_time != b->expiration_time) && | 105 | if ((a->expiration_time != b->expiration_time) && |
@@ -115,7 +115,7 @@ GNUNET_GNSRECORD_records_cmp (const struct GNUNET_GNSRECORD_Data *a, | |||
115 | != (b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)) | 115 | != (b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS)) |
116 | { | 116 | { |
117 | LOG (GNUNET_ERROR_TYPE_DEBUG, | 117 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
118 | "Flags %lu (%lu) != %lu (%lu)\n", a->flags, | 118 | "Flags %u (%u) != %u (%u)\n", a->flags, |
119 | a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS, b->flags, | 119 | a->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS, b->flags, |
120 | b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS); | 120 | b->flags & GNUNET_GNSRECORD_RF_RCMP_FLAGS); |
121 | return GNUNET_NO; | 121 | return GNUNET_NO; |
@@ -236,12 +236,12 @@ GNUNET_GNSRECORD_is_expired (const struct GNUNET_GNSRECORD_Data *rd) | |||
236 | * key in an encoding suitable for DNS labels. | 236 | * key in an encoding suitable for DNS labels. |
237 | */ | 237 | */ |
238 | const char * | 238 | const char * |
239 | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 239 | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey) |
240 | { | 240 | { |
241 | static char ret[128]; | 241 | static char ret[128]; |
242 | char *pkeys; | 242 | char *pkeys; |
243 | 243 | ||
244 | pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); | 244 | pkeys = GNUNET_IDENTITY_public_key_to_string (pkey); |
245 | GNUNET_snprintf (ret, | 245 | GNUNET_snprintf (ret, |
246 | sizeof(ret), | 246 | sizeof(ret), |
247 | "%s", | 247 | "%s", |
@@ -262,12 +262,11 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | |||
262 | */ | 262 | */ |
263 | int | 263 | int |
264 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | 264 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, |
265 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) | 265 | struct GNUNET_IDENTITY_PublicKey *pkey) |
266 | { | 266 | { |
267 | if (GNUNET_OK != | 267 | if (GNUNET_OK != |
268 | GNUNET_CRYPTO_ecdsa_public_key_from_string (zkey, | 268 | GNUNET_IDENTITY_public_key_from_string (zkey, |
269 | strlen (zkey), | 269 | pkey)) |
270 | pkey)) | ||
271 | return GNUNET_SYSERR; | 270 | return GNUNET_SYSERR; |
272 | return GNUNET_OK; | 271 | return GNUNET_OK; |
273 | } | 272 | } |
diff --git a/src/gnsrecord/gnunet-gnsrecord-tvg.c b/src/gnsrecord/gnunet-gnsrecord-tvg.c index 789ff8aa3..31f077722 100644 --- a/src/gnsrecord/gnunet-gnsrecord-tvg.c +++ b/src/gnsrecord/gnunet-gnsrecord-tvg.c | |||
@@ -90,18 +90,19 @@ run (void *cls, | |||
90 | struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get (); | 90 | struct GNUNET_TIME_Absolute exp_abs = GNUNET_TIME_absolute_get (); |
91 | struct GNUNET_GNSRECORD_Block *rrblock; | 91 | struct GNUNET_GNSRECORD_Block *rrblock; |
92 | char *bdata; | 92 | char *bdata; |
93 | struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv; | 93 | struct GNUNET_IDENTITY_PrivateKey id_priv; |
94 | struct GNUNET_CRYPTO_EcdsaPublicKey id_pub; | 94 | struct GNUNET_IDENTITY_PublicKey id_pub; |
95 | struct GNUNET_CRYPTO_EcdsaPrivateKey pkey_data_p; | 95 | struct GNUNET_IDENTITY_PrivateKey pkey_data_p; |
96 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey_data; | 96 | struct GNUNET_IDENTITY_PublicKey pkey_data; |
97 | void *data; | 97 | void *data; |
98 | size_t data_size; | 98 | size_t data_size; |
99 | char *rdata; | 99 | char *rdata; |
100 | size_t rdata_size; | 100 | size_t rdata_size; |
101 | 101 | ||
102 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv); | 102 | id_priv.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
103 | GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, | 103 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key); |
104 | &id_pub); | 104 | GNUNET_IDENTITY_key_get_public (&id_priv, |
105 | &id_pub); | ||
105 | fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); | 106 | fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); |
106 | print_bytes (&id_priv, sizeof(id_priv), 0); | 107 | print_bytes (&id_priv, sizeof(id_priv), 0); |
107 | fprintf (stdout, "\n"); | 108 | fprintf (stdout, "\n"); |
@@ -109,9 +110,10 @@ run (void *cls, | |||
109 | print_bytes (&id_pub, sizeof(id_pub), 0); | 110 | print_bytes (&id_pub, sizeof(id_pub), 0); |
110 | fprintf (stdout, "\n"); | 111 | fprintf (stdout, "\n"); |
111 | 112 | ||
112 | GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p); | 113 | pkey_data_p.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
113 | GNUNET_CRYPTO_ecdsa_key_get_public (&pkey_data_p, | 114 | GNUNET_CRYPTO_ecdsa_key_create (&pkey_data_p.ecdsa_key); |
114 | &pkey_data); | 115 | GNUNET_IDENTITY_key_get_public (&pkey_data_p, |
116 | &pkey_data); | ||
115 | fprintf (stdout, | 117 | fprintf (stdout, |
116 | "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT); | 118 | "Label: %s\nRRCOUNT: %d\n\n", TEST_RECORD_LABEL, TEST_RRCOUNT); |
117 | memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2); | 119 | memset (rd, 0, sizeof (struct GNUNET_GNSRECORD_Data) * 2); |
diff --git a/src/gnsrecord/perf_gnsrecord_crypto.c b/src/gnsrecord/perf_gnsrecord_crypto.c index eb4633f75..d9a3c20cf 100644 --- a/src/gnsrecord/perf_gnsrecord_crypto.c +++ b/src/gnsrecord/perf_gnsrecord_crypto.c | |||
@@ -73,7 +73,7 @@ run (void *cls, | |||
73 | struct GNUNET_GNSRECORD_Data *s_rd; | 73 | struct GNUNET_GNSRECORD_Data *s_rd; |
74 | const char *s_name; | 74 | const char *s_name; |
75 | struct GNUNET_TIME_Absolute start_time; | 75 | struct GNUNET_TIME_Absolute start_time; |
76 | struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 76 | struct GNUNET_IDENTITY_PrivateKey privkey; |
77 | struct GNUNET_TIME_Absolute expire; | 77 | struct GNUNET_TIME_Absolute expire; |
78 | 78 | ||
79 | (void) cls; | 79 | (void) cls; |
@@ -81,7 +81,8 @@ run (void *cls, | |||
81 | (void) cfgfile; | 81 | (void) cfgfile; |
82 | (void) cfg; | 82 | (void) cfg; |
83 | expire = GNUNET_TIME_absolute_get (); | 83 | expire = GNUNET_TIME_absolute_get (); |
84 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 84 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
85 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
85 | 86 | ||
86 | /* test block creation */ | 87 | /* test block creation */ |
87 | s_name = "DUMMY.dummy.gnunet"; | 88 | s_name = "DUMMY.dummy.gnunet"; |
diff --git a/src/gnsrecord/plugin_gnsrecord_dns.c b/src/gnsrecord/plugin_gnsrecord_dns.c index 9ac6fb9e6..bde9944e2 100644 --- a/src/gnsrecord/plugin_gnsrecord_dns.c +++ b/src/gnsrecord/plugin_gnsrecord_dns.c | |||
@@ -100,7 +100,7 @@ dns_value_to_string (void *cls, | |||
100 | return NULL; | 100 | return NULL; |
101 | } | 101 | } |
102 | GNUNET_asprintf (&result, | 102 | GNUNET_asprintf (&result, |
103 | "rname=%s mname=%s %lu,%lu,%lu,%lu,%lu", | 103 | "rname=%s mname=%s %u,%u,%u,%u,%u", |
104 | soa->rname, | 104 | soa->rname, |
105 | soa->mname, | 105 | soa->mname, |
106 | soa->serial, | 106 | soa->serial, |
diff --git a/src/gnsrecord/test_gnsrecord_crypto.c b/src/gnsrecord/test_gnsrecord_crypto.c index b67e9a123..d541f3076 100644 --- a/src/gnsrecord/test_gnsrecord_crypto.c +++ b/src/gnsrecord/test_gnsrecord_crypto.c | |||
@@ -100,17 +100,18 @@ run (void *cls, | |||
100 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 100 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
101 | { | 101 | { |
102 | struct GNUNET_GNSRECORD_Block *block; | 102 | struct GNUNET_GNSRECORD_Block *block; |
103 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 103 | struct GNUNET_IDENTITY_PublicKey pubkey; |
104 | struct GNUNET_HashCode query_pub; | 104 | struct GNUNET_HashCode query_pub; |
105 | struct GNUNET_HashCode query_priv; | 105 | struct GNUNET_HashCode query_priv; |
106 | struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get (); | 106 | struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get (); |
107 | struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 107 | struct GNUNET_IDENTITY_PrivateKey privkey; |
108 | 108 | ||
109 | 109 | ||
110 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 110 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
111 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
111 | /* get public key */ | 112 | /* get public key */ |
112 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 113 | GNUNET_IDENTITY_key_get_public (&privkey, |
113 | &pubkey); | 114 | &pubkey); |
114 | 115 | ||
115 | /* test query derivation */ | 116 | /* test query derivation */ |
116 | GNUNET_GNSRECORD_query_from_private_key (&privkey, | 117 | GNUNET_GNSRECORD_query_from_private_key (&privkey, |
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index d0f5546f3..e16ca83e3 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c | |||
@@ -108,7 +108,7 @@ static struct GNUNET_IDENTITY_Operation *delete_op; | |||
108 | /** | 108 | /** |
109 | * Private key from command line option, or NULL. | 109 | * Private key from command line option, or NULL. |
110 | */ | 110 | */ |
111 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; | 111 | struct GNUNET_IDENTITY_PrivateKey pk; |
112 | 112 | ||
113 | /** | 113 | /** |
114 | * Value to return from #main(). | 114 | * Value to return from #main(). |
@@ -197,7 +197,7 @@ delete_finished (void *cls, | |||
197 | */ | 197 | */ |
198 | static void | 198 | static void |
199 | create_finished (void *cls, | 199 | create_finished (void *cls, |
200 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 200 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
201 | const char *emsg) | 201 | const char *emsg) |
202 | { | 202 | { |
203 | struct GNUNET_IDENTITY_Operation **op = cls; | 203 | struct GNUNET_IDENTITY_Operation **op = cls; |
@@ -212,16 +212,16 @@ create_finished (void *cls, | |||
212 | } | 212 | } |
213 | else if (verbose) | 213 | else if (verbose) |
214 | { | 214 | { |
215 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 215 | struct GNUNET_IDENTITY_PublicKey pub; |
216 | char *pubs; | 216 | char *pubs; |
217 | 217 | ||
218 | GNUNET_CRYPTO_ecdsa_key_get_public (pk, &pub); | 218 | GNUNET_IDENTITY_key_get_public (pk, &pub); |
219 | pubs = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pub); | 219 | pubs = GNUNET_IDENTITY_public_key_to_string (&pub); |
220 | if (private_keys) | 220 | if (private_keys) |
221 | { | 221 | { |
222 | char *privs; | 222 | char *privs; |
223 | 223 | ||
224 | privs = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk); | 224 | privs = GNUNET_IDENTITY_private_key_to_string (pk); |
225 | fprintf (stdout, "%s - %s\n", pubs, privs); | 225 | fprintf (stdout, "%s - %s\n", pubs, privs); |
226 | GNUNET_free (privs); | 226 | GNUNET_free (privs); |
227 | } | 227 | } |
@@ -293,7 +293,7 @@ print_ego (void *cls, | |||
293 | void **ctx, | 293 | void **ctx, |
294 | const char *identifier) | 294 | const char *identifier) |
295 | { | 295 | { |
296 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 296 | struct GNUNET_IDENTITY_PublicKey pk; |
297 | char *s; | 297 | char *s; |
298 | char *privs; | 298 | char *privs; |
299 | 299 | ||
@@ -342,8 +342,8 @@ print_ego (void *cls, | |||
342 | set_ego)) ) | 342 | set_ego)) ) |
343 | return; | 343 | return; |
344 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 344 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
345 | s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 345 | s = GNUNET_IDENTITY_public_key_to_string (&pk); |
346 | privs = GNUNET_CRYPTO_ecdsa_private_key_to_string ( | 346 | privs = GNUNET_IDENTITY_private_key_to_string ( |
347 | GNUNET_IDENTITY_ego_get_private_key (ego)); | 347 | GNUNET_IDENTITY_ego_get_private_key (ego)); |
348 | if ((monitor) || (NULL != identifier)) | 348 | if ((monitor) || (NULL != identifier)) |
349 | { | 349 | { |
@@ -407,11 +407,12 @@ run (void *cls, | |||
407 | strlen (privkey_ego), | 407 | strlen (privkey_ego), |
408 | &pk, | 408 | &pk, |
409 | sizeof(struct | 409 | sizeof(struct |
410 | GNUNET_CRYPTO_EcdsaPrivateKey)); | 410 | GNUNET_IDENTITY_PrivateKey)); |
411 | create_op = | 411 | create_op = |
412 | GNUNET_IDENTITY_create (sh, | 412 | GNUNET_IDENTITY_create (sh, |
413 | create_ego, | 413 | create_ego, |
414 | &pk, | 414 | &pk, |
415 | 0, //Ignored | ||
415 | &create_finished, | 416 | &create_finished, |
416 | &create_op); | 417 | &create_op); |
417 | } | 418 | } |
@@ -420,6 +421,7 @@ run (void *cls, | |||
420 | GNUNET_IDENTITY_create (sh, | 421 | GNUNET_IDENTITY_create (sh, |
421 | create_ego, | 422 | create_ego, |
422 | NULL, | 423 | NULL, |
424 | GNUNET_IDENTITY_TYPE_ECDSA, //FIXME from parameter | ||
423 | &create_finished, | 425 | &create_finished, |
424 | &create_op); | 426 | &create_op); |
425 | } | 427 | } |
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index bdacf3ba0..6cdb1c2f7 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c | |||
@@ -57,7 +57,7 @@ struct Ego | |||
57 | /** | 57 | /** |
58 | * Private key of the ego. | 58 | * Private key of the ego. |
59 | */ | 59 | */ |
60 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; | 60 | struct GNUNET_IDENTITY_PrivateKey pk; |
61 | 61 | ||
62 | /** | 62 | /** |
63 | * String identifier for the ego. | 63 | * String identifier for the ego. |
@@ -538,8 +538,8 @@ handle_get_default_message (void *cls, | |||
538 | * @return 0 if the keys are equal | 538 | * @return 0 if the keys are equal |
539 | */ | 539 | */ |
540 | static int | 540 | static int |
541 | key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, | 541 | key_cmp (const struct GNUNET_IDENTITY_PrivateKey *pk1, |
542 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) | 542 | const struct GNUNET_IDENTITY_PrivateKey *pk2) |
543 | { | 543 | { |
544 | return GNUNET_memcmp (pk1, pk2); | 544 | return GNUNET_memcmp (pk1, pk2); |
545 | } | 545 | } |
@@ -738,10 +738,10 @@ handle_create_message (void *cls, | |||
738 | send_result_code (client, 0, NULL); | 738 | send_result_code (client, 0, NULL); |
739 | fn = get_ego_filename (ego); | 739 | fn = get_ego_filename (ego); |
740 | (void) GNUNET_DISK_directory_create_for_file (fn); | 740 | (void) GNUNET_DISK_directory_create_for_file (fn); |
741 | if (sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey) != | 741 | if (sizeof(struct GNUNET_IDENTITY_PrivateKey) != |
742 | GNUNET_DISK_fn_write (fn, | 742 | GNUNET_DISK_fn_write (fn, |
743 | &crm->private_key, | 743 | &crm->private_key, |
744 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), | 744 | sizeof(struct GNUNET_IDENTITY_PrivateKey), |
745 | GNUNET_DISK_PERM_USER_READ | 745 | GNUNET_DISK_PERM_USER_READ |
746 | | GNUNET_DISK_PERM_USER_WRITE)) | 746 | | GNUNET_DISK_PERM_USER_WRITE)) |
747 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn); | 747 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn); |
@@ -1038,6 +1038,67 @@ handle_delete_message (void *cls, const struct DeleteMessage *dm) | |||
1038 | } | 1038 | } |
1039 | 1039 | ||
1040 | 1040 | ||
1041 | static int | ||
1042 | read_from_file (const char *filename, | ||
1043 | void *buf, | ||
1044 | size_t buf_size) | ||
1045 | { | ||
1046 | int fd; | ||
1047 | struct stat sb; | ||
1048 | |||
1049 | fd = open (filename, | ||
1050 | O_RDONLY); | ||
1051 | if (-1 == fd) | ||
1052 | { | ||
1053 | memset (buf, | ||
1054 | 0, | ||
1055 | buf_size); | ||
1056 | return GNUNET_SYSERR; | ||
1057 | } | ||
1058 | if (0 != fstat (fd, | ||
1059 | &sb)) | ||
1060 | { | ||
1061 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | ||
1062 | "stat", | ||
1063 | filename); | ||
1064 | GNUNET_assert (0 == close (fd)); | ||
1065 | memset (buf, | ||
1066 | 0, | ||
1067 | buf_size); | ||
1068 | return GNUNET_SYSERR; | ||
1069 | } | ||
1070 | if (sb.st_size != buf_size) | ||
1071 | { | ||
1072 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | ||
1073 | "File `%s' has wrong size (%llu), expected %llu bytes\n", | ||
1074 | filename, | ||
1075 | (unsigned long long) sb.st_size, | ||
1076 | (unsigned long long) buf_size); | ||
1077 | GNUNET_assert (0 == close (fd)); | ||
1078 | memset (buf, | ||
1079 | 0, | ||
1080 | buf_size); | ||
1081 | return GNUNET_SYSERR; | ||
1082 | } | ||
1083 | if (buf_size != | ||
1084 | read (fd, | ||
1085 | buf, | ||
1086 | buf_size)) | ||
1087 | { | ||
1088 | GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING, | ||
1089 | "read", | ||
1090 | filename); | ||
1091 | GNUNET_assert (0 == close (fd)); | ||
1092 | memset (buf, | ||
1093 | 0, | ||
1094 | buf_size); | ||
1095 | return GNUNET_SYSERR; | ||
1096 | } | ||
1097 | GNUNET_assert (0 == close (fd)); | ||
1098 | return GNUNET_OK; | ||
1099 | } | ||
1100 | |||
1101 | |||
1041 | /** | 1102 | /** |
1042 | * Process the given file from the "EGODIR". Parses the file | 1103 | * Process the given file from the "EGODIR". Parses the file |
1043 | * and creates the respective 'struct Ego' in memory. | 1104 | * and creates the respective 'struct Ego' in memory. |
@@ -1063,9 +1124,9 @@ process_ego_file (void *cls, | |||
1063 | } | 1124 | } |
1064 | ego = GNUNET_new (struct Ego); | 1125 | ego = GNUNET_new (struct Ego); |
1065 | if (GNUNET_OK != | 1126 | if (GNUNET_OK != |
1066 | GNUNET_CRYPTO_ecdsa_key_from_file (filename, | 1127 | read_from_file (filename, |
1067 | GNUNET_NO, | 1128 | &ego->pk, |
1068 | &ego->pk)) | 1129 | sizeof (ego->pk))) |
1069 | { | 1130 | { |
1070 | GNUNET_free (ego); | 1131 | GNUNET_free (ego); |
1071 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, | 1132 | GNUNET_log (GNUNET_ERROR_TYPE_WARNING, |
diff --git a/src/identity/identity.h b/src/identity/identity.h index ef638fa36..11c5883bc 100644 --- a/src/identity/identity.h +++ b/src/identity/identity.h | |||
@@ -30,6 +30,44 @@ | |||
30 | 30 | ||
31 | #include "gnunet_common.h" | 31 | #include "gnunet_common.h" |
32 | 32 | ||
33 | /** | ||
34 | * Handle for an ego. | ||
35 | */ | ||
36 | struct GNUNET_IDENTITY_Ego | ||
37 | { | ||
38 | /** | ||
39 | * Hash of the private key of this ego. | ||
40 | */ | ||
41 | struct GNUNET_HashCode id; | ||
42 | |||
43 | /** | ||
44 | * The identity key pair | ||
45 | */ | ||
46 | struct GNUNET_IDENTITY_PublicKey pub; | ||
47 | |||
48 | /** | ||
49 | * The identity key pair | ||
50 | */ | ||
51 | struct GNUNET_IDENTITY_PrivateKey pk; | ||
52 | |||
53 | /** | ||
54 | * Current name associated with this ego. | ||
55 | */ | ||
56 | char *name; | ||
57 | |||
58 | /** | ||
59 | * Client context associated with this ego. | ||
60 | */ | ||
61 | void *ctx; | ||
62 | |||
63 | /** | ||
64 | * Set to true once @e pub was initialized | ||
65 | */ | ||
66 | bool pub_initialized; | ||
67 | }; | ||
68 | |||
69 | |||
70 | |||
33 | 71 | ||
34 | GNUNET_NETWORK_STRUCT_BEGIN | 72 | GNUNET_NETWORK_STRUCT_BEGIN |
35 | 73 | ||
@@ -95,7 +133,7 @@ struct UpdateMessage | |||
95 | /** | 133 | /** |
96 | * The private key | 134 | * The private key |
97 | */ | 135 | */ |
98 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 136 | struct GNUNET_IDENTITY_PrivateKey private_key; |
99 | 137 | ||
100 | /* followed by 0-terminated ego name */ | 138 | /* followed by 0-terminated ego name */ |
101 | }; | 139 | }; |
@@ -151,7 +189,7 @@ struct SetDefaultMessage | |||
151 | /** | 189 | /** |
152 | * The private key | 190 | * The private key |
153 | */ | 191 | */ |
154 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 192 | struct GNUNET_IDENTITY_PrivateKey private_key; |
155 | 193 | ||
156 | /* followed by 0-terminated service name */ | 194 | /* followed by 0-terminated service name */ |
157 | }; | 195 | }; |
@@ -181,7 +219,7 @@ struct CreateRequestMessage | |||
181 | /** | 219 | /** |
182 | * The private key | 220 | * The private key |
183 | */ | 221 | */ |
184 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 222 | struct GNUNET_IDENTITY_PrivateKey private_key; |
185 | 223 | ||
186 | /* followed by 0-terminated identity name */ | 224 | /* followed by 0-terminated identity name */ |
187 | }; | 225 | }; |
@@ -239,42 +277,5 @@ struct DeleteMessage | |||
239 | 277 | ||
240 | GNUNET_NETWORK_STRUCT_END | 278 | GNUNET_NETWORK_STRUCT_END |
241 | 279 | ||
242 | /** | ||
243 | * Handle for an ego. | ||
244 | */ | ||
245 | struct GNUNET_IDENTITY_Ego | ||
246 | { | ||
247 | /** | ||
248 | * Hash of the private key of this ego. | ||
249 | */ | ||
250 | struct GNUNET_HashCode id; | ||
251 | |||
252 | /** | ||
253 | * Private key associated with this ego. | ||
254 | */ | ||
255 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; | ||
256 | |||
257 | /** | ||
258 | * Public key associated with this ego. Initialized on demand. | ||
259 | * Always use #GNUNET_IDENTITY_ego_get_public_key() to obtain. | ||
260 | */ | ||
261 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | ||
262 | |||
263 | /** | ||
264 | * Current name associated with this ego. | ||
265 | */ | ||
266 | char *name; | ||
267 | |||
268 | /** | ||
269 | * Client context associated with this ego. | ||
270 | */ | ||
271 | void *ctx; | ||
272 | |||
273 | /** | ||
274 | * Set to true once @e pub was initialized | ||
275 | */ | ||
276 | bool pub_initialized; | ||
277 | }; | ||
278 | |||
279 | 280 | ||
280 | #endif | 281 | #endif |
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index f7aca1655..63fa4b919 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c | |||
@@ -74,7 +74,7 @@ struct GNUNET_IDENTITY_Operation | |||
74 | /** | 74 | /** |
75 | * Private key to return to @e create_cont, or NULL. | 75 | * Private key to return to @e create_cont, or NULL. |
76 | */ | 76 | */ |
77 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; | 77 | struct GNUNET_IDENTITY_PrivateKey pk; |
78 | 78 | ||
79 | /** | 79 | /** |
80 | * Continuation to invoke with the result of the transmission for | 80 | * Continuation to invoke with the result of the transmission for |
@@ -157,13 +157,12 @@ GNUNET_IDENTITY_ego_get_anonymous () | |||
157 | { | 157 | { |
158 | static struct GNUNET_IDENTITY_Ego anon; | 158 | static struct GNUNET_IDENTITY_Ego anon; |
159 | static int setup; | 159 | static int setup; |
160 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | ||
161 | 160 | ||
162 | if (setup) | 161 | if (setup) |
163 | return &anon; | 162 | return &anon; |
164 | anon.pk = *GNUNET_CRYPTO_ecdsa_key_get_anonymous (); | 163 | anon.pk.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA); |
165 | GNUNET_CRYPTO_ecdsa_key_get_public (&anon.pk, | 164 | anon.pub.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA); |
166 | &pub); | 165 | anon.pk.ecdsa_key = *GNUNET_CRYPTO_ecdsa_key_get_anonymous (); |
167 | GNUNET_CRYPTO_hash (&anon.pk, | 166 | GNUNET_CRYPTO_hash (&anon.pk, |
168 | sizeof(anon.pk), | 167 | sizeof(anon.pk), |
169 | &anon.id); | 168 | &anon.id); |
@@ -172,6 +171,51 @@ GNUNET_IDENTITY_ego_get_anonymous () | |||
172 | } | 171 | } |
173 | 172 | ||
174 | 173 | ||
174 | enum GNUNET_GenericReturnValue | ||
175 | GNUNET_IDENTITY_key_get_public (const struct | ||
176 | GNUNET_IDENTITY_PrivateKey *privkey, | ||
177 | struct GNUNET_IDENTITY_PublicKey *key) | ||
178 | { | ||
179 | key->type = privkey->type; | ||
180 | switch (ntohl (privkey->type)) | ||
181 | { | ||
182 | case GNUNET_IDENTITY_TYPE_ECDSA: | ||
183 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey->ecdsa_key, | ||
184 | &key->ecdsa_key); | ||
185 | break; | ||
186 | case GNUNET_IDENTITY_TYPE_EDDSA: | ||
187 | GNUNET_CRYPTO_eddsa_key_get_public (&privkey->eddsa_key, | ||
188 | &key->eddsa_key); | ||
189 | break; | ||
190 | default: | ||
191 | GNUNET_break (0); | ||
192 | return GNUNET_SYSERR; | ||
193 | } | ||
194 | return GNUNET_OK; | ||
195 | } | ||
196 | |||
197 | |||
198 | static int | ||
199 | private_key_create (enum GNUNET_IDENTITY_KeyType ktype, | ||
200 | struct GNUNET_IDENTITY_PrivateKey *key) | ||
201 | { | ||
202 | key->type = htonl (ktype); | ||
203 | switch (ktype) | ||
204 | { | ||
205 | case GNUNET_IDENTITY_TYPE_ECDSA: | ||
206 | GNUNET_CRYPTO_ecdsa_key_create (&key->ecdsa_key); | ||
207 | break; | ||
208 | case GNUNET_IDENTITY_TYPE_EDDSA: | ||
209 | GNUNET_CRYPTO_eddsa_key_create (&key->eddsa_key); | ||
210 | break; | ||
211 | default: | ||
212 | GNUNET_break (0); | ||
213 | return GNUNET_SYSERR; | ||
214 | } | ||
215 | return GNUNET_OK; | ||
216 | } | ||
217 | |||
218 | |||
175 | /** | 219 | /** |
176 | * Try again to connect to the identity service. | 220 | * Try again to connect to the identity service. |
177 | * | 221 | * |
@@ -591,7 +635,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
591 | * @param ego the ego | 635 | * @param ego the ego |
592 | * @return associated ECC key, valid as long as the ego is valid | 636 | * @return associated ECC key, valid as long as the ego is valid |
593 | */ | 637 | */ |
594 | const struct GNUNET_CRYPTO_EcdsaPrivateKey * | 638 | const struct GNUNET_IDENTITY_PrivateKey * |
595 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) | 639 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) |
596 | { | 640 | { |
597 | return &ego->pk; | 641 | return &ego->pk; |
@@ -606,12 +650,11 @@ GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) | |||
606 | */ | 650 | */ |
607 | void | 651 | void |
608 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, | 652 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, |
609 | struct GNUNET_CRYPTO_EcdsaPublicKey *pk) | 653 | struct GNUNET_IDENTITY_PublicKey *pk) |
610 | { | 654 | { |
611 | if (GNUNET_NO == ego->pub_initialized) | 655 | if (GNUNET_NO == ego->pub_initialized) |
612 | { | 656 | { |
613 | GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk, | 657 | GNUNET_IDENTITY_key_get_public (&ego->pk, &ego->pub); |
614 | &ego->pub); | ||
615 | ego->pub_initialized = GNUNET_YES; | 658 | ego->pub_initialized = GNUNET_YES; |
616 | } | 659 | } |
617 | *pk = ego->pub; | 660 | *pk = ego->pub; |
@@ -710,20 +753,11 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h, | |||
710 | } | 753 | } |
711 | 754 | ||
712 | 755 | ||
713 | /** | ||
714 | * Create a new identity with the given name. | ||
715 | * | ||
716 | * @param h identity service to use | ||
717 | * @param name desired name | ||
718 | * @param privkey desired private key or NULL to create one | ||
719 | * @param cont function to call with the result (will only be called once) | ||
720 | * @param cont_cls closure for @a cont | ||
721 | * @return handle to abort the operation | ||
722 | */ | ||
723 | struct GNUNET_IDENTITY_Operation * | 756 | struct GNUNET_IDENTITY_Operation * |
724 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, | 757 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, |
725 | const char *name, | 758 | const char *name, |
726 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey, | 759 | const struct GNUNET_IDENTITY_PrivateKey *privkey, |
760 | enum GNUNET_IDENTITY_KeyType ktype, | ||
727 | GNUNET_IDENTITY_CreateContinuation cont, | 761 | GNUNET_IDENTITY_CreateContinuation cont, |
728 | void *cont_cls) | 762 | void *cont_cls) |
729 | { | 763 | { |
@@ -749,7 +783,10 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, | |||
749 | crm->name_len = htons (slen); | 783 | crm->name_len = htons (slen); |
750 | crm->reserved = htons (0); | 784 | crm->reserved = htons (0); |
751 | if (NULL == privkey) | 785 | if (NULL == privkey) |
752 | GNUNET_CRYPTO_ecdsa_key_create (&crm->private_key); | 786 | { |
787 | GNUNET_assert (GNUNET_OK == | ||
788 | private_key_create (ktype, &crm->private_key)); | ||
789 | } | ||
753 | else | 790 | else |
754 | crm->private_key = *privkey; | 791 | crm->private_key = *privkey; |
755 | op->pk = crm->private_key; | 792 | op->pk = crm->private_key; |
@@ -917,4 +954,101 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h) | |||
917 | } | 954 | } |
918 | 955 | ||
919 | 956 | ||
957 | ssize_t | ||
958 | GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key) | ||
959 | { | ||
960 | switch (ntohl (key->type)) | ||
961 | { | ||
962 | case GNUNET_IDENTITY_TYPE_ECDSA: | ||
963 | return sizeof (key->type) + sizeof (key->ecdsa_key); | ||
964 | break; | ||
965 | case GNUNET_IDENTITY_TYPE_EDDSA: | ||
966 | return sizeof (key->type) + sizeof (key->eddsa_key); | ||
967 | break; | ||
968 | default: | ||
969 | GNUNET_break (0); | ||
970 | } | ||
971 | return -1; | ||
972 | } | ||
973 | |||
974 | |||
975 | char * | ||
976 | GNUNET_IDENTITY_public_key_to_string (const struct | ||
977 | GNUNET_IDENTITY_PublicKey *key) | ||
978 | { | ||
979 | size_t size = 0; | ||
980 | char *res; | ||
981 | size = GNUNET_IDENTITY_key_get_length (key); | ||
982 | GNUNET_STRINGS_base64_encode (key, | ||
983 | size, | ||
984 | &res); | ||
985 | return res; | ||
986 | } | ||
987 | |||
988 | |||
989 | char * | ||
990 | GNUNET_IDENTITY_private_key_to_string (const struct | ||
991 | GNUNET_IDENTITY_PrivateKey *key) | ||
992 | { | ||
993 | size_t size = 0; | ||
994 | char *res; | ||
995 | size += sizeof (key->type); | ||
996 | switch (ntohl (key->type)) | ||
997 | { | ||
998 | case GNUNET_IDENTITY_TYPE_ECDSA: | ||
999 | size += sizeof (key->ecdsa_key); | ||
1000 | break; | ||
1001 | case GNUNET_IDENTITY_TYPE_EDDSA: | ||
1002 | size += sizeof (key->eddsa_key); | ||
1003 | break; | ||
1004 | } | ||
1005 | size = GNUNET_STRINGS_base64_encode (key, | ||
1006 | size, | ||
1007 | &res); | ||
1008 | return res; | ||
1009 | } | ||
1010 | |||
1011 | |||
1012 | enum GNUNET_GenericReturnValue | ||
1013 | GNUNET_IDENTITY_public_key_from_string (const char *str, | ||
1014 | struct GNUNET_IDENTITY_PublicKey *key) | ||
1015 | { | ||
1016 | char *data = NULL; | ||
1017 | size_t size; | ||
1018 | |||
1019 | size = GNUNET_STRINGS_base64_decode (str, | ||
1020 | strlen (str), | ||
1021 | (void*) &data); | ||
1022 | if ((NULL == data) || | ||
1023 | (size > sizeof (*key))) | ||
1024 | { | ||
1025 | GNUNET_free (data); | ||
1026 | return GNUNET_SYSERR; | ||
1027 | } | ||
1028 | memcpy (key, data, size); | ||
1029 | return GNUNET_OK; | ||
1030 | } | ||
1031 | |||
1032 | |||
1033 | enum GNUNET_GenericReturnValue | ||
1034 | GNUNET_IDENTITY_private_key_from_string (const char *str, | ||
1035 | struct GNUNET_IDENTITY_PrivateKey *key) | ||
1036 | { | ||
1037 | char *data = NULL; | ||
1038 | size_t size; | ||
1039 | |||
1040 | size = GNUNET_STRINGS_base64_decode (str, | ||
1041 | strlen (str), | ||
1042 | (void*) &data); | ||
1043 | if ((NULL == data) || | ||
1044 | (size > sizeof (*key))) | ||
1045 | { | ||
1046 | GNUNET_free (data); | ||
1047 | return GNUNET_SYSERR; | ||
1048 | } | ||
1049 | memcpy (key, data, size); | ||
1050 | return GNUNET_OK; | ||
1051 | } | ||
1052 | |||
1053 | |||
920 | /* end of identity_api.c */ | 1054 | /* end of identity_api.c */ |
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c index 26b1eacd7..51afb2515 100644 --- a/src/identity/identity_api_lookup.c +++ b/src/identity/identity_api_lookup.c | |||
@@ -127,14 +127,12 @@ handle_identity_update (void *cls, const struct UpdateMessage *um) | |||
127 | struct GNUNET_IDENTITY_EgoLookup *el = cls; | 127 | struct GNUNET_IDENTITY_EgoLookup *el = cls; |
128 | uint16_t name_len = ntohs (um->name_len); | 128 | uint16_t name_len = ntohs (um->name_len); |
129 | const char *str = (0 == name_len) ? NULL : (const char *) &um[1]; | 129 | const char *str = (0 == name_len) ? NULL : (const char *) &um[1]; |
130 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | ||
131 | struct GNUNET_HashCode id; | 130 | struct GNUNET_HashCode id; |
132 | struct GNUNET_IDENTITY_Ego ego; | 131 | struct GNUNET_IDENTITY_Ego ego; |
133 | memset (&ego, 0, sizeof (ego)); | 132 | memset (&ego, 0, sizeof (ego)); |
134 | 133 | ||
135 | GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); | 134 | GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); |
136 | GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); | 135 | GNUNET_CRYPTO_hash (&um->private_key, sizeof(um->private_key), &id); |
137 | GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id); | ||
138 | ego.pk = um->private_key; | 136 | ego.pk = um->private_key; |
139 | ego.name = (char *) str; | 137 | ego.name = (char *) str; |
140 | ego.id = id; | 138 | ego.id = id; |
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c index d86d29e36..dba1d478d 100644 --- a/src/identity/plugin_rest_identity.c +++ b/src/identity/plugin_rest_identity.c | |||
@@ -384,7 +384,7 @@ ego_get_for_subsystem (void *cls, | |||
384 | { | 384 | { |
385 | struct RequestHandle *handle = cls; | 385 | struct RequestHandle *handle = cls; |
386 | struct MHD_Response *resp; | 386 | struct MHD_Response *resp; |
387 | struct GNUNET_CRYPTO_EcdsaPublicKey public_key; | 387 | struct GNUNET_IDENTITY_PublicKey public_key; |
388 | json_t *json_root; | 388 | json_t *json_root; |
389 | char *result_str; | 389 | char *result_str; |
390 | char *public_key_string; | 390 | char *public_key_string; |
@@ -398,7 +398,7 @@ ego_get_for_subsystem (void *cls, | |||
398 | } | 398 | } |
399 | 399 | ||
400 | GNUNET_IDENTITY_ego_get_public_key (ego, &public_key); | 400 | GNUNET_IDENTITY_ego_get_public_key (ego, &public_key); |
401 | public_key_string = GNUNET_CRYPTO_ecdsa_public_key_to_string (&public_key); | 401 | public_key_string = GNUNET_IDENTITY_public_key_to_string (&public_key); |
402 | 402 | ||
403 | // create json with subsystem identity | 403 | // create json with subsystem identity |
404 | json_root = json_object (); | 404 | json_root = json_object (); |
@@ -496,7 +496,7 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle, | |||
496 | GNUNET_CONTAINER_multihashmap_contains ( | 496 | GNUNET_CONTAINER_multihashmap_contains ( |
497 | handle->rest_handle->url_param_map, &key)) | 497 | handle->rest_handle->url_param_map, &key)) |
498 | { | 498 | { |
499 | privkey_str = GNUNET_CRYPTO_ecdsa_private_key_to_string ( | 499 | privkey_str = GNUNET_IDENTITY_private_key_to_string ( |
500 | GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); | 500 | GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); |
501 | json_object_set_new (json_ego, | 501 | json_object_set_new (json_ego, |
502 | GNUNET_REST_IDENTITY_PARAM_PRIVKEY, | 502 | GNUNET_REST_IDENTITY_PARAM_PRIVKEY, |
@@ -549,7 +549,7 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry) | |||
549 | GNUNET_CONTAINER_multihashmap_contains ( | 549 | GNUNET_CONTAINER_multihashmap_contains ( |
550 | handle->rest_handle->url_param_map, &key)) | 550 | handle->rest_handle->url_param_map, &key)) |
551 | { | 551 | { |
552 | privkey_str = GNUNET_CRYPTO_ecdsa_private_key_to_string ( | 552 | privkey_str = GNUNET_IDENTITY_private_key_to_string ( |
553 | GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); | 553 | GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); |
554 | json_object_set_new (json_ego, | 554 | json_object_set_new (json_ego, |
555 | GNUNET_REST_IDENTITY_PARAM_PRIVKEY, | 555 | GNUNET_REST_IDENTITY_PARAM_PRIVKEY, |
@@ -686,7 +686,7 @@ do_finished (void *cls, const char *emsg) | |||
686 | */ | 686 | */ |
687 | static void | 687 | static void |
688 | do_finished_create (void *cls, | 688 | do_finished_create (void *cls, |
689 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 689 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
690 | const char *emsg) | 690 | const char *emsg) |
691 | { | 691 | { |
692 | struct RequestHandle *handle = cls; | 692 | struct RequestHandle *handle = cls; |
@@ -999,8 +999,8 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle, | |||
999 | json_error_t err; | 999 | json_error_t err; |
1000 | char *egoname; | 1000 | char *egoname; |
1001 | char *privkey; | 1001 | char *privkey; |
1002 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; | 1002 | struct GNUNET_IDENTITY_PrivateKey pk; |
1003 | struct GNUNET_CRYPTO_EcdsaPrivateKey *pk_ptr; | 1003 | struct GNUNET_IDENTITY_PrivateKey *pk_ptr; |
1004 | int json_unpack_state; | 1004 | int json_unpack_state; |
1005 | char term_data[handle->data_size + 1]; | 1005 | char term_data[handle->data_size + 1]; |
1006 | 1006 | ||
@@ -1074,7 +1074,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle, | |||
1074 | strlen (privkey), | 1074 | strlen (privkey), |
1075 | &pk, | 1075 | &pk, |
1076 | sizeof(struct | 1076 | sizeof(struct |
1077 | GNUNET_CRYPTO_EcdsaPrivateKey)); | 1077 | GNUNET_IDENTITY_PrivateKey)); |
1078 | pk_ptr = &pk; | 1078 | pk_ptr = &pk; |
1079 | } | 1079 | } |
1080 | else | 1080 | else |
@@ -1084,6 +1084,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle, | |||
1084 | handle->op = GNUNET_IDENTITY_create (identity_handle, | 1084 | handle->op = GNUNET_IDENTITY_create (identity_handle, |
1085 | handle->name, | 1085 | handle->name, |
1086 | pk_ptr, | 1086 | pk_ptr, |
1087 | GNUNET_IDENTITY_TYPE_ECDSA, | ||
1087 | &do_finished_create, | 1088 | &do_finished_create, |
1088 | handle); | 1089 | handle); |
1089 | } | 1090 | } |
@@ -1208,7 +1209,7 @@ list_ego (void *cls, | |||
1208 | const char *identifier) | 1209 | const char *identifier) |
1209 | { | 1210 | { |
1210 | struct EgoEntry *ego_entry; | 1211 | struct EgoEntry *ego_entry; |
1211 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 1212 | struct GNUNET_IDENTITY_PublicKey pk; |
1212 | 1213 | ||
1213 | if ((NULL == ego) && (ID_REST_STATE_INIT == state)) | 1214 | if ((NULL == ego) && (ID_REST_STATE_INIT == state)) |
1214 | { | 1215 | { |
@@ -1219,7 +1220,7 @@ list_ego (void *cls, | |||
1219 | { | 1220 | { |
1220 | ego_entry = GNUNET_new (struct EgoEntry); | 1221 | ego_entry = GNUNET_new (struct EgoEntry); |
1221 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 1222 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
1222 | ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 1223 | ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk); |
1223 | ego_entry->ego = ego; | 1224 | ego_entry->ego = ego; |
1224 | ego_entry->identifier = GNUNET_strdup (identifier); | 1225 | ego_entry->identifier = GNUNET_strdup (identifier); |
1225 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, | 1226 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, |
@@ -1245,7 +1246,7 @@ list_ego (void *cls, | |||
1245 | /* Add */ | 1246 | /* Add */ |
1246 | ego_entry = GNUNET_new (struct EgoEntry); | 1247 | ego_entry = GNUNET_new (struct EgoEntry); |
1247 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 1248 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
1248 | ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 1249 | ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk); |
1249 | ego_entry->ego = ego; | 1250 | ego_entry->ego = ego; |
1250 | ego_entry->identifier = GNUNET_strdup (identifier); | 1251 | ego_entry->identifier = GNUNET_strdup (identifier); |
1251 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, | 1252 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, |
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c index 37eeab238..4954fe7be 100644 --- a/src/identity/test_identity.c +++ b/src/identity/test_identity.c | |||
@@ -253,7 +253,7 @@ success_rename_cont (void *cls, const char *emsg) | |||
253 | */ | 253 | */ |
254 | static void | 254 | static void |
255 | create_cb (void *cls, | 255 | create_cb (void *cls, |
256 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 256 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
257 | const char *emsg) | 257 | const char *emsg) |
258 | { | 258 | { |
259 | CHECK (NULL != pk); | 259 | CHECK (NULL != pk); |
@@ -279,7 +279,11 @@ run (void *cls, | |||
279 | GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); | 279 | GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); |
280 | h = GNUNET_IDENTITY_connect (cfg, ¬ification_cb, NULL); | 280 | h = GNUNET_IDENTITY_connect (cfg, ¬ification_cb, NULL); |
281 | CHECK (NULL != h); | 281 | CHECK (NULL != h); |
282 | op = GNUNET_IDENTITY_create (h, "test-id", NULL, &create_cb, NULL); | 282 | op = GNUNET_IDENTITY_create (h, |
283 | "test-id", | ||
284 | NULL, | ||
285 | GNUNET_IDENTITY_TYPE_ECDSA, | ||
286 | &create_cb, NULL); | ||
283 | } | 287 | } |
284 | 288 | ||
285 | 289 | ||
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c index 53eec1252..2d5244d1b 100644 --- a/src/identity/test_identity_defaults.c +++ b/src/identity/test_identity_defaults.c | |||
@@ -241,7 +241,7 @@ notification_cb (void *cls, | |||
241 | */ | 241 | */ |
242 | static void | 242 | static void |
243 | create_cb (void *cls, | 243 | create_cb (void *cls, |
244 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 244 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
245 | const char *emsg) | 245 | const char *emsg) |
246 | { | 246 | { |
247 | CHECK (NULL == emsg); | 247 | CHECK (NULL == emsg); |
@@ -266,7 +266,11 @@ run_set (void *cls, | |||
266 | GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); | 266 | GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); |
267 | h = GNUNET_IDENTITY_connect (cfg, ¬ification_cb, NULL); | 267 | h = GNUNET_IDENTITY_connect (cfg, ¬ification_cb, NULL); |
268 | CHECK (NULL != h); | 268 | CHECK (NULL != h); |
269 | op = GNUNET_IDENTITY_create (h, "test-id", NULL, &create_cb, NULL); | 269 | op = GNUNET_IDENTITY_create (h, |
270 | "test-id", | ||
271 | NULL, | ||
272 | GNUNET_IDENTITY_TYPE_ECDSA, | ||
273 | &create_cb, NULL); | ||
270 | } | 274 | } |
271 | 275 | ||
272 | 276 | ||
diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index ef81e9a88..3f6c9b9aa 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h | |||
@@ -36,6 +36,7 @@ | |||
36 | 36 | ||
37 | #include "gnunet_util_lib.h" | 37 | #include "gnunet_util_lib.h" |
38 | #include "gnunet_dnsparser_lib.h" | 38 | #include "gnunet_dnsparser_lib.h" |
39 | #include "gnunet_identity_service.h" | ||
39 | #include "gnunet_namestore_service.h" | 40 | #include "gnunet_namestore_service.h" |
40 | 41 | ||
41 | #ifdef __cplusplus | 42 | #ifdef __cplusplus |
@@ -139,7 +140,7 @@ enum GNUNET_GNS_LocalOptions | |||
139 | struct GNUNET_GNS_LookupRequest * | 140 | struct GNUNET_GNS_LookupRequest * |
140 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | 141 | GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, |
141 | const char *name, | 142 | const char *name, |
142 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 143 | const struct GNUNET_IDENTITY_PublicKey *zone, |
143 | uint32_t type, | 144 | uint32_t type, |
144 | enum GNUNET_GNS_LocalOptions options, | 145 | enum GNUNET_GNS_LocalOptions options, |
145 | GNUNET_GNS_LookupResultProcessor proc, | 146 | GNUNET_GNS_LookupResultProcessor proc, |
@@ -163,7 +164,7 @@ GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, | |||
163 | struct GNUNET_GNS_LookupRequest * | 164 | struct GNUNET_GNS_LookupRequest * |
164 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, | 165 | GNUNET_GNS_lookup_limited (struct GNUNET_GNS_Handle *handle, |
165 | const char *name, | 166 | const char *name, |
166 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, | 167 | const struct GNUNET_IDENTITY_PublicKey *zone, |
167 | uint32_t type, | 168 | uint32_t type, |
168 | enum GNUNET_GNS_LocalOptions options, | 169 | enum GNUNET_GNS_LocalOptions options, |
169 | uint16_t recursion_depth_limit, | 170 | uint16_t recursion_depth_limit, |
diff --git a/src/include/gnunet_gnsrecord_lib.h b/src/include/gnunet_gnsrecord_lib.h index 960203fb1..6124b2925 100644 --- a/src/include/gnunet_gnsrecord_lib.h +++ b/src/include/gnunet_gnsrecord_lib.h | |||
@@ -34,6 +34,8 @@ | |||
34 | #ifndef GNUNET_GNSRECORD_LIB_H | 34 | #ifndef GNUNET_GNSRECORD_LIB_H |
35 | #define GNUNET_GNSRECORD_LIB_H | 35 | #define GNUNET_GNSRECORD_LIB_H |
36 | 36 | ||
37 | #include "gnunet_identity_service.h" | ||
38 | |||
37 | #ifdef __cplusplus | 39 | #ifdef __cplusplus |
38 | extern "C" { | 40 | extern "C" { |
39 | #if 0 /* keep Emacsens' auto-indent happy */ | 41 | #if 0 /* keep Emacsens' auto-indent happy */ |
@@ -55,7 +57,7 @@ extern "C" { | |||
55 | /** | 57 | /** |
56 | * Record type for GNS zone transfer ("PKEY"). | 58 | * Record type for GNS zone transfer ("PKEY"). |
57 | */ | 59 | */ |
58 | #define GNUNET_GNSRECORD_TYPE_PKEY 65536 | 60 | #define GNUNET_GNSRECORD_TYPE_PKEY GNUNET_IDENTITY_TYPE_ECDSA |
59 | 61 | ||
60 | /** | 62 | /** |
61 | * Record type for GNS nick names ("NICK"). | 63 | * Record type for GNS nick names ("NICK"). |
@@ -275,7 +277,7 @@ struct GNUNET_GNSRECORD_Block | |||
275 | /** | 277 | /** |
276 | * Derived key used for signing; hash of this is the query. | 278 | * Derived key used for signing; hash of this is the query. |
277 | */ | 279 | */ |
278 | struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; | 280 | struct GNUNET_IDENTITY_PublicKey derived_key; |
279 | 281 | ||
280 | /** | 282 | /** |
281 | * Number of bytes signed; also specifies the number of bytes | 283 | * Number of bytes signed; also specifies the number of bytes |
@@ -335,7 +337,7 @@ struct GNUNET_GNSRECORD_ReverseRecord | |||
335 | /** | 337 | /** |
336 | * The public key of the namespace the is delegating to our namespace | 338 | * The public key of the namespace the is delegating to our namespace |
337 | */ | 339 | */ |
338 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 340 | struct GNUNET_IDENTITY_PublicKey pkey; |
339 | 341 | ||
340 | /** | 342 | /** |
341 | * The expiration time of the delegation | 343 | * The expiration time of the delegation |
@@ -488,7 +490,7 @@ GNUNET_GNSRECORD_string_to_lowercase (const char *src); | |||
488 | * #GNUNET_GNSRECORD_z2s. | 490 | * #GNUNET_GNSRECORD_z2s. |
489 | */ | 491 | */ |
490 | const char * | 492 | const char * |
491 | GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); | 493 | GNUNET_GNSRECORD_z2s (const struct GNUNET_IDENTITY_PublicKey *z); |
492 | 494 | ||
493 | 495 | ||
494 | /** | 496 | /** |
@@ -502,7 +504,7 @@ GNUNET_GNSRECORD_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); | |||
502 | * key in an encoding suitable for DNS labels. | 504 | * key in an encoding suitable for DNS labels. |
503 | */ | 505 | */ |
504 | const char * | 506 | const char * |
505 | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 507 | GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_IDENTITY_PublicKey *pkey); |
506 | 508 | ||
507 | 509 | ||
508 | /** | 510 | /** |
@@ -516,7 +518,7 @@ GNUNET_GNSRECORD_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | |||
516 | */ | 518 | */ |
517 | int | 519 | int |
518 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | 520 | GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, |
519 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); | 521 | struct GNUNET_IDENTITY_PublicKey *pkey); |
520 | 522 | ||
521 | 523 | ||
522 | /** | 524 | /** |
@@ -528,7 +530,7 @@ GNUNET_GNSRECORD_zkey_to_pkey (const char *zkey, | |||
528 | */ | 530 | */ |
529 | void | 531 | void |
530 | GNUNET_GNSRECORD_query_from_private_key ( | 532 | GNUNET_GNSRECORD_query_from_private_key ( |
531 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, | 533 | const struct GNUNET_IDENTITY_PrivateKey *zone, const char *label, |
532 | struct GNUNET_HashCode *query); | 534 | struct GNUNET_HashCode *query); |
533 | 535 | ||
534 | 536 | ||
@@ -541,7 +543,7 @@ GNUNET_GNSRECORD_query_from_private_key ( | |||
541 | */ | 543 | */ |
542 | void | 544 | void |
543 | GNUNET_GNSRECORD_query_from_public_key ( | 545 | GNUNET_GNSRECORD_query_from_public_key ( |
544 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, | 546 | const struct GNUNET_IDENTITY_PublicKey *pub, const char *label, |
545 | struct GNUNET_HashCode *query); | 547 | struct GNUNET_HashCode *query); |
546 | 548 | ||
547 | 549 | ||
@@ -555,7 +557,7 @@ GNUNET_GNSRECORD_query_from_public_key ( | |||
555 | * @param rd_count number of records in @a rd | 557 | * @param rd_count number of records in @a rd |
556 | */ | 558 | */ |
557 | struct GNUNET_GNSRECORD_Block * | 559 | struct GNUNET_GNSRECORD_Block * |
558 | GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 560 | GNUNET_GNSRECORD_block_create (const struct GNUNET_IDENTITY_PrivateKey *key, |
559 | struct GNUNET_TIME_Absolute expire, | 561 | struct GNUNET_TIME_Absolute expire, |
560 | const char *label, | 562 | const char *label, |
561 | const struct GNUNET_GNSRECORD_Data *rd, | 563 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -574,7 +576,7 @@ GNUNET_GNSRECORD_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
574 | * @param rd_count number of records in @a rd | 576 | * @param rd_count number of records in @a rd |
575 | */ | 577 | */ |
576 | struct GNUNET_GNSRECORD_Block * | 578 | struct GNUNET_GNSRECORD_Block * |
577 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 579 | GNUNET_GNSRECORD_block_create2 (const struct GNUNET_IDENTITY_PrivateKey *key, |
578 | struct GNUNET_TIME_Absolute expire, | 580 | struct GNUNET_TIME_Absolute expire, |
579 | const char *label, | 581 | const char *label, |
580 | const struct GNUNET_GNSRECORD_Data *rd, | 582 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -606,7 +608,7 @@ GNUNET_GNSRECORD_block_verify (const struct GNUNET_GNSRECORD_Block *block); | |||
606 | int | 608 | int |
607 | GNUNET_GNSRECORD_block_decrypt ( | 609 | GNUNET_GNSRECORD_block_decrypt ( |
608 | const struct GNUNET_GNSRECORD_Block *block, | 610 | const struct GNUNET_GNSRECORD_Block *block, |
609 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, | 611 | const struct GNUNET_IDENTITY_PublicKey *zone_key, const char *label, |
610 | GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); | 612 | GNUNET_GNSRECORD_RecordCallback proc, void *proc_cls); |
611 | 613 | ||
612 | 614 | ||
diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 94127248e..c72e6d146 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h | |||
@@ -57,6 +57,21 @@ extern "C" { | |||
57 | */ | 57 | */ |
58 | #define GNUNET_IDENTITY_VERSION 0x00000100 | 58 | #define GNUNET_IDENTITY_VERSION 0x00000100 |
59 | 59 | ||
60 | enum GNUNET_IDENTITY_KeyType | ||
61 | { | ||
62 | /** | ||
63 | * The identity type. The value is the same as the | ||
64 | * PKEY record type. | ||
65 | */ | ||
66 | GNUNET_IDENTITY_TYPE_ECDSA = 65536, | ||
67 | |||
68 | /** | ||
69 | * EDDSA identity. The value is the same as the EDKEY | ||
70 | * record type. | ||
71 | */ | ||
72 | GNUNET_IDENTITY_TYPE_EDDSA = 65599 // FIXME | ||
73 | }; | ||
74 | |||
60 | /** | 75 | /** |
61 | * Handle to access the identity service. | 76 | * Handle to access the identity service. |
62 | */ | 77 | */ |
@@ -67,6 +82,61 @@ struct GNUNET_IDENTITY_Handle; | |||
67 | */ | 82 | */ |
68 | struct GNUNET_IDENTITY_Ego; | 83 | struct GNUNET_IDENTITY_Ego; |
69 | 84 | ||
85 | |||
86 | /** | ||
87 | * A private key for an identity as per LSD0001. | ||
88 | */ | ||
89 | struct GNUNET_IDENTITY_PrivateKey | ||
90 | { | ||
91 | /** | ||
92 | * Type of public key. | ||
93 | * Defined by the GNS zone type value. | ||
94 | * In NBO. | ||
95 | */ | ||
96 | uint32_t type; | ||
97 | |||
98 | union | ||
99 | { | ||
100 | /** | ||
101 | * An ECDSA identity key. | ||
102 | */ | ||
103 | struct GNUNET_CRYPTO_EcdsaPrivateKey ecdsa_key; | ||
104 | |||
105 | /** | ||
106 | * AN EdDSA identtiy key | ||
107 | */ | ||
108 | struct GNUNET_CRYPTO_EddsaPrivateKey eddsa_key; | ||
109 | }; | ||
110 | }; | ||
111 | |||
112 | |||
113 | /** | ||
114 | * An identity key as per LSD0001. | ||
115 | */ | ||
116 | struct GNUNET_IDENTITY_PublicKey | ||
117 | { | ||
118 | /** | ||
119 | * Type of public key. | ||
120 | * Defined by the GNS zone type value. | ||
121 | * In NBO. | ||
122 | */ | ||
123 | uint32_t type; | ||
124 | |||
125 | union | ||
126 | { | ||
127 | /** | ||
128 | * An ECDSA identity key. | ||
129 | */ | ||
130 | struct GNUNET_CRYPTO_EcdsaPublicKey ecdsa_key; | ||
131 | |||
132 | /** | ||
133 | * AN EdDSA identtiy key | ||
134 | */ | ||
135 | struct GNUNET_CRYPTO_EddsaPublicKey eddsa_key; | ||
136 | }; | ||
137 | }; | ||
138 | |||
139 | |||
70 | /** | 140 | /** |
71 | * Handle for an operation with the identity service. | 141 | * Handle for an operation with the identity service. |
72 | */ | 142 | */ |
@@ -79,7 +149,7 @@ struct GNUNET_IDENTITY_Operation; | |||
79 | * @param ego the ego | 149 | * @param ego the ego |
80 | * @return associated ECC key, valid as long as the ego is valid | 150 | * @return associated ECC key, valid as long as the ego is valid |
81 | */ | 151 | */ |
82 | const struct GNUNET_CRYPTO_EcdsaPrivateKey * | 152 | const struct GNUNET_IDENTITY_PrivateKey * |
83 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); | 153 | GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); |
84 | 154 | ||
85 | 155 | ||
@@ -100,7 +170,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void); | |||
100 | */ | 170 | */ |
101 | void | 171 | void |
102 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, | 172 | GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, |
103 | struct GNUNET_CRYPTO_EcdsaPublicKey *pk); | 173 | struct GNUNET_IDENTITY_PublicKey *pk); |
104 | 174 | ||
105 | 175 | ||
106 | /** | 176 | /** |
@@ -224,7 +294,7 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h); | |||
224 | typedef void | 294 | typedef void |
225 | (*GNUNET_IDENTITY_CreateContinuation) ( | 295 | (*GNUNET_IDENTITY_CreateContinuation) ( |
226 | void *cls, | 296 | void *cls, |
227 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 297 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
228 | const char *emsg); | 298 | const char *emsg); |
229 | 299 | ||
230 | 300 | ||
@@ -234,6 +304,7 @@ typedef void | |||
234 | * @param id identity service to use | 304 | * @param id identity service to use |
235 | * @param name desired name | 305 | * @param name desired name |
236 | * @param privkey desired private key or NULL to create one | 306 | * @param privkey desired private key or NULL to create one |
307 | * @param ktype the type of key to create. Ignored if privkey != NULL. | ||
237 | * @param cont function to call with the result (will only be called once) | 308 | * @param cont function to call with the result (will only be called once) |
238 | * @param cont_cls closure for @a cont | 309 | * @param cont_cls closure for @a cont |
239 | * @return handle to abort the operation | 310 | * @return handle to abort the operation |
@@ -241,7 +312,8 @@ typedef void | |||
241 | struct GNUNET_IDENTITY_Operation * | 312 | struct GNUNET_IDENTITY_Operation * |
242 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, | 313 | GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, |
243 | const char *name, | 314 | const char *name, |
244 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey, | 315 | const struct GNUNET_IDENTITY_PrivateKey *privkey, |
316 | enum GNUNET_IDENTITY_KeyType ktype, | ||
245 | GNUNET_IDENTITY_CreateContinuation cont, | 317 | GNUNET_IDENTITY_CreateContinuation cont, |
246 | void *cont_cls); | 318 | void *cont_cls); |
247 | 319 | ||
@@ -291,6 +363,31 @@ GNUNET_IDENTITY_delete (struct GNUNET_IDENTITY_Handle *id, | |||
291 | void | 363 | void |
292 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); | 364 | GNUNET_IDENTITY_cancel (struct GNUNET_IDENTITY_Operation *op); |
293 | 365 | ||
366 | ssize_t | ||
367 | GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key); | ||
368 | |||
369 | char * | ||
370 | GNUNET_IDENTITY_public_key_to_string (const struct | ||
371 | GNUNET_IDENTITY_PublicKey *key); | ||
372 | |||
373 | |||
374 | char * | ||
375 | GNUNET_IDENTITY_private_key_to_string (const struct | ||
376 | GNUNET_IDENTITY_PrivateKey *key); | ||
377 | |||
378 | |||
379 | enum GNUNET_GenericReturnValue | ||
380 | GNUNET_IDENTITY_public_key_from_string (const char*str, | ||
381 | struct GNUNET_IDENTITY_PublicKey *key); | ||
382 | |||
383 | enum GNUNET_GenericReturnValue | ||
384 | GNUNET_IDENTITY_private_key_from_string (const char*str, | ||
385 | struct GNUNET_IDENTITY_PrivateKey *key); | ||
386 | |||
387 | enum GNUNET_GenericReturnValue | ||
388 | GNUNET_IDENTITY_key_get_public (const struct GNUNET_IDENTITY_PrivateKey *privkey, | ||
389 | struct GNUNET_IDENTITY_PublicKey *key); | ||
390 | |||
294 | 391 | ||
295 | /* ************* convenience API to lookup an ego ***************** */ | 392 | /* ************* convenience API to lookup an ego ***************** */ |
296 | 393 | ||
@@ -344,7 +441,7 @@ GNUNET_IDENTITY_ego_lookup_cancel (struct GNUNET_IDENTITY_EgoLookup *el); | |||
344 | typedef void | 441 | typedef void |
345 | (*GNUNET_IDENTITY_EgoSuffixCallback) ( | 442 | (*GNUNET_IDENTITY_EgoSuffixCallback) ( |
346 | void *cls, | 443 | void *cls, |
347 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, | 444 | const struct GNUNET_IDENTITY_PrivateKey *priv, |
348 | const char *ego_name); | 445 | const char *ego_name); |
349 | 446 | ||
350 | 447 | ||
diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index 443c9e451..9cc8abc6e 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h | |||
@@ -58,7 +58,7 @@ typedef void | |||
58 | (*GNUNET_NAMESTORE_RecordIterator) (void *cls, | 58 | (*GNUNET_NAMESTORE_RecordIterator) (void *cls, |
59 | uint64_t serial, | 59 | uint64_t serial, |
60 | const struct | 60 | const struct |
61 | GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 61 | GNUNET_IDENTITY_PrivateKey *private_key, |
62 | const char *label, | 62 | const char *label, |
63 | unsigned int rd_count, | 63 | unsigned int rd_count, |
64 | const struct GNUNET_GNSRECORD_Data *rd); | 64 | const struct GNUNET_GNSRECORD_Data *rd); |
@@ -87,7 +87,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
87 | */ | 87 | */ |
88 | int | 88 | int |
89 | (*store_records) (void *cls, | 89 | (*store_records) (void *cls, |
90 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 90 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
91 | const char *label, | 91 | const char *label, |
92 | unsigned int rd_count, | 92 | unsigned int rd_count, |
93 | const struct GNUNET_GNSRECORD_Data *rd); | 93 | const struct GNUNET_GNSRECORD_Data *rd); |
@@ -104,7 +104,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
104 | */ | 104 | */ |
105 | int | 105 | int |
106 | (*lookup_records) (void *cls, | 106 | (*lookup_records) (void *cls, |
107 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 107 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
108 | const char *label, | 108 | const char *label, |
109 | GNUNET_NAMESTORE_RecordIterator iter, | 109 | GNUNET_NAMESTORE_RecordIterator iter, |
110 | void *iter_cls); | 110 | void *iter_cls); |
@@ -126,7 +126,7 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
126 | */ | 126 | */ |
127 | int | 127 | int |
128 | (*iterate_records) (void *cls, | 128 | (*iterate_records) (void *cls, |
129 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 129 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
130 | uint64_t serial, | 130 | uint64_t serial, |
131 | uint64_t limit, | 131 | uint64_t limit, |
132 | GNUNET_NAMESTORE_RecordIterator iter, | 132 | GNUNET_NAMESTORE_RecordIterator iter, |
@@ -146,8 +146,8 @@ struct GNUNET_NAMESTORE_PluginFunctions | |||
146 | */ | 146 | */ |
147 | int | 147 | int |
148 | (*zone_to_name) (void *cls, | 148 | (*zone_to_name) (void *cls, |
149 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 149 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
150 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 150 | const struct GNUNET_IDENTITY_PublicKey *value_zone, |
151 | GNUNET_NAMESTORE_RecordIterator iter, | 151 | GNUNET_NAMESTORE_RecordIterator iter, |
152 | void *iter_cls); | 152 | void *iter_cls); |
153 | }; | 153 | }; |
diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index bf42c8d34..ca4d2cb52 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h | |||
@@ -41,6 +41,7 @@ | |||
41 | #include "gnunet_util_lib.h" | 41 | #include "gnunet_util_lib.h" |
42 | #include "gnunet_block_lib.h" | 42 | #include "gnunet_block_lib.h" |
43 | #include "gnunet_gnsrecord_lib.h" | 43 | #include "gnunet_gnsrecord_lib.h" |
44 | #include "gnunet_identity_service.h" | ||
44 | 45 | ||
45 | #ifdef __cplusplus | 46 | #ifdef __cplusplus |
46 | extern "C" | 47 | extern "C" |
@@ -127,7 +128,7 @@ typedef void | |||
127 | struct GNUNET_NAMESTORE_QueueEntry * | 128 | struct GNUNET_NAMESTORE_QueueEntry * |
128 | GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, | 129 | GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, |
129 | const struct | 130 | const struct |
130 | GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 131 | GNUNET_IDENTITY_PrivateKey *pkey, |
131 | const char *label, | 132 | const char *label, |
132 | unsigned int rd_count, | 133 | unsigned int rd_count, |
133 | const struct GNUNET_GNSRECORD_Data *rd, | 134 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -147,7 +148,7 @@ GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, | |||
147 | typedef void | 148 | typedef void |
148 | (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, | 149 | (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, |
149 | const struct | 150 | const struct |
150 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 151 | GNUNET_IDENTITY_PrivateKey *zone, |
151 | const char *label, | 152 | const char *label, |
152 | unsigned int rd_count, | 153 | unsigned int rd_count, |
153 | const struct GNUNET_GNSRECORD_Data *rd); | 154 | const struct GNUNET_GNSRECORD_Data *rd); |
@@ -170,7 +171,7 @@ typedef void | |||
170 | struct GNUNET_NAMESTORE_QueueEntry * | 171 | struct GNUNET_NAMESTORE_QueueEntry * |
171 | GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, | 172 | GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, |
172 | const struct | 173 | const struct |
173 | GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 174 | GNUNET_IDENTITY_PrivateKey *pkey, |
174 | const char *label, | 175 | const char *label, |
175 | GNUNET_SCHEDULER_TaskCallback error_cb, | 176 | GNUNET_SCHEDULER_TaskCallback error_cb, |
176 | void *error_cb_cls, | 177 | void *error_cb_cls, |
@@ -197,9 +198,9 @@ GNUNET_NAMESTORE_records_lookup (struct GNUNET_NAMESTORE_Handle *h, | |||
197 | */ | 198 | */ |
198 | struct GNUNET_NAMESTORE_QueueEntry * | 199 | struct GNUNET_NAMESTORE_QueueEntry * |
199 | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, | 200 | GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, |
200 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 201 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
201 | const struct | 202 | const struct |
202 | GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 203 | GNUNET_IDENTITY_PublicKey *value_zone, |
203 | GNUNET_SCHEDULER_TaskCallback error_cb, | 204 | GNUNET_SCHEDULER_TaskCallback error_cb, |
204 | void *error_cb_cls, | 205 | void *error_cb_cls, |
205 | GNUNET_NAMESTORE_RecordMonitor proc, | 206 | GNUNET_NAMESTORE_RecordMonitor proc, |
@@ -246,7 +247,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); | |||
246 | struct GNUNET_NAMESTORE_ZoneIterator * | 247 | struct GNUNET_NAMESTORE_ZoneIterator * |
247 | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, | 248 | GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, |
248 | const struct | 249 | const struct |
249 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 250 | GNUNET_IDENTITY_PrivateKey *zone, |
250 | GNUNET_SCHEDULER_TaskCallback error_cb, | 251 | GNUNET_SCHEDULER_TaskCallback error_cb, |
251 | void *error_cb_cls, | 252 | void *error_cb_cls, |
252 | GNUNET_NAMESTORE_RecordMonitor proc, | 253 | GNUNET_NAMESTORE_RecordMonitor proc, |
@@ -316,7 +317,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor * | |||
316 | GNUNET_NAMESTORE_zone_monitor_start (const struct | 317 | GNUNET_NAMESTORE_zone_monitor_start (const struct |
317 | GNUNET_CONFIGURATION_Handle *cfg, | 318 | GNUNET_CONFIGURATION_Handle *cfg, |
318 | const struct | 319 | const struct |
319 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 320 | GNUNET_IDENTITY_PrivateKey *zone, |
320 | int iterate_first, | 321 | int iterate_first, |
321 | GNUNET_SCHEDULER_TaskCallback error_cb, | 322 | GNUNET_SCHEDULER_TaskCallback error_cb, |
322 | void *error_cb_cls, | 323 | void *error_cb_cls, |
diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index 105bb1149..479cc61d7 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h | |||
@@ -21,6 +21,8 @@ | |||
21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ | 21 | #ifndef GNUNET_REVOCATION_SERVICE_H_ |
22 | #define GNUNET_REVOCATION_SERVICE_H_ | 22 | #define GNUNET_REVOCATION_SERVICE_H_ |
23 | 23 | ||
24 | #include "gnunet_identity_service.h" | ||
25 | |||
24 | /** | 26 | /** |
25 | * @author Christian Grothoff | 27 | * @author Christian Grothoff |
26 | * | 28 | * |
@@ -80,14 +82,16 @@ struct GNUNET_REVOCATION_PowP | |||
80 | uint64_t pow[POW_COUNT] GNUNET_PACKED; | 82 | uint64_t pow[POW_COUNT] GNUNET_PACKED; |
81 | 83 | ||
82 | /** | 84 | /** |
83 | * The signature | 85 | * The revoked public key |
84 | */ | 86 | */ |
85 | struct GNUNET_CRYPTO_EcdsaSignature signature; | 87 | struct GNUNET_IDENTITY_PublicKey key; |
86 | 88 | ||
87 | /** | 89 | /** |
88 | * The revoked public key | 90 | * Length of the signature |
89 | */ | 91 | */ |
90 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | 92 | uint32_t sig_len; |
93 | |||
94 | /** followed by a signature **/ | ||
91 | }; | 95 | }; |
92 | 96 | ||
93 | 97 | ||
@@ -104,7 +108,7 @@ struct GNUNET_REVOCATION_SignaturePurposePS | |||
104 | /** | 108 | /** |
105 | * The revoked public key | 109 | * The revoked public key |
106 | */ | 110 | */ |
107 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | 111 | struct GNUNET_IDENTITY_PublicKey key; |
108 | 112 | ||
109 | /** | 113 | /** |
110 | * The timestamp of the revocation | 114 | * The timestamp of the revocation |
@@ -150,7 +154,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls, | |||
150 | */ | 154 | */ |
151 | struct GNUNET_REVOCATION_Query * | 155 | struct GNUNET_REVOCATION_Query * |
152 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 156 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, |
153 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 157 | const struct GNUNET_IDENTITY_PublicKey *key, |
154 | GNUNET_REVOCATION_Callback func, void *func_cls); | 158 | GNUNET_REVOCATION_Callback func, void *func_cls); |
155 | 159 | ||
156 | 160 | ||
@@ -217,7 +221,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
217 | * @param pow the pow object to work with in the calculation. | 221 | * @param pow the pow object to work with in the calculation. |
218 | */ | 222 | */ |
219 | void | 223 | void |
220 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 224 | GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key, |
221 | struct GNUNET_REVOCATION_PowP *pow); | 225 | struct GNUNET_REVOCATION_PowP *pow); |
222 | 226 | ||
223 | 227 | ||
diff --git a/src/namecache/gnunet-namecache.c b/src/namecache/gnunet-namecache.c index 2e3c733e6..19f2a5766 100644 --- a/src/namecache/gnunet-namecache.c +++ b/src/namecache/gnunet-namecache.c | |||
@@ -51,7 +51,7 @@ static char *name; | |||
51 | /** | 51 | /** |
52 | * Public key of the zone to look in. | 52 | * Public key of the zone to look in. |
53 | */ | 53 | */ |
54 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 54 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
55 | 55 | ||
56 | /** | 56 | /** |
57 | * Public key of the zone to look in, in ASCII. | 57 | * Public key of the zone to look in, in ASCII. |
@@ -177,7 +177,7 @@ run (void *cls, | |||
177 | } | 177 | } |
178 | 178 | ||
179 | if (GNUNET_OK != | 179 | if (GNUNET_OK != |
180 | GNUNET_CRYPTO_ecdsa_public_key_from_string (pkey, strlen (pkey), &pubkey)) | 180 | GNUNET_IDENTITY_public_key_from_string (pkey, &pubkey)) |
181 | { | 181 | { |
182 | fprintf (stderr, _ ("Invalid public key for zone `%s'\n"), pkey); | 182 | fprintf (stderr, _ ("Invalid public key for zone `%s'\n"), pkey); |
183 | GNUNET_SCHEDULER_shutdown (); | 183 | GNUNET_SCHEDULER_shutdown (); |
diff --git a/src/namecache/namecache.h b/src/namecache/namecache.h index 1657662c2..43c8cf85f 100644 --- a/src/namecache/namecache.h +++ b/src/namecache/namecache.h | |||
@@ -92,7 +92,7 @@ struct LookupBlockResponseMessage | |||
92 | /** | 92 | /** |
93 | * Derived public key. | 93 | * Derived public key. |
94 | */ | 94 | */ |
95 | struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; | 95 | struct GNUNET_IDENTITY_PublicKey derived_key; |
96 | 96 | ||
97 | /* follwed by encrypted block data */ | 97 | /* follwed by encrypted block data */ |
98 | }; | 98 | }; |
@@ -121,7 +121,7 @@ struct BlockCacheMessage | |||
121 | /** | 121 | /** |
122 | * Derived public key. | 122 | * Derived public key. |
123 | */ | 123 | */ |
124 | struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; | 124 | struct GNUNET_IDENTITY_PublicKey derived_key; |
125 | 125 | ||
126 | /* follwed by encrypted block data */ | 126 | /* follwed by encrypted block data */ |
127 | }; | 127 | }; |
diff --git a/src/namecache/plugin_namecache_flat.c b/src/namecache/plugin_namecache_flat.c index 24f4f2570..1775561e1 100644 --- a/src/namecache/plugin_namecache_flat.c +++ b/src/namecache/plugin_namecache_flat.c | |||
@@ -208,7 +208,7 @@ store_and_free_entries (void *cls, | |||
208 | size_t block_size; | 208 | size_t block_size; |
209 | 209 | ||
210 | block_size = ntohl (entry->block->purpose.size) | 210 | block_size = ntohl (entry->block->purpose.size) |
211 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 211 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
212 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); | 212 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); |
213 | 213 | ||
214 | GNUNET_STRINGS_base64_encode ((char *) entry->block, | 214 | GNUNET_STRINGS_base64_encode ((char *) entry->block, |
@@ -320,10 +320,10 @@ namecache_cache_block (void *cls, | |||
320 | 320 | ||
321 | namecache_expire_blocks (plugin); | 321 | namecache_expire_blocks (plugin); |
322 | GNUNET_CRYPTO_hash (&block->derived_key, | 322 | GNUNET_CRYPTO_hash (&block->derived_key, |
323 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 323 | sizeof(struct GNUNET_IDENTITY_PublicKey), |
324 | &query); | 324 | &query); |
325 | block_size = ntohl (block->purpose.size) | 325 | block_size = ntohl (block->purpose.size) |
326 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 326 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
327 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); | 327 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); |
328 | if (block_size > 64 * 65536) | 328 | if (block_size > 64 * 65536) |
329 | { | 329 | { |
diff --git a/src/namecache/plugin_namecache_postgres.c b/src/namecache/plugin_namecache_postgres.c index 654a3ae81..3c8fc4555 100644 --- a/src/namecache/plugin_namecache_postgres.c +++ b/src/namecache/plugin_namecache_postgres.c | |||
@@ -183,7 +183,7 @@ namecache_postgres_cache_block (void *cls, | |||
183 | struct Plugin *plugin = cls; | 183 | struct Plugin *plugin = cls; |
184 | struct GNUNET_HashCode query; | 184 | struct GNUNET_HashCode query; |
185 | size_t block_size = ntohl (block->purpose.size) | 185 | size_t block_size = ntohl (block->purpose.size) |
186 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 186 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
187 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); | 187 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); |
188 | struct GNUNET_PQ_QueryParam params[] = { | 188 | struct GNUNET_PQ_QueryParam params[] = { |
189 | GNUNET_PQ_query_param_auto_from_type (&query), | 189 | GNUNET_PQ_query_param_auto_from_type (&query), |
@@ -195,7 +195,7 @@ namecache_postgres_cache_block (void *cls, | |||
195 | 195 | ||
196 | namecache_postgres_expire_blocks (plugin); | 196 | namecache_postgres_expire_blocks (plugin); |
197 | GNUNET_CRYPTO_hash (&block->derived_key, | 197 | GNUNET_CRYPTO_hash (&block->derived_key, |
198 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 198 | sizeof(struct GNUNET_IDENTITY_PublicKey), |
199 | &query); | 199 | &query); |
200 | if (block_size > 64 * 65536) | 200 | if (block_size > 64 * 65536) |
201 | { | 201 | { |
@@ -265,7 +265,7 @@ namecache_postgres_lookup_block (void *cls, | |||
265 | } | 265 | } |
266 | if ((bsize < sizeof(*block)) || | 266 | if ((bsize < sizeof(*block)) || |
267 | (bsize != ntohl (block->purpose.size) | 267 | (bsize != ntohl (block->purpose.size) |
268 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 268 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
269 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature))) | 269 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature))) |
270 | { | 270 | { |
271 | GNUNET_break (0); | 271 | GNUNET_break (0); |
diff --git a/src/namecache/plugin_namecache_sqlite.c b/src/namecache/plugin_namecache_sqlite.c index c9d79ba2d..33970631b 100644 --- a/src/namecache/plugin_namecache_sqlite.c +++ b/src/namecache/plugin_namecache_sqlite.c | |||
@@ -333,7 +333,7 @@ namecache_sqlite_cache_block (void *cls, | |||
333 | struct GNUNET_HashCode query; | 333 | struct GNUNET_HashCode query; |
334 | struct GNUNET_TIME_Absolute expiration; | 334 | struct GNUNET_TIME_Absolute expiration; |
335 | size_t block_size = ntohl (block->purpose.size) | 335 | size_t block_size = ntohl (block->purpose.size) |
336 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 336 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
337 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); | 337 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature); |
338 | struct GNUNET_SQ_QueryParam del_params[] = { | 338 | struct GNUNET_SQ_QueryParam del_params[] = { |
339 | GNUNET_SQ_query_param_auto_from_type (&query), | 339 | GNUNET_SQ_query_param_auto_from_type (&query), |
@@ -357,7 +357,7 @@ namecache_sqlite_cache_block (void *cls, | |||
357 | namecache_sqlite_expire_blocks (plugin); | 357 | namecache_sqlite_expire_blocks (plugin); |
358 | } | 358 | } |
359 | GNUNET_CRYPTO_hash (&block->derived_key, | 359 | GNUNET_CRYPTO_hash (&block->derived_key, |
360 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 360 | sizeof(block->derived_key), |
361 | &query); | 361 | &query); |
362 | expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); | 362 | expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); |
363 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, | 363 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, |
@@ -500,7 +500,7 @@ namecache_sqlite_lookup_block (void *cls, | |||
500 | } | 500 | } |
501 | else if ((block_size < sizeof(struct GNUNET_GNSRECORD_Block)) || | 501 | else if ((block_size < sizeof(struct GNUNET_GNSRECORD_Block)) || |
502 | (ntohl (block->purpose.size) | 502 | (ntohl (block->purpose.size) |
503 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 503 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
504 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature) != block_size)) | 504 | + sizeof(struct GNUNET_CRYPTO_EcdsaSignature) != block_size)) |
505 | { | 505 | { |
506 | GNUNET_break (0); | 506 | GNUNET_break (0); |
diff --git a/src/namecache/test_namecache_api_cache_block.c b/src/namecache/test_namecache_api_cache_block.c index 12b72d93b..310c4de42 100644 --- a/src/namecache/test_namecache_api_cache_block.c +++ b/src/namecache/test_namecache_api_cache_block.c | |||
@@ -39,9 +39,9 @@ static struct GNUNET_NAMECACHE_Handle *nsh; | |||
39 | 39 | ||
40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 42 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 44 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
45 | 45 | ||
46 | static int res; | 46 | static int res; |
47 | 47 | ||
@@ -172,23 +172,13 @@ run (void *cls, | |||
172 | { | 172 | { |
173 | struct GNUNET_GNSRECORD_Data rd; | 173 | struct GNUNET_GNSRECORD_Data rd; |
174 | struct GNUNET_GNSRECORD_Block *block; | 174 | struct GNUNET_GNSRECORD_Block *block; |
175 | char *hostkey_file; | ||
176 | const char *name = "dummy.dummy.gnunet"; | 175 | const char *name = "dummy.dummy.gnunet"; |
177 | 176 | ||
178 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 177 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
179 | &endbadly, NULL); | 178 | &endbadly, NULL); |
180 | GNUNET_asprintf (&hostkey_file, | 179 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
181 | "zonefiles%s%s", | 180 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
182 | DIR_SEPARATOR_STR, | 181 | GNUNET_IDENTITY_key_get_public (&privkey, &pubkey); |
183 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | ||
184 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", | ||
185 | hostkey_file); | ||
186 | GNUNET_assert (GNUNET_SYSERR != | ||
187 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
188 | GNUNET_YES, | ||
189 | &privkey)); | ||
190 | GNUNET_free (hostkey_file); | ||
191 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); | ||
192 | 182 | ||
193 | 183 | ||
194 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000; | 184 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 10000000000; |
diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 34641d22e..844f4a990 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c | |||
@@ -164,7 +164,7 @@ struct Request | |||
164 | */ | 164 | */ |
165 | char public_key[128]; | 165 | char public_key[128]; |
166 | 166 | ||
167 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 167 | struct GNUNET_IDENTITY_PublicKey pub; |
168 | }; | 168 | }; |
169 | 169 | ||
170 | /** | 170 | /** |
@@ -211,7 +211,7 @@ static struct GNUNET_NAMESTORE_Handle *ns; | |||
211 | /** | 211 | /** |
212 | * Private key for the fcfsd zone. | 212 | * Private key for the fcfsd zone. |
213 | */ | 213 | */ |
214 | static struct GNUNET_CRYPTO_EcdsaPrivateKey fcfs_zone_pkey; | 214 | static struct GNUNET_IDENTITY_PrivateKey fcfs_zone_pkey; |
215 | 215 | ||
216 | /** | 216 | /** |
217 | * Connection to identity service. | 217 | * Connection to identity service. |
@@ -306,7 +306,6 @@ zone_iteration_end (void *cls) | |||
306 | /* return static form */ | 306 | /* return static form */ |
307 | GNUNET_asprintf (&full_page, | 307 | GNUNET_asprintf (&full_page, |
308 | ZONEINFO_PAGE, | 308 | ZONEINFO_PAGE, |
309 | zr->zoneinfo, | ||
310 | zr->zoneinfo); | 309 | zr->zoneinfo); |
311 | response = MHD_create_response_from_buffer (strlen (full_page), | 310 | response = MHD_create_response_from_buffer (strlen (full_page), |
312 | (void *) full_page, | 311 | (void *) full_page, |
@@ -332,7 +331,7 @@ zone_iteration_end (void *cls) | |||
332 | */ | 331 | */ |
333 | static void | 332 | static void |
334 | iterate_cb (void *cls, | 333 | iterate_cb (void *cls, |
335 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 334 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
336 | const char *name, | 335 | const char *name, |
337 | unsigned int rd_len, | 336 | unsigned int rd_len, |
338 | const struct GNUNET_GNSRECORD_Data *rd) | 337 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -615,7 +614,7 @@ zone_to_name_error (void *cls) | |||
615 | */ | 614 | */ |
616 | static void | 615 | static void |
617 | zone_to_name_cb (void *cls, | 616 | zone_to_name_cb (void *cls, |
618 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 617 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
619 | const char *name, | 618 | const char *name, |
620 | unsigned int rd_count, | 619 | unsigned int rd_count, |
621 | const struct GNUNET_GNSRECORD_Data *rd) | 620 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -677,7 +676,7 @@ lookup_it_error (void *cls) | |||
677 | */ | 676 | */ |
678 | static void | 677 | static void |
679 | lookup_it_processor (void *cls, | 678 | lookup_it_processor (void *cls, |
680 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zonekey, | 679 | const struct GNUNET_IDENTITY_PrivateKey *zonekey, |
681 | const char *label, | 680 | const char *label, |
682 | unsigned int rd_count, | 681 | unsigned int rd_count, |
683 | const struct GNUNET_GNSRECORD_Data *rd) | 682 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -712,9 +711,8 @@ lookup_it_finished (void *cls) | |||
712 | return; | 711 | return; |
713 | } | 712 | } |
714 | if (GNUNET_OK != | 713 | if (GNUNET_OK != |
715 | GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, | 714 | GNUNET_IDENTITY_public_key_from_string (request->public_key, |
716 | strlen (request->public_key), | 715 | &request->pub)) |
717 | &request->pub)) | ||
718 | { | 716 | { |
719 | GNUNET_break (0); | 717 | GNUNET_break (0); |
720 | request->phase = RP_FAIL; | 718 | request->phase = RP_FAIL; |
@@ -767,7 +765,7 @@ create_response (void *cls, | |||
767 | { | 765 | { |
768 | struct MHD_Response *response; | 766 | struct MHD_Response *response; |
769 | struct Request *request; | 767 | struct Request *request; |
770 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 768 | struct GNUNET_IDENTITY_PublicKey pub; |
771 | MHD_RESULT ret; | 769 | MHD_RESULT ret; |
772 | 770 | ||
773 | (void) cls; | 771 | (void) cls; |
@@ -822,10 +820,8 @@ create_response (void *cls, | |||
822 | request->pp = NULL; | 820 | request->pp = NULL; |
823 | } | 821 | } |
824 | if (GNUNET_OK != | 822 | if (GNUNET_OK != |
825 | GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, | 823 | GNUNET_IDENTITY_public_key_from_string (request->public_key, |
826 | strlen ( | 824 | &pub)) |
827 | request->public_key), | ||
828 | &pub)) | ||
829 | { | 825 | { |
830 | /* parse error */ | 826 | /* parse error */ |
831 | return fill_s_reply ("Failed to parse given public key", | 827 | return fill_s_reply ("Failed to parse given public key", |
@@ -1211,7 +1207,8 @@ main (int argc, | |||
1211 | options, | 1207 | options, |
1212 | &run, NULL)) ? 0 : 1; | 1208 | &run, NULL)) ? 0 : 1; |
1213 | GNUNET_free_nz ((void *) argv); | 1209 | GNUNET_free_nz ((void *) argv); |
1214 | GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); | 1210 | // FIXME |
1211 | // GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); | ||
1215 | return ret; | 1212 | return ret; |
1216 | } | 1213 | } |
1217 | 1214 | ||
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 | ||
diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index b24bb2952..d6774b37b 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c | |||
@@ -82,7 +82,7 @@ struct ZoneIteration | |||
82 | /** | 82 | /** |
83 | * Key of the zone we are iterating over. | 83 | * Key of the zone we are iterating over. |
84 | */ | 84 | */ |
85 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 85 | struct GNUNET_IDENTITY_PrivateKey zone; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Last sequence number in the zone iteration used to address next | 88 | * Last sequence number in the zone iteration used to address next |
@@ -174,7 +174,7 @@ struct ZoneMonitor | |||
174 | /** | 174 | /** |
175 | * Private key of the zone. | 175 | * Private key of the zone. |
176 | */ | 176 | */ |
177 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 177 | struct GNUNET_IDENTITY_PrivateKey zone; |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * Task active during initial iteration. | 180 | * Task active during initial iteration. |
@@ -314,7 +314,7 @@ struct NickCache | |||
314 | /** | 314 | /** |
315 | * Zone the cache entry is for. | 315 | * Zone the cache entry is for. |
316 | */ | 316 | */ |
317 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 317 | struct GNUNET_IDENTITY_PrivateKey zone; |
318 | 318 | ||
319 | /** | 319 | /** |
320 | * Cached record data. | 320 | * Cached record data. |
@@ -336,7 +336,7 @@ static struct NickCache nick_cache[NC_SIZE]; | |||
336 | /** | 336 | /** |
337 | * Public key of all zeros. | 337 | * Public key of all zeros. |
338 | */ | 338 | */ |
339 | static const struct GNUNET_CRYPTO_EcdsaPrivateKey zero; | 339 | static const struct GNUNET_IDENTITY_PrivateKey zero; |
340 | 340 | ||
341 | /** | 341 | /** |
342 | * Configuration handle. | 342 | * Configuration handle. |
@@ -481,7 +481,7 @@ free_store_activity (struct StoreActivity *sa) | |||
481 | static void | 481 | static void |
482 | lookup_nick_it (void *cls, | 482 | lookup_nick_it (void *cls, |
483 | uint64_t seq, | 483 | uint64_t seq, |
484 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 484 | const struct GNUNET_IDENTITY_PrivateKey *private_key, |
485 | const char *label, | 485 | const char *label, |
486 | unsigned int rd_count, | 486 | unsigned int rd_count, |
487 | const struct GNUNET_GNSRECORD_Data *rd) | 487 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -521,7 +521,7 @@ lookup_nick_it (void *cls, | |||
521 | * @param nick nick entry to cache | 521 | * @param nick nick entry to cache |
522 | */ | 522 | */ |
523 | static void | 523 | static void |
524 | cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 524 | cache_nick (const struct GNUNET_IDENTITY_PrivateKey *zone, |
525 | const struct GNUNET_GNSRECORD_Data *nick) | 525 | const struct GNUNET_GNSRECORD_Data *nick) |
526 | { | 526 | { |
527 | struct NickCache *oldest; | 527 | struct NickCache *oldest; |
@@ -564,9 +564,9 @@ cache_nick (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | |||
564 | * @return NULL if no NICK record was found | 564 | * @return NULL if no NICK record was found |
565 | */ | 565 | */ |
566 | static struct GNUNET_GNSRECORD_Data * | 566 | static struct GNUNET_GNSRECORD_Data * |
567 | get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) | 567 | get_nick_record (const struct GNUNET_IDENTITY_PrivateKey *zone) |
568 | { | 568 | { |
569 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; | 569 | struct GNUNET_IDENTITY_PublicKey pub; |
570 | struct GNUNET_GNSRECORD_Data *nick; | 570 | struct GNUNET_GNSRECORD_Data *nick; |
571 | int res; | 571 | int res; |
572 | 572 | ||
@@ -606,7 +606,7 @@ get_nick_record (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone) | |||
606 | __LINE__); | 606 | __LINE__); |
607 | if (1 == do_log) | 607 | if (1 == do_log) |
608 | { | 608 | { |
609 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); | 609 | GNUNET_IDENTITY_key_get_public (zone, &pub); |
610 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, | 610 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG | GNUNET_ERROR_TYPE_BULK, |
611 | "No nick name set for zone `%s'\n", | 611 | "No nick name set for zone `%s'\n", |
612 | GNUNET_GNSRECORD_z2s (&pub)); | 612 | GNUNET_GNSRECORD_z2s (&pub)); |
@@ -720,7 +720,7 @@ merge_with_nick_records (const struct GNUNET_GNSRECORD_Data *nick_rd, | |||
720 | static void | 720 | static void |
721 | send_lookup_response (struct NamestoreClient *nc, | 721 | send_lookup_response (struct NamestoreClient *nc, |
722 | uint32_t request_id, | 722 | uint32_t request_id, |
723 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 723 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
724 | const char *name, | 724 | const char *name, |
725 | unsigned int rd_count, | 725 | unsigned int rd_count, |
726 | const struct GNUNET_GNSRECORD_Data *rd) | 726 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -899,14 +899,14 @@ static void | |||
899 | refresh_block (struct NamestoreClient *nc, | 899 | refresh_block (struct NamestoreClient *nc, |
900 | struct ZoneIteration *zi, | 900 | struct ZoneIteration *zi, |
901 | uint32_t rid, | 901 | uint32_t rid, |
902 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 902 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
903 | const char *name, | 903 | const char *name, |
904 | unsigned int rd_count, | 904 | unsigned int rd_count, |
905 | const struct GNUNET_GNSRECORD_Data *rd) | 905 | const struct GNUNET_GNSRECORD_Data *rd) |
906 | { | 906 | { |
907 | struct GNUNET_GNSRECORD_Block *block; | 907 | struct GNUNET_GNSRECORD_Block *block; |
908 | struct CacheOperation *cop; | 908 | struct CacheOperation *cop; |
909 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 909 | struct GNUNET_IDENTITY_PublicKey pkey; |
910 | struct GNUNET_GNSRECORD_Data *nick; | 910 | struct GNUNET_GNSRECORD_Data *nick; |
911 | struct GNUNET_GNSRECORD_Data *res; | 911 | struct GNUNET_GNSRECORD_Data *res; |
912 | unsigned int res_count; | 912 | unsigned int res_count; |
@@ -946,7 +946,7 @@ refresh_block (struct NamestoreClient *nc, | |||
946 | block = | 946 | block = |
947 | GNUNET_GNSRECORD_block_create (zone_key, exp_time, name, res, res_count); | 947 | GNUNET_GNSRECORD_block_create (zone_key, exp_time, name, res, res_count); |
948 | GNUNET_assert (NULL != block); | 948 | GNUNET_assert (NULL != block); |
949 | GNUNET_CRYPTO_ecdsa_key_get_public (zone_key, &pkey); | 949 | GNUNET_IDENTITY_key_get_public (zone_key, &pkey); |
950 | GNUNET_log ( | 950 | GNUNET_log ( |
951 | GNUNET_ERROR_TYPE_DEBUG, | 951 | GNUNET_ERROR_TYPE_DEBUG, |
952 | "Caching block for label `%s' with %u records and expiration %s in zone `%s' in namecache\n", | 952 | "Caching block for label `%s' with %u records and expiration %s in zone `%s' in namecache\n", |
@@ -1214,7 +1214,7 @@ struct RecordLookupContext | |||
1214 | static void | 1214 | static void |
1215 | lookup_it (void *cls, | 1215 | lookup_it (void *cls, |
1216 | uint64_t seq, | 1216 | uint64_t seq, |
1217 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, | 1217 | const struct GNUNET_IDENTITY_PrivateKey *private_key, |
1218 | const char *label, | 1218 | const char *label, |
1219 | unsigned int rd_count, | 1219 | unsigned int rd_count, |
1220 | const struct GNUNET_GNSRECORD_Data *rd) | 1220 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -1605,7 +1605,7 @@ struct ZoneToNameCtx | |||
1605 | static void | 1605 | static void |
1606 | handle_zone_to_name_it (void *cls, | 1606 | handle_zone_to_name_it (void *cls, |
1607 | uint64_t seq, | 1607 | uint64_t seq, |
1608 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 1608 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
1609 | const char *name, | 1609 | const char *name, |
1610 | unsigned int rd_count, | 1610 | unsigned int rd_count, |
1611 | const struct GNUNET_GNSRECORD_Data *rd) | 1611 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -1738,7 +1738,7 @@ struct ZoneIterationProcResult | |||
1738 | static void | 1738 | static void |
1739 | zone_iterate_proc (void *cls, | 1739 | zone_iterate_proc (void *cls, |
1740 | uint64_t seq, | 1740 | uint64_t seq, |
1741 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 1741 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
1742 | const char *name, | 1742 | const char *name, |
1743 | unsigned int rd_count, | 1743 | unsigned int rd_count, |
1744 | const struct GNUNET_GNSRECORD_Data *rd) | 1744 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -2009,7 +2009,7 @@ monitor_iteration_next (void *cls); | |||
2009 | static void | 2009 | static void |
2010 | monitor_iterate_cb (void *cls, | 2010 | monitor_iterate_cb (void *cls, |
2011 | uint64_t seq, | 2011 | uint64_t seq, |
2012 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 2012 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
2013 | const char *name, | 2013 | const char *name, |
2014 | unsigned int rd_count, | 2014 | unsigned int rd_count, |
2015 | const struct GNUNET_GNSRECORD_Data *rd) | 2015 | const struct GNUNET_GNSRECORD_Data *rd) |
diff --git a/src/namestore/gnunet-zoneimport.c b/src/namestore/gnunet-zoneimport.c index 5b4e41475..ce62b52d5 100644 --- a/src/namestore/gnunet-zoneimport.c +++ b/src/namestore/gnunet-zoneimport.c | |||
@@ -96,7 +96,7 @@ struct Zone | |||
96 | /** | 96 | /** |
97 | * Private key of the zone. | 97 | * Private key of the zone. |
98 | */ | 98 | */ |
99 | struct GNUNET_CRYPTO_EcdsaPrivateKey key; | 99 | struct GNUNET_IDENTITY_PrivateKey key; |
100 | }; | 100 | }; |
101 | 101 | ||
102 | 102 | ||
@@ -1405,7 +1405,7 @@ ns_lookup_error_cb (void *cls) | |||
1405 | */ | 1405 | */ |
1406 | static void | 1406 | static void |
1407 | ns_lookup_result_cb (void *cls, | 1407 | ns_lookup_result_cb (void *cls, |
1408 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | 1408 | const struct GNUNET_IDENTITY_PrivateKey *key, |
1409 | const char *label, | 1409 | const char *label, |
1410 | unsigned int rd_count, | 1410 | unsigned int rd_count, |
1411 | const struct GNUNET_GNSRECORD_Data *rd) | 1411 | const struct GNUNET_GNSRECORD_Data *rd) |
diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index 6f45ab1c1..fd9a8ed47 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h | |||
@@ -90,7 +90,7 @@ struct RecordStoreMessage | |||
90 | /** | 90 | /** |
91 | * The private key of the authority. | 91 | * The private key of the authority. |
92 | */ | 92 | */ |
93 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 93 | struct GNUNET_IDENTITY_PrivateKey private_key; |
94 | 94 | ||
95 | /* followed by: | 95 | /* followed by: |
96 | * name with length name_len | 96 | * name with length name_len |
@@ -134,7 +134,7 @@ struct LabelLookupMessage | |||
134 | /** | 134 | /** |
135 | * The private key of the zone to look up in | 135 | * The private key of the zone to look up in |
136 | */ | 136 | */ |
137 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 137 | struct GNUNET_IDENTITY_PrivateKey zone; |
138 | 138 | ||
139 | /* followed by: | 139 | /* followed by: |
140 | * name with length name_len | 140 | * name with length name_len |
@@ -176,7 +176,7 @@ struct LabelLookupResponseMessage | |||
176 | /** | 176 | /** |
177 | * The private key of the authority. | 177 | * The private key of the authority. |
178 | */ | 178 | */ |
179 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 179 | struct GNUNET_IDENTITY_PrivateKey private_key; |
180 | 180 | ||
181 | /* followed by: | 181 | /* followed by: |
182 | * name with length name_len | 182 | * name with length name_len |
@@ -198,12 +198,12 @@ struct ZoneToNameMessage | |||
198 | /** | 198 | /** |
199 | * The private key of the zone to look up in | 199 | * The private key of the zone to look up in |
200 | */ | 200 | */ |
201 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 201 | struct GNUNET_IDENTITY_PrivateKey zone; |
202 | 202 | ||
203 | /** | 203 | /** |
204 | * The public key of the target zone | 204 | * The public key of the target zone |
205 | */ | 205 | */ |
206 | struct GNUNET_CRYPTO_EcdsaPublicKey value_zone; | 206 | struct GNUNET_IDENTITY_PublicKey value_zone; |
207 | }; | 207 | }; |
208 | 208 | ||
209 | 209 | ||
@@ -241,7 +241,7 @@ struct ZoneToNameResponseMessage | |||
241 | /** | 241 | /** |
242 | * The private key of the zone that contained the name. | 242 | * The private key of the zone that contained the name. |
243 | */ | 243 | */ |
244 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 244 | struct GNUNET_IDENTITY_PrivateKey zone; |
245 | 245 | ||
246 | /* followed by: | 246 | /* followed by: |
247 | * name with length name_len | 247 | * name with length name_len |
@@ -283,7 +283,7 @@ struct RecordResultMessage | |||
283 | /** | 283 | /** |
284 | * The private key of the authority. | 284 | * The private key of the authority. |
285 | */ | 285 | */ |
286 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 286 | struct GNUNET_IDENTITY_PrivateKey private_key; |
287 | 287 | ||
288 | /* followed by: | 288 | /* followed by: |
289 | * name with length name_len | 289 | * name with length name_len |
@@ -311,7 +311,7 @@ struct ZoneMonitorStartMessage | |||
311 | /** | 311 | /** |
312 | * Zone key. | 312 | * Zone key. |
313 | */ | 313 | */ |
314 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 314 | struct GNUNET_IDENTITY_PrivateKey zone; |
315 | }; | 315 | }; |
316 | 316 | ||
317 | 317 | ||
@@ -352,7 +352,7 @@ struct ZoneIterationStartMessage | |||
352 | /** | 352 | /** |
353 | * Zone key. All zeros for "all zones". | 353 | * Zone key. All zeros for "all zones". |
354 | */ | 354 | */ |
355 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 355 | struct GNUNET_IDENTITY_PrivateKey zone; |
356 | }; | 356 | }; |
357 | 357 | ||
358 | 358 | ||
diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index f383f8b4a..c845b5019 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c | |||
@@ -174,7 +174,7 @@ struct GNUNET_NAMESTORE_ZoneIterator | |||
174 | /** | 174 | /** |
175 | * Private key of the zone. | 175 | * Private key of the zone. |
176 | */ | 176 | */ |
177 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 177 | struct GNUNET_IDENTITY_PrivateKey zone; |
178 | 178 | ||
179 | /** | 179 | /** |
180 | * The operation id this zone iteration operation has | 180 | * The operation id this zone iteration operation has |
@@ -493,7 +493,7 @@ handle_lookup_result (void *cls, const struct LabelLookupResponseMessage *msg) | |||
493 | static int | 493 | static int |
494 | check_record_result (void *cls, const struct RecordResultMessage *msg) | 494 | check_record_result (void *cls, const struct RecordResultMessage *msg) |
495 | { | 495 | { |
496 | static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy; | 496 | static struct GNUNET_IDENTITY_PrivateKey priv_dummy; |
497 | const char *name; | 497 | const char *name; |
498 | size_t msg_len; | 498 | size_t msg_len; |
499 | size_t name_len; | 499 | size_t name_len; |
@@ -981,7 +981,7 @@ warn_delay (void *cls) | |||
981 | struct GNUNET_NAMESTORE_QueueEntry * | 981 | struct GNUNET_NAMESTORE_QueueEntry * |
982 | GNUNET_NAMESTORE_records_store ( | 982 | GNUNET_NAMESTORE_records_store ( |
983 | struct GNUNET_NAMESTORE_Handle *h, | 983 | struct GNUNET_NAMESTORE_Handle *h, |
984 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 984 | const struct GNUNET_IDENTITY_PrivateKey *pkey, |
985 | const char *label, | 985 | const char *label, |
986 | unsigned int rd_count, | 986 | unsigned int rd_count, |
987 | const struct GNUNET_GNSRECORD_Data *rd, | 987 | const struct GNUNET_GNSRECORD_Data *rd, |
@@ -1080,7 +1080,7 @@ GNUNET_NAMESTORE_records_store ( | |||
1080 | struct GNUNET_NAMESTORE_QueueEntry * | 1080 | struct GNUNET_NAMESTORE_QueueEntry * |
1081 | GNUNET_NAMESTORE_records_lookup ( | 1081 | GNUNET_NAMESTORE_records_lookup ( |
1082 | struct GNUNET_NAMESTORE_Handle *h, | 1082 | struct GNUNET_NAMESTORE_Handle *h, |
1083 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 1083 | const struct GNUNET_IDENTITY_PrivateKey *pkey, |
1084 | const char *label, | 1084 | const char *label, |
1085 | GNUNET_SCHEDULER_TaskCallback error_cb, | 1085 | GNUNET_SCHEDULER_TaskCallback error_cb, |
1086 | void *error_cb_cls, | 1086 | void *error_cb_cls, |
@@ -1140,8 +1140,8 @@ GNUNET_NAMESTORE_records_lookup ( | |||
1140 | struct GNUNET_NAMESTORE_QueueEntry * | 1140 | struct GNUNET_NAMESTORE_QueueEntry * |
1141 | GNUNET_NAMESTORE_zone_to_name ( | 1141 | GNUNET_NAMESTORE_zone_to_name ( |
1142 | struct GNUNET_NAMESTORE_Handle *h, | 1142 | struct GNUNET_NAMESTORE_Handle *h, |
1143 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1143 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
1144 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 1144 | const struct GNUNET_IDENTITY_PublicKey *value_zone, |
1145 | GNUNET_SCHEDULER_TaskCallback error_cb, | 1145 | GNUNET_SCHEDULER_TaskCallback error_cb, |
1146 | void *error_cb_cls, | 1146 | void *error_cb_cls, |
1147 | GNUNET_NAMESTORE_RecordMonitor proc, | 1147 | GNUNET_NAMESTORE_RecordMonitor proc, |
@@ -1196,7 +1196,7 @@ GNUNET_NAMESTORE_zone_to_name ( | |||
1196 | struct GNUNET_NAMESTORE_ZoneIterator * | 1196 | struct GNUNET_NAMESTORE_ZoneIterator * |
1197 | GNUNET_NAMESTORE_zone_iteration_start ( | 1197 | GNUNET_NAMESTORE_zone_iteration_start ( |
1198 | struct GNUNET_NAMESTORE_Handle *h, | 1198 | struct GNUNET_NAMESTORE_Handle *h, |
1199 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 1199 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
1200 | GNUNET_SCHEDULER_TaskCallback error_cb, | 1200 | GNUNET_SCHEDULER_TaskCallback error_cb, |
1201 | void *error_cb_cls, | 1201 | void *error_cb_cls, |
1202 | GNUNET_NAMESTORE_RecordMonitor proc, | 1202 | GNUNET_NAMESTORE_RecordMonitor proc, |
diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index 9dc955544..6670e54ce 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c | |||
@@ -82,7 +82,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor | |||
82 | /** | 82 | /** |
83 | * Monitored zone. | 83 | * Monitored zone. |
84 | */ | 84 | */ |
85 | struct GNUNET_CRYPTO_EcdsaPrivateKey zone; | 85 | struct GNUNET_IDENTITY_PrivateKey zone; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * Do we first iterate over all existing records? | 88 | * Do we first iterate over all existing records? |
@@ -302,7 +302,7 @@ reconnect (struct GNUNET_NAMESTORE_ZoneMonitor *zm) | |||
302 | struct GNUNET_NAMESTORE_ZoneMonitor * | 302 | struct GNUNET_NAMESTORE_ZoneMonitor * |
303 | GNUNET_NAMESTORE_zone_monitor_start ( | 303 | GNUNET_NAMESTORE_zone_monitor_start ( |
304 | const struct GNUNET_CONFIGURATION_Handle *cfg, | 304 | const struct GNUNET_CONFIGURATION_Handle *cfg, |
305 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 305 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
306 | int iterate_first, | 306 | int iterate_first, |
307 | GNUNET_SCHEDULER_TaskCallback error_cb, | 307 | GNUNET_SCHEDULER_TaskCallback error_cb, |
308 | void *error_cb_cls, | 308 | void *error_cb_cls, |
diff --git a/src/namestore/perf_namestore_api_zone_iteration.c b/src/namestore/perf_namestore_api_zone_iteration.c index c1012de62..f46a1c523 100644 --- a/src/namestore/perf_namestore_api_zone_iteration.c +++ b/src/namestore/perf_namestore_api_zone_iteration.c | |||
@@ -64,7 +64,7 @@ static struct GNUNET_SCHEDULER_Task *timeout_task; | |||
64 | 64 | ||
65 | static struct GNUNET_SCHEDULER_Task *t; | 65 | static struct GNUNET_SCHEDULER_Task *t; |
66 | 66 | ||
67 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 67 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
68 | 68 | ||
69 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 69 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
70 | 70 | ||
@@ -188,7 +188,7 @@ fail_cb (void *cls) | |||
188 | 188 | ||
189 | static void | 189 | static void |
190 | zone_proc (void *cls, | 190 | zone_proc (void *cls, |
191 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 191 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
192 | const char *label, | 192 | const char *label, |
193 | unsigned int rd_count, | 193 | unsigned int rd_count, |
194 | const struct GNUNET_GNSRECORD_Data *rd) | 194 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -341,7 +341,8 @@ run (void *cls, | |||
341 | NULL); | 341 | NULL); |
342 | nsh = GNUNET_NAMESTORE_connect (cfg); | 342 | nsh = GNUNET_NAMESTORE_connect (cfg); |
343 | GNUNET_assert (NULL != nsh); | 343 | GNUNET_assert (NULL != nsh); |
344 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 344 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
345 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
345 | start = GNUNET_TIME_absolute_get (); | 346 | start = GNUNET_TIME_absolute_get (); |
346 | t = GNUNET_SCHEDULER_add_now (&publish_record, | 347 | t = GNUNET_SCHEDULER_add_now (&publish_record, |
347 | NULL); | 348 | NULL); |
diff --git a/src/namestore/plugin_namestore_flat.c b/src/namestore/plugin_namestore_flat.c index 60b24df67..1a071fd80 100644 --- a/src/namestore/plugin_namestore_flat.c +++ b/src/namestore/plugin_namestore_flat.c | |||
@@ -54,7 +54,7 @@ struct FlatFileEntry | |||
54 | /** | 54 | /** |
55 | * Entry zone | 55 | * Entry zone |
56 | */ | 56 | */ |
57 | struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; | 57 | struct GNUNET_IDENTITY_PrivateKey private_key; |
58 | 58 | ||
59 | /** | 59 | /** |
60 | * Record cound | 60 | * Record cound |
@@ -86,7 +86,7 @@ struct FlatFileEntry | |||
86 | * @param h[out] initialized hash | 86 | * @param h[out] initialized hash |
87 | */ | 87 | */ |
88 | static void | 88 | static void |
89 | hash_pkey_and_label (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | 89 | hash_pkey_and_label (const struct GNUNET_IDENTITY_PrivateKey *pkey, |
90 | const char *label, | 90 | const char *label, |
91 | struct GNUNET_HashCode *h) | 91 | struct GNUNET_HashCode *h) |
92 | { | 92 | { |
@@ -95,14 +95,14 @@ hash_pkey_and_label (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, | |||
95 | size_t key_len; | 95 | size_t key_len; |
96 | 96 | ||
97 | label_len = strlen (label); | 97 | label_len = strlen (label); |
98 | key_len = label_len + sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey); | 98 | key_len = label_len + sizeof(struct GNUNET_IDENTITY_PrivateKey); |
99 | key = GNUNET_malloc (key_len); | 99 | key = GNUNET_malloc (key_len); |
100 | GNUNET_memcpy (key, | 100 | GNUNET_memcpy (key, |
101 | label, | 101 | label, |
102 | label_len); | 102 | label_len); |
103 | GNUNET_memcpy (key + label_len, | 103 | GNUNET_memcpy (key + label_len, |
104 | pkey, | 104 | pkey, |
105 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); | 105 | sizeof(struct GNUNET_IDENTITY_PrivateKey)); |
106 | GNUNET_CRYPTO_hash (key, | 106 | GNUNET_CRYPTO_hash (key, |
107 | key_len, | 107 | key_len, |
108 | h); | 108 | h); |
@@ -296,7 +296,7 @@ database_setup (struct Plugin *plugin) | |||
296 | GNUNET_free (record_data); | 296 | GNUNET_free (record_data); |
297 | 297 | ||
298 | { | 298 | { |
299 | struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key; | 299 | struct GNUNET_IDENTITY_PrivateKey *private_key; |
300 | 300 | ||
301 | GNUNET_STRINGS_base64_decode (zone_private_key, | 301 | GNUNET_STRINGS_base64_decode (zone_private_key, |
302 | strlen (zone_private_key), | 302 | strlen (zone_private_key), |
@@ -345,7 +345,7 @@ store_and_free_entries (void *cls, | |||
345 | 345 | ||
346 | (void) key; | 346 | (void) key; |
347 | GNUNET_STRINGS_base64_encode (&entry->private_key, | 347 | GNUNET_STRINGS_base64_encode (&entry->private_key, |
348 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), | 348 | sizeof(struct GNUNET_IDENTITY_PrivateKey), |
349 | &zone_private_key); | 349 | &zone_private_key); |
350 | data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count, | 350 | data_size = GNUNET_GNSRECORD_records_get_size (entry->record_count, |
351 | entry->record_data); | 351 | entry->record_data); |
@@ -452,7 +452,7 @@ database_shutdown (struct Plugin *plugin) | |||
452 | static int | 452 | static int |
453 | namestore_flat_store_records (void *cls, | 453 | namestore_flat_store_records (void *cls, |
454 | const struct | 454 | const struct |
455 | GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 455 | GNUNET_IDENTITY_PrivateKey *zone_key, |
456 | const char *label, | 456 | const char *label, |
457 | unsigned int rd_count, | 457 | unsigned int rd_count, |
458 | const struct GNUNET_GNSRECORD_Data *rd) | 458 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -482,7 +482,7 @@ namestore_flat_store_records (void *cls, | |||
482 | strlen (label)); | 482 | strlen (label)); |
483 | GNUNET_memcpy (&entry->private_key, | 483 | GNUNET_memcpy (&entry->private_key, |
484 | zone_key, | 484 | zone_key, |
485 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); | 485 | sizeof(struct GNUNET_IDENTITY_PrivateKey)); |
486 | entry->rvalue = rvalue; | 486 | entry->rvalue = rvalue; |
487 | entry->record_count = rd_count; | 487 | entry->record_count = rd_count; |
488 | entry->record_data = GNUNET_new_array (rd_count, | 488 | entry->record_data = GNUNET_new_array (rd_count, |
@@ -517,7 +517,7 @@ namestore_flat_store_records (void *cls, | |||
517 | */ | 517 | */ |
518 | static int | 518 | static int |
519 | namestore_flat_lookup_records (void *cls, | 519 | namestore_flat_lookup_records (void *cls, |
520 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 520 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
521 | const char *label, | 521 | const char *label, |
522 | GNUNET_NAMESTORE_RecordIterator iter, | 522 | GNUNET_NAMESTORE_RecordIterator iter, |
523 | void *iter_cls) | 523 | void *iter_cls) |
@@ -574,7 +574,7 @@ struct IterateContext | |||
574 | /** | 574 | /** |
575 | * Target zone. | 575 | * Target zone. |
576 | */ | 576 | */ |
577 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone; | 577 | const struct GNUNET_IDENTITY_PrivateKey *zone; |
578 | 578 | ||
579 | /** | 579 | /** |
580 | * Function to call on each record. | 580 | * Function to call on each record. |
@@ -647,7 +647,7 @@ iterate_zones (void *cls, | |||
647 | static int | 647 | static int |
648 | namestore_flat_iterate_records (void *cls, | 648 | namestore_flat_iterate_records (void *cls, |
649 | const struct | 649 | const struct |
650 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 650 | GNUNET_IDENTITY_PrivateKey *zone, |
651 | uint64_t serial, | 651 | uint64_t serial, |
652 | uint64_t limit, | 652 | uint64_t limit, |
653 | GNUNET_NAMESTORE_RecordIterator iter, | 653 | GNUNET_NAMESTORE_RecordIterator iter, |
@@ -674,8 +674,8 @@ namestore_flat_iterate_records (void *cls, | |||
674 | */ | 674 | */ |
675 | struct ZoneToNameContext | 675 | struct ZoneToNameContext |
676 | { | 676 | { |
677 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone; | 677 | const struct GNUNET_IDENTITY_PrivateKey *zone; |
678 | const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone; | 678 | const struct GNUNET_IDENTITY_PublicKey *value_zone; |
679 | GNUNET_NAMESTORE_RecordIterator iter; | 679 | GNUNET_NAMESTORE_RecordIterator iter; |
680 | void *iter_cls; | 680 | void *iter_cls; |
681 | 681 | ||
@@ -702,7 +702,7 @@ zone_to_name (void *cls, | |||
702 | continue; | 702 | continue; |
703 | if (0 == memcmp (ztn->value_zone, | 703 | if (0 == memcmp (ztn->value_zone, |
704 | entry->record_data[i].data, | 704 | entry->record_data[i].data, |
705 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey))) | 705 | sizeof(struct GNUNET_IDENTITY_PublicKey))) |
706 | { | 706 | { |
707 | ztn->iter (ztn->iter_cls, | 707 | ztn->iter (ztn->iter_cls, |
708 | i + 1, /* zero is illegal! */ | 708 | i + 1, /* zero is illegal! */ |
@@ -730,9 +730,9 @@ zone_to_name (void *cls, | |||
730 | */ | 730 | */ |
731 | static int | 731 | static int |
732 | namestore_flat_zone_to_name (void *cls, | 732 | namestore_flat_zone_to_name (void *cls, |
733 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 733 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
734 | const struct | 734 | const struct |
735 | GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 735 | GNUNET_IDENTITY_PublicKey *value_zone, |
736 | GNUNET_NAMESTORE_RecordIterator iter, | 736 | GNUNET_NAMESTORE_RecordIterator iter, |
737 | void *iter_cls) | 737 | void *iter_cls) |
738 | { | 738 | { |
diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 04100567c..358fd35d6 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c | |||
@@ -180,13 +180,13 @@ database_setup (struct Plugin *plugin) | |||
180 | static int | 180 | static int |
181 | namestore_postgres_store_records (void *cls, | 181 | namestore_postgres_store_records (void *cls, |
182 | const struct | 182 | const struct |
183 | GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 183 | GNUNET_IDENTITY_PrivateKey *zone_key, |
184 | const char *label, | 184 | const char *label, |
185 | unsigned int rd_count, | 185 | unsigned int rd_count, |
186 | const struct GNUNET_GNSRECORD_Data *rd) | 186 | const struct GNUNET_GNSRECORD_Data *rd) |
187 | { | 187 | { |
188 | struct Plugin *plugin = cls; | 188 | struct Plugin *plugin = cls; |
189 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 189 | struct GNUNET_IDENTITY_PublicKey pkey; |
190 | uint64_t rvalue; | 190 | uint64_t rvalue; |
191 | uint32_t rd_count32 = (uint32_t) rd_count; | 191 | uint32_t rd_count32 = (uint32_t) rd_count; |
192 | ssize_t data_size; | 192 | ssize_t data_size; |
@@ -197,7 +197,7 @@ namestore_postgres_store_records (void *cls, | |||
197 | for (unsigned int i = 0; i < rd_count; i++) | 197 | for (unsigned int i = 0; i < rd_count; i++) |
198 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) | 198 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) |
199 | { | 199 | { |
200 | GNUNET_break (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) == | 200 | GNUNET_break (sizeof(struct GNUNET_IDENTITY_PublicKey) == |
201 | rd[i].data_size); | 201 | rd[i].data_size); |
202 | GNUNET_memcpy (&pkey, | 202 | GNUNET_memcpy (&pkey, |
203 | rd[i].data, | 203 | rd[i].data, |
@@ -296,7 +296,7 @@ struct ParserContext | |||
296 | /** | 296 | /** |
297 | * Zone key, NULL if part of record. | 297 | * Zone key, NULL if part of record. |
298 | */ | 298 | */ |
299 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key; | 299 | const struct GNUNET_IDENTITY_PrivateKey *zone_key; |
300 | 300 | ||
301 | /** | 301 | /** |
302 | * Number of results still to return (counted down by | 302 | * Number of results still to return (counted down by |
@@ -330,7 +330,7 @@ parse_result_call_iterator (void *cls, | |||
330 | size_t data_size; | 330 | size_t data_size; |
331 | uint32_t record_count; | 331 | uint32_t record_count; |
332 | char *label; | 332 | char *label; |
333 | struct GNUNET_CRYPTO_EcdsaPrivateKey zk; | 333 | struct GNUNET_IDENTITY_PrivateKey zk; |
334 | struct GNUNET_PQ_ResultSpec rs_with_zone[] = { | 334 | struct GNUNET_PQ_ResultSpec rs_with_zone[] = { |
335 | GNUNET_PQ_result_spec_uint64 ("seq", &serial), | 335 | GNUNET_PQ_result_spec_uint64 ("seq", &serial), |
336 | GNUNET_PQ_result_spec_uint32 ("record_count", &record_count), | 336 | GNUNET_PQ_result_spec_uint32 ("record_count", &record_count), |
@@ -407,7 +407,7 @@ parse_result_call_iterator (void *cls, | |||
407 | static int | 407 | static int |
408 | namestore_postgres_lookup_records (void *cls, | 408 | namestore_postgres_lookup_records (void *cls, |
409 | const struct | 409 | const struct |
410 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 410 | GNUNET_IDENTITY_PrivateKey *zone, |
411 | const char *label, | 411 | const char *label, |
412 | GNUNET_NAMESTORE_RecordIterator iter, | 412 | GNUNET_NAMESTORE_RecordIterator iter, |
413 | void *iter_cls) | 413 | void *iter_cls) |
@@ -457,7 +457,7 @@ namestore_postgres_lookup_records (void *cls, | |||
457 | static int | 457 | static int |
458 | namestore_postgres_iterate_records (void *cls, | 458 | namestore_postgres_iterate_records (void *cls, |
459 | const struct | 459 | const struct |
460 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 460 | GNUNET_IDENTITY_PrivateKey *zone, |
461 | uint64_t serial, | 461 | uint64_t serial, |
462 | uint64_t limit, | 462 | uint64_t limit, |
463 | GNUNET_NAMESTORE_RecordIterator iter, | 463 | GNUNET_NAMESTORE_RecordIterator iter, |
@@ -524,9 +524,9 @@ namestore_postgres_iterate_records (void *cls, | |||
524 | static int | 524 | static int |
525 | namestore_postgres_zone_to_name (void *cls, | 525 | namestore_postgres_zone_to_name (void *cls, |
526 | const struct | 526 | const struct |
527 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 527 | GNUNET_IDENTITY_PrivateKey *zone, |
528 | const struct | 528 | const struct |
529 | GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 529 | GNUNET_IDENTITY_PublicKey *value_zone, |
530 | GNUNET_NAMESTORE_RecordIterator iter, | 530 | GNUNET_NAMESTORE_RecordIterator iter, |
531 | void *iter_cls) | 531 | void *iter_cls) |
532 | { | 532 | { |
diff --git a/src/namestore/plugin_namestore_sqlite.c b/src/namestore/plugin_namestore_sqlite.c index 45fb782f7..4a4ce3d8d 100644 --- a/src/namestore/plugin_namestore_sqlite.c +++ b/src/namestore/plugin_namestore_sqlite.c | |||
@@ -314,14 +314,14 @@ database_shutdown (struct Plugin *plugin) | |||
314 | static int | 314 | static int |
315 | namestore_sqlite_store_records (void *cls, | 315 | namestore_sqlite_store_records (void *cls, |
316 | const struct | 316 | const struct |
317 | GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 317 | GNUNET_IDENTITY_PrivateKey *zone_key, |
318 | const char *label, | 318 | const char *label, |
319 | unsigned int rd_count, | 319 | unsigned int rd_count, |
320 | const struct GNUNET_GNSRECORD_Data *rd) | 320 | const struct GNUNET_GNSRECORD_Data *rd) |
321 | { | 321 | { |
322 | struct Plugin *plugin = cls; | 322 | struct Plugin *plugin = cls; |
323 | int n; | 323 | int n; |
324 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; | 324 | struct GNUNET_IDENTITY_PublicKey pkey; |
325 | uint64_t rvalue; | 325 | uint64_t rvalue; |
326 | ssize_t data_size; | 326 | ssize_t data_size; |
327 | 327 | ||
@@ -331,7 +331,7 @@ namestore_sqlite_store_records (void *cls, | |||
331 | for (unsigned int i = 0; i < rd_count; i++) | 331 | for (unsigned int i = 0; i < rd_count; i++) |
332 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) | 332 | if (GNUNET_GNSRECORD_TYPE_PKEY == rd[i].record_type) |
333 | { | 333 | { |
334 | GNUNET_break (sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) == | 334 | GNUNET_break (sizeof(struct GNUNET_IDENTITY_PublicKey) == |
335 | rd[i].data_size); | 335 | rd[i].data_size); |
336 | GNUNET_memcpy (&pkey, | 336 | GNUNET_memcpy (&pkey, |
337 | rd[i].data, | 337 | rd[i].data, |
@@ -461,7 +461,7 @@ static int | |||
461 | get_records_and_call_iterator (struct Plugin *plugin, | 461 | get_records_and_call_iterator (struct Plugin *plugin, |
462 | sqlite3_stmt *stmt, | 462 | sqlite3_stmt *stmt, |
463 | const struct | 463 | const struct |
464 | GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 464 | GNUNET_IDENTITY_PrivateKey *zone_key, |
465 | uint64_t limit, | 465 | uint64_t limit, |
466 | GNUNET_NAMESTORE_RecordIterator iter, | 466 | GNUNET_NAMESTORE_RecordIterator iter, |
467 | void *iter_cls) | 467 | void *iter_cls) |
@@ -496,7 +496,7 @@ get_records_and_call_iterator (struct Plugin *plugin, | |||
496 | size_t data_size; | 496 | size_t data_size; |
497 | void *data; | 497 | void *data; |
498 | char *label; | 498 | char *label; |
499 | struct GNUNET_CRYPTO_EcdsaPrivateKey zk; | 499 | struct GNUNET_IDENTITY_PrivateKey zk; |
500 | struct GNUNET_SQ_ResultSpec rs[] = { | 500 | struct GNUNET_SQ_ResultSpec rs[] = { |
501 | GNUNET_SQ_result_spec_uint64 (&seq), | 501 | GNUNET_SQ_result_spec_uint64 (&seq), |
502 | GNUNET_SQ_result_spec_uint32 (&record_count), | 502 | GNUNET_SQ_result_spec_uint32 (&record_count), |
@@ -578,7 +578,7 @@ get_records_and_call_iterator (struct Plugin *plugin, | |||
578 | static int | 578 | static int |
579 | namestore_sqlite_lookup_records (void *cls, | 579 | namestore_sqlite_lookup_records (void *cls, |
580 | const struct | 580 | const struct |
581 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 581 | GNUNET_IDENTITY_PrivateKey *zone, |
582 | const char *label, | 582 | const char *label, |
583 | GNUNET_NAMESTORE_RecordIterator iter, | 583 | GNUNET_NAMESTORE_RecordIterator iter, |
584 | void *iter_cls) | 584 | void *iter_cls) |
@@ -629,7 +629,7 @@ namestore_sqlite_lookup_records (void *cls, | |||
629 | static int | 629 | static int |
630 | namestore_sqlite_iterate_records (void *cls, | 630 | namestore_sqlite_iterate_records (void *cls, |
631 | const struct | 631 | const struct |
632 | GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 632 | GNUNET_IDENTITY_PrivateKey *zone, |
633 | uint64_t serial, | 633 | uint64_t serial, |
634 | uint64_t limit, | 634 | uint64_t limit, |
635 | GNUNET_NAMESTORE_RecordIterator iter, | 635 | GNUNET_NAMESTORE_RecordIterator iter, |
@@ -695,9 +695,9 @@ namestore_sqlite_iterate_records (void *cls, | |||
695 | */ | 695 | */ |
696 | static int | 696 | static int |
697 | namestore_sqlite_zone_to_name (void *cls, | 697 | namestore_sqlite_zone_to_name (void *cls, |
698 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 698 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
699 | const struct | 699 | const struct |
700 | GNUNET_CRYPTO_EcdsaPublicKey *value_zone, | 700 | GNUNET_IDENTITY_PublicKey *value_zone, |
701 | GNUNET_NAMESTORE_RecordIterator iter, | 701 | GNUNET_NAMESTORE_RecordIterator iter, |
702 | void *iter_cls) | 702 | void *iter_cls) |
703 | { | 703 | { |
diff --git a/src/namestore/plugin_rest_namestore.c b/src/namestore/plugin_rest_namestore.c index 9354b9896..f295951bc 100644 --- a/src/namestore/plugin_rest_namestore.c +++ b/src/namestore/plugin_rest_namestore.c | |||
@@ -214,7 +214,7 @@ struct RequestHandle | |||
214 | /** | 214 | /** |
215 | * Private key for the zone | 215 | * Private key for the zone |
216 | */ | 216 | */ |
217 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_pkey; | 217 | const struct GNUNET_IDENTITY_PrivateKey *zone_pkey; |
218 | 218 | ||
219 | /** | 219 | /** |
220 | * IDENTITY Operation | 220 | * IDENTITY Operation |
@@ -510,7 +510,7 @@ namestore_list_finished (void *cls) | |||
510 | */ | 510 | */ |
511 | static void | 511 | static void |
512 | namestore_list_iteration (void *cls, | 512 | namestore_list_iteration (void *cls, |
513 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 513 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
514 | const char *rname, | 514 | const char *rname, |
515 | unsigned int rd_len, | 515 | unsigned int rd_len, |
516 | const struct GNUNET_GNSRECORD_Data *rd) | 516 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -561,7 +561,7 @@ ns_lookup_error_cb (void *cls) | |||
561 | 561 | ||
562 | static void | 562 | static void |
563 | ns_get_lookup_cb (void *cls, | 563 | ns_get_lookup_cb (void *cls, |
564 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 564 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
565 | const char *label, | 565 | const char *label, |
566 | unsigned int rd_len, | 566 | unsigned int rd_len, |
567 | const struct GNUNET_GNSRECORD_Data *rd) | 567 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -689,7 +689,7 @@ namestore_get (struct GNUNET_REST_RequestHandle *con_handle, | |||
689 | 689 | ||
690 | static void | 690 | static void |
691 | ns_lookup_cb (void *cls, | 691 | ns_lookup_cb (void *cls, |
692 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 692 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
693 | const char *label, | 693 | const char *label, |
694 | unsigned int rd_count, | 694 | unsigned int rd_count, |
695 | const struct GNUNET_GNSRECORD_Data *rd) | 695 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -946,7 +946,7 @@ list_ego (void *cls, | |||
946 | const char *identifier) | 946 | const char *identifier) |
947 | { | 947 | { |
948 | struct EgoEntry *ego_entry; | 948 | struct EgoEntry *ego_entry; |
949 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 949 | struct GNUNET_IDENTITY_PublicKey pk; |
950 | 950 | ||
951 | if ((NULL == ego) && (ID_REST_STATE_INIT == state)) | 951 | if ((NULL == ego) && (ID_REST_STATE_INIT == state)) |
952 | { | 952 | { |
@@ -957,7 +957,7 @@ list_ego (void *cls, | |||
957 | { | 957 | { |
958 | ego_entry = GNUNET_new (struct EgoEntry); | 958 | ego_entry = GNUNET_new (struct EgoEntry); |
959 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 959 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
960 | ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 960 | ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk); |
961 | ego_entry->ego = ego; | 961 | ego_entry->ego = ego; |
962 | ego_entry->identifier = GNUNET_strdup (identifier); | 962 | ego_entry->identifier = GNUNET_strdup (identifier); |
963 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, | 963 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, |
@@ -983,7 +983,7 @@ list_ego (void *cls, | |||
983 | /* Add */ | 983 | /* Add */ |
984 | ego_entry = GNUNET_new (struct EgoEntry); | 984 | ego_entry = GNUNET_new (struct EgoEntry); |
985 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); | 985 | GNUNET_IDENTITY_ego_get_public_key (ego, &pk); |
986 | ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); | 986 | ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk); |
987 | ego_entry->ego = ego; | 987 | ego_entry->ego = ego; |
988 | ego_entry->identifier = GNUNET_strdup (identifier); | 988 | ego_entry->identifier = GNUNET_strdup (identifier); |
989 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, | 989 | GNUNET_CONTAINER_DLL_insert_tail (ego_head, |
diff --git a/src/namestore/test_namestore_api_lookup_nick.c b/src/namestore/test_namestore_api_lookup_nick.c index 14fe7fc70..6ce969c9b 100644 --- a/src/namestore/test_namestore_api_lookup_nick.c +++ b/src/namestore/test_namestore_api_lookup_nick.c | |||
@@ -41,9 +41,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
41 | 41 | ||
42 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 42 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 44 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
45 | 45 | ||
46 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 46 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
47 | 47 | ||
48 | static int res; | 48 | static int res; |
49 | 49 | ||
@@ -98,7 +98,7 @@ end (void *cls) | |||
98 | 98 | ||
99 | static void | 99 | static void |
100 | lookup_it (void *cls, | 100 | lookup_it (void *cls, |
101 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 101 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
102 | const char *label, | 102 | const char *label, |
103 | unsigned int rd_count, | 103 | unsigned int rd_count, |
104 | const struct GNUNET_GNSRECORD_Data *rd) | 104 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -288,8 +288,9 @@ run (void *cls, | |||
288 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 288 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
289 | &endbadly, | 289 | &endbadly, |
290 | NULL); | 290 | NULL); |
291 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 291 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
292 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 292 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
293 | GNUNET_IDENTITY_key_get_public (&privkey, | ||
293 | &pubkey); | 294 | &pubkey); |
294 | 295 | ||
295 | nsh = GNUNET_NAMESTORE_connect (cfg); | 296 | nsh = GNUNET_NAMESTORE_connect (cfg); |
diff --git a/src/namestore/test_namestore_api_lookup_private.c b/src/namestore/test_namestore_api_lookup_private.c index d0ad726cc..67cf54582 100644 --- a/src/namestore/test_namestore_api_lookup_private.c +++ b/src/namestore/test_namestore_api_lookup_private.c | |||
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
38 | 38 | ||
39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
40 | 40 | ||
41 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 41 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 43 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
44 | 44 | ||
45 | static int res; | 45 | static int res; |
46 | 46 | ||
@@ -91,7 +91,7 @@ end (void *cls) | |||
91 | 91 | ||
92 | static void | 92 | static void |
93 | lookup_it (void *cls, | 93 | lookup_it (void *cls, |
94 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 94 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
95 | const char *label, | 95 | const char *label, |
96 | unsigned int rd_count, | 96 | unsigned int rd_count, |
97 | const struct GNUNET_GNSRECORD_Data *rd) | 97 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -187,8 +187,9 @@ run (void *cls, | |||
187 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 187 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
188 | &endbadly, | 188 | &endbadly, |
189 | NULL); | 189 | NULL); |
190 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 190 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
191 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); | 191 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
192 | GNUNET_IDENTITY_key_get_public (&privkey, &pubkey); | ||
192 | 193 | ||
193 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; | 194 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; |
194 | rd.record_type = TEST_RECORD_TYPE; | 195 | rd.record_type = TEST_RECORD_TYPE; |
diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index 039c7cbf6..5e3e7bbd8 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c | |||
@@ -42,9 +42,9 @@ static struct GNUNET_NAMECACHE_Handle *nch; | |||
42 | 42 | ||
43 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 43 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
44 | 44 | ||
45 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 45 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
46 | 46 | ||
47 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 47 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
48 | 48 | ||
49 | static int res; | 49 | static int res; |
50 | 50 | ||
@@ -163,7 +163,7 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
163 | { | 163 | { |
164 | const char *name = cls; | 164 | const char *name = cls; |
165 | struct GNUNET_HashCode derived_hash; | 165 | struct GNUNET_HashCode derived_hash; |
166 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 166 | struct GNUNET_IDENTITY_PublicKey pubkey; |
167 | 167 | ||
168 | nsqe = NULL; | 168 | nsqe = NULL; |
169 | GNUNET_assert (NULL != cls); | 169 | GNUNET_assert (NULL != cls); |
@@ -173,8 +173,8 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
173 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); | 173 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); |
174 | 174 | ||
175 | /* Create derived hash */ | 175 | /* Create derived hash */ |
176 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 176 | GNUNET_IDENTITY_key_get_public (&privkey, |
177 | &pubkey); | 177 | &pubkey); |
178 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash); | 178 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, name, &derived_hash); |
179 | 179 | ||
180 | ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, | 180 | ncqe = GNUNET_NAMECACHE_lookup_block (nch, &derived_hash, |
@@ -193,9 +193,10 @@ run (void *cls, | |||
193 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 193 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
194 | &endbadly, | 194 | &endbadly, |
195 | NULL); | 195 | NULL); |
196 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 196 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
197 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 197 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
198 | &pubkey); | 198 | GNUNET_IDENTITY_key_get_public (&privkey, |
199 | &pubkey); | ||
199 | 200 | ||
200 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; | 201 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; |
201 | rd.record_type = TEST_RECORD_TYPE; | 202 | rd.record_type = TEST_RECORD_TYPE; |
diff --git a/src/namestore/test_namestore_api_lookup_shadow.c b/src/namestore/test_namestore_api_lookup_shadow.c index d399d903a..79fa4c9c6 100644 --- a/src/namestore/test_namestore_api_lookup_shadow.c +++ b/src/namestore/test_namestore_api_lookup_shadow.c | |||
@@ -44,9 +44,9 @@ static struct GNUNET_NAMECACHE_Handle *nch; | |||
44 | 44 | ||
45 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 45 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
46 | 46 | ||
47 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 47 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
48 | 48 | ||
49 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 49 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
50 | 50 | ||
51 | static int res; | 51 | static int res; |
52 | 52 | ||
@@ -195,7 +195,7 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
195 | { | 195 | { |
196 | const char *name = cls; | 196 | const char *name = cls; |
197 | struct GNUNET_HashCode derived_hash; | 197 | struct GNUNET_HashCode derived_hash; |
198 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 198 | struct GNUNET_IDENTITY_PublicKey pubkey; |
199 | 199 | ||
200 | nsqe = NULL; | 200 | nsqe = NULL; |
201 | GNUNET_assert (NULL != cls); | 201 | GNUNET_assert (NULL != cls); |
@@ -205,8 +205,8 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
205 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); | 205 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); |
206 | 206 | ||
207 | /* Create derived hash */ | 207 | /* Create derived hash */ |
208 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 208 | GNUNET_IDENTITY_key_get_public (&privkey, |
209 | &pubkey); | 209 | &pubkey); |
210 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, | 210 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, |
211 | name, | 211 | name, |
212 | &derived_hash); | 212 | &derived_hash); |
@@ -228,9 +228,10 @@ run (void *cls, | |||
228 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 228 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
229 | &endbadly, | 229 | &endbadly, |
230 | NULL); | 230 | NULL); |
231 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 231 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
232 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 232 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
233 | &pubkey); | 233 | GNUNET_IDENTITY_key_get_public (&privkey, |
234 | &pubkey); | ||
234 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; | 235 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; |
235 | rd.record_type = TEST_RECORD_TYPE; | 236 | rd.record_type = TEST_RECORD_TYPE; |
236 | rd.data_size = TEST_RECORD_DATALEN; | 237 | rd.data_size = TEST_RECORD_DATALEN; |
diff --git a/src/namestore/test_namestore_api_lookup_shadow_filter.c b/src/namestore/test_namestore_api_lookup_shadow_filter.c index 40dbeb90f..4fc197750 100644 --- a/src/namestore/test_namestore_api_lookup_shadow_filter.c +++ b/src/namestore/test_namestore_api_lookup_shadow_filter.c | |||
@@ -48,9 +48,9 @@ static struct GNUNET_SCHEDULER_Task *endbadly_task; | |||
48 | 48 | ||
49 | static struct GNUNET_SCHEDULER_Task *delayed_lookup_task; | 49 | static struct GNUNET_SCHEDULER_Task *delayed_lookup_task; |
50 | 50 | ||
51 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 51 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
52 | 52 | ||
53 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 53 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
54 | 54 | ||
55 | static int res; | 55 | static int res; |
56 | 56 | ||
@@ -66,7 +66,7 @@ static struct GNUNET_TIME_Absolute record_expiration; | |||
66 | 66 | ||
67 | static struct GNUNET_HashCode derived_hash; | 67 | static struct GNUNET_HashCode derived_hash; |
68 | 68 | ||
69 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 69 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
70 | 70 | ||
71 | 71 | ||
72 | static void | 72 | static void |
@@ -267,8 +267,8 @@ put_cont (void *cls, int32_t success, const char *emsg) | |||
267 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); | 267 | (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); |
268 | 268 | ||
269 | /* Create derived hash */ | 269 | /* Create derived hash */ |
270 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 270 | GNUNET_IDENTITY_key_get_public (&privkey, |
271 | &pubkey); | 271 | &pubkey); |
272 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, TEST_NAME, &derived_hash); | 272 | GNUNET_GNSRECORD_query_from_public_key (&pubkey, TEST_NAME, &derived_hash); |
273 | 273 | ||
274 | if (0 == GNUNET_TIME_absolute_get_remaining (record_expiration).rel_value_us) | 274 | if (0 == GNUNET_TIME_absolute_get_remaining (record_expiration).rel_value_us) |
@@ -297,9 +297,10 @@ run (void *cls, | |||
297 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 297 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
298 | &endbadly, | 298 | &endbadly, |
299 | NULL); | 299 | NULL); |
300 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 300 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
301 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 301 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
302 | &pubkey); | 302 | GNUNET_IDENTITY_key_get_public (&privkey, |
303 | &pubkey); | ||
303 | 304 | ||
304 | record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), | 305 | record_expiration = GNUNET_TIME_absolute_add (GNUNET_TIME_absolute_get (), |
305 | EXPIRATION); | 306 | EXPIRATION); |
diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index 3f1be1403..df0c38608 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c | |||
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
37 | 37 | ||
38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
39 | 39 | ||
40 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 40 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; | 42 | static struct GNUNET_IDENTITY_PrivateKey privkey2; |
43 | 43 | ||
44 | static struct GNUNET_NAMESTORE_ZoneMonitor *zm; | 44 | static struct GNUNET_NAMESTORE_ZoneMonitor *zm; |
45 | 45 | ||
@@ -133,7 +133,7 @@ end (void *cls) | |||
133 | 133 | ||
134 | static void | 134 | static void |
135 | zone_proc (void *cls, | 135 | zone_proc (void *cls, |
136 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 136 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
137 | const char *name, | 137 | const char *name, |
138 | unsigned int rd_count, | 138 | unsigned int rd_count, |
139 | const struct GNUNET_GNSRECORD_Data *rd) | 139 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -273,7 +273,8 @@ run (void *cls, | |||
273 | struct GNUNET_TESTING_Peer *peer) | 273 | struct GNUNET_TESTING_Peer *peer) |
274 | { | 274 | { |
275 | res = 1; | 275 | res = 1; |
276 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 276 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
277 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
277 | /* Start monitoring */ | 278 | /* Start monitoring */ |
278 | zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, | 279 | zm = GNUNET_NAMESTORE_zone_monitor_start (cfg, |
279 | &privkey, | 280 | &privkey, |
@@ -304,7 +305,8 @@ run (void *cls, | |||
304 | return; | 305 | return; |
305 | } | 306 | } |
306 | 307 | ||
307 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2); | 308 | privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
309 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key); | ||
308 | 310 | ||
309 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 311 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
310 | "Created record 3\n"); | 312 | "Created record 3\n"); |
diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index 728fcc25e..366f5739f 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c | |||
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
38 | 38 | ||
39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
40 | 40 | ||
41 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 41 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; | 43 | static struct GNUNET_IDENTITY_PrivateKey privkey2; |
44 | 44 | ||
45 | static struct GNUNET_NAMESTORE_ZoneMonitor *zm; | 45 | static struct GNUNET_NAMESTORE_ZoneMonitor *zm; |
46 | 46 | ||
@@ -129,7 +129,7 @@ end (void *cls) | |||
129 | 129 | ||
130 | static void | 130 | static void |
131 | zone_proc (void *cls, | 131 | zone_proc (void *cls, |
132 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 132 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
133 | const char *name, | 133 | const char *name, |
134 | unsigned int rd_count, | 134 | unsigned int rd_count, |
135 | const struct GNUNET_GNSRECORD_Data *rd) | 135 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -302,8 +302,10 @@ run (void *cls, | |||
302 | struct GNUNET_TESTING_Peer *peer) | 302 | struct GNUNET_TESTING_Peer *peer) |
303 | { | 303 | { |
304 | res = 1; | 304 | res = 1; |
305 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 305 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
306 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2); | 306 | privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
307 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
308 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key); | ||
307 | 309 | ||
308 | cfg = mycfg; | 310 | cfg = mycfg; |
309 | GNUNET_SCHEDULER_add_shutdown (&end, | 311 | GNUNET_SCHEDULER_add_shutdown (&end, |
diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index e575821e8..b6254e531 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c | |||
@@ -39,9 +39,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
39 | 39 | ||
40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 42 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 44 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
45 | 45 | ||
46 | static int res; | 46 | static int res; |
47 | 47 | ||
@@ -158,9 +158,10 @@ run (void *cls, | |||
158 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 158 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
159 | &endbadly, | 159 | &endbadly, |
160 | NULL); | 160 | NULL); |
161 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 161 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
162 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 162 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
163 | &pubkey); | 163 | GNUNET_IDENTITY_key_get_public (&privkey, |
164 | &pubkey); | ||
164 | 165 | ||
165 | removed = GNUNET_NO; | 166 | removed = GNUNET_NO; |
166 | 167 | ||
diff --git a/src/namestore/test_namestore_api_remove_not_existing_record.c b/src/namestore/test_namestore_api_remove_not_existing_record.c index 75e1cc3ed..e66992909 100644 --- a/src/namestore/test_namestore_api_remove_not_existing_record.c +++ b/src/namestore/test_namestore_api_remove_not_existing_record.c | |||
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
38 | 38 | ||
39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
40 | 40 | ||
41 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 41 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 43 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
44 | 44 | ||
45 | static int res; | 45 | static int res; |
46 | 46 | ||
@@ -132,8 +132,9 @@ run (void *cls, | |||
132 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 132 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
133 | &endbadly, | 133 | &endbadly, |
134 | NULL); | 134 | NULL); |
135 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 135 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
136 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); | 136 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
137 | GNUNET_IDENTITY_key_get_public (&privkey, &pubkey); | ||
137 | 138 | ||
138 | nsh = GNUNET_NAMESTORE_connect (cfg); | 139 | nsh = GNUNET_NAMESTORE_connect (cfg); |
139 | GNUNET_break (NULL != nsh); | 140 | GNUNET_break (NULL != nsh); |
diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 9223b56a3..e0b7daa5d 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c | |||
@@ -39,9 +39,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
39 | 39 | ||
40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 40 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 42 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
43 | 43 | ||
44 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 44 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
45 | 45 | ||
46 | static int res; | 46 | static int res; |
47 | 47 | ||
@@ -113,8 +113,9 @@ run (void *cls, | |||
113 | 113 | ||
114 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 114 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
115 | &endbadly, NULL); | 115 | &endbadly, NULL); |
116 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 116 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
117 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, &pubkey); | 117 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
118 | GNUNET_IDENTITY_key_get_public (&privkey, &pubkey); | ||
118 | 119 | ||
119 | 120 | ||
120 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; | 121 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us; |
diff --git a/src/namestore/test_namestore_api_store_update.c b/src/namestore/test_namestore_api_store_update.c index 7a5a69a6c..5c169734a 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c | |||
@@ -48,9 +48,9 @@ static struct GNUNET_NAMECACHE_Handle *nch; | |||
48 | 48 | ||
49 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 49 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
50 | 50 | ||
51 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 51 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
52 | 52 | ||
53 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 53 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
54 | 54 | ||
55 | static int res; | 55 | static int res; |
56 | 56 | ||
@@ -246,9 +246,10 @@ run (void *cls, | |||
246 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, | 246 | endbadly_task = GNUNET_SCHEDULER_add_delayed (TIMEOUT, |
247 | &endbadly, | 247 | &endbadly, |
248 | NULL); | 248 | NULL); |
249 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 249 | memset (&privkey, 0, sizeof (privkey)); |
250 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 250 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
251 | &pubkey); | 251 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
252 | GNUNET_IDENTITY_key_get_public (&privkey, &pubkey); | ||
252 | rd.flags = GNUNET_GNSRECORD_RF_NONE; | 253 | rd.flags = GNUNET_GNSRECORD_RF_NONE; |
253 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; | 254 | rd.expiration_time = GNUNET_TIME_absolute_get ().abs_value_us + 1000000000; |
254 | rd.record_type = TEST_RECORD_TYPE; | 255 | rd.record_type = TEST_RECORD_TYPE; |
@@ -291,7 +292,7 @@ main (int argc, | |||
291 | SETUP_CFG (plugin_name, cfg_name); | 292 | SETUP_CFG (plugin_name, cfg_name); |
292 | res = 1; | 293 | res = 1; |
293 | if (0 != | 294 | if (0 != |
294 | GNUNET_TESTING_peer_run ("test-namestore-api-store-update", | 295 | GNUNET_TESTING_peer_run ("test--store-update", |
295 | cfg_name, | 296 | cfg_name, |
296 | &run, | 297 | &run, |
297 | NULL)) | 298 | NULL)) |
diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 5d02b9e49..55ca901e2 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c | |||
@@ -37,9 +37,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
37 | 37 | ||
38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 38 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
39 | 39 | ||
40 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 40 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
41 | 41 | ||
42 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; | 42 | static struct GNUNET_IDENTITY_PrivateKey privkey2; |
43 | 43 | ||
44 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 44 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
45 | 45 | ||
@@ -142,7 +142,7 @@ fail_cb (void *cls) | |||
142 | 142 | ||
143 | static void | 143 | static void |
144 | zone_proc (void *cls, | 144 | zone_proc (void *cls, |
145 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 145 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
146 | const char *label, | 146 | const char *label, |
147 | unsigned int rd_count, | 147 | unsigned int rd_count, |
148 | const struct GNUNET_GNSRECORD_Data *rd) | 148 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -331,7 +331,7 @@ create_record (unsigned int count) | |||
331 | */ | 331 | */ |
332 | static void | 332 | static void |
333 | empty_zone_proc (void *cls, | 333 | empty_zone_proc (void *cls, |
334 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 334 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
335 | const char *label, | 335 | const char *label, |
336 | unsigned int rd_count, | 336 | unsigned int rd_count, |
337 | const struct GNUNET_GNSRECORD_Data *rd) | 337 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -362,34 +362,11 @@ empty_zone_proc (void *cls, | |||
362 | static void | 362 | static void |
363 | empty_zone_end (void *cls) | 363 | empty_zone_end (void *cls) |
364 | { | 364 | { |
365 | char *hostkey_file; | ||
366 | |||
367 | zi = NULL; | 365 | zi = NULL; |
368 | GNUNET_asprintf (&hostkey_file, | 366 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
369 | "zonefiles%s%s", | 367 | privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
370 | DIR_SEPARATOR_STR, | 368 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
371 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | 369 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key); |
372 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
373 | "Using zonekey file `%s' \n", | ||
374 | hostkey_file); | ||
375 | GNUNET_assert (GNUNET_SYSERR != | ||
376 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
377 | GNUNET_YES, | ||
378 | &privkey)); | ||
379 | GNUNET_free (hostkey_file); | ||
380 | |||
381 | GNUNET_asprintf (&hostkey_file, | ||
382 | "zonefiles%s%s", | ||
383 | DIR_SEPARATOR_STR, | ||
384 | "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); | ||
385 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
386 | "Using zonekey file `%s' \n", | ||
387 | hostkey_file); | ||
388 | GNUNET_assert (GNUNET_SYSERR != | ||
389 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
390 | GNUNET_YES, | ||
391 | &privkey2)); | ||
392 | GNUNET_free (hostkey_file); | ||
393 | 370 | ||
394 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); | 371 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Created record 1\n"); |
395 | 372 | ||
diff --git a/src/namestore/test_namestore_api_zone_iteration_nick.c b/src/namestore/test_namestore_api_zone_iteration_nick.c index 4e54a05d2..c203a63a6 100644 --- a/src/namestore/test_namestore_api_zone_iteration_nick.c +++ b/src/namestore/test_namestore_api_zone_iteration_nick.c | |||
@@ -38,9 +38,9 @@ | |||
38 | 38 | ||
39 | static struct GNUNET_NAMESTORE_Handle *nsh; | 39 | static struct GNUNET_NAMESTORE_Handle *nsh; |
40 | 40 | ||
41 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 41 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; | 43 | static struct GNUNET_IDENTITY_PrivateKey privkey2; |
44 | 44 | ||
45 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 45 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
46 | 46 | ||
@@ -153,7 +153,7 @@ zone_proc_end (void *cls) | |||
153 | 153 | ||
154 | static void | 154 | static void |
155 | zone_proc (void *cls, | 155 | zone_proc (void *cls, |
156 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 156 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
157 | const char *label, | 157 | const char *label, |
158 | unsigned int rd_count, | 158 | unsigned int rd_count, |
159 | const struct GNUNET_GNSRECORD_Data *rd) | 159 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -345,7 +345,7 @@ nick_1_cont (void *cls, int32_t success, const char *emsg) | |||
345 | */ | 345 | */ |
346 | static void | 346 | static void |
347 | empty_zone_proc (void *cls, | 347 | empty_zone_proc (void *cls, |
348 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 348 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
349 | const char *label, | 349 | const char *label, |
350 | unsigned int rd_count, | 350 | unsigned int rd_count, |
351 | const struct GNUNET_GNSRECORD_Data *rd) | 351 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -379,8 +379,10 @@ empty_zone_end (void *cls) | |||
379 | struct GNUNET_GNSRECORD_Data rd; | 379 | struct GNUNET_GNSRECORD_Data rd; |
380 | 380 | ||
381 | zi = NULL; | 381 | zi = NULL; |
382 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 382 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
383 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2); | 383 | privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
384 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
385 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key); | ||
384 | 386 | ||
385 | memset (&rd, 0, sizeof(rd)); | 387 | memset (&rd, 0, sizeof(rd)); |
386 | rd.data = ZONE_NICK_1; | 388 | rd.data = ZONE_NICK_1; |
diff --git a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c index 30920713f..70097a69e 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c | |||
@@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
38 | 38 | ||
39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 39 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
40 | 40 | ||
41 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 41 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
42 | 42 | ||
43 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; | 43 | static struct GNUNET_IDENTITY_PrivateKey privkey2; |
44 | 44 | ||
45 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 45 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
46 | 46 | ||
@@ -124,7 +124,7 @@ fail_cb (void *cls) | |||
124 | 124 | ||
125 | static void | 125 | static void |
126 | zone_proc (void *cls, | 126 | zone_proc (void *cls, |
127 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 127 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
128 | const char *label, | 128 | const char *label, |
129 | unsigned int rd_count, | 129 | unsigned int rd_count, |
130 | const struct GNUNET_GNSRECORD_Data *rd) | 130 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -309,7 +309,7 @@ create_record (unsigned int count) | |||
309 | */ | 309 | */ |
310 | static void | 310 | static void |
311 | empty_zone_proc (void *cls, | 311 | empty_zone_proc (void *cls, |
312 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 312 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
313 | const char *label, | 313 | const char *label, |
314 | unsigned int rd_count, | 314 | unsigned int rd_count, |
315 | const struct GNUNET_GNSRECORD_Data *rd) | 315 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -341,8 +341,10 @@ static void | |||
341 | empty_zone_proc_end (void *cls) | 341 | empty_zone_proc_end (void *cls) |
342 | { | 342 | { |
343 | zi = NULL; | 343 | zi = NULL; |
344 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 344 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
345 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2); | 345 | privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
346 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
347 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key); | ||
346 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 348 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
347 | "Created record 1\n"); | 349 | "Created record 1\n"); |
348 | GNUNET_asprintf (&s_name_1, | 350 | GNUNET_asprintf (&s_name_1, |
diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index bdcdd1706..71b36ba09 100644 --- a/src/namestore/test_namestore_api_zone_iteration_stop.c +++ b/src/namestore/test_namestore_api_zone_iteration_stop.c | |||
@@ -34,9 +34,9 @@ | |||
34 | 34 | ||
35 | static struct GNUNET_NAMESTORE_Handle *nsh; | 35 | static struct GNUNET_NAMESTORE_Handle *nsh; |
36 | 36 | ||
37 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 37 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
38 | 38 | ||
39 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey2; | 39 | static struct GNUNET_IDENTITY_PrivateKey privkey2; |
40 | 40 | ||
41 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; | 41 | static struct GNUNET_NAMESTORE_ZoneIterator *zi; |
42 | 42 | ||
@@ -112,7 +112,7 @@ fail_cb (void *cls) | |||
112 | 112 | ||
113 | static void | 113 | static void |
114 | zone_proc (void *cls, | 114 | zone_proc (void *cls, |
115 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 115 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
116 | const char *label, | 116 | const char *label, |
117 | unsigned int rd_count, | 117 | unsigned int rd_count, |
118 | const struct GNUNET_GNSRECORD_Data *rd) | 118 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -318,7 +318,7 @@ create_record (unsigned int count) | |||
318 | */ | 318 | */ |
319 | static void | 319 | static void |
320 | empty_zone_proc (void *cls, | 320 | empty_zone_proc (void *cls, |
321 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, | 321 | const struct GNUNET_IDENTITY_PrivateKey *zone, |
322 | const char *label, | 322 | const char *label, |
323 | unsigned int rd_count, | 323 | unsigned int rd_count, |
324 | const struct GNUNET_GNSRECORD_Data *rd) | 324 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -347,34 +347,13 @@ empty_zone_proc (void *cls, | |||
347 | static void | 347 | static void |
348 | empty_zone_proc_end (void *cls) | 348 | empty_zone_proc_end (void *cls) |
349 | { | 349 | { |
350 | char *hostkey_file; | ||
351 | |||
352 | GNUNET_assert (nsh == cls); | 350 | GNUNET_assert (nsh == cls); |
353 | zi = NULL; | 351 | zi = NULL; |
354 | GNUNET_asprintf (&hostkey_file, | 352 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
355 | "zonefiles%s%s", | 353 | privkey2.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
356 | DIR_SEPARATOR_STR, | 354 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); |
357 | "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); | 355 | GNUNET_CRYPTO_ecdsa_key_create (&privkey2.ecdsa_key); |
358 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 356 | |
359 | "Using zonekey file `%s' \n", | ||
360 | hostkey_file); | ||
361 | GNUNET_assert (GNUNET_SYSERR | ||
362 | != GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
363 | GNUNET_YES, | ||
364 | &privkey)); | ||
365 | GNUNET_free (hostkey_file); | ||
366 | GNUNET_asprintf (&hostkey_file, | ||
367 | "zonefiles%s%s", | ||
368 | DIR_SEPARATOR_STR, | ||
369 | "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); | ||
370 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | ||
371 | "Using zonekey file `%s'\n", | ||
372 | hostkey_file); | ||
373 | GNUNET_assert (GNUNET_SYSERR != | ||
374 | GNUNET_CRYPTO_ecdsa_key_from_file (hostkey_file, | ||
375 | GNUNET_YES, | ||
376 | &privkey2)); | ||
377 | GNUNET_free (hostkey_file); | ||
378 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 357 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
379 | "Created record 1\n"); | 358 | "Created record 1\n"); |
380 | 359 | ||
diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 94cc5c285..e5ede6bcd 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c | |||
@@ -42,11 +42,11 @@ static struct GNUNET_NAMESTORE_Handle *nsh; | |||
42 | 42 | ||
43 | static struct GNUNET_SCHEDULER_Task *endbadly_task; | 43 | static struct GNUNET_SCHEDULER_Task *endbadly_task; |
44 | 44 | ||
45 | static struct GNUNET_CRYPTO_EcdsaPrivateKey privkey; | 45 | static struct GNUNET_IDENTITY_PrivateKey privkey; |
46 | 46 | ||
47 | static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 47 | static struct GNUNET_IDENTITY_PublicKey pubkey; |
48 | 48 | ||
49 | static struct GNUNET_CRYPTO_EcdsaPublicKey s_zone_value; | 49 | static struct GNUNET_IDENTITY_PublicKey s_zone_value; |
50 | 50 | ||
51 | static char *s_name; | 51 | static char *s_name; |
52 | 52 | ||
@@ -92,7 +92,7 @@ end (void *cls) | |||
92 | 92 | ||
93 | static void | 93 | static void |
94 | zone_to_name_proc (void *cls, | 94 | zone_to_name_proc (void *cls, |
95 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 95 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
96 | const char *n, | 96 | const char *n, |
97 | unsigned int rd_count, | 97 | unsigned int rd_count, |
98 | const struct GNUNET_GNSRECORD_Data *rd) | 98 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -203,10 +203,11 @@ run (void *cls, | |||
203 | GNUNET_SCHEDULER_add_shutdown (&end, | 203 | GNUNET_SCHEDULER_add_shutdown (&end, |
204 | NULL); | 204 | NULL); |
205 | GNUNET_asprintf (&s_name, "dummy"); | 205 | GNUNET_asprintf (&s_name, "dummy"); |
206 | GNUNET_CRYPTO_ecdsa_key_create (&privkey); | 206 | privkey.type = htonl (GNUNET_GNSRECORD_TYPE_PKEY); |
207 | GNUNET_CRYPTO_ecdsa_key_create (&privkey.ecdsa_key); | ||
207 | /* get public key */ | 208 | /* get public key */ |
208 | GNUNET_CRYPTO_ecdsa_key_get_public (&privkey, | 209 | GNUNET_IDENTITY_key_get_public (&privkey, |
209 | &pubkey); | 210 | &pubkey); |
210 | 211 | ||
211 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, | 212 | GNUNET_CRYPTO_random_block (GNUNET_CRYPTO_QUALITY_WEAK, |
212 | &s_zone_value, | 213 | &s_zone_value, |
diff --git a/src/revocation/Makefile.am b/src/revocation/Makefile.am index 9d98502a6..d63d7213c 100644 --- a/src/revocation/Makefile.am +++ b/src/revocation/Makefile.am | |||
@@ -63,6 +63,7 @@ libgnunetrevocation_la_SOURCES = \ | |||
63 | revocation_api.c revocation.h | 63 | revocation_api.c revocation.h |
64 | libgnunetrevocation_la_LIBADD = \ | 64 | libgnunetrevocation_la_LIBADD = \ |
65 | $(top_builddir)/src/util/libgnunetutil.la \ | 65 | $(top_builddir)/src/util/libgnunetutil.la \ |
66 | $(top_builddir)/src/identity/libgnunetidentity.la \ | ||
66 | $(LIBGCRYPT_LIBS) \ | 67 | $(LIBGCRYPT_LIBS) \ |
67 | $(GN_LIBINTL) $(XLIB) -lgcrypt | 68 | $(GN_LIBINTL) $(XLIB) -lgcrypt |
68 | libgnunetrevocation_la_LDFLAGS = \ | 69 | libgnunetrevocation_la_LDFLAGS = \ |
diff --git a/src/revocation/gnunet-revocation-tvg.c b/src/revocation/gnunet-revocation-tvg.c index 29df1bb4d..13dee3529 100644 --- a/src/revocation/gnunet-revocation-tvg.c +++ b/src/revocation/gnunet-revocation-tvg.c | |||
@@ -65,15 +65,16 @@ run (void *cls, | |||
65 | const char *cfgfile, | 65 | const char *cfgfile, |
66 | const struct GNUNET_CONFIGURATION_Handle *cfg) | 66 | const struct GNUNET_CONFIGURATION_Handle *cfg) |
67 | { | 67 | { |
68 | struct GNUNET_CRYPTO_EcdsaPrivateKey id_priv; | 68 | struct GNUNET_IDENTITY_PrivateKey id_priv; |
69 | struct GNUNET_CRYPTO_EcdsaPublicKey id_pub; | 69 | struct GNUNET_IDENTITY_PublicKey id_pub; |
70 | struct GNUNET_REVOCATION_PowP pow; | 70 | struct GNUNET_REVOCATION_PowP pow; |
71 | struct GNUNET_REVOCATION_PowCalculationHandle *ph; | 71 | struct GNUNET_REVOCATION_PowCalculationHandle *ph; |
72 | struct GNUNET_TIME_Relative exp; | 72 | struct GNUNET_TIME_Relative exp; |
73 | 73 | ||
74 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv); | 74 | id_priv.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA); |
75 | GNUNET_CRYPTO_ecdsa_key_get_public (&id_priv, | 75 | GNUNET_CRYPTO_ecdsa_key_create (&id_priv.ecdsa_key); |
76 | &id_pub); | 76 | GNUNET_IDENTITY_key_get_public (&id_priv, |
77 | &id_pub); | ||
77 | fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); | 78 | fprintf (stdout, "Zone private key (d, little-endian scalar):\n"); |
78 | print_bytes (&id_priv, sizeof(id_priv), 0); | 79 | print_bytes (&id_priv, sizeof(id_priv), 0); |
79 | fprintf (stdout, "\n"); | 80 | fprintf (stdout, "\n"); |
diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 0e1e482ab..2ba5d0420 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c | |||
@@ -101,7 +101,7 @@ static struct GNUNET_SCHEDULER_Task *pow_task; | |||
101 | /** | 101 | /** |
102 | * Proof-of-work object | 102 | * Proof-of-work object |
103 | */ | 103 | */ |
104 | static struct GNUNET_REVOCATION_PowP proof_of_work; | 104 | static struct GNUNET_REVOCATION_PowP *proof_of_work; |
105 | 105 | ||
106 | /** | 106 | /** |
107 | * Function run if the user aborts with CTRL-C. | 107 | * Function run if the user aborts with CTRL-C. |
@@ -325,8 +325,8 @@ calculate_pow (void *cls) | |||
325 | static void | 325 | static void |
326 | ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 326 | ego_callback (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
327 | { | 327 | { |
328 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | 328 | struct GNUNET_IDENTITY_PublicKey key; |
329 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 329 | const struct GNUNET_IDENTITY_PrivateKey *privkey; |
330 | struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL; | 330 | struct GNUNET_REVOCATION_PowCalculationHandle *ph = NULL; |
331 | 331 | ||
332 | el = NULL; | 332 | el = NULL; |
@@ -403,15 +403,14 @@ run (void *cls, | |||
403 | const char *cfgfile, | 403 | const char *cfgfile, |
404 | const struct GNUNET_CONFIGURATION_Handle *c) | 404 | const struct GNUNET_CONFIGURATION_Handle *c) |
405 | { | 405 | { |
406 | struct GNUNET_CRYPTO_EcdsaPublicKey pk; | 406 | struct GNUNET_IDENTITY_PublicKey pk; |
407 | 407 | ||
408 | cfg = c; | 408 | cfg = c; |
409 | if (NULL != test_ego) | 409 | if (NULL != test_ego) |
410 | { | 410 | { |
411 | if (GNUNET_OK != | 411 | if (GNUNET_OK != |
412 | GNUNET_CRYPTO_ecdsa_public_key_from_string (test_ego, | 412 | GNUNET_IDENTITY_public_key_from_string (test_ego, |
413 | strlen (test_ego), | 413 | &pk)) |
414 | &pk)) | ||
415 | { | 414 | { |
416 | fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego); | 415 | fprintf (stderr, _ ("Public key `%s' malformed\n"), test_ego); |
417 | return; | 416 | return; |
diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index ddebb38ad..56ec9f489 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c | |||
@@ -172,7 +172,8 @@ new_peer_entry (const struct GNUNET_PeerIdentity *peer) | |||
172 | static int | 172 | static int |
173 | verify_revoke_message (const struct RevokeMessage *rm) | 173 | verify_revoke_message (const struct RevokeMessage *rm) |
174 | { | 174 | { |
175 | if (GNUNET_YES != GNUNET_REVOCATION_check_pow (&rm->proof_of_work, | 175 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
176 | if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow, | ||
176 | (unsigned | 177 | (unsigned |
177 | int) revocation_work_required, | 178 | int) revocation_work_required, |
178 | epoch_duration)) | 179 | epoch_duration)) |
@@ -236,7 +237,7 @@ handle_query_message (void *cls, | |||
236 | int res; | 237 | int res; |
237 | 238 | ||
238 | GNUNET_CRYPTO_hash (&qm->key, | 239 | GNUNET_CRYPTO_hash (&qm->key, |
239 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 240 | sizeof(struct GNUNET_IDENTITY_PublicKey), |
240 | &hc); | 241 | &hc); |
241 | res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, | 242 | res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, |
242 | &hc); | 243 | &hc); |
@@ -276,9 +277,11 @@ do_flood (void *cls, | |||
276 | return GNUNET_OK; /* peer connected to us via SET, | 277 | return GNUNET_OK; /* peer connected to us via SET, |
277 | but we have no direct CORE | 278 | but we have no direct CORE |
278 | connection for flooding */ | 279 | connection for flooding */ |
279 | e = GNUNET_MQ_msg (cp, | 280 | e = GNUNET_MQ_msg_extra (cp, |
281 | htonl (rm->pow_size), | ||
280 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | 282 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); |
281 | *cp = *rm; | 283 | *cp = *rm; |
284 | memcpy (&cp[1], &rm[1], htonl (rm->pow_size)); | ||
282 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 285 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
283 | "Flooding revocation to `%s'\n", | 286 | "Flooding revocation to `%s'\n", |
284 | GNUNET_i2s (target)); | 287 | GNUNET_i2s (target)); |
@@ -304,8 +307,9 @@ publicize_rm (const struct RevokeMessage *rm) | |||
304 | struct GNUNET_HashCode hc; | 307 | struct GNUNET_HashCode hc; |
305 | struct GNUNET_SETU_Element e; | 308 | struct GNUNET_SETU_Element e; |
306 | 309 | ||
307 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 310 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
308 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 311 | GNUNET_CRYPTO_hash (&pow->key, |
312 | sizeof(struct GNUNET_IDENTITY_PublicKey), | ||
309 | &hc); | 313 | &hc); |
310 | if (GNUNET_YES == | 314 | if (GNUNET_YES == |
311 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, | 315 | GNUNET_CONTAINER_multihashmap_contains (revocation_map, |
@@ -371,6 +375,23 @@ publicize_rm (const struct RevokeMessage *rm) | |||
371 | } | 375 | } |
372 | 376 | ||
373 | 377 | ||
378 | static int | ||
379 | check_revoke_message (void *cls, | ||
380 | const struct RevokeMessage *rm) | ||
381 | { | ||
382 | uint16_t size; | ||
383 | |||
384 | size = ntohs (rm->header.size); | ||
385 | if (size <= sizeof(struct RevokeMessage)) | ||
386 | { | ||
387 | GNUNET_break (0); | ||
388 | return GNUNET_SYSERR; | ||
389 | } | ||
390 | return GNUNET_OK; | ||
391 | |||
392 | } | ||
393 | |||
394 | |||
374 | /** | 395 | /** |
375 | * Handle REVOKE message from client. | 396 | * Handle REVOKE message from client. |
376 | * | 397 | * |
@@ -403,6 +424,23 @@ handle_revoke_message (void *cls, | |||
403 | } | 424 | } |
404 | 425 | ||
405 | 426 | ||
427 | static int | ||
428 | check_p2p_revoke (void *cls, | ||
429 | const struct RevokeMessage *rm) | ||
430 | { | ||
431 | uint16_t size; | ||
432 | |||
433 | size = ntohs (rm->header.size); | ||
434 | if (size <= sizeof(struct RevokeMessage)) | ||
435 | { | ||
436 | GNUNET_break (0); | ||
437 | return GNUNET_SYSERR; | ||
438 | } | ||
439 | return GNUNET_OK; | ||
440 | |||
441 | } | ||
442 | |||
443 | |||
406 | /** | 444 | /** |
407 | * Core handler for flooded revocation messages. | 445 | * Core handler for flooded revocation messages. |
408 | * | 446 | * |
@@ -784,10 +822,10 @@ run (void *cls, | |||
784 | struct GNUNET_SERVICE_Handle *service) | 822 | struct GNUNET_SERVICE_Handle *service) |
785 | { | 823 | { |
786 | struct GNUNET_MQ_MessageHandler core_handlers[] = { | 824 | struct GNUNET_MQ_MessageHandler core_handlers[] = { |
787 | GNUNET_MQ_hd_fixed_size (p2p_revoke, | 825 | GNUNET_MQ_hd_var_size (p2p_revoke, |
788 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, | 826 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, |
789 | struct RevokeMessage, | 827 | struct RevokeMessage, |
790 | NULL), | 828 | NULL), |
791 | GNUNET_MQ_handler_end () | 829 | GNUNET_MQ_handler_end () |
792 | }; | 830 | }; |
793 | char *fn; | 831 | char *fn; |
@@ -892,9 +930,10 @@ run (void *cls, | |||
892 | GNUNET_free (fn); | 930 | GNUNET_free (fn); |
893 | return; | 931 | return; |
894 | } | 932 | } |
895 | GNUNET_break (0 == ntohl (rm->reserved)); | 933 | struct GNUNET_REVOCATION_PowP *pow = (struct |
896 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 934 | GNUNET_REVOCATION_PowP *) &rm[1]; |
897 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 935 | GNUNET_CRYPTO_hash (&pow->key, |
936 | sizeof(struct GNUNET_IDENTITY_PublicKey), | ||
898 | &hc); | 937 | &hc); |
899 | GNUNET_break (GNUNET_OK == | 938 | GNUNET_break (GNUNET_OK == |
900 | GNUNET_CONTAINER_multihashmap_put (revocation_map, | 939 | GNUNET_CONTAINER_multihashmap_put (revocation_map, |
@@ -939,10 +978,10 @@ GNUNET_SERVICE_MAIN | |||
939 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY, | 978 | GNUNET_MESSAGE_TYPE_REVOCATION_QUERY, |
940 | struct QueryMessage, | 979 | struct QueryMessage, |
941 | NULL), | 980 | NULL), |
942 | GNUNET_MQ_hd_fixed_size (revoke_message, | 981 | GNUNET_MQ_hd_var_size (revoke_message, |
943 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, | 982 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE, |
944 | struct RevokeMessage, | 983 | struct RevokeMessage, |
945 | NULL), | 984 | NULL), |
946 | GNUNET_MQ_handler_end ()); | 985 | GNUNET_MQ_handler_end ()); |
947 | 986 | ||
948 | 987 | ||
diff --git a/src/revocation/plugin_block_revocation.c b/src/revocation/plugin_block_revocation.c index 291c56f70..ba3c33b6f 100644 --- a/src/revocation/plugin_block_revocation.c +++ b/src/revocation/plugin_block_revocation.c | |||
@@ -143,16 +143,16 @@ block_plugin_revocation_evaluate (void *cls, | |||
143 | GNUNET_break_op (0); | 143 | GNUNET_break_op (0); |
144 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 144 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
145 | } | 145 | } |
146 | if (0 >= | 146 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
147 | GNUNET_REVOCATION_check_pow (&rm->proof_of_work, | 147 | if (GNUNET_YES != GNUNET_REVOCATION_check_pow (pow, |
148 | ic->matching_bits, | 148 | ic->matching_bits, |
149 | ic->epoch_duration)) | 149 | ic->epoch_duration)) |
150 | { | 150 | { |
151 | GNUNET_break_op (0); | 151 | GNUNET_break_op (0); |
152 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; | 152 | return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; |
153 | } | 153 | } |
154 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 154 | GNUNET_CRYPTO_hash (&pow->key, |
155 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 155 | sizeof(struct GNUNET_IDENTITY_PublicKey), |
156 | &chash); | 156 | &chash); |
157 | if (GNUNET_YES == | 157 | if (GNUNET_YES == |
158 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, | 158 | GNUNET_BLOCK_GROUP_bf_test_and_set (group, |
@@ -182,13 +182,14 @@ block_plugin_revocation_get_key (void *cls, | |||
182 | { | 182 | { |
183 | const struct RevokeMessage *rm = block; | 183 | const struct RevokeMessage *rm = block; |
184 | 184 | ||
185 | if (block_size != sizeof(*rm)) | 185 | if (block_size <= sizeof(*rm)) |
186 | { | 186 | { |
187 | GNUNET_break_op (0); | 187 | GNUNET_break_op (0); |
188 | return GNUNET_SYSERR; | 188 | return GNUNET_SYSERR; |
189 | } | 189 | } |
190 | GNUNET_CRYPTO_hash (&rm->proof_of_work.key, | 190 | struct GNUNET_REVOCATION_PowP *pow = (struct GNUNET_REVOCATION_PowP *) &rm[1]; |
191 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), | 191 | GNUNET_CRYPTO_hash (&pow->key, |
192 | sizeof(struct GNUNET_IDENTITY_PublicKey), | ||
192 | key); | 193 | key); |
193 | return GNUNET_OK; | 194 | return GNUNET_OK; |
194 | } | 195 | } |
diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h index 635c56cfc..c3a9c9e6b 100644 --- a/src/revocation/revocation.h +++ b/src/revocation/revocation.h | |||
@@ -49,7 +49,7 @@ struct QueryMessage | |||
49 | /** | 49 | /** |
50 | * Key to check. | 50 | * Key to check. |
51 | */ | 51 | */ |
52 | struct GNUNET_CRYPTO_EcdsaPublicKey key; | 52 | struct GNUNET_IDENTITY_PublicKey key; |
53 | }; | 53 | }; |
54 | 54 | ||
55 | 55 | ||
@@ -85,14 +85,11 @@ struct RevokeMessage | |||
85 | struct GNUNET_MessageHeader header; | 85 | struct GNUNET_MessageHeader header; |
86 | 86 | ||
87 | /** | 87 | /** |
88 | * For alignment. | 88 | * Length of PoW with signature. |
89 | */ | 89 | */ |
90 | uint32_t reserved GNUNET_PACKED; | 90 | uint32_t pow_size GNUNET_PACKED; |
91 | 91 | ||
92 | /** | 92 | /** Followed by the PoW **/ |
93 | * Number that causes a hash collision with the @e public_key. | ||
94 | */ | ||
95 | struct GNUNET_REVOCATION_PowP proof_of_work; | ||
96 | }; | 93 | }; |
97 | 94 | ||
98 | 95 | ||
diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index 75cfd8761..34529df35 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c | |||
@@ -160,7 +160,7 @@ handle_revocation_query_response (void *cls, | |||
160 | */ | 160 | */ |
161 | struct GNUNET_REVOCATION_Query * | 161 | struct GNUNET_REVOCATION_Query * |
162 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, | 162 | GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, |
163 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key, | 163 | const struct GNUNET_IDENTITY_PublicKey *key, |
164 | GNUNET_REVOCATION_Callback func, | 164 | GNUNET_REVOCATION_Callback func, |
165 | void *func_cls) | 165 | void *func_cls) |
166 | { | 166 | { |
@@ -359,10 +359,12 @@ GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, | |||
359 | } | 359 | } |
360 | h->func = func; | 360 | h->func = func; |
361 | h->func_cls = func_cls; | 361 | h->func_cls = func_cls; |
362 | env = GNUNET_MQ_msg (rm, | 362 | size_t extra_len = ntohl (pow->sig_len) + sizeof (*pow); |
363 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); | 363 | env = GNUNET_MQ_msg_extra (rm, |
364 | rm->reserved = htonl (0); | 364 | extra_len, |
365 | rm->proof_of_work = *pow; | 365 | GNUNET_MESSAGE_TYPE_REVOCATION_REVOKE); |
366 | rm->pow_size = htonl (extra_len); | ||
367 | memcpy (&rm[1], pow, extra_len); | ||
366 | GNUNET_MQ_send (h->mq, | 368 | GNUNET_MQ_send (h->mq, |
367 | env); | 369 | env); |
368 | return h; | 370 | return h; |
@@ -420,6 +422,46 @@ calculate_score (const struct GNUNET_REVOCATION_PowCalculationHandle *ph) | |||
420 | } | 422 | } |
421 | 423 | ||
422 | 424 | ||
425 | enum GNUNET_GenericReturnValue | ||
426 | check_signature_ecdsa (const struct GNUNET_REVOCATION_PowP *pow, | ||
427 | const struct GNUNET_CRYPTO_EcdsaPublicKey *key) | ||
428 | { | ||
429 | struct GNUNET_REVOCATION_SignaturePurposePS spurp; | ||
430 | struct GNUNET_CRYPTO_EcdsaSignature *sig; | ||
431 | |||
432 | spurp.key = pow->key; | ||
433 | spurp.timestamp = pow->timestamp; | ||
434 | spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | ||
435 | spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) | ||
436 | + sizeof(struct GNUNET_IDENTITY_PublicKey) | ||
437 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); | ||
438 | sig = (struct GNUNET_CRYPTO_EcdsaSignature *) &pow[1]; | ||
439 | if (GNUNET_OK != | ||
440 | GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, | ||
441 | &spurp.purpose, | ||
442 | sig, | ||
443 | key)) | ||
444 | { | ||
445 | return GNUNET_SYSERR; | ||
446 | } | ||
447 | return GNUNET_OK; | ||
448 | } | ||
449 | |||
450 | |||
451 | enum GNUNET_GenericReturnValue | ||
452 | check_signature (const struct GNUNET_REVOCATION_PowP *pow) | ||
453 | { | ||
454 | switch (ntohl (pow->key.type)) | ||
455 | { | ||
456 | case GNUNET_IDENTITY_TYPE_ECDSA: | ||
457 | return check_signature_ecdsa (pow, &pow->key.ecdsa_key); | ||
458 | default: | ||
459 | return GNUNET_SYSERR; | ||
460 | } | ||
461 | return GNUNET_SYSERR; | ||
462 | } | ||
463 | |||
464 | |||
423 | /** | 465 | /** |
424 | * Check if the given proof-of-work is valid. | 466 | * Check if the given proof-of-work is valid. |
425 | * | 467 | * |
@@ -433,10 +475,9 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
433 | unsigned int difficulty, | 475 | unsigned int difficulty, |
434 | struct GNUNET_TIME_Relative epoch_duration) | 476 | struct GNUNET_TIME_Relative epoch_duration) |
435 | { | 477 | { |
436 | char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 478 | char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) |
437 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) | 479 | + sizeof (struct GNUNET_TIME_AbsoluteNBO) |
438 | + sizeof (uint64_t)] GNUNET_ALIGN; | 480 | + sizeof (uint64_t)] GNUNET_ALIGN; |
439 | struct GNUNET_REVOCATION_SignaturePurposePS spurp; | ||
440 | struct GNUNET_HashCode result; | 481 | struct GNUNET_HashCode result; |
441 | struct GNUNET_TIME_Absolute ts; | 482 | struct GNUNET_TIME_Absolute ts; |
442 | struct GNUNET_TIME_Absolute exp; | 483 | struct GNUNET_TIME_Absolute exp; |
@@ -450,21 +491,11 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
450 | /** | 491 | /** |
451 | * Check if signature valid | 492 | * Check if signature valid |
452 | */ | 493 | */ |
453 | spurp.key = pow->key; | 494 | if (GNUNET_OK != check_signature (pow)) |
454 | spurp.timestamp = pow->timestamp; | ||
455 | spurp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | ||
456 | spurp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) | ||
457 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | ||
458 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); | ||
459 | if (GNUNET_OK != | ||
460 | GNUNET_CRYPTO_ecdsa_verify_ (GNUNET_SIGNATURE_PURPOSE_REVOCATION, | ||
461 | &spurp.purpose, | ||
462 | &pow->signature, | ||
463 | &pow->key)) | ||
464 | { | 495 | { |
465 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 496 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
466 | "Proof of work signature invalid!\n"); | 497 | "Proof of work signature invalid!\n"); |
467 | return GNUNET_NO; | 498 | return GNUNET_SYSERR; |
468 | } | 499 | } |
469 | 500 | ||
470 | /** | 501 | /** |
@@ -480,7 +511,7 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
480 | sizeof (uint64_t)); | 511 | sizeof (uint64_t)); |
481 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | 512 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], |
482 | &pow->key, | 513 | &pow->key, |
483 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); | 514 | sizeof(struct GNUNET_IDENTITY_PublicKey)); |
484 | for (unsigned int i = 0; i < POW_COUNT; i++) | 515 | for (unsigned int i = 0; i < POW_COUNT; i++) |
485 | { | 516 | { |
486 | pow_val = GNUNET_ntohll (pow->pow[i]); | 517 | pow_val = GNUNET_ntohll (pow->pow[i]); |
@@ -529,15 +560,9 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_REVOCATION_PowP *pow, | |||
529 | } | 560 | } |
530 | 561 | ||
531 | 562 | ||
532 | /** | 563 | enum GNUNET_GenericReturnValue |
533 | * Initializes a fresh PoW computation. | 564 | sign_pow_ecdsa (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
534 | * | 565 | struct GNUNET_REVOCATION_PowP *pow) |
535 | * @param key the key to calculate the PoW for. | ||
536 | * @param[out] pow starting point for PoW calculation (not yet valid) | ||
537 | */ | ||
538 | void | ||
539 | GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | ||
540 | struct GNUNET_REVOCATION_PowP *pow) | ||
541 | { | 566 | { |
542 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); | 567 | struct GNUNET_TIME_Absolute ts = GNUNET_TIME_absolute_get (); |
543 | struct GNUNET_REVOCATION_SignaturePurposePS rp; | 568 | struct GNUNET_REVOCATION_SignaturePurposePS rp; |
@@ -553,14 +578,44 @@ GNUNET_REVOCATION_pow_init (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, | |||
553 | rp.timestamp = pow->timestamp; | 578 | rp.timestamp = pow->timestamp; |
554 | rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); | 579 | rp.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); |
555 | rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) | 580 | rp.purpose.size = htonl (sizeof(struct GNUNET_CRYPTO_EccSignaturePurpose) |
556 | + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 581 | + sizeof(struct GNUNET_IDENTITY_PublicKey) |
557 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); | 582 | + sizeof (struct GNUNET_TIME_AbsoluteNBO)); |
558 | GNUNET_CRYPTO_ecdsa_key_get_public (key, &pow->key); | ||
559 | rp.key = pow->key; | 583 | rp.key = pow->key; |
560 | GNUNET_assert (GNUNET_OK == | 584 | pow->sig_len = htonl (sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); |
561 | GNUNET_CRYPTO_ecdsa_sign_ (key, | 585 | return GNUNET_CRYPTO_ecdsa_sign_ (key, |
562 | &rp.purpose, | 586 | &rp.purpose, |
563 | &pow->signature)); | 587 | (void*) &pow[1]); |
588 | |||
589 | } | ||
590 | |||
591 | |||
592 | enum GNUNET_GenericReturnValue | ||
593 | sign_pow (const struct GNUNET_IDENTITY_PrivateKey *key, | ||
594 | struct GNUNET_REVOCATION_PowP *pow) | ||
595 | { | ||
596 | GNUNET_IDENTITY_key_get_public (key, &pow->key); | ||
597 | switch (ntohl (pow->key.type)) | ||
598 | { | ||
599 | case GNUNET_IDENTITY_TYPE_ECDSA: | ||
600 | return sign_pow_ecdsa (&key->ecdsa_key, pow); | ||
601 | default: | ||
602 | return GNUNET_NO; | ||
603 | } | ||
604 | return GNUNET_NO; | ||
605 | } | ||
606 | |||
607 | |||
608 | /** | ||
609 | * Initializes a fresh PoW computation. | ||
610 | * | ||
611 | * @param key the key to calculate the PoW for. | ||
612 | * @param[out] pow starting point for PoW calculation (not yet valid) | ||
613 | */ | ||
614 | void | ||
615 | GNUNET_REVOCATION_pow_init (const struct GNUNET_IDENTITY_PrivateKey *key, | ||
616 | struct GNUNET_REVOCATION_PowP *pow) | ||
617 | { | ||
618 | GNUNET_assert (GNUNET_OK == sign_pow (key, pow)); | ||
564 | } | 619 | } |
565 | 620 | ||
566 | 621 | ||
@@ -622,7 +677,7 @@ cmp_pow_value (const void *a, const void *b) | |||
622 | enum GNUNET_GenericReturnValue | 677 | enum GNUNET_GenericReturnValue |
623 | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | 678 | GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) |
624 | { | 679 | { |
625 | char buf[sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey) | 680 | char buf[sizeof(struct GNUNET_IDENTITY_PublicKey) |
626 | + sizeof (uint64_t) | 681 | + sizeof (uint64_t) |
627 | + sizeof (uint64_t)] GNUNET_ALIGN; | 682 | + sizeof (uint64_t)] GNUNET_ALIGN; |
628 | struct GNUNET_HashCode result; | 683 | struct GNUNET_HashCode result; |
@@ -645,7 +700,7 @@ GNUNET_REVOCATION_pow_round (struct GNUNET_REVOCATION_PowCalculationHandle *pc) | |||
645 | sizeof (uint64_t)); | 700 | sizeof (uint64_t)); |
646 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], | 701 | GNUNET_memcpy (&buf[sizeof(uint64_t) * 2], |
647 | &pc->pow->key, | 702 | &pc->pow->key, |
648 | sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey)); | 703 | sizeof(struct GNUNET_IDENTITY_PublicKey)); |
649 | GNUNET_CRYPTO_pow_hash (&salt, | 704 | GNUNET_CRYPTO_pow_hash (&salt, |
650 | buf, | 705 | buf, |
651 | sizeof(buf), | 706 | sizeof(buf), |
diff --git a/src/revocation/test_revocation.c b/src/revocation/test_revocation.c index b65567d79..58fcf2e76 100644 --- a/src/revocation/test_revocation.c +++ b/src/revocation/test_revocation.c | |||
@@ -38,8 +38,8 @@ struct TestPeer | |||
38 | struct GNUNET_TESTBED_Operation *core_op; | 38 | struct GNUNET_TESTBED_Operation *core_op; |
39 | struct GNUNET_IDENTITY_Handle *idh; | 39 | struct GNUNET_IDENTITY_Handle *idh; |
40 | const struct GNUNET_CONFIGURATION_Handle *cfg; | 40 | const struct GNUNET_CONFIGURATION_Handle *cfg; |
41 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 41 | const struct GNUNET_IDENTITY_PrivateKey *privkey; |
42 | struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; | 42 | struct GNUNET_IDENTITY_PublicKey pubkey; |
43 | struct GNUNET_CRYPTO_EcdsaSignature sig; | 43 | struct GNUNET_CRYPTO_EcdsaSignature sig; |
44 | struct GNUNET_IDENTITY_Operation *create_id_op; | 44 | struct GNUNET_IDENTITY_Operation *create_id_op; |
45 | struct GNUNET_IDENTITY_EgoLookup *ego_lookup; | 45 | struct GNUNET_IDENTITY_EgoLookup *ego_lookup; |
@@ -142,13 +142,13 @@ revocation_cb (void *cls, enum GNUNET_GenericReturnValue is_valid) | |||
142 | } | 142 | } |
143 | 143 | ||
144 | 144 | ||
145 | static struct GNUNET_REVOCATION_PowP proof_of_work; | 145 | static struct GNUNET_REVOCATION_PowP *proof_of_work; |
146 | 146 | ||
147 | static void | 147 | static void |
148 | ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 148 | ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
149 | { | 149 | { |
150 | static int completed = 0; | 150 | static int completed = 0; |
151 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 151 | const struct GNUNET_IDENTITY_PrivateKey *privkey; |
152 | 152 | ||
153 | if ((NULL != ego) && (cls == &testpeers[0])) | 153 | if ((NULL != ego) && (cls == &testpeers[0])) |
154 | { | 154 | { |
@@ -164,10 +164,11 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
164 | GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); | 164 | GNUNET_IDENTITY_ego_get_public_key (ego, &testpeers[1].pubkey); |
165 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); | 165 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Calculating proof of work...\n"); |
166 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 166 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
167 | memset (&proof_of_work, 0, sizeof (proof_of_work)); | 167 | proof_of_work = GNUNET_malloc (sizeof (struct GNUNET_REVOCATION_PowP) + |
168 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); | ||
168 | GNUNET_REVOCATION_pow_init (privkey, | 169 | GNUNET_REVOCATION_pow_init (privkey, |
169 | &proof_of_work); | 170 | proof_of_work); |
170 | testpeers[1].pow = GNUNET_REVOCATION_pow_start (&proof_of_work, | 171 | testpeers[1].pow = GNUNET_REVOCATION_pow_start (proof_of_work, |
171 | 1, | 172 | 1, |
172 | 5); | 173 | 5); |
173 | int res = | 174 | int res = |
@@ -184,7 +185,7 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
184 | { | 185 | { |
185 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); | 186 | GNUNET_log (GNUNET_ERROR_TYPE_INFO, "Egos retrieved\n"); |
186 | testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, | 187 | testpeers[1].revok_handle = GNUNET_REVOCATION_revoke (testpeers[1].cfg, |
187 | &proof_of_work, | 188 | proof_of_work, |
188 | &revocation_cb, | 189 | &revocation_cb, |
189 | NULL); | 190 | NULL); |
190 | GNUNET_REVOCATION_pow_stop (testpeers[1].pow); | 191 | GNUNET_REVOCATION_pow_stop (testpeers[1].pow); |
@@ -194,7 +195,7 @@ ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
194 | 195 | ||
195 | static void | 196 | static void |
196 | identity_create_cb (void *cls, | 197 | identity_create_cb (void *cls, |
197 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, | 198 | const struct GNUNET_IDENTITY_PrivateKey *pk, |
198 | const char *emsg) | 199 | const char *emsg) |
199 | { | 200 | { |
200 | static int completed = 0; | 201 | static int completed = 0; |
@@ -238,11 +239,13 @@ identity_completion_cb (void *cls, | |||
238 | testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh, | 239 | testpeers[0].create_id_op = GNUNET_IDENTITY_create (testpeers[0].idh, |
239 | "client", | 240 | "client", |
240 | NULL, | 241 | NULL, |
242 | GNUNET_IDENTITY_TYPE_ECDSA, | ||
241 | &identity_create_cb, | 243 | &identity_create_cb, |
242 | &testpeers[0]); | 244 | &testpeers[0]); |
243 | testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh, | 245 | testpeers[1].create_id_op = GNUNET_IDENTITY_create (testpeers[1].idh, |
244 | "toberevoked", | 246 | "toberevoked", |
245 | NULL, | 247 | NULL, |
248 | GNUNET_IDENTITY_TYPE_ECDSA, | ||
246 | &identity_create_cb, | 249 | &identity_create_cb, |
247 | &testpeers[1]); | 250 | &testpeers[1]); |
248 | } | 251 | } |