diff options
Diffstat (limited to 'src/namestore/namestore_api_common.c')
-rw-r--r-- | src/namestore/namestore_api_common.c | 44 |
1 files changed, 22 insertions, 22 deletions
diff --git a/src/namestore/namestore_api_common.c b/src/namestore/namestore_api_common.c index dec6acafe..f752b18c3 100644 --- a/src/namestore/namestore_api_common.c +++ b/src/namestore/namestore_api_common.c | |||
@@ -97,13 +97,13 @@ GNUNET_NAMESTORE_normalize_string (const char *src) | |||
97 | * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s | 97 | * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s |
98 | */ | 98 | */ |
99 | const char * | 99 | const char * |
100 | GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicKey *z) | 100 | GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z) |
101 | { | 101 | { |
102 | static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicKey) * 8]; | 102 | static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; |
103 | char *end; | 103 | char *end; |
104 | 104 | ||
105 | end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, | 105 | end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, |
106 | sizeof (struct GNUNET_CRYPTO_EccPublicKey), | 106 | sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), |
107 | buf, sizeof (buf)); | 107 | buf, sizeof (buf)); |
108 | if (NULL == end) | 108 | if (NULL == end) |
109 | { | 109 | { |
@@ -324,18 +324,18 @@ static void | |||
324 | derive_block_aes_key (struct GNUNET_CRYPTO_AesInitializationVector *iv, | 324 | derive_block_aes_key (struct GNUNET_CRYPTO_AesInitializationVector *iv, |
325 | struct GNUNET_CRYPTO_AesSessionKey *skey, | 325 | struct GNUNET_CRYPTO_AesSessionKey *skey, |
326 | const char *label, | 326 | const char *label, |
327 | const struct GNUNET_CRYPTO_EccPublicKey *pub) | 327 | const struct GNUNET_CRYPTO_EccPublicSignKey *pub) |
328 | { | 328 | { |
329 | static const char ctx_key[] = "gns-aes-ctx-key"; | 329 | static const char ctx_key[] = "gns-aes-ctx-key"; |
330 | static const char ctx_iv[] = "gns-aes-ctx-iv"; | 330 | static const char ctx_iv[] = "gns-aes-ctx-iv"; |
331 | 331 | ||
332 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), | 332 | GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_AesSessionKey), |
333 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicKey), | 333 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), |
334 | label, strlen (label), | 334 | label, strlen (label), |
335 | ctx_key, strlen (ctx_key), | 335 | ctx_key, strlen (ctx_key), |
336 | NULL, 0); | 336 | NULL, 0); |
337 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_AesInitializationVector), | 337 | GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_AesInitializationVector), |
338 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicKey), | 338 | pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), |
339 | label, strlen (label), | 339 | label, strlen (label), |
340 | ctx_iv, strlen (ctx_iv), | 340 | ctx_iv, strlen (ctx_iv), |
341 | NULL, 0); | 341 | NULL, 0); |
@@ -362,7 +362,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
362 | size_t payload_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); | 362 | size_t payload_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); |
363 | char payload[sizeof (uint32_t) + payload_len]; | 363 | char payload[sizeof (uint32_t) + payload_len]; |
364 | struct GNUNET_NAMESTORE_Block *block; | 364 | struct GNUNET_NAMESTORE_Block *block; |
365 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 365 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; |
366 | struct GNUNET_CRYPTO_EccPrivateKey *dkey; | 366 | struct GNUNET_CRYPTO_EccPrivateKey *dkey; |
367 | struct GNUNET_CRYPTO_AesInitializationVector iv; | 367 | struct GNUNET_CRYPTO_AesInitializationVector iv; |
368 | struct GNUNET_CRYPTO_AesSessionKey skey; | 368 | struct GNUNET_CRYPTO_AesSessionKey skey; |
@@ -385,9 +385,9 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, | |||
385 | dkey = GNUNET_CRYPTO_ecc_key_derive (key, | 385 | dkey = GNUNET_CRYPTO_ecc_key_derive (key, |
386 | label, | 386 | label, |
387 | "gns"); | 387 | "gns"); |
388 | GNUNET_CRYPTO_ecc_key_get_public (dkey, | 388 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (dkey, |
389 | &block->derived_key); | 389 | &block->derived_key); |
390 | GNUNET_CRYPTO_ecc_key_get_public (key, | 390 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, |
391 | &pkey); | 391 | &pkey); |
392 | derive_block_aes_key (&iv, &skey, label, &pkey); | 392 | derive_block_aes_key (&iv, &skey, label, &pkey); |
393 | GNUNET_break (payload_len + sizeof (uint32_t) == | 393 | GNUNET_break (payload_len + sizeof (uint32_t) == |
@@ -439,7 +439,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) | |||
439 | */ | 439 | */ |
440 | int | 440 | int |
441 | GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, | 441 | GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, |
442 | const struct GNUNET_CRYPTO_EccPublicKey *zone_key, | 442 | const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, |
443 | const char *label, | 443 | const char *label, |
444 | GNUNET_NAMESTORE_RecordCallback proc, | 444 | GNUNET_NAMESTORE_RecordCallback proc, |
445 | void *proc_cls) | 445 | void *proc_cls) |
@@ -580,7 +580,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, | |||
580 | return NULL; | 580 | return NULL; |
581 | return GNUNET_strdup (tmp); | 581 | return GNUNET_strdup (tmp); |
582 | case GNUNET_NAMESTORE_TYPE_PKEY: | 582 | case GNUNET_NAMESTORE_TYPE_PKEY: |
583 | if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicKey)) | 583 | if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) |
584 | return NULL; | 584 | return NULL; |
585 | return GNUNET_CRYPTO_ecc_public_key_to_string (data); | 585 | return GNUNET_CRYPTO_ecc_public_key_to_string (data); |
586 | case GNUNET_NAMESTORE_TYPE_PSEU: | 586 | case GNUNET_NAMESTORE_TYPE_PSEU: |
@@ -664,7 +664,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
664 | { | 664 | { |
665 | struct in_addr value_a; | 665 | struct in_addr value_a; |
666 | struct in6_addr value_aaaa; | 666 | struct in6_addr value_aaaa; |
667 | struct GNUNET_CRYPTO_EccPublicKey pkey; | 667 | struct GNUNET_CRYPTO_EccPublicSignKey pkey; |
668 | struct GNUNET_TUN_DnsSoaRecord *soa; | 668 | struct GNUNET_TUN_DnsSoaRecord *soa; |
669 | struct GNUNET_TUN_GnsVpnRecord *vpn; | 669 | struct GNUNET_TUN_GnsVpnRecord *vpn; |
670 | struct GNUNET_TUN_DnsTlsaRecord *tlsa; | 670 | struct GNUNET_TUN_DnsTlsaRecord *tlsa; |
@@ -769,16 +769,16 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, | |||
769 | return GNUNET_OK; | 769 | return GNUNET_OK; |
770 | case GNUNET_NAMESTORE_TYPE_PKEY: | 770 | case GNUNET_NAMESTORE_TYPE_PKEY: |
771 | if (GNUNET_OK != | 771 | if (GNUNET_OK != |
772 | GNUNET_CRYPTO_ecc_public_key_from_string (s, strlen (s), &pkey)) | 772 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (s, strlen (s), &pkey)) |
773 | { | 773 | { |
774 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, | 774 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, |
775 | _("Unable to parse PKEY record `%s'\n"), | 775 | _("Unable to parse PKEY record `%s'\n"), |
776 | s); | 776 | s); |
777 | return GNUNET_SYSERR; | 777 | return GNUNET_SYSERR; |
778 | } | 778 | } |
779 | *data = GNUNET_new (struct GNUNET_CRYPTO_EccPublicKey); | 779 | *data = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey); |
780 | memcpy (*data, &pkey, sizeof (pkey)); | 780 | memcpy (*data, &pkey, sizeof (pkey)); |
781 | *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicKey); | 781 | *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); |
782 | return GNUNET_OK; | 782 | return GNUNET_OK; |
783 | case GNUNET_NAMESTORE_TYPE_PSEU: | 783 | case GNUNET_NAMESTORE_TYPE_PSEU: |
784 | *data = GNUNET_strdup (s); | 784 | *data = GNUNET_strdup (s); |
@@ -928,9 +928,9 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe | |||
928 | const char *label, | 928 | const char *label, |
929 | struct GNUNET_HashCode *query) | 929 | struct GNUNET_HashCode *query) |
930 | { | 930 | { |
931 | struct GNUNET_CRYPTO_EccPublicKey pub; | 931 | struct GNUNET_CRYPTO_EccPublicSignKey pub; |
932 | 932 | ||
933 | GNUNET_CRYPTO_ecc_key_get_public (zone, &pub); | 933 | GNUNET_CRYPTO_ecc_key_get_public_for_signature (zone, &pub); |
934 | GNUNET_NAMESTORE_query_from_public_key (&pub, label, query); | 934 | GNUNET_NAMESTORE_query_from_public_key (&pub, label, query); |
935 | } | 935 | } |
936 | 936 | ||
@@ -943,11 +943,11 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe | |||
943 | * @param query hash to use for the query | 943 | * @param query hash to use for the query |
944 | */ | 944 | */ |
945 | void | 945 | void |
946 | GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicKey *pub, | 946 | GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, |
947 | const char *label, | 947 | const char *label, |
948 | struct GNUNET_HashCode *query) | 948 | struct GNUNET_HashCode *query) |
949 | { | 949 | { |
950 | struct GNUNET_CRYPTO_EccPublicKey pd; | 950 | struct GNUNET_CRYPTO_EccPublicSignKey pd; |
951 | 951 | ||
952 | GNUNET_CRYPTO_ecc_public_key_derive (pub, label, "gns", &pd); | 952 | GNUNET_CRYPTO_ecc_public_key_derive (pub, label, "gns", &pd); |
953 | GNUNET_CRYPTO_hash (&pd, sizeof (pd), query); | 953 | GNUNET_CRYPTO_hash (&pd, sizeof (pd), query); |
@@ -965,7 +965,7 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicKey | |||
965 | * key in an encoding suitable for DNS labels. | 965 | * key in an encoding suitable for DNS labels. |
966 | */ | 966 | */ |
967 | const char * | 967 | const char * |
968 | GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey) | 968 | GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey) |
969 | { | 969 | { |
970 | static char ret[128]; | 970 | static char ret[128]; |
971 | char *pkeys; | 971 | char *pkeys; |
@@ -991,7 +991,7 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey) | |||
991 | */ | 991 | */ |
992 | int | 992 | int |
993 | GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, | 993 | GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, |
994 | struct GNUNET_CRYPTO_EccPublicKey *pkey) | 994 | struct GNUNET_CRYPTO_EccPublicSignKey *pkey) |
995 | { | 995 | { |
996 | char *cpy; | 996 | char *cpy; |
997 | char *dot; | 997 | char *dot; |
@@ -1007,7 +1007,7 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, | |||
1007 | goto error; | 1007 | goto error; |
1008 | 1008 | ||
1009 | if (GNUNET_OK != | 1009 | if (GNUNET_OK != |
1010 | GNUNET_CRYPTO_ecc_public_key_from_string (x, | 1010 | GNUNET_CRYPTO_ecc_public_sign_key_from_string (x, |
1011 | strlen (x), | 1011 | strlen (x), |
1012 | pkey)) | 1012 | pkey)) |
1013 | goto error; | 1013 | goto error; |