diff options
Diffstat (limited to 'src/namestore/namestore_api_common.c')
-rw-r--r-- | src/namestore/namestore_api_common.c | 68 |
1 files changed, 34 insertions, 34 deletions
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index 8cf75330c..81662a861 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -98,13 +98,13 @@ GNUNET_NAMESTORE_normalize_string (const char *src) | |||
98 | * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s | 98 | * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s |
99 | */ | 99 | */ |
100 | const char * | 100 | const char * |
101 | GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z) | 101 | GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z) |
102 | { | 102 | { |
103 | static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; | 103 | static char buf[sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) * 8]; |
104 | char *end; | 104 | char *end; |
105 | 105 | ||
106 | end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, | 106 | end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, |
107 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 107 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
108 | buf, sizeof (buf)); | 108 | buf, sizeof (buf)); |
109 | if (NULL == end) | 109 | if (NULL == end) |
110 | { | 110 | { |
@@ -342,18 +342,18 @@ static void | |||
342 | derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | 342 | derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, |
343 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, | 343 | struct GNUNET_CRYPTO_SymmetricSessionKey *skey, |
344 | const char *label, | 344 | const char *label, |
345 | const struct GNUNET_CRYPTO_EccPublicSignKey *pub) | 345 | const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) |
346 | { | 346 | { |
347 | static const char ctx_key[] = "gns-aes-ctx-key"; | 347 | static const char ctx_key[] = "gns-aes-ctx-key"; |
348 | static const char ctx_iv[] = "gns-aes-ctx-iv"; | 348 | static const char ctx_iv[] = "gns-aes-ctx-iv"; |
349 | 349 | ||
350 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), | 350 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), |
351 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 351 | pub, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
352 | label, strlen (label), | 352 | label, strlen (label), |
353 | ctx_key, strlen (ctx_key), | 353 | ctx_key, strlen (ctx_key), |
354 | NULL, 0); | 354 | NULL, 0); |
355 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), | 355 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), |
356 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), | 356 | pub, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), |
357 | label, strlen (label), | 357 | label, strlen (label), |
358 | ctx_iv, strlen (ctx_iv), | 358 | ctx_iv, strlen (ctx_iv), |
359 | NULL, 0); | 359 | NULL, 0); |
@@ -371,7 +371,7 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, | |||
371 | * @return NULL on error (block too large) | 371 | * @return NULL on error (block too large) |
372 | */ | 372 | */ |
373 | struct GNUNET_NAMESTORE_Block * | 373 | struct GNUNET_NAMESTORE_Block * |
374 | GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | 374 | GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, |
375 | struct GNUNET_TIME_Absolute expire, | 375 | struct GNUNET_TIME_Absolute expire, |
376 | const char *label, | 376 | const char *label, |
377 | const struct GNUNET_NAMESTORE_RecordData *rd, | 377 | const struct GNUNET_NAMESTORE_RecordData *rd, |
@@ -380,8 +380,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
380 | size_t payload_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); | 380 | size_t payload_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); |
381 | char payload[sizeof (uint32_t) + payload_len]; | 381 | char payload[sizeof (uint32_t) + payload_len]; |
382 | struct GNUNET_NAMESTORE_Block *block; | 382 | struct GNUNET_NAMESTORE_Block *block; |
383 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; | 383 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
384 | struct GNUNET_CRYPTO_EccPrivateKey *dkey; | 384 | struct GNUNET_CRYPTO_EcdsaPrivateKey *dkey; |
385 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; | 385 | struct GNUNET_CRYPTO_SymmetricInitializationVector iv; |
386 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; | 386 | struct GNUNET_CRYPTO_SymmetricSessionKey skey; |
387 | uint32_t rd_count_nbo; | 387 | uint32_t rd_count_nbo; |
@@ -400,12 +400,12 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
400 | sizeof (struct GNUNET_TIME_AbsoluteNBO)); | 400 | sizeof (struct GNUNET_TIME_AbsoluteNBO)); |
401 | block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); | 401 | block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); |
402 | block->expiration_time = GNUNET_TIME_absolute_hton (expire); | 402 | block->expiration_time = GNUNET_TIME_absolute_hton (expire); |
403 | dkey = GNUNET_CRYPTO_ecc_key_derive (key, | 403 | dkey = GNUNET_CRYPTO_ecdsa_private_key_derive (key, |
404 | label, | 404 | label, |
405 | "gns"); | 405 | "gns"); |
406 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (dkey, | 406 | GNUNET_CRYPTO_ecdsa_key_get_public (dkey, |
407 | &block->derived_key); | 407 | &block->derived_key); |
408 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, | 408 | GNUNET_CRYPTO_ecdsa_key_get_public (key, |
409 | &pkey); | 409 | &pkey); |
410 | derive_block_aes_key (&iv, &skey, label, &pkey); | 410 | derive_block_aes_key (&iv, &skey, label, &pkey); |
411 | GNUNET_break (payload_len + sizeof (uint32_t) == | 411 | GNUNET_break (payload_len + sizeof (uint32_t) == |
@@ -413,7 +413,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
413 | &skey, &iv, | 413 | &skey, &iv, |
414 | &block[1])); | 414 | &block[1])); |
415 | if (GNUNET_OK != | 415 | if (GNUNET_OK != |
416 | GNUNET_CRYPTO_ecc_sign (dkey, | 416 | GNUNET_CRYPTO_ecdsa_sign (dkey, |
417 | &block->purpose, | 417 | &block->purpose, |
418 | &block->signature)) | 418 | &block->signature)) |
419 | { | 419 | { |
@@ -437,7 +437,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
437 | int | 437 | int |
438 | GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) | 438 | GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) |
439 | { | 439 | { |
440 | return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, | 440 | return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, |
441 | &block->purpose, | 441 | &block->purpose, |
442 | &block->signature, | 442 | &block->signature, |
443 | &block->derived_key); | 443 | &block->derived_key); |
@@ -457,7 +457,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) | |||
457 | */ | 457 | */ |
458 | int | 458 | int |
459 | GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, | 459 | GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, |
460 | const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, | 460 | const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, |
461 | const char *label, | 461 | const char *label, |
462 | GNUNET_NAMESTORE_RecordCallback proc, | 462 | GNUNET_NAMESTORE_RecordCallback proc, |
463 | void *proc_cls) | 463 | void *proc_cls) |
@@ -653,9 +653,9 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
653 | return NULL; | 653 | return NULL; |
654 | return GNUNET_strdup (tmp); | 654 | return GNUNET_strdup (tmp); |
655 | case GNUNET_NAMESTORE_TYPE_PKEY: | 655 | case GNUNET_NAMESTORE_TYPE_PKEY: |
656 | if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) | 656 | if (data_size != sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) |
657 | return NULL; | 657 | return NULL; |
658 | return GNUNET_CRYPTO_ecc_public_sign_key_to_string (data); | 658 | return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); |
659 | case GNUNET_NAMESTORE_TYPE_PHONE: | 659 | case GNUNET_NAMESTORE_TYPE_PHONE: |
660 | { | 660 | { |
661 | const struct GNUNET_CONVERSATION_PhoneRecord *pr; | 661 | const struct GNUNET_CONVERSATION_PhoneRecord *pr; |
@@ -667,7 +667,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
667 | pr = data; | 667 | pr = data; |
668 | if (0 != ntohl (pr->version)) | 668 | if (0 != ntohl (pr->version)) |
669 | return NULL; | 669 | return NULL; |
670 | pkey = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pr->peer.public_key); | 670 | pkey = GNUNET_CRYPTO_eddsa_public_key_to_string (&pr->peer.public_key); |
671 | GNUNET_asprintf (&ret, | 671 | GNUNET_asprintf (&ret, |
672 | "%u-%s", | 672 | "%u-%s", |
673 | ntohl (pr->line), | 673 | ntohl (pr->line), |
@@ -792,7 +792,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
792 | { | 792 | { |
793 | struct in_addr value_a; | 793 | struct in_addr value_a; |
794 | struct in6_addr value_aaaa; | 794 | struct in6_addr value_aaaa; |
795 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; | 795 | struct GNUNET_CRYPTO_EcdsaPublicKey pkey; |
796 | struct GNUNET_TUN_GnsVpnRecord *vpn; | 796 | struct GNUNET_TUN_GnsVpnRecord *vpn; |
797 | struct GNUNET_TUN_DnsTlsaRecord *tlsa; | 797 | struct GNUNET_TUN_DnsTlsaRecord *tlsa; |
798 | char s_peer[103 + 1]; | 798 | char s_peer[103 + 1]; |
@@ -987,16 +987,16 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
987 | return GNUNET_OK; | 987 | return GNUNET_OK; |
988 | case GNUNET_NAMESTORE_TYPE_PKEY: | 988 | case GNUNET_NAMESTORE_TYPE_PKEY: |
989 | if (GNUNET_OK != | 989 | if (GNUNET_OK != |
990 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (s, strlen (s), &pkey)) | 990 | GNUNET_CRYPTO_ecdsa_public_key_from_string (s, strlen (s), &pkey)) |
991 | { | 991 | { |
992 | LOG (GNUNET_ERROR_TYPE_ERROR, | 992 | LOG (GNUNET_ERROR_TYPE_ERROR, |
993 | _("Unable to parse PKEY record `%s'\n"), | 993 | _("Unable to parse PKEY record `%s'\n"), |
994 | s); | 994 | s); |
995 | return GNUNET_SYSERR; | 995 | return GNUNET_SYSERR; |
996 | } | 996 | } |
997 | *data = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey); | 997 | *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); |
998 | memcpy (*data, &pkey, sizeof (pkey)); | 998 | memcpy (*data, &pkey, sizeof (pkey)); |
999 | *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); | 999 | *data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); |
1000 | return GNUNET_OK; | 1000 | return GNUNET_OK; |
1001 | case GNUNET_NAMESTORE_TYPE_PHONE: | 1001 | case GNUNET_NAMESTORE_TYPE_PHONE: |
1002 | { | 1002 | { |
@@ -1008,7 +1008,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
1008 | if ( (NULL == (dash = strchr (s, '-'))) || | 1008 | if ( (NULL == (dash = strchr (s, '-'))) || |
1009 | (1 != sscanf (s, "%u-", &line)) || | 1009 | (1 != sscanf (s, "%u-", &line)) || |
1010 | (GNUNET_OK != | 1010 | (GNUNET_OK != |
1011 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, | 1011 | GNUNET_CRYPTO_eddsa_public_key_from_string (dash + 1, |
1012 | strlen (dash + 1), | 1012 | strlen (dash + 1), |
1013 | &peer.public_key)) ) | 1013 | &peer.public_key)) ) |
1014 | { | 1014 | { |
@@ -1044,7 +1044,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
1044 | } | 1044 | } |
1045 | *data_size = sizeof (struct GNUNET_TUN_GnsVpnRecord) + strlen (s_serv) + 1; | 1045 | *data_size = sizeof (struct GNUNET_TUN_GnsVpnRecord) + strlen (s_serv) + 1; |
1046 | *data = vpn = GNUNET_malloc (*data_size); | 1046 | *data = vpn = GNUNET_malloc (*data_size); |
1047 | if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string ((char*) s_peer, | 1047 | if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string ((char*) s_peer, |
1048 | strlen (s_peer), | 1048 | strlen (s_peer), |
1049 | &vpn->peer.public_key)) | 1049 | &vpn->peer.public_key)) |
1050 | { | 1050 | { |
@@ -1194,13 +1194,13 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd) | |||
1194 | * @param query hash to use for the query | 1194 | * @param query hash to use for the query |
1195 | */ | 1195 | */ |
1196 | void | 1196 | void |
1197 | GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *zone, | 1197 | GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, |
1198 | const char *label, | 1198 | const char *label, |
1199 | struct GNUNET_HashCode *query) | 1199 | struct GNUNET_HashCode *query) |
1200 | { | 1200 | { |
1201 | struct GNUNET_CRYPTO_EccPublicSignKey pub; | 1201 | struct GNUNET_CRYPTO_EcdsaPublicKey pub; |
1202 | 1202 | ||
1203 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (zone, &pub); | 1203 | GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); |
1204 | GNUNET_NAMESTORE_query_from_public_key (&pub, label, query); | 1204 | GNUNET_NAMESTORE_query_from_public_key (&pub, label, query); |
1205 | } | 1205 | } |
1206 | 1206 | ||
@@ -1213,13 +1213,13 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe | |||
1213 | * @param query hash to use for the query | 1213 | * @param query hash to use for the query |
1214 | */ | 1214 | */ |
1215 | void | 1215 | void |
1216 | GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, | 1216 | GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, |
1217 | const char *label, | 1217 | const char *label, |
1218 | struct GNUNET_HashCode *query) | 1218 | struct GNUNET_HashCode *query) |
1219 | { | 1219 | { |
1220 | struct GNUNET_CRYPTO_EccPublicSignKey pd; | 1220 | struct GNUNET_CRYPTO_EcdsaPublicKey pd; |
1221 | 1221 | ||
1222 | GNUNET_CRYPTO_ecc_public_key_derive (pub, label, "gns", &pd); | 1222 | GNUNET_CRYPTO_ecdsa_public_key_derive (pub, label, "gns", &pd); |
1223 | GNUNET_CRYPTO_hash (&pd, sizeof (pd), query); | 1223 | GNUNET_CRYPTO_hash (&pd, sizeof (pd), query); |
1224 | } | 1224 | } |
1225 | 1225 | ||
@@ -1235,12 +1235,12 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign | |||
1235 | * key in an encoding suitable for DNS labels. | 1235 | * key in an encoding suitable for DNS labels. |
1236 | */ | 1236 | */ |
1237 | const char * | 1237 | const char * |
1238 | GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey) | 1238 | GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) |
1239 | { | 1239 | { |
1240 | static char ret[128]; | 1240 | static char ret[128]; |
1241 | char *pkeys; | 1241 | char *pkeys; |
1242 | 1242 | ||
1243 | pkeys = GNUNET_CRYPTO_ecc_public_sign_key_to_string (pkey); | 1243 | pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); |
1244 | GNUNET_snprintf (ret, | 1244 | GNUNET_snprintf (ret, |
1245 | sizeof (ret), | 1245 | sizeof (ret), |
1246 | "%s.zkey", | 1246 | "%s.zkey", |
@@ -1261,7 +1261,7 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey | |||
1261 | */ | 1261 | */ |
1262 | int | 1262 | int |
1263 | GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, | 1263 | GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, |
1264 | struct GNUNET_CRYPTO_EccPublicSignKey *pkey) | 1264 | struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) |
1265 | { | 1265 | { |
1266 | char *cpy; | 1266 | char *cpy; |
1267 | char *dot; | 1267 | char *dot; |
@@ -1277,7 +1277,7 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, | |||
1277 | goto error; | 1277 | goto error; |
1278 | 1278 | ||
1279 | if (GNUNET_OK != | 1279 | if (GNUNET_OK != |
1280 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (x, | 1280 | GNUNET_CRYPTO_ecdsa_public_key_from_string (x, |
1281 | strlen (x), | 1281 | strlen (x), |
1282 | pkey)) | 1282 | pkey)) |
1283 | goto error; | 1283 | goto error; |