From: Christian Grothoff Date: Thu, 10 Oct 2013 14:38:55 +0000 (+0000) Subject: separating ECC crypto into functions/structs for ECDHE, ECDSA and EDDSA X-Git-Tag: initial-import-from-subversion-38251~6621 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=9351b1e9bdf2b067b6db06562c26ba658cff42b8;p=oweals%2Fgnunet.git separating ECC crypto into functions/structs for ECDHE, ECDSA and EDDSA --- diff --git a/src/ats-tool/gnunet-ats.c b/src/ats-tool/gnunet-ats.c index 90523652d..a873ab0f2 100644 --- a/src/ats-tool/gnunet-ats.c +++ b/src/ats-tool/gnunet-ats.c @@ -352,7 +352,7 @@ testservice_ats (void *cls, if (NULL != pid_str) { - if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (pid_str, + if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (pid_str, strlen (pid_str), &pid.public_key)) { diff --git a/src/core/gnunet-service-core.c b/src/core/gnunet-service-core.c index ada9b7bd9..c6eeb070b 100644 --- a/src/core/gnunet-service-core.c +++ b/src/core/gnunet-service-core.c @@ -91,7 +91,7 @@ static void run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; char *keyfile; GSC_cfg = c; @@ -111,7 +111,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, NULL); GNUNET_SERVER_suspend (server); GSC_TYPEMAP_init (); - pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); + pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); GNUNET_free (keyfile); GNUNET_assert (NULL != pk); if ((GNUNET_OK != GSC_KX_init (pk)) || diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index a74b3ae74..25db9c750 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c @@ -90,7 +90,7 @@ struct EphemeralKeyMessage * An ECC signature of the 'origin' asserting the validity of * the given ephemeral key. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; /** * Information about what is being signed. @@ -111,7 +111,7 @@ struct EphemeralKeyMessage * Ephemeral public ECC key (always for NIST P-521) encoded in a format suitable * for network transmission as created using 'gcry_sexp_sprint'. */ - struct GNUNET_CRYPTO_EccPublicEncryptKey ephemeral_key; + struct GNUNET_CRYPTO_EcdhePublicKey ephemeral_key; /** * Public key of the signing peer (persistent version, not the ephemeral public key). @@ -377,12 +377,12 @@ struct GSC_KeyExchangeInfo /** * Our private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /** * Our ephemeral private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_ephemeral_key; +static struct GNUNET_CRYPTO_EcdhePrivateKey *my_ephemeral_key; /** * Current message we send for a key exchange. @@ -675,7 +675,7 @@ GSC_KX_start (const struct GNUNET_PeerIdentity *pid) kx); GNUNET_CRYPTO_hash (pid, sizeof (struct GNUNET_PeerIdentity), &h1); GNUNET_CRYPTO_hash (&GSC_my_identity, sizeof (struct GNUNET_PeerIdentity), &h2); - + if (0 < GNUNET_CRYPTO_hash_cmp (&h1, &h2)) { @@ -785,10 +785,10 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) || + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)) || (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, + GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY, &m->purpose, &m->signature, &m->origin_identity.public_key))) { @@ -810,7 +810,7 @@ GSC_KX_handle_ephemeral_key (struct GSC_KeyExchangeInfo *kx, } if (GNUNET_OK != GNUNET_CRYPTO_ecc_ecdh (my_ephemeral_key, - &m->ephemeral_key, + &m->ephemeral_key, &key_material)) { GNUNET_break (0); @@ -1478,8 +1478,8 @@ sign_ephemeral_key () current_ekm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + sizeof (struct GNUNET_TIME_AbsoluteNBO) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); current_ekm.creation_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); if (GNUNET_YES == GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, @@ -1493,11 +1493,11 @@ sign_ephemeral_key () { current_ekm.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_UNIT_FOREVER_ABS); } - GNUNET_CRYPTO_ecc_key_get_public_for_encryption (my_ephemeral_key, - ¤t_ekm.ephemeral_key); + GNUNET_CRYPTO_ecdhe_key_get_public (my_ephemeral_key, + ¤t_ekm.ephemeral_key); current_ekm.origin_identity = GSC_my_identity; GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (my_private_key, + GNUNET_CRYPTO_eddsa_sign (my_private_key, ¤t_ekm.purpose, ¤t_ekm.signature)); } @@ -1520,7 +1520,7 @@ do_rekey (void *cls, NULL); if (NULL != my_ephemeral_key) GNUNET_free (my_ephemeral_key); - my_ephemeral_key = GNUNET_CRYPTO_ecc_key_create (); + my_ephemeral_key = GNUNET_CRYPTO_ecdhe_key_create (); GNUNET_assert (NULL != my_ephemeral_key); sign_ephemeral_key (); for (pos = kx_head; NULL != pos; pos = pos->next) @@ -1535,38 +1535,27 @@ do_rekey (void *cls, * Initialize KX subsystem. * * @param pk private key to use for the peer - * @return GNUNET_OK on success, GNUNET_SYSERR on failure + * @return #GNUNET_OK on success, #GNUNET_SYSERR on failure */ int -GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk) +GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) { GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &GSC_my_identity.public_key); - if (GNUNET_YES == - GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, - "core", - "USE_EPHEMERAL_KEYS")) + my_ephemeral_key = GNUNET_CRYPTO_ecdhe_key_create (); + if (NULL == my_ephemeral_key) { - my_ephemeral_key = GNUNET_CRYPTO_ecc_key_create (); - if (NULL == my_ephemeral_key) - { - GNUNET_break (0); - GNUNET_free (my_private_key); - my_private_key = NULL; - return GNUNET_SYSERR; - } - sign_ephemeral_key (); - rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_FREQUENCY, - &do_rekey, - NULL); - } - else - { - my_ephemeral_key = my_private_key; - sign_ephemeral_key (); + GNUNET_break (0); + GNUNET_free (my_private_key); + my_private_key = NULL; + return GNUNET_SYSERR; } + sign_ephemeral_key (); + rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_FREQUENCY, + &do_rekey, + NULL); mst = GNUNET_SERVER_mst_create (&deliver_message, NULL); return GNUNET_OK; } @@ -1583,8 +1572,7 @@ GSC_KX_done () GNUNET_SCHEDULER_cancel (rekey_task); rekey_task = GNUNET_SCHEDULER_NO_TASK; } - if ( (NULL != my_ephemeral_key) && - (my_ephemeral_key != my_private_key) ) + if (NULL != my_ephemeral_key) { GNUNET_free (my_ephemeral_key); my_ephemeral_key = NULL; diff --git a/src/core/gnunet-service-core_kx.h b/src/core/gnunet-service-core_kx.h index e1b860919..4c99669b2 100644 --- a/src/core/gnunet-service-core_kx.h +++ b/src/core/gnunet-service-core_kx.h @@ -121,7 +121,7 @@ GSC_KX_stop (struct GSC_KeyExchangeInfo *kx); * @return GNUNET_OK on success, GNUNET_SYSERR on failure */ int -GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk); +GSC_KX_init (struct GNUNET_CRYPTO_EddsaPrivateKey *pk); /** diff --git a/src/dns/plugin_block_dns.c b/src/dns/plugin_block_dns.c index a8846944e..fd76d0ce0 100644 --- a/src/dns/plugin_block_dns.c +++ b/src/dns/plugin_block_dns.c @@ -76,7 +76,7 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, if (ntohl (ad->purpose.size) != sizeof (struct GNUNET_DNS_Advertisement) - - sizeof (struct GNUNET_CRYPTO_EccSignature)) + sizeof (struct GNUNET_CRYPTO_EddsaSignature)) { GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; @@ -90,7 +90,7 @@ block_plugin_dns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD, + GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD, &ad->purpose, &ad->signature, &ad->peer.public_key)) diff --git a/src/exit/gnunet-daemon-exit.c b/src/exit/gnunet-daemon-exit.c index f4d656f3c..5b1f5b681 100644 --- a/src/exit/gnunet-daemon-exit.c +++ b/src/exit/gnunet-daemon-exit.c @@ -438,7 +438,7 @@ static struct GNUNET_HashCode dht_put_key; /** * Private key for this peer. */ -static struct GNUNET_CRYPTO_EccPrivateKey *peer_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *peer_key; /** * Are we an IPv4-exit? @@ -3415,7 +3415,7 @@ do_dht_put (void *cls, expiration = GNUNET_TIME_relative_to_absolute (DNS_ADVERTISEMENT_TIMEOUT); dns_advertisement.expiration_time = GNUNET_TIME_absolute_hton (expiration); GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (peer_key, + GNUNET_CRYPTO_eddsa_sign (peer_key, &dns_advertisement.purpose, &dns_advertisement.signature)); } @@ -3572,11 +3572,11 @@ run (void *cls, char *const *args GNUNET_UNUSED, if (NULL != dns_exit) { dht = GNUNET_DHT_connect (cfg, 1); - peer_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (peer_key, + peer_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg); + GNUNET_CRYPTO_eddsa_key_get_public (peer_key, &dns_advertisement.peer.public_key); dns_advertisement.purpose.size = htonl (sizeof (struct GNUNET_DNS_Advertisement) - - sizeof (struct GNUNET_CRYPTO_EccSignature)); + sizeof (struct GNUNET_CRYPTO_EddsaSignature)); dns_advertisement.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DNS_RECORD); GNUNET_CRYPTO_hash ("dns", strlen ("dns"), diff --git a/src/fs/fs_api.c b/src/fs/fs_api.c index 04057bc98..688bdf282 100644 --- a/src/fs/fs_api.c +++ b/src/fs/fs_api.c @@ -1477,7 +1477,7 @@ deserialize_publish_file (void *cls, const char *filename) int32_t all_done; int32_t have_ns; char *fi_root; - struct GNUNET_CRYPTO_EccPrivateKey ns; + struct GNUNET_CRYPTO_EcdsaPrivateKey ns; char *fi_pos; char *emsg; @@ -1522,7 +1522,7 @@ deserialize_publish_file (void *cls, const char *filename) } if (GNUNET_YES == have_ns) { - pc->ns = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + pc->ns = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); *pc->ns = ns; } if ((0 == (pc->options & GNUNET_FS_PUBLISH_OPTION_SIMULATE_ONLY)) && @@ -1637,7 +1637,7 @@ GNUNET_FS_publish_sync_ (struct GNUNET_FS_PublishContext *pc) ( (NULL != pc->ns) && (GNUNET_OK != GNUNET_BIO_write (wh, pc->ns, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey)) ) )) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) ) )) { GNUNET_break (0); goto cleanup; diff --git a/src/fs/fs_api.h b/src/fs/fs_api.h index 5858c916c..4b0965f15 100644 --- a/src/fs/fs_api.h +++ b/src/fs/fs_api.h @@ -128,10 +128,10 @@ struct Location struct GNUNET_TIME_Absolute expirationTime; /** - * RSA signature over the GNUNET_EC_FileIdentifier, - * GNUNET_hash of the peer and expiration time. + * Signature over the GNUNET_EC_FileIdentifier, + * peer identity and expiration time. */ - struct GNUNET_CRYPTO_EccSignature contentSignature; + struct GNUNET_CRYPTO_EddsaSignature contentSignature; }; @@ -140,24 +140,24 @@ struct Location */ enum GNUNET_FS_UriType { - /** - * Content-hash-key (simple file). - */ + /** + * Content-hash-key (simple file). + */ GNUNET_FS_URI_CHK, - /** - * Signed key space (file in namespace). - */ + /** + * Signed key space (file in namespace). + */ GNUNET_FS_URI_SKS, - /** - * Keyword search key (query with keywords). - */ + /** + * Keyword search key (query with keywords). + */ GNUNET_FS_URI_KSK, - /** - * Location (chk with identity of hosting peer). - */ + /** + * Location (chk with identity of hosting peer). + */ GNUNET_FS_URI_LOC }; @@ -198,7 +198,7 @@ struct GNUNET_FS_Uri /** * Identifier of the namespace. */ - struct GNUNET_CRYPTO_EccPublicSignKey ns; + struct GNUNET_CRYPTO_EcdsaPublicKey ns; /** * Human-readable identifier chosen for this entry in the @@ -1171,7 +1171,7 @@ struct GNUNET_FS_PublishContext /** * Namespace that we are publishing in, NULL if we have no namespace. */ - struct GNUNET_CRYPTO_EccPrivateKey *ns; + struct GNUNET_CRYPTO_EcdsaPrivateKey *ns; /** * ID of the content in the namespace, NULL if we have no namespace. @@ -1461,7 +1461,7 @@ struct SearchRequestEntry /** * Derived public key, hashes to 'uquery'. */ - struct GNUNET_CRYPTO_EccPublicSignKey dpub; + struct GNUNET_CRYPTO_EcdsaPublicKey dpub; /** * The original keyword, used to derive the diff --git a/src/fs/fs_namespace.c b/src/fs/fs_namespace.c index f4cd82978..39bb39701 100644 --- a/src/fs/fs_namespace.c +++ b/src/fs/fs_namespace.c @@ -92,7 +92,7 @@ struct GNUNET_FS_UpdateInformationGraph /** * Private key for the namespace. */ - struct GNUNET_CRYPTO_EccPrivateKey ns; + struct GNUNET_CRYPTO_EcdsaPrivateKey ns; /** * Hash map mapping identifiers of update nodes @@ -127,11 +127,11 @@ struct GNUNET_FS_UpdateInformationGraph */ static char * get_update_information_directory (struct GNUNET_FS_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *ns) + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) { char *dn; char *ret; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; struct GNUNET_HashCode hc; struct GNUNET_CRYPTO_HashAsciiEncoded enc; @@ -143,7 +143,7 @@ get_update_information_directory (struct GNUNET_FS_Handle *h, "fs", "UPDATE_DIR"); return NULL; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns, &pub); + GNUNET_CRYPTO_ecdsa_key_get_public (ns, &pub); GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc); GNUNET_CRYPTO_hash_to_enc (&hc, &enc); @@ -241,7 +241,7 @@ END: */ static struct GNUNET_FS_UpdateInformationGraph * read_update_information_graph (struct GNUNET_FS_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *ns) + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns) { struct GNUNET_FS_UpdateInformationGraph *uig; char *fn; @@ -346,7 +346,7 @@ struct GNUNET_FS_PublishSksContext /** * Namespace we're publishing to. */ - struct GNUNET_CRYPTO_EccPrivateKey ns; + struct GNUNET_CRYPTO_EcdsaPrivateKey ns; /** * Handle to the datastore. @@ -434,7 +434,7 @@ sks_publish_cont (void *cls, */ struct GNUNET_FS_PublishSksContext * GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *identifier, const char *update, const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_FS_Uri *uri, @@ -448,7 +448,7 @@ GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, sks_uri = GNUNET_new (struct GNUNET_FS_Uri); sks_uri->type = GNUNET_FS_URI_SKS; sks_uri->data.sks.identifier = GNUNET_strdup (identifier); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns, + GNUNET_CRYPTO_ecdsa_key_get_public (ns, &sks_uri->data.sks.ns); psc = GNUNET_new (struct GNUNET_FS_PublishSksContext); @@ -679,7 +679,7 @@ find_trees (void *cls, */ void GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *next_id, GNUNET_FS_IdentifierProcessor ip, void *ip_cls) diff --git a/src/fs/fs_publish.c b/src/fs/fs_publish.c index 387ede6a1..05645f0ab 100644 --- a/src/fs/fs_publish.c +++ b/src/fs/fs_publish.c @@ -1152,7 +1152,7 @@ finish_reserve (void *cls, int success, struct GNUNET_FS_PublishContext * GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *nid, const char *nuid, enum GNUNET_FS_PublishOptions options) @@ -1177,7 +1177,7 @@ GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, ret->fi = fi; if (NULL != ns) { - ret->ns = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + ret->ns = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); *ret->ns = *ns; GNUNET_assert (NULL != nid); ret->nid = GNUNET_strdup (nid); diff --git a/src/fs/fs_publish_ksk.c b/src/fs/fs_publish_ksk.c index 6aac94011..67157f408 100644 --- a/src/fs/fs_publish_ksk.c +++ b/src/fs/fs_publish_ksk.c @@ -170,7 +170,7 @@ publish_ksk_cont (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) pkc->dsh, keyword + 1 /* skip '+' */, NULL, - GNUNET_CRYPTO_ecc_key_get_anonymous (), + GNUNET_CRYPTO_ecdsa_key_get_anonymous (), pkc->meta, pkc->uri, &pkc->bo, diff --git a/src/fs/fs_publish_ublock.c b/src/fs/fs_publish_ublock.c index 18f4804d1..791366073 100644 --- a/src/fs/fs_publish_ublock.c +++ b/src/fs/fs_publish_ublock.c @@ -46,7 +46,7 @@ static void derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey, struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, const char *label, - const struct GNUNET_CRYPTO_EccPublicSignKey *pub) + const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) { struct GNUNET_HashCode key; @@ -73,7 +73,7 @@ derive_ublock_encryption_key (struct GNUNET_CRYPTO_SymmetricSessionKey *skey, void GNUNET_FS_ublock_decrypt_ (const void *input, size_t input_len, - const struct GNUNET_CRYPTO_EccPublicSignKey *ns, + const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *label, void *output) { @@ -158,7 +158,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, struct GNUNET_DATASTORE_Handle *dsh, const char *label, const char *ulabel, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, @@ -169,8 +169,8 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, struct GNUNET_HashCode query; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct GNUNET_CRYPTO_SymmetricSessionKey skey; - struct GNUNET_CRYPTO_EccPrivateKey *nsd; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPrivateKey *nsd; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; char *uris; size_t size; char *kbe; @@ -225,7 +225,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, "Publishing under identifier `%s'\n", label); /* get public key of the namespace */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns, + GNUNET_CRYPTO_ecdsa_key_get_public (ns, &pub); derive_ublock_encryption_key (&skey, &iv, label, &pub); @@ -238,15 +238,15 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, &ub_enc[1]); ub_enc->purpose.size = htonl (ulen + slen + mdsize + sizeof (struct UBlock) - - sizeof (struct GNUNET_CRYPTO_EccSignature)); + - sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); ub_enc->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK); /* derive signing-key from 'label' and public key of the namespace */ - nsd = GNUNET_CRYPTO_ecc_key_derive (ns, label, "fs-ublock"); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (nsd, + nsd = GNUNET_CRYPTO_ecdsa_private_key_derive (ns, label, "fs-ublock"); + GNUNET_CRYPTO_ecdsa_key_get_public (nsd, &ub_enc->verification_key); GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (nsd, + GNUNET_CRYPTO_ecdsa_sign (nsd, &ub_enc->purpose, &ub_enc->signature)); GNUNET_CRYPTO_hash (&ub_enc->verification_key, diff --git a/src/fs/fs_publish_ublock.h b/src/fs/fs_publish_ublock.h index ed8d599a8..0b22366d5 100644 --- a/src/fs/fs_publish_ublock.h +++ b/src/fs/fs_publish_ublock.h @@ -46,7 +46,7 @@ void GNUNET_FS_ublock_decrypt_ (const void *input, size_t input_len, - const struct GNUNET_CRYPTO_EccPublicSignKey *ns, + const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *label, void *output); @@ -89,7 +89,7 @@ GNUNET_FS_publish_ublock_ (struct GNUNET_FS_Handle *h, struct GNUNET_DATASTORE_Handle *dsh, const char *label, const char *ulabel, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const struct GNUNET_CONTAINER_MetaData *meta, const struct GNUNET_FS_Uri *uri, const struct GNUNET_FS_BlockOptions *bo, diff --git a/src/fs/fs_search.c b/src/fs/fs_search.c index 11af03646..bc3561856 100644 --- a/src/fs/fs_search.c +++ b/src/fs/fs_search.c @@ -679,20 +679,20 @@ process_sks_result (struct GNUNET_FS_SearchContext *sc, const char *id_update, */ static int decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, - const struct GNUNET_CRYPTO_EccPublicSignKey *dpub, + const struct GNUNET_CRYPTO_EcdsaPublicKey *dpub, const void *edata, size_t edata_size, char *data) { - const struct GNUNET_CRYPTO_EccPrivateKey *anon; - struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; + const struct GNUNET_CRYPTO_EcdsaPrivateKey *anon; + struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub; unsigned int i; /* find key */ for (i = 0; i < sc->uri->data.ksk.keywordCount; i++) if (0 == memcmp (dpub, &sc->requests[i].dpub, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) break; if (i == sc->uri->data.ksk.keywordCount) { @@ -701,8 +701,8 @@ decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc, return GNUNET_SYSERR; } /* decrypt */ - anon = GNUNET_CRYPTO_ecc_key_get_anonymous (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub); + anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous (); + GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub); GNUNET_FS_ublock_decrypt_ (edata, edata_size, &anon_pub, sc->requests[i].keyword, @@ -1035,7 +1035,7 @@ transmit_search_request (void *cls, size_t size, void *buf) struct MessageBuilderContext mbc; size_t msize; struct SearchMessage *sm; - struct GNUNET_CRYPTO_EccPublicSignKey dpub; + struct GNUNET_CRYPTO_EcdsaPublicKey dpub; unsigned int sqms; uint32_t options; @@ -1102,7 +1102,7 @@ transmit_search_request (void *cls, size_t size, void *buf) sm->type = htonl (GNUNET_BLOCK_TYPE_FS_UBLOCK); sm->anonymity_level = htonl (sc->anonymity); memset (&sm->target, 0, sizeof (struct GNUNET_HashCode)); - GNUNET_CRYPTO_ecc_public_key_derive (&sc->uri->data.sks.ns, + GNUNET_CRYPTO_ecdsa_public_key_derive (&sc->uri->data.sks.ns, sc->uri->data.sks.identifier, "fs-ublock", &dpub); @@ -1271,16 +1271,16 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) { unsigned int i; const char *keyword; - const struct GNUNET_CRYPTO_EccPrivateKey *anon; - struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; + const struct GNUNET_CRYPTO_EcdsaPrivateKey *anon; + struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub; struct SearchRequestEntry *sre; GNUNET_assert (NULL == sc->client); if (GNUNET_FS_uri_test_ksk (sc->uri)) { GNUNET_assert (0 != sc->uri->data.ksk.keywordCount); - anon = GNUNET_CRYPTO_ecc_key_get_anonymous (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub); + anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous (); + GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub); sc->requests = GNUNET_malloc (sizeof (struct SearchRequestEntry) * sc->uri->data.ksk.keywordCount); @@ -1289,12 +1289,12 @@ GNUNET_FS_search_start_searching_ (struct GNUNET_FS_SearchContext *sc) keyword = &sc->uri->data.ksk.keywords[i][1]; sre = &sc->requests[i]; sre->keyword = GNUNET_strdup (keyword); - GNUNET_CRYPTO_ecc_public_key_derive (&anon_pub, + GNUNET_CRYPTO_ecdsa_public_key_derive (&anon_pub, keyword, "fs-ublock", &sre->dpub); GNUNET_CRYPTO_hash (&sre->dpub, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &sre->uquery); sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+'); if (sre->mandatory) diff --git a/src/fs/fs_unindex.c b/src/fs/fs_unindex.c index 7e189d697..14ab0fd69 100644 --- a/src/fs/fs_unindex.c +++ b/src/fs/fs_unindex.c @@ -490,10 +490,10 @@ process_kblock_for_unindex (void *cls, } { char pt[size - sizeof (struct UBlock)]; - struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; + struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub; const char *keyword; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (), + GNUNET_CRYPTO_ecdsa_key_get_public (GNUNET_CRYPTO_ecdsa_key_get_anonymous (), &anon_pub); keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1]; GNUNET_FS_ublock_decrypt_ (&ub[1], size - sizeof (struct UBlock), @@ -550,9 +550,9 @@ void GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc) { const char *keyword; - const struct GNUNET_CRYPTO_EccPrivateKey *anon; - struct GNUNET_CRYPTO_EccPublicSignKey anon_pub; - struct GNUNET_CRYPTO_EccPublicSignKey dpub; + const struct GNUNET_CRYPTO_EcdsaPrivateKey *anon; + struct GNUNET_CRYPTO_EcdsaPublicKey anon_pub; + struct GNUNET_CRYPTO_EcdsaPublicKey dpub; if (NULL == uc->dsh) uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg); @@ -570,10 +570,10 @@ GNUNET_FS_unindex_do_remove_kblocks_ (struct GNUNET_FS_UnindexContext *uc) unindex_finish (uc); return; } - anon = GNUNET_CRYPTO_ecc_key_get_anonymous (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub); + anon = GNUNET_CRYPTO_ecdsa_key_get_anonymous (); + GNUNET_CRYPTO_ecdsa_key_get_public (anon, &anon_pub); keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1]; - GNUNET_CRYPTO_ecc_public_key_derive (&anon_pub, + GNUNET_CRYPTO_ecdsa_public_key_derive (&anon_pub, keyword, "fs-ublock", &dpub); diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c index e64fabeba..578fc6820 100644 --- a/src/fs/fs_uri.c +++ b/src/fs/fs_uri.c @@ -118,7 +118,7 @@ GNUNET_FS_uri_to_key (const struct GNUNET_FS_Uri *uri, case GNUNET_FS_URI_LOC: GNUNET_CRYPTO_hash (&uri->data.loc.fi, sizeof (struct FileIdentifier) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), key); break; default: @@ -357,7 +357,7 @@ static struct GNUNET_FS_Uri * uri_sks_parse (const char *s, char **emsg) { struct GNUNET_FS_Uri *ret; - struct GNUNET_CRYPTO_EccPublicSignKey ns; + struct GNUNET_CRYPTO_EcdsaPublicKey ns; size_t pos; char *end; @@ -559,7 +559,7 @@ uri_loc_parse (const char *s, char **emsg) unsigned long long exptime; unsigned long long flen; struct GNUNET_TIME_Absolute et; - struct GNUNET_CRYPTO_EccSignature sig; + struct GNUNET_CRYPTO_EddsaSignature sig; struct LocUriAssembly ass; int ret; size_t slen; @@ -604,7 +604,7 @@ uri_loc_parse (const char *s, char **emsg) npos++; ret = enc2bin (&s[npos], &ass.peer, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); if (ret == -1) { *emsg = @@ -617,7 +617,7 @@ uri_loc_parse (const char *s, char **emsg) *emsg = GNUNET_strdup (_("SKS URI malformed (could not find signature)")); goto ERR; } - ret = enc2bin (&s[npos], &sig, sizeof (struct GNUNET_CRYPTO_EccSignature)); + ret = enc2bin (&s[npos], &sig, sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); if (ret == -1) { *emsg = GNUNET_strdup (_("SKS URI malformed (could not decode signature)")); @@ -641,8 +641,8 @@ uri_loc_parse (const char *s, char **emsg) et.abs_value_us = exptime * 1000LL * 1000LL; ass.exptime = GNUNET_TIME_absolute_hton (et); if (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, - &ass.purpose, &sig, &ass.peer.public_key)) + GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT, + &ass.purpose, &sig, &ass.peer.public_key)) { *emsg = GNUNET_strdup (_("SKS URI malformed (signature failed validation)")); @@ -894,8 +894,8 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, struct GNUNET_TIME_Absolute expiration_time) { struct GNUNET_FS_Uri *uri; - struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; - struct GNUNET_CRYPTO_EccPublicSignKey my_public_key; + struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; + struct GNUNET_CRYPTO_EddsaPublicKey my_public_key; char *keyfile; struct LocUriAssembly ass; struct GNUNET_TIME_Absolute et; @@ -910,7 +910,7 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, _("Lacking key configuration settings.\n")); return NULL; } - if (NULL == (my_private_key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile))) + if (NULL == (my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not access hostkey file `%s'.\n"), keyfile); @@ -920,7 +920,7 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, GNUNET_free (keyfile); /* we round expiration time to full seconds for SKS URIs */ et.abs_value_us = (expiration_time.abs_value_us / 1000000LL) * 1000000LL; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key); + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_public_key); ass.purpose.size = htonl (sizeof (struct LocUriAssembly)); ass.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_PEER_PLACEMENT); ass.exptime = GNUNET_TIME_absolute_hton (et); @@ -932,8 +932,8 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, uri->data.loc.expirationTime = et; uri->data.loc.peer.public_key = my_public_key; GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (my_private_key, &ass.purpose, - &uri->data.loc.contentSignature)); + GNUNET_CRYPTO_eddsa_sign (my_private_key, &ass.purpose, + &uri->data.loc.contentSignature)); GNUNET_free (my_private_key); return uri; } @@ -947,7 +947,7 @@ GNUNET_FS_uri_loc_create (const struct GNUNET_FS_Uri *baseUri, * @return an FS URI for the given namespace and identifier */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, +GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *id) { struct GNUNET_FS_Uri *ns_uri; @@ -1258,7 +1258,7 @@ GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, case GNUNET_FS_URI_SKS: if ((0 == memcmp (&u1->data.sks.ns, &u2->data.sks.ns, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) && + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) && (0 == strcmp (u1->data.sks.identifier, u2->data.sks.identifier))) return GNUNET_YES; @@ -1285,7 +1285,7 @@ GNUNET_FS_uri_test_equal (const struct GNUNET_FS_Uri *u1, if (memcmp (&u1->data.loc, &u2->data.loc, sizeof (struct FileIdentifier) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + sizeof (struct GNUNET_TIME_Absolute) + sizeof (unsigned short) + sizeof (unsigned short)) != 0) return GNUNET_NO; @@ -1319,7 +1319,7 @@ GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri) */ int GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, - struct GNUNET_CRYPTO_EccPublicSignKey *pseudonym) + struct GNUNET_CRYPTO_EcdsaPublicKey *pseudonym) { if (!GNUNET_FS_uri_test_sks (uri)) { @@ -1927,7 +1927,7 @@ uri_sks_to_string (const struct GNUNET_FS_Uri *uri) if (GNUNET_FS_URI_SKS != uri->type) return NULL; ret = GNUNET_STRINGS_data_to_string (&uri->data.sks.ns, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), buf, sizeof (buf)); GNUNET_assert (NULL != ret); @@ -2032,10 +2032,10 @@ uri_loc_to_string (const struct GNUNET_FS_Uri *uri) GNUNET_CRYPTO_hash_to_enc (&uri->data.loc.fi.chk.query, &queryhash); peerId = bin2enc (&uri->data.loc.peer, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); peerSig = bin2enc (&uri->data.loc.contentSignature, - sizeof (struct GNUNET_CRYPTO_EccSignature)); + sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); GNUNET_asprintf (&ret, "%s%s%s.%s.%llu.%s.%s.%llu", GNUNET_FS_URI_PREFIX, GNUNET_FS_URI_LOC_INFIX, (const char *) &keyhash, diff --git a/src/fs/gnunet-publish.c b/src/fs/gnunet-publish.c index 83dd45a28..7f7423ae5 100644 --- a/src/fs/gnunet-publish.c +++ b/src/fs/gnunet-publish.c @@ -438,7 +438,7 @@ static void uri_ksk_continuation (void *cls, const struct GNUNET_FS_Uri *ksk_uri, const char *emsg) { - const struct GNUNET_CRYPTO_EccPrivateKey *priv; + const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; if (NULL != emsg) { @@ -520,7 +520,7 @@ static void directory_trim_complete (struct GNUNET_FS_ShareTreeItem *directory_scan_result) { struct GNUNET_FS_FileInformation *fi; - const struct GNUNET_CRYPTO_EccPrivateKey *priv; + const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; fi = get_file_information (directory_scan_result); GNUNET_FS_share_tree_free (directory_scan_result); diff --git a/src/fs/plugin_block_fs.c b/src/fs/plugin_block_fs.c index 9f6791bb5..36e7f0796 100644 --- a/src/fs/plugin_block_fs.c +++ b/src/fs/plugin_block_fs.c @@ -105,13 +105,13 @@ block_plugin_fs_evaluate (void *cls, enum GNUNET_BLOCK_Type type, GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } - if (reply_block_size != ntohl (ub->purpose.size) + sizeof (struct GNUNET_CRYPTO_EccSignature)) + if (reply_block_size != ntohl (ub->purpose.size) + sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) { GNUNET_break_op (0); return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, + GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_FS_UBLOCK, &ub->purpose, &ub->signature, &ub->verification_key)) diff --git a/src/fs/test_fs_namespace.c b/src/fs/test_fs_namespace.c index b0358e809..c78008122 100644 --- a/src/fs/test_fs_namespace.c +++ b/src/fs/test_fs_namespace.c @@ -29,7 +29,7 @@ #include "gnunet_fs_service.h" -static struct GNUNET_CRYPTO_EccPublicSignKey nsid; +static struct GNUNET_CRYPTO_EcdsaPublicKey nsid; static struct GNUNET_FS_Uri *sks_expect_uri; @@ -237,7 +237,7 @@ static void adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) { struct GNUNET_CONTAINER_MetaData *meta; - struct GNUNET_CRYPTO_EccPrivateKey *ns; + struct GNUNET_CRYPTO_EcdsaPrivateKey *ns; struct GNUNET_FS_BlockOptions bo; if (NULL != emsg) @@ -247,7 +247,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) GNUNET_FS_stop (fs); return; } - ns = GNUNET_CRYPTO_ecc_key_create (); + ns = GNUNET_CRYPTO_ecdsa_key_create (); meta = GNUNET_CONTAINER_meta_data_create (); sks_expect_uri = GNUNET_FS_uri_dup (uri); bo.content_priority = 1; @@ -255,7 +255,7 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) bo.replication_level = 0; bo.expiration_time = GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns, &nsid); + GNUNET_CRYPTO_ecdsa_key_get_public (ns, &nsid); GNUNET_FS_publish_sks (fs, ns, "this", "next", meta, uri, &bo, GNUNET_FS_PUBLISH_OPTION_NONE, &sks_cont, NULL); GNUNET_CONTAINER_meta_data_destroy (meta); @@ -266,13 +266,13 @@ adv_cont (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) static void testNamespace () { - struct GNUNET_CRYPTO_EccPrivateKey *ns; + struct GNUNET_CRYPTO_EcdsaPrivateKey *ns; struct GNUNET_FS_BlockOptions bo; struct GNUNET_CONTAINER_MetaData *meta; struct GNUNET_FS_Uri *ksk_uri; struct GNUNET_FS_Uri *sks_uri; - ns = GNUNET_CRYPTO_ecc_key_create (); + ns = GNUNET_CRYPTO_ecdsa_key_create (); meta = GNUNET_CONTAINER_meta_data_create (); ksk_uri = GNUNET_FS_uri_parse ("gnunet://fs/ksk/testnsa", NULL); bo.content_priority = 1; diff --git a/src/fs/test_fs_namespace_list_updateable.c b/src/fs/test_fs_namespace_list_updateable.c index 69fc6542c..e8cfb2b77 100644 --- a/src/fs/test_fs_namespace_list_updateable.c +++ b/src/fs/test_fs_namespace_list_updateable.c @@ -33,7 +33,7 @@ static struct GNUNET_FS_Handle *fs; static int err; -static struct GNUNET_CRYPTO_EccPrivateKey *ns; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *ns; static struct GNUNET_CONTAINER_MetaData *meta; @@ -127,7 +127,7 @@ sks_cont_this (void *cls, const struct GNUNET_FS_Uri *uri, const char *emsg) static void testNamespace () { - ns = GNUNET_CRYPTO_ecc_key_create (); + ns = GNUNET_CRYPTO_ecdsa_key_create (); GNUNET_assert (NULL != ns); bo.content_priority = 1; bo.anonymity_level = 1; diff --git a/src/fs/test_fs_uri.c b/src/fs/test_fs_uri.c index 1e1bd8fb8..2fc5b2a2d 100644 --- a/src/fs/test_fs_uri.c +++ b/src/fs/test_fs_uri.c @@ -163,8 +163,8 @@ testNamespace (int i) char *uri; struct GNUNET_FS_Uri *ret; char *emsg; - struct GNUNET_CRYPTO_EccPrivateKey *ph; - struct GNUNET_CRYPTO_EccPublicSignKey id; + struct GNUNET_CRYPTO_EcdsaPrivateKey *ph; + struct GNUNET_CRYPTO_EcdsaPublicKey id; char buf[1024]; char ubuf[1024]; char *sret; @@ -193,8 +193,8 @@ testNamespace (int i) GNUNET_assert (0); } GNUNET_free (emsg); - ph = GNUNET_CRYPTO_ecc_key_create (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (ph, &id); + ph = GNUNET_CRYPTO_ecdsa_key_create (); + GNUNET_CRYPTO_ecdsa_key_get_public (ph, &id); sret = GNUNET_STRINGS_data_to_string (&id, sizeof (id), ubuf, sizeof (ubuf) - 1); GNUNET_assert (NULL != sret); diff --git a/src/gns/gns.h b/src/gns/gns.h index 571b62dc7..17a7c7323 100644 --- a/src/gns/gns.h +++ b/src/gns/gns.h @@ -63,7 +63,7 @@ struct GNUNET_GNS_ClientLookupMessage /** * Zone that is to be used for lookup */ - struct GNUNET_CRYPTO_EccPublicSignKey zone; + struct GNUNET_CRYPTO_EcdsaPublicKey zone; /** * Only check cached results @@ -83,7 +83,7 @@ struct GNUNET_GNS_ClientLookupMessage /** * The key for shorten, if @e have_key is set */ - struct GNUNET_CRYPTO_EccPrivateKey shorten_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey shorten_key; /* Followed by the name to look up */ }; diff --git a/src/gns/gns_api.c b/src/gns/gns_api.c index 75c2f9530..3d58922ad 100644 --- a/src/gns/gns_api.c +++ b/src/gns/gns_api.c @@ -527,10 +527,10 @@ GNUNET_GNS_lookup_cancel (struct GNUNET_GNS_LookupRequest *lr) struct GNUNET_GNS_LookupRequest* GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, const char *name, - const struct GNUNET_CRYPTO_EccPublicSignKey *zone, + const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, int type, int only_cached, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_zone_key, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls) { diff --git a/src/gns/gnunet-dns2gns.c b/src/gns/gnunet-dns2gns.c index 42d5ef0e2..6b7afdb59 100644 --- a/src/gns/gnunet-dns2gns.c +++ b/src/gns/gnunet-dns2gns.c @@ -143,7 +143,7 @@ static unsigned int listen_port = 53; /** * Which GNS zone do we translate incoming DNS requests to? */ -static struct GNUNET_CRYPTO_EccPublicSignKey my_zone; +static struct GNUNET_CRYPTO_EcdsaPublicKey my_zone; /** * '-z' option with the main zone to use. @@ -741,7 +741,7 @@ run (void *cls, char *const *args, const char *cfgfile, } if ( (NULL == gns_zone_str) || (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (gns_zone_str, + GNUNET_CRYPTO_ecdsa_public_key_from_string (gns_zone_str, strlen (gns_zone_str), &my_zone)) ) { diff --git a/src/gns/gnunet-gns-helper-service-w32.c b/src/gns/gnunet-gns-helper-service-w32.c index 26a3f688a..78eb1e0a3 100644 --- a/src/gns/gnunet-gns-helper-service-w32.c +++ b/src/gns/gnunet-gns-helper-service-w32.c @@ -61,9 +61,9 @@ struct request */ static struct GNUNET_GNS_Handle *gns; -static struct GNUNET_CRYPTO_EccPublicSignKey *zone = NULL; +static struct GNUNET_CRYPTO_EcdsaPublicKey *zone = NULL; static struct GNUNET_HashCode user_zone; -struct GNUNET_CRYPTO_EccPrivateKey *shorten_key = NULL; +struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key = NULL; /** @@ -662,8 +662,8 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, }; char* keyfile; - struct GNUNET_CRYPTO_EccPrivateKey *key = NULL; - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPrivateKey *key = NULL; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; struct GNUNET_CRYPTO_HashAsciiEncoded zonename; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "gns", @@ -677,9 +677,9 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, { if (GNUNET_YES == GNUNET_DISK_file_test (keyfile)) { - key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey); - GNUNET_CRYPTO_hash (&pkey, sizeof(struct GNUNET_CRYPTO_EccPublicSignKey), + key = GNUNET_CRYPTO_ecdsa_key_create_from_file (keyfile); + GNUNET_CRYPTO_ecdsa_key_get_public (key, &pkey); + GNUNET_CRYPTO_hash (&pkey, sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), &user_zone); GNUNET_CRYPTO_hash_to_enc (&user_zone, &zonename); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -700,7 +700,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, { if (GNUNET_YES == GNUNET_DISK_file_test (keyfile)) { - shorten_key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); + shorten_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (keyfile); } GNUNET_free(keyfile); } diff --git a/src/gns/gnunet-gns-proxy.c b/src/gns/gnunet-gns-proxy.c index a67f7356e..276ea70b0 100644 --- a/src/gns/gnunet-gns-proxy.c +++ b/src/gns/gnunet-gns-proxy.c @@ -623,12 +623,12 @@ static struct Socks5Request *s5r_tail; /** * The users local GNS master zone */ -static struct GNUNET_CRYPTO_EccPublicSignKey local_gns_zone; +static struct GNUNET_CRYPTO_EcdsaPublicKey local_gns_zone; /** * The users local shorten zone */ -static struct GNUNET_CRYPTO_EccPrivateKey local_shorten_zone; +static struct GNUNET_CRYPTO_EcdsaPrivateKey local_shorten_zone; /** * Is shortening enabled? @@ -2864,7 +2864,7 @@ main (int argc, char *const *argv) &run, NULL)) ? 0 : 1; MHD_destroy_response (curl_failure_response); GNUNET_free_non_null ((char *) argv); - GNUNET_CRYPTO_ecc_key_clear (&local_shorten_zone); + GNUNET_CRYPTO_ecdsa_key_clear (&local_shorten_zone); return ret; } diff --git a/src/gns/gnunet-gns.c b/src/gns/gnunet-gns.c index 713f94b92..0a4275f0d 100644 --- a/src/gns/gnunet-gns.c +++ b/src/gns/gnunet-gns.c @@ -191,8 +191,8 @@ process_lookup_result (void *cls, uint32_t rd_count, * @param shorten_key private key used for shortening, can be NULL */ static void -lookup_with_keys (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key) +lookup_with_keys (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key) { if (NULL != lookup_type) rtype = GNUNET_NAMESTORE_typename_to_number (lookup_type); @@ -238,7 +238,7 @@ identity_shorten_cb (void *cls, void **ctx, const char *name) { - struct GNUNET_CRYPTO_EccPublicSignKey *pkeym = cls; + struct GNUNET_CRYPTO_EcdsaPublicKey *pkeym = cls; id_op = NULL; if (NULL == ego) @@ -257,12 +257,12 @@ identity_shorten_cb (void *cls, * @param pkey public key to use for the zone */ static void -lookup_with_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey) +lookup_with_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) { - struct GNUNET_CRYPTO_EccPublicSignKey *pkeym; + struct GNUNET_CRYPTO_EcdsaPublicKey *pkeym; GNUNET_assert (NULL != pkey); - pkeym = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey); + pkeym = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); *pkeym = *pkey; id_op = GNUNET_IDENTITY_get (identity, "gns-short", @@ -287,7 +287,7 @@ static void identity_zone_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) { - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; el = NULL; if (NULL == ego) @@ -325,7 +325,7 @@ identity_master_cb (void *cls, void **ctx, const char *name) { - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; id_op = NULL; if (NULL == ego) @@ -352,7 +352,7 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; cfg = c; gns = GNUNET_GNS_connect (cfg); @@ -368,7 +368,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (NULL != public_key) { if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (public_key, + GNUNET_CRYPTO_ecdsa_public_key_from_string (public_key, strlen (public_key), &pkey)) { @@ -395,7 +395,7 @@ run (void *cls, char *const *args, const char *cfgfile, &lookup_name[strlen (lookup_name) - 4])) ) { /* no zone required, use 'anonymous' zone */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (), + GNUNET_CRYPTO_ecdsa_key_get_public (GNUNET_CRYPTO_ecdsa_key_get_anonymous (), &pkey); lookup_with_public_key (&pkey); } diff --git a/src/gns/gnunet-service-gns.c b/src/gns/gnunet-service-gns.c index 8fcd75e7c..d3728ee00 100644 --- a/src/gns/gnunet-service-gns.c +++ b/src/gns/gnunet-service-gns.c @@ -318,7 +318,7 @@ dht_put_continuation (void *cls, */ static void put_gns_record (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -414,8 +414,8 @@ put_gns_record (void *cls, rd_public, rd_public_count); block_size = ntohl (block->purpose.size) - + sizeof (struct GNUNET_CRYPTO_EccSignature) - + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature) + + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); GNUNET_NAMESTORE_query_from_private_key (key, name, &query); @@ -528,7 +528,7 @@ handle_lookup (void *cls, struct ClientLookupHandle *clh; char *nameptr = name; const char *utf_in; - const struct GNUNET_CRYPTO_EccPrivateKey *key; + const struct GNUNET_CRYPTO_EcdsaPrivateKey *key; uint16_t msg_size; const struct GNUNET_GNS_ClientLookupMessage *sh_msg; @@ -630,7 +630,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, { &handle_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_LOOKUP, 0}, {NULL, NULL, 0, 0} }; - struct GNUNET_CRYPTO_EccPublicSignKey dns_root; + struct GNUNET_CRYPTO_EcdsaPublicKey dns_root; unsigned long long max_parallel_bg_queries = 0; char *dns_root_name; @@ -683,7 +683,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, &dns_root_name)) { if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (dns_root_name, + GNUNET_CRYPTO_ecdsa_public_key_from_string (dns_root_name, strlen (dns_root_name), &dns_root)) { diff --git a/src/gns/gnunet-service-gns_interceptor.c b/src/gns/gnunet-service-gns_interceptor.c index 8cb1951bf..61568c438 100644 --- a/src/gns/gnunet-service-gns_interceptor.c +++ b/src/gns/gnunet-service-gns_interceptor.c @@ -75,7 +75,7 @@ static struct GNUNET_DNS_Handle *dns_handle; /** * Key of the zone we start lookups in. */ -static struct GNUNET_CRYPTO_EccPublicSignKey zone; +static struct GNUNET_CRYPTO_EcdsaPublicKey zone; /** * Head of the DLL. @@ -353,7 +353,7 @@ handle_dns_request (void *cls, * @return #GNUNET_OK on success */ int -GNS_interceptor_init (const struct GNUNET_CRYPTO_EccPublicSignKey *gnu_zone, +GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone, const struct GNUNET_CONFIGURATION_Handle *c) { GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/gns/gnunet-service-gns_interceptor.h b/src/gns/gnunet-service-gns_interceptor.h index 509875645..bfcc54017 100644 --- a/src/gns/gnunet-service-gns_interceptor.h +++ b/src/gns/gnunet-service-gns_interceptor.h @@ -36,7 +36,7 @@ * @return GNUNET_YES on success GNUNET_SYSERR on error */ int -GNS_interceptor_init (const struct GNUNET_CRYPTO_EccPublicSignKey *gnu_zone, +GNS_interceptor_init (const struct GNUNET_CRYPTO_EcdsaPublicKey *gnu_zone, const struct GNUNET_CONFIGURATION_Handle *c); /** diff --git a/src/gns/gnunet-service-gns_resolver.c b/src/gns/gnunet-service-gns_resolver.c index 43d50aed5..4b26803ff 100644 --- a/src/gns/gnunet-service-gns_resolver.c +++ b/src/gns/gnunet-service-gns_resolver.c @@ -112,7 +112,7 @@ struct AuthorityChain /** * The zone of the GNS authority */ - struct GNUNET_CRYPTO_EccPublicSignKey gns_authority; + struct GNUNET_CRYPTO_EcdsaPublicKey gns_authority; struct { @@ -230,7 +230,7 @@ struct GNS_ResolverHandle /** * The top-level GNS authoritative zone to query */ - struct GNUNET_CRYPTO_EccPublicSignKey authority_zone; + struct GNUNET_CRYPTO_EcdsaPublicKey authority_zone; /** * called when resolution phase finishes @@ -286,7 +286,7 @@ struct GNS_ResolverHandle /** * Private key of the shorten zone, NULL to not shorten. */ - struct GNUNET_CRYPTO_EccPrivateKey *shorten_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key; /** * ID of a task associated with the resolution process. @@ -1421,9 +1421,9 @@ handle_gns_resolution_result (void *cls, /* tigger shortening */ if (NULL != rh->shorten_key) { - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; - if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) + if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) { GNUNET_break_op (0); break; @@ -1454,7 +1454,7 @@ handle_gns_resolution_result (void *cls, { case GNUNET_NAMESTORE_TYPE_PKEY: /* delegation to another zone */ - if (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != + if (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) != rd[i].data_size) { GNUNET_break_op (0); @@ -1468,7 +1468,7 @@ handle_gns_resolution_result (void *cls, ac->gns_authority = GNUNET_YES; memcpy (&ac->authority_info.gns_authority, rd[i].data, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); ac->label = resolver_lookup_get_next_label (rh); /* tigger shortening */ if (NULL != rh->shorten_key) @@ -1719,8 +1719,8 @@ handle_dht_response (void *cls, block = data; if (size != ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature)) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) { /* how did this pass DHT block validation!? */ GNUNET_break (0); @@ -1768,7 +1768,7 @@ handle_namestore_block_response (void *cls, struct GNS_ResolverHandle *rx; struct AuthorityChain *ac = rh->ac_tail; const char *label = ac->label; - const struct GNUNET_CRYPTO_EccPublicSignKey *auth = &ac->authority_info.gns_authority; + const struct GNUNET_CRYPTO_EcdsaPublicKey *auth = &ac->authority_info.gns_authority; struct GNUNET_HashCode query; GNUNET_NAMESTORE_query_from_public_key (auth, @@ -1947,7 +1947,7 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh) if ( (NULL == x) || (NULL == y) || (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (pkey, + GNUNET_CRYPTO_ecdsa_public_key_from_string (pkey, strlen (pkey), &rh->authority_zone)) ) { @@ -1995,10 +1995,10 @@ start_resolver_lookup (struct GNS_ResolverHandle *rh) * @return handle to cancel operation */ struct GNS_ResolverHandle * -GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone, +GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, uint32_t record_type, const char *name, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key, int only_cached, GNS_ResultProcessor proc, void *proc_cls) { @@ -2022,7 +2022,7 @@ GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone, rh->name_resolution_pos = strlen (name); if (NULL != shorten_key) { - rh->shorten_key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + rh->shorten_key = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); *rh->shorten_key = *shorten_key; } start_resolver_lookup (rh); diff --git a/src/gns/gnunet-service-gns_resolver.h b/src/gns/gnunet-service-gns_resolver.h index e9916c778..06273766a 100644 --- a/src/gns/gnunet-service-gns_resolver.h +++ b/src/gns/gnunet-service-gns_resolver.h @@ -83,10 +83,10 @@ typedef void (*GNS_ResultProcessor)(void *cls, * @return handle to cancel operation */ struct GNS_ResolverHandle * -GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone, +GNS_resolver_lookup (const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, uint32_t record_type, const char *name, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_key, int only_cached, GNS_ResultProcessor proc, void *proc_cls); diff --git a/src/gns/gnunet-service-gns_shorten.c b/src/gns/gnunet-service-gns_shorten.c index ff2cab097..f0c96716a 100644 --- a/src/gns/gnunet-service-gns_shorten.c +++ b/src/gns/gnunet-service-gns_shorten.c @@ -65,7 +65,7 @@ struct GetPseuAuthorityHandle * Private key of the (shorten) zone to store the resulting * pseudonym in. */ - struct GNUNET_CRYPTO_EccPrivateKey shorten_zone_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey shorten_zone_key; /** * Original label (used if no PSEU record is found). @@ -80,7 +80,7 @@ struct GetPseuAuthorityHandle /** * The zone for which we are trying to find the PSEU record. */ - struct GNUNET_CRYPTO_EccPublicSignKey target_zone; + struct GNUNET_CRYPTO_EcdsaPublicKey target_zone; /** * Handle for DHT lookups. Should be NULL if no lookups are in progress @@ -195,7 +195,7 @@ process_pseu_block_ns (void *cls, const struct GNUNET_NAMESTORE_Block *block) { struct GetPseuAuthorityHandle *gph = cls; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; gph->namestore_task = NULL; if (NULL == block) @@ -203,7 +203,7 @@ process_pseu_block_ns (void *cls, process_pseu_lookup_ns (gph, 0, NULL); return; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key, + GNUNET_CRYPTO_ecdsa_key_get_public (&gph->shorten_zone_key, &pub); if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, @@ -229,10 +229,10 @@ static void perform_pseu_lookup (struct GetPseuAuthorityHandle *gph, const char *label) { - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; struct GNUNET_HashCode query; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&gph->shorten_zone_key, + GNUNET_CRYPTO_ecdsa_key_get_public (&gph->shorten_zone_key, &pub); GNUNET_free_non_null (gph->current_label); gph->current_label = GNUNET_strdup (label); @@ -287,7 +287,7 @@ process_pseu_lookup_ns (void *cls, GNUNET_NAMESTORE_z2s (&gph->target_zone), gph->current_label); new_pkey.expiration_time = UINT64_MAX; - new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); + new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); new_pkey.data = &gph->target_zone; new_pkey.record_type = GNUNET_NAMESTORE_TYPE_PKEY; new_pkey.flags = GNUNET_NAMESTORE_RF_NONE @@ -437,8 +437,8 @@ process_auth_discovery_dht_result (void* cls, block = data; if (size != ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature)) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) { /* how did this pass DHT block validation!? */ GNUNET_break (0); @@ -472,7 +472,7 @@ process_auth_discovery_dht_result (void* cls, */ static void process_zone_to_name_discover (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_len, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -519,8 +519,8 @@ process_zone_to_name_discover (void *cls, */ void GNS_shorten_start (const char *original_label, - const struct GNUNET_CRYPTO_EccPublicSignKey *pub, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone) + const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_zone) { struct GetPseuAuthorityHandle *gph; diff --git a/src/gns/gnunet-service-gns_shorten.h b/src/gns/gnunet-service-gns_shorten.h index ed3bdf11f..5f583eeb5 100644 --- a/src/gns/gnunet-service-gns_shorten.h +++ b/src/gns/gnunet-service-gns_shorten.h @@ -59,8 +59,8 @@ GNS_shorten_done (void); */ void GNS_shorten_start (const char *original_label, - const struct GNUNET_CRYPTO_EccPublicSignKey *pub, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone); + const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_zone); #endif diff --git a/src/gns/plugin_block_gns.c b/src/gns/plugin_block_gns.c index 932900910..ad2e6594e 100644 --- a/src/gns/plugin_block_gns.c +++ b/src/gns/plugin_block_gns.c @@ -85,7 +85,7 @@ block_plugin_gns_evaluate (void *cls, enum GNUNET_BLOCK_Type type, return GNUNET_BLOCK_EVALUATION_RESULT_INVALID; } block = reply_block; - if (ntohl (block->purpose.size) + sizeof (struct GNUNET_CRYPTO_EccSignature) + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != + if (ntohl (block->purpose.size) + sizeof (struct GNUNET_CRYPTO_EcdsaSignature) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) != reply_block_size) { GNUNET_break_op (0); diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c index 8563eda2f..66a2eb091 100644 --- a/src/gns/test_gns_proxy.c +++ b/src/gns/test_gns_proxy.c @@ -364,7 +364,7 @@ run (void *cls, struct GNUNET_TESTING_Peer *peer) { enum MHD_FLAG flags; - struct GNUNET_CRYPTO_EccPrivateKey *host_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *host_key; struct GNUNET_NAMESTORE_RecordData rd; char *zone_keyfile; @@ -421,7 +421,7 @@ run (void *cls, return; } - host_key = GNUNET_CRYPTO_ecc_key_create_from_file (zone_keyfile); + host_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (zone_keyfile); rd.expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; GNUNET_assert (GNUNET_OK == GNUNET_NAMESTORE_string_to_value (GNUNET_DNSPARSER_TYPE_A, "127.0.0.1", diff --git a/src/gns/test_gns_pseu_shorten.c b/src/gns/test_gns_pseu_shorten.c index a4c337067..f4c628cb0 100644 --- a/src/gns/test_gns_pseu_shorten.c +++ b/src/gns/test_gns_pseu_shorten.c @@ -69,16 +69,16 @@ static struct GNUNET_DHT_Handle *dht_handle; static const struct GNUNET_CONFIGURATION_Handle *cfg; -static struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey; -static struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey; -static struct GNUNET_CRYPTO_EccPublicSignKey our_pkey; -static struct GNUNET_CRYPTO_EccPublicSignKey priv_pkey; -static struct GNUNET_CRYPTO_EccPublicSignKey short_pkey; -static struct GNUNET_CRYPTO_EccPrivateKey *alice_key; -static struct GNUNET_CRYPTO_EccPrivateKey *bob_key; -static struct GNUNET_CRYPTO_EccPrivateKey *our_key; -static struct GNUNET_CRYPTO_EccPrivateKey *priv_key; -static struct GNUNET_CRYPTO_EccPrivateKey *short_key; +static struct GNUNET_CRYPTO_EcdsaPublicKey alice_pkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey bob_pkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey our_pkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey priv_pkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey short_pkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *alice_key; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *bob_key; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *our_key; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *short_key; static struct GNUNET_CRYPTO_ShortHashCode alice_hash; static struct GNUNET_CRYPTO_ShortHashCode bob_hash; static struct GNUNET_CRYPTO_ShortHashCode our_zone; @@ -265,7 +265,7 @@ put_pseu_dht (void *cls, int success) struct GNUNET_HashCode zone_hash_double; uint32_t rd_payload_length; char* nrb_data = NULL; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaSignature *sig; struct GNUNET_NAMESTORE_RecordData rd; memset (&rd, 0, sizeof (struct GNUNET_NAMESTORE_RecordData)); @@ -316,7 +316,7 @@ put_pseu_dht (void *cls, int success) } GNUNET_CRYPTO_short_hash(GNUNET_GNS_MASTERZONE_STR, strlen(GNUNET_GNS_MASTERZONE_STR), &name_hash); GNUNET_CRYPTO_short_hash(&alice_pkey, - sizeof(struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), &zone_hash); GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); @@ -353,7 +353,7 @@ put_www_dht (void *cls, int success) struct GNUNET_HashCode zone_hash_double; uint32_t rd_payload_length; char* nrb_data = NULL; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaSignature *sig; struct GNUNET_NAMESTORE_RecordData rd; char* ip = TEST_IP; struct in_addr *web = GNUNET_malloc(sizeof(struct in_addr)); @@ -405,7 +405,7 @@ put_www_dht (void *cls, int success) } GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash); GNUNET_CRYPTO_short_hash(&alice_pkey, - sizeof(struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), &zone_hash); GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double); GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); @@ -441,7 +441,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) struct GNUNET_HashCode zone_hash_double; uint32_t rd_payload_length; char* nrb_data = NULL; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaSignature *sig; struct GNUNET_NAMESTORE_RecordData rd; rd.expiration_time = UINT64_MAX; @@ -488,7 +488,7 @@ put_pkey_dht (void *cls, int32_t success, const char *emsg) GNUNET_CRYPTO_short_hash (TEST_AUTHORITY_ALICE, strlen (TEST_AUTHORITY_ALICE), &name_hash); GNUNET_CRYPTO_short_hash (&bob_pkey, - sizeof(struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof(struct GNUNET_CRYPTO_EcdsaPublicKey), &zone_hash); GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double); GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double); @@ -616,21 +616,21 @@ do_check (void *cls, GNUNET_free (private_keyfile); return; } - our_key = GNUNET_CRYPTO_ecc_key_create_from_file (our_keyfile); - priv_key = GNUNET_CRYPTO_ecc_key_create_from_file (private_keyfile); - short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile); - bob_key = GNUNET_CRYPTO_ecc_key_create (); - alice_key = GNUNET_CRYPTO_ecc_key_create (); + our_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (our_keyfile); + priv_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (private_keyfile); + short_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (shorten_keyfile); + bob_key = GNUNET_CRYPTO_ecdsa_key_create (); + alice_key = GNUNET_CRYPTO_ecdsa_key_create (); GNUNET_free (our_keyfile); GNUNET_free (shorten_keyfile); GNUNET_free (private_keyfile); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (our_key, &our_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv_key, &priv_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (short_key, &short_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (our_key, &our_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (priv_key, &priv_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (short_key, &short_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (bob_key, &bob_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (alice_key, &alice_pkey); GNUNET_CRYPTO_short_hash (&bob_pkey, sizeof(bob_pkey), &bob_hash); GNUNET_CRYPTO_short_hash (&alice_pkey, sizeof(alice_pkey), &alice_hash); GNUNET_CRYPTO_short_hash (&our_pkey, sizeof(our_pkey), &our_zone); diff --git a/src/gns/test_gns_revocation.c b/src/gns/test_gns_revocation.c index 30fe5eb66..5be15759a 100644 --- a/src/gns/test_gns_revocation.c +++ b/src/gns/test_gns_revocation.c @@ -181,12 +181,12 @@ do_check (void *cls, const struct GNUNET_CONFIGURATION_Handle *ccfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey; - struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey; - struct GNUNET_CRYPTO_EccPrivateKey *alice_key; - struct GNUNET_CRYPTO_EccPrivateKey *bob_key; + struct GNUNET_CRYPTO_EcdsaPublicKey alice_pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey bob_pkey; + struct GNUNET_CRYPTO_EcdsaPrivateKey *alice_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *bob_key; struct GNUNET_CRYPTO_ShortHashCode bob_hash; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaSignature *sig; char* alice_keyfile; cfg = ccfg; @@ -210,11 +210,11 @@ do_check (void *cls, return; } - alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile); - bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB); + alice_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (alice_keyfile); + bob_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (KEYFILE_BOB); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (alice_key, &alice_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (bob_key, &bob_pkey); struct GNUNET_NAMESTORE_RecordData rd; char* ip = TEST_IP; diff --git a/src/gns/test_gns_simple_shorten.c b/src/gns/test_gns_simple_shorten.c index 1b383a0bd..a4cfa26dc 100644 --- a/src/gns/test_gns_simple_shorten.c +++ b/src/gns/test_gns_simple_shorten.c @@ -61,10 +61,10 @@ static struct GNUNET_GNS_Handle *gns_handle; const struct GNUNET_CONFIGURATION_Handle *cfg; -struct GNUNET_CRYPTO_EccPublicSignKey priv_pkey; -struct GNUNET_CRYPTO_EccPublicSignKey short_pkey; -struct GNUNET_CRYPTO_EccPrivateKey *priv_key; -struct GNUNET_CRYPTO_EccPrivateKey *short_key; +struct GNUNET_CRYPTO_EcdsaPublicKey priv_pkey; +struct GNUNET_CRYPTO_EcdsaPublicKey short_pkey; +struct GNUNET_CRYPTO_EcdsaPrivateKey *priv_key; +struct GNUNET_CRYPTO_EcdsaPrivateKey *short_key; struct GNUNET_CRYPTO_ShortHashCode priv_zone; struct GNUNET_CRYPTO_ShortHashCode short_zone; @@ -170,15 +170,15 @@ void do_check (void *cls, const struct GNUNET_CONFIGURATION_Handle *ccfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_CRYPTO_EccPublicSignKey our_pkey; - struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey; - struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey; - struct GNUNET_CRYPTO_EccPrivateKey *our_key; - struct GNUNET_CRYPTO_EccPrivateKey *alice_key; - struct GNUNET_CRYPTO_EccPrivateKey *bob_key; + struct GNUNET_CRYPTO_EcdsaPublicKey our_pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey alice_pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey bob_pkey; + struct GNUNET_CRYPTO_EcdsaPrivateKey *our_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *alice_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *bob_key; struct GNUNET_CRYPTO_ShortHashCode bob_hash; struct GNUNET_CRYPTO_ShortHashCode alice_hash; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaSignature *sig; char* our_keyfile; char* private_keyfile; char* shorten_keyfile; @@ -226,22 +226,22 @@ void do_check (void *cls, return; } - our_key = GNUNET_CRYPTO_ecc_key_create_from_file (our_keyfile); + our_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (our_keyfile); GNUNET_free(our_keyfile); - bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB); - alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_ALICE); - priv_key = GNUNET_CRYPTO_ecc_key_create_from_file (private_keyfile); - short_key = GNUNET_CRYPTO_ecc_key_create_from_file (shorten_keyfile); + bob_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (KEYFILE_BOB); + alice_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (KEYFILE_ALICE); + priv_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (private_keyfile); + short_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (shorten_keyfile); GNUNET_free(shorten_keyfile); GNUNET_free(private_keyfile); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (our_key, &our_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv_key, &priv_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (short_key, &short_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (our_key, &our_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (alice_key, &alice_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (bob_key, &bob_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (priv_key, &priv_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (short_key, &short_pkey); GNUNET_CRYPTO_short_hash(&priv_pkey, sizeof(priv_pkey), &priv_zone); GNUNET_CRYPTO_short_hash(&short_pkey, sizeof(short_pkey), &short_zone); diff --git a/src/gns/test_gns_simple_srv_lookup.c b/src/gns/test_gns_simple_srv_lookup.c index 76e564f41..f31ae6daa 100644 --- a/src/gns/test_gns_simple_srv_lookup.c +++ b/src/gns/test_gns_simple_srv_lookup.c @@ -182,12 +182,12 @@ do_check (void *cls, const struct GNUNET_CONFIGURATION_Handle *ccfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey; - struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey; - struct GNUNET_CRYPTO_EccPrivateKey *alice_key; - struct GNUNET_CRYPTO_EccPrivateKey *bob_key; + struct GNUNET_CRYPTO_EcdsaPublicKey alice_pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey bob_pkey; + struct GNUNET_CRYPTO_EcdsaPrivateKey *alice_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *bob_key; struct GNUNET_CRYPTO_ShortHashCode bob_hash; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaSignature *sig; char* alice_keyfile; struct GNUNET_TUN_DnsSrvRecord *srv_data; struct GNUNET_TIME_Absolute et; @@ -213,11 +213,11 @@ do_check (void *cls, return; } - alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile); - bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB); + alice_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (alice_keyfile); + bob_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (KEYFILE_BOB); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (alice_key, &alice_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (bob_key, &bob_pkey); struct GNUNET_NAMESTORE_RecordData rd; char* ip = TEST_IP; diff --git a/src/gns/test_gns_simple_zkey_lookup.c b/src/gns/test_gns_simple_zkey_lookup.c index 52a550ebf..a808d2d9d 100644 --- a/src/gns/test_gns_simple_zkey_lookup.c +++ b/src/gns/test_gns_simple_zkey_lookup.c @@ -199,11 +199,11 @@ do_check (void *cls, const struct GNUNET_CONFIGURATION_Handle *ccfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey; - struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey; - struct GNUNET_CRYPTO_EccPrivateKey *alice_key; - struct GNUNET_CRYPTO_EccPrivateKey *bob_key; - struct GNUNET_CRYPTO_EccSignature *sig; + struct GNUNET_CRYPTO_EcdsaPublicKey alice_pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey bob_pkey; + struct GNUNET_CRYPTO_EcdsaPrivateKey *alice_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey *bob_key; + struct GNUNET_CRYPTO_EcdsaSignature *sig; char* alice_keyfile; cfg = ccfg; @@ -227,11 +227,11 @@ do_check (void *cls, return; } - alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile); - bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB); + alice_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (alice_keyfile); + bob_key = GNUNET_CRYPTO_ecdsa_key_create_from_file (KEYFILE_BOB); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (bob_key, &bob_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (alice_key, &alice_pkey); + GNUNET_CRYPTO_ecdsa_key_get_public (bob_key, &bob_pkey); struct GNUNET_NAMESTORE_RecordData rd; char* ip = TEST_IP; diff --git a/src/hello/gnunet-hello.c b/src/hello/gnunet-hello.c index 795f4f29b..e857bde26 100644 --- a/src/hello/gnunet-hello.c +++ b/src/hello/gnunet-hello.c @@ -111,7 +111,7 @@ main (int argc, char *argv[]) struct GNUNET_DISK_FileHandle *fh; struct GNUNET_HELLO_Message *orig; struct GNUNET_HELLO_Message *result; - struct GNUNET_CRYPTO_EccPublicSignKey pk; + struct GNUNET_CRYPTO_EddsaPublicKey pk; uint64_t fsize; address_count = 0; diff --git a/src/hello/hello.c b/src/hello/hello.c index 6261dcb6b..37acc5996 100644 --- a/src/hello/hello.c +++ b/src/hello/hello.c @@ -59,7 +59,7 @@ struct GNUNET_HELLO_Message /** * The public key of the peer. */ - struct GNUNET_CRYPTO_EccPublicSignKey publicKey; + struct GNUNET_CRYPTO_EddsaPublicKey publicKey; }; GNUNET_NETWORK_STRUCT_END @@ -218,7 +218,7 @@ get_hello_address_size (const char *buf, * @return the hello message */ struct GNUNET_HELLO_Message * -GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicSignKey *publicKey, +GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EddsaPublicKey *publicKey, GNUNET_HELLO_GenerateAddressListCallback addrgen, void *addrgen_cls, int friend_only) @@ -249,7 +249,7 @@ GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicSignKey *publicKey, hello->friend_only = htonl (friend_only); memcpy (&hello->publicKey, publicKey, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); memcpy (&hello[1], buffer, used); return hello; } @@ -530,7 +530,7 @@ GNUNET_HELLO_size (const struct GNUNET_HELLO_Message *hello) */ int GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello, - struct GNUNET_CRYPTO_EccPublicSignKey *publicKey) + struct GNUNET_CRYPTO_EddsaPublicKey *publicKey) { uint16_t ret = ntohs (hello->header.size); @@ -669,7 +669,7 @@ GNUNET_HELLO_equals (const struct GNUNET_HELLO_Message *h1, if (0 != memcmp (&h1->publicKey, &h2->publicKey, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))) return GNUNET_TIME_UNIT_ZERO_ABS; ec.expiration_limit = now; ec.result = GNUNET_TIME_UNIT_FOREVER_ABS; @@ -871,7 +871,7 @@ GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello, struct GNUNET_HELLO_ComposeUriContext ctx; ctx.plugins_find = plugins_find; - char *pkey = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&(hello->publicKey)); + char *pkey = GNUNET_CRYPTO_eddsa_public_key_to_string (&(hello->publicKey)); GNUNET_asprintf (&(ctx.uri), "%s%s", @@ -1044,7 +1044,7 @@ add_address_to_hello (void *cls, size_t max, void *buffer) */ int GNUNET_HELLO_parse_uri (const char *uri, - struct GNUNET_CRYPTO_EccPublicSignKey *pubkey, + struct GNUNET_CRYPTO_EddsaPublicKey *pubkey, struct GNUNET_HELLO_Message **hello, GNUNET_HELLO_TransportPluginsFind plugins_find) { diff --git a/src/hello/test_friend_hello.c b/src/hello/test_friend_hello.c index d5f75c824..019bf4b9a 100644 --- a/src/hello/test_friend_hello.c +++ b/src/hello/test_friend_hello.c @@ -93,8 +93,8 @@ main (int argc, char *argv[]) struct GNUNET_HELLO_Message *msg1; struct GNUNET_HELLO_Message *msg2; struct GNUNET_HELLO_Message *msg3; - struct GNUNET_CRYPTO_EccPublicSignKey publicKey; - struct GNUNET_CRYPTO_EccPublicSignKey pk; + struct GNUNET_CRYPTO_EddsaPublicKey publicKey; + struct GNUNET_CRYPTO_EddsaPublicKey pk; struct GNUNET_TIME_Absolute startup_time; unsigned int i; diff --git a/src/hello/test_hello.c b/src/hello/test_hello.c index f1fa8234a..ff80f1889 100644 --- a/src/hello/test_hello.c +++ b/src/hello/test_hello.c @@ -93,8 +93,8 @@ main (int argc, char *argv[]) struct GNUNET_HELLO_Message *msg1; struct GNUNET_HELLO_Message *msg2; struct GNUNET_HELLO_Message *msg3; - struct GNUNET_CRYPTO_EccPublicSignKey publicKey; - struct GNUNET_CRYPTO_EccPublicSignKey pk; + struct GNUNET_CRYPTO_EddsaPublicKey publicKey; + struct GNUNET_CRYPTO_EddsaPublicKey pk; struct GNUNET_TIME_Absolute startup_time; unsigned int i; diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index c2c381604..8304a707d 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c @@ -226,7 +226,7 @@ print_ego (void *cls, void **ctx, const char *identifier) { - struct GNUNET_CRYPTO_EccPublicSignKey pk; + struct GNUNET_CRYPTO_EcdsaPublicKey pk; char *s; if ( (NULL != set_ego) && @@ -267,7 +267,7 @@ print_ego (void *cls, if (NULL == ego) return; GNUNET_IDENTITY_ego_get_public_key (ego, &pk); - s = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pk); + s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); if ( (monitor) || (NULL != identifier) ) fprintf (stdout, "%s - %s\n", identifier, s); GNUNET_free (s); diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c index c61286bd5..e0c0bd783 100644 --- a/src/identity/gnunet-service-identity.c +++ b/src/identity/gnunet-service-identity.c @@ -58,7 +58,7 @@ struct Ego /** * Private key of the ego. */ - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; /** * String identifier for the ego. @@ -370,10 +370,10 @@ handle_get_default_message (void *cls, struct GNUNET_SERVER_Client *client, * @return 0 if the keys are equal */ static int -key_cmp (const struct GNUNET_CRYPTO_EccPrivateKey *pk1, - const struct GNUNET_CRYPTO_EccPrivateKey *pk2) +key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) { - return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)); + return memcmp (pk1, pk2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); } @@ -517,7 +517,7 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, } } ego = GNUNET_new (struct Ego); - ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); *ego->pk = crm->private_key; ego->identifier = GNUNET_strdup (str); GNUNET_CONTAINER_DLL_insert (ego_head, @@ -526,10 +526,10 @@ handle_create_message (void *cls, struct GNUNET_SERVER_Client *client, send_result_code (client, 0, NULL); fn = get_ego_filename (ego); (void) GNUNET_DISK_directory_create_for_file (fn); - if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != + if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) != GNUNET_DISK_fn_write (fn, &crm->private_key, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), GNUNET_DISK_PERM_USER_READ | GNUNET_DISK_PERM_USER_WRITE)) GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, @@ -819,7 +819,7 @@ process_ego_file (void *cls, return GNUNET_OK; } ego = GNUNET_new (struct Ego); - ego->pk = GNUNET_CRYPTO_ecc_key_create_from_file (filename); + ego->pk = GNUNET_CRYPTO_ecdsa_key_create_from_file (filename); if (NULL == ego->pk) { GNUNET_free (ego); diff --git a/src/identity/identity.h b/src/identity/identity.h index 5e965b2c7..206f08f2a 100644 --- a/src/identity/identity.h +++ b/src/identity/identity.h @@ -81,7 +81,7 @@ struct GNUNET_IDENTITY_UpdateMessage /** * The private key */ - struct GNUNET_CRYPTO_EccPrivateKey private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; /* followed by 0-terminated identity name */ @@ -140,7 +140,7 @@ struct GNUNET_IDENTITY_SetDefaultMessage /** * The private key */ - struct GNUNET_CRYPTO_EccPrivateKey private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; /* followed by 0-terminated service name */ @@ -171,7 +171,7 @@ struct GNUNET_IDENTITY_CreateRequestMessage /** * The private key */ - struct GNUNET_CRYPTO_EccPrivateKey private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; /* followed by 0-terminated identity name */ diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c index dc4613cdb..931deb509 100644 --- a/src/identity/identity_api.c +++ b/src/identity/identity_api.c @@ -40,7 +40,7 @@ struct GNUNET_IDENTITY_Ego /** * Private key associated with this ego. */ - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; /** * Current name associated with this ego. @@ -179,12 +179,12 @@ const struct GNUNET_IDENTITY_Ego * GNUNET_IDENTITY_ego_get_anonymous () { static struct GNUNET_IDENTITY_Ego anon; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; if (NULL != anon.pk) return &anon; - anon.pk = (struct GNUNET_CRYPTO_EccPrivateKey *) GNUNET_CRYPTO_ecc_key_get_anonymous (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon.pk, + anon.pk = (struct GNUNET_CRYPTO_EcdsaPrivateKey *) GNUNET_CRYPTO_ecdsa_key_get_anonymous (); + GNUNET_CRYPTO_ecdsa_key_get_public (anon.pk, &pub); GNUNET_CRYPTO_hash (&pub, sizeof (pub), &anon.id); return &anon; @@ -249,7 +249,7 @@ message_handler (void *cls, const struct GNUNET_IDENTITY_ResultCodeMessage *rcm; const struct GNUNET_IDENTITY_UpdateMessage *um; const struct GNUNET_IDENTITY_SetDefaultMessage *sdm; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; struct GNUNET_HashCode id; const char *str; uint16_t size; @@ -326,7 +326,7 @@ message_handler (void *cls, h->cb (h->cb_cls, NULL, NULL, NULL); break; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&um->private_key, + GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id); if (0 == name_len) @@ -346,7 +346,7 @@ message_handler (void *cls, return; } ego = GNUNET_new (struct GNUNET_IDENTITY_Ego); - ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + ego->pk = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); *ego->pk = um->private_key; ego->name = GNUNET_strdup (str); ego->id = id; @@ -406,7 +406,7 @@ message_handler (void *cls, } /* Note: we know which service this should be for, so we're not really using 'str' henceforth */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&sdm->private_key, + GNUNET_CRYPTO_ecdsa_key_get_public (&sdm->private_key, &pub); GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id); ego = GNUNET_CONTAINER_multihashmap_get (h->egos, @@ -591,7 +591,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg, * @param ego the ego * @return associated ECC key, valid as long as the ego is valid */ -const struct GNUNET_CRYPTO_EccPrivateKey * +const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) { return ego->pk; @@ -606,9 +606,9 @@ GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) */ void GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, - struct GNUNET_CRYPTO_EccPublicSignKey *pk) + struct GNUNET_CRYPTO_EcdsaPublicKey *pk) { - GNUNET_CRYPTO_ecc_key_get_public_for_signature (ego->pk, + GNUNET_CRYPTO_ecdsa_key_get_public (ego->pk, pk); } @@ -730,11 +730,11 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *id, { struct GNUNET_IDENTITY_Operation *op; struct GNUNET_IDENTITY_CreateRequestMessage *crm; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EcdsaPrivateKey *pk; size_t slen; slen = strlen (name) + 1; - pk = GNUNET_CRYPTO_ecc_key_create (); + pk = GNUNET_CRYPTO_ecdsa_key_create (); if (slen >= GNUNET_SERVER_MAX_MESSAGE_SIZE - sizeof (struct GNUNET_IDENTITY_CreateRequestMessage)) { diff --git a/src/include/block_dns.h b/src/include/block_dns.h index 650b3bc14..9bfaac1c6 100644 --- a/src/include/block_dns.h +++ b/src/include/block_dns.h @@ -37,7 +37,7 @@ struct GNUNET_DNS_Advertisement /** * Signature of the peer affirming that he is offering the service. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; /** * Beginning of signed portion of the record, signs everything until diff --git a/src/include/block_fs.h b/src/include/block_fs.h index 3a0afba14..3f904caeb 100644 --- a/src/include/block_fs.h +++ b/src/include/block_fs.h @@ -48,7 +48,7 @@ struct UBlock /** * Signature using pseudonym and search keyword / identifier. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; /** * What is being signed and why? @@ -58,7 +58,7 @@ struct UBlock /** * Public key used to sign this block. */ - struct GNUNET_CRYPTO_EccPublicSignKey verification_key; + struct GNUNET_CRYPTO_EcdsaPublicKey verification_key; /* rest of the data is encrypted */ diff --git a/src/include/block_regex.h b/src/include/block_regex.h index 77f778c95..326183d56 100644 --- a/src/include/block_regex.h +++ b/src/include/block_regex.h @@ -72,7 +72,7 @@ struct RegexAcceptBlock /** * The signature. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; }; diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h index bd1a2f3bf..da4de4c87 100644 --- a/src/include/gnunet_crypto_lib.h +++ b/src/include/gnunet_crypto_lib.h @@ -148,9 +148,10 @@ struct GNUNET_CRYPTO_EccSignaturePurpose /** - * @brief an ECC signature + * @brief an ECC signature using EdDSA. + * See https://gnunet.org/ed25519 */ -struct GNUNET_CRYPTO_EccSignature +struct GNUNET_CRYPTO_EddsaSignature { /** @@ -166,11 +167,54 @@ struct GNUNET_CRYPTO_EccSignature }; + /** - * Public ECC key (always for NIST P-521) encoded in a format suitable - * for network transmission and signatures (ECDSA/EdDSA). + * @brief an ECC signature using ECDSA */ -struct GNUNET_CRYPTO_EccPublicSignKey +struct GNUNET_CRYPTO_EcdsaSignature +{ + + /** + * R value. + */ + unsigned char r[256 / 8]; + + /** + * S value. + */ + unsigned char s[256 / 8]; + +}; + + +/** + * Public ECC key (always for Curve25519) encoded in a format suitable + * for network transmission and EdDSA signatures. + */ +struct GNUNET_CRYPTO_EddsaPublicKey +{ + /** + * Q consists of an x- and a y-value, each mod p (256 bits), + * given here in affine coordinates. + * + * FIXME: this coordinate will be removed in the future (compressed point!). + */ + unsigned char q_x[256 / 8]; + + /** + * Q consists of an x- and a y-value, each mod p (256 bits), + * given here in affine coordinates. + */ + unsigned char q_y[256 / 8]; + +}; + + +/** + * Public ECC key (always for Curve25519) encoded in a format suitable + * for network transmission and ECDSA signatures. + */ +struct GNUNET_CRYPTO_EcdsaPublicKey { /** * Q consists of an x- and a y-value, each mod p (256 bits), @@ -194,15 +238,16 @@ struct GNUNET_CRYPTO_EccPublicSignKey */ struct GNUNET_PeerIdentity { - struct GNUNET_CRYPTO_EccPublicSignKey public_key; + struct GNUNET_CRYPTO_EddsaPublicKey public_key; }; /** - * Public ECC key (always for NIST P-521) encoded in a format suitable - * for network transmission and encryption (ECDH). + * Public ECC key (always for Curve25519) encoded in a format suitable + * for network transmission and encryption (ECDH), + * See http://cr.yp.to/ecdh.html */ -struct GNUNET_CRYPTO_EccPublicEncryptKey +struct GNUNET_CRYPTO_EcdhePublicKey { /** * Q consists of an x- and a y-value, each mod p (256 bits), @@ -222,9 +267,36 @@ struct GNUNET_CRYPTO_EccPublicEncryptKey /** - * Private ECC key encoded for transmission. + * Private ECC key encoded for transmission. To be used only for ECDH + * key exchange (ECDHE to be precise). */ -struct GNUNET_CRYPTO_EccPrivateKey +struct GNUNET_CRYPTO_EcdhePrivateKey +{ + /** + * d is a value mod n, where n has at most 256 bits. + */ + unsigned char d[256 / 8]; + +}; + +/** + * Private ECC key encoded for transmission. To be used only for ECDSA + * signatures. + */ +struct GNUNET_CRYPTO_EcdsaPrivateKey +{ + /** + * d is a value mod n, where n has at most 256 bits. + */ + unsigned char d[256 / 8]; + +}; + +/** + * Private ECC key encoded for transmission. To be used only for EdDSA + * signatures. + */ +struct GNUNET_CRYPTO_EddsaPrivateKey { /** * d is a value mod n, where n has at most 256 bits. @@ -743,11 +815,11 @@ GNUNET_CRYPTO_hmac_derive_key (struct GNUNET_CRYPTO_AuthKey *key, * @param xtr_algo hash algorithm for the extraction phase, GCRY_MD_... * @param prf_algo hash algorithm for the expansion phase, GCRY_MD_... * @param xts salt - * @param xts_len length of xts + * @param xts_len length of @a xts * @param skm source key material - * @param skm_len length of skm + * @param skm_len length of @a skm * @param ... pair of void * & size_t for context chunks, terminated by NULL - * @return GNUNET_YES on success + * @return #GNUNET_YES on success */ int GNUNET_CRYPTO_hkdf (void *result, size_t out_len, int xtr_algo, int prf_algo, @@ -763,11 +835,11 @@ GNUNET_CRYPTO_hkdf (void *result, size_t out_len, int xtr_algo, int prf_algo, * @param xtr_algo hash algorithm for the extraction phase, GCRY_MD_... * @param prf_algo hash algorithm for the expansion phase, GCRY_MD_... * @param xts salt - * @param xts_len length of xts + * @param xts_len length of @a xts * @param skm source key material - * @param skm_len length of skm + * @param skm_len length of @a skm * @param argp va_list of void * & size_t pairs for context chunks - * @return GNUNET_YES on success + * @return #GNUNET_YES on success */ int GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo, @@ -780,11 +852,11 @@ GNUNET_CRYPTO_hkdf_v (void *result, size_t out_len, int xtr_algo, int prf_algo, * @param result buffer for the derived key, allocated by caller * @param out_len desired length of the derived key * @param xts salt - * @param xts_len length of xts + * @param xts_len length of @a xts * @param skm source key material - * @param skm_len length of skm + * @param skm_len length of @a skm * @param argp va_list of void * & size_t pairs for context chunks - * @return GNUNET_YES on success + * @return #GNUNET_YES on success */ int GNUNET_CRYPTO_kdf_v (void *result, size_t out_len, const void *xts, @@ -798,9 +870,9 @@ GNUNET_CRYPTO_kdf_v (void *result, size_t out_len, const void *xts, * @param result buffer for the derived key, allocated by caller * @param out_len desired length of the derived key * @param xts salt - * @param xts_len length of xts + * @param xts_len length of @a xts * @param skm source key material - * @param skm_len length of skm + * @param skm_len length of @a skm * @param ... void * & size_t pairs for context chunks * @return #GNUNET_YES on success */ @@ -810,16 +882,15 @@ GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts, /** - * Function called upon completion of 'GNUNET_CRYPTO_ecc_key_create_async'. + * @ingroup crypto + * Extract the public key for the given private key. * - * @param cls closure - * @param pk NULL on error, otherwise the private key (which must be free'd by the callee) - * @param emsg NULL on success, otherwise an error message + * @param priv the private key + * @param pub where to write the public key */ -typedef void (*GNUNET_CRYPTO_EccKeyCallback)(void *cls, - struct GNUNET_CRYPTO_EccPrivateKey *pk, - const char *emsg); - +void +GNUNET_CRYPTO_ecdsa_key_get_public (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, + struct GNUNET_CRYPTO_EcdsaPublicKey *pub); /** * @ingroup crypto @@ -829,9 +900,8 @@ typedef void (*GNUNET_CRYPTO_EccKeyCallback)(void *cls, * @param pub where to write the public key */ void -GNUNET_CRYPTO_ecc_key_get_public_for_signature (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - struct GNUNET_CRYPTO_EccPublicSignKey *pub); - +GNUNET_CRYPTO_eddsa_key_get_public (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, + struct GNUNET_CRYPTO_EddsaPublicKey *pub); /** @@ -842,8 +912,18 @@ GNUNET_CRYPTO_ecc_key_get_public_for_signature (const struct GNUNET_CRYPTO_EccPr * @param pub where to write the public key */ void -GNUNET_CRYPTO_ecc_key_get_public_for_encryption (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - struct GNUNET_CRYPTO_EccPublicEncryptKey *pub); +GNUNET_CRYPTO_ecdhe_key_get_public (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, + struct GNUNET_CRYPTO_EcdhePublicKey *pub); + + +/** + * Convert a public key to a string. + * + * @param pub key to convert + * @return string representing @a pub + */ +char * +GNUNET_CRYPTO_ecdsa_public_key_to_string (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub); /** @@ -853,7 +933,7 @@ GNUNET_CRYPTO_ecc_key_get_public_for_encryption (const struct GNUNET_CRYPTO_EccP * @return string representing @a pub */ char * -GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPublicSignKey *pub); +GNUNET_CRYPTO_eddsa_public_key_to_string (const struct GNUNET_CRYPTO_EddsaPublicKey *pub); /** @@ -865,20 +945,9 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli * @return #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, - size_t enclen, - struct GNUNET_CRYPTO_EccPublicSignKey *pub); - - - -/** - * Convert a public key to a string. - * - * @param pub key to convert - * @return string representing @a pub - */ -char * -GNUNET_CRYPTO_ecc_public_encrypt_key_to_string (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub); +GNUNET_CRYPTO_ecdsa_public_key_from_string (const char *enc, + size_t enclen, + struct GNUNET_CRYPTO_EcdsaPublicKey *pub); /** @@ -890,9 +959,28 @@ GNUNET_CRYPTO_ecc_public_encrypt_key_to_string (const struct GNUNET_CRYPTO_EccPu * @return #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_public_encrypt_key_from_string (const char *enc, - size_t enclen, - struct GNUNET_CRYPTO_EccPublicEncryptKey *pub); +GNUNET_CRYPTO_eddsa_public_key_from_string (const char *enc, + size_t enclen, + struct GNUNET_CRYPTO_EddsaPublicKey *pub); + + +/** + * @ingroup crypto + * Create a new private key by reading it from a file. If the + * files does not exist, create a new key and write it to the + * file. Caller must free return value. Note that this function + * can not guarantee that another process might not be trying + * the same operation on the same file at the same time. + * If the contents of the file + * are invalid the old file is deleted and a fresh key is + * created. + * + * @param filename name of file to use to store the key + * @return new private key, NULL on error (for example, + * permission denied); free using #GNUNET_free + */ +struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename); /** @@ -910,8 +998,8 @@ GNUNET_CRYPTO_ecc_public_encrypt_key_from_string (const char *enc, * @return new private key, NULL on error (for example, * permission denied); free using #GNUNET_free */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename); +struct GNUNET_CRYPTO_EddsaPrivateKey * +GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename); /** @@ -923,8 +1011,28 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename); * @return new private key, NULL on error (for example, * permission denied); free using #GNUNET_free */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg); +struct GNUNET_CRYPTO_EddsaPrivateKey * +GNUNET_CRYPTO_eddsa_key_create_from_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg); + + +/** + * @ingroup crypto + * Create a new private key. Caller must free return value. + * + * @return fresh private key; free using #GNUNET_free + */ +struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_key_create (void); + + +/** + * @ingroup crypto + * Create a new private key. Caller must free return value. + * + * @return fresh private key; free using #GNUNET_free + */ +struct GNUNET_CRYPTO_EddsaPrivateKey * +GNUNET_CRYPTO_eddsa_key_create (void); /** @@ -933,8 +1041,8 @@ GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATI * * @return fresh private key; free using #GNUNET_free */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_create (void); +struct GNUNET_CRYPTO_EcdhePrivateKey * +GNUNET_CRYPTO_ecdhe_key_create (void); /** @@ -944,7 +1052,26 @@ GNUNET_CRYPTO_ecc_key_create (void); * @param pk location of the key */ void -GNUNET_CRYPTO_ecc_key_clear (struct GNUNET_CRYPTO_EccPrivateKey *pk); +GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk); + + +/** + * @ingroup crypto + * Clear memory that was used to store a private key. + * + * @param pk location of the key + */ +void +GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk); + +/** + * @ingroup crypto + * Clear memory that was used to store a private key. + * + * @param pk location of the key + */ +void +GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk); /** @@ -953,8 +1080,8 @@ GNUNET_CRYPTO_ecc_key_clear (struct GNUNET_CRYPTO_EccPrivateKey *pk); * * @return "anonymous" private key; do not free */ -const struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_get_anonymous (void); +const struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_key_get_anonymous (void); /** @@ -967,7 +1094,7 @@ GNUNET_CRYPTO_ecc_key_get_anonymous (void); * @param cfg_name name of the configuration file to use */ void -GNUNET_CRYPTO_ecc_setup_hostkey (const char *cfg_name); +GNUNET_CRYPTO_eddsa_setup_hostkey (const char *cfg_name); /** @@ -989,19 +1116,34 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, * Derive key material from a public and a private ECC key. * * @param priv private key to use for the ECDH (x) - * @param pub public key to use for the ECDY (yG) + * @param pub public key to use for the ECDH (yG) * @param key_material where to write the key material (xyG) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub, +GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, + const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material); /** * @ingroup crypto - * Sign a given block. + * EdDSA sign a given block. + * + * @param priv private key to use for the signing + * @param purpose what to sign (size, purpose) + * @param sig where to write the signature + * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + */ +int +GNUNET_CRYPTO_eddsa_sign (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + struct GNUNET_CRYPTO_EddsaSignature *sig); + + +/** + * @ingroup crypto + * ECDSA Sign a given block. * * @param priv private key to use for the signing * @param purpose what to sign (size, purpose) @@ -1009,14 +1151,31 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct GNUNET_CRYPTO_EccSignature *sig); +GNUNET_CRYPTO_ecdsa_sign (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + struct GNUNET_CRYPTO_EcdsaSignature *sig); + +/** + * @ingroup crypto + * Verify EdDSA signature. + * + * @param purpose what is the purpose that the signature should have? + * @param validate block to validate (size, purpose, data) + * @param sig signature that is being validated + * @param pub public key of the signer + * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid + */ +int +GNUNET_CRYPTO_eddsa_verify (uint32_t purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + const struct GNUNET_CRYPTO_EddsaPublicKey *pub); + /** * @ingroup crypto - * Verify signature. + * Verify ECDSA signature. * * @param purpose what is the purpose that the signature should have? * @param validate block to validate (size, purpose, data) @@ -1025,10 +1184,10 @@ GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid */ int -GNUNET_CRYPTO_ecc_verify (uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, - const struct GNUNET_CRYPTO_EccSignature *sig, - const struct GNUNET_CRYPTO_EccPublicSignKey *pub); +GNUNET_CRYPTO_ecdsa_verify (uint32_t purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_EcdsaSignature *sig, + const struct GNUNET_CRYPTO_EcdsaPublicKey *pub); /** @@ -1044,10 +1203,10 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, * typically the name of the subsystem/application * @return derived private key */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - const char *label, - const char *context); +struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_private_key_derive (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, + const char *label, + const char *context); /** @@ -1062,10 +1221,10 @@ GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @param result where to write the derived public key */ void -GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, - const char *label, - const char *context, - struct GNUNET_CRYPTO_EccPublicSignKey *result); +GNUNET_CRYPTO_ecdsa_public_key_derive (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, + const char *label, + const char *context, + struct GNUNET_CRYPTO_EcdsaPublicKey *result); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/include/gnunet_fs_service.h b/src/include/gnunet_fs_service.h index a13c3b91c..3546fdcb7 100644 --- a/src/include/gnunet_fs_service.h +++ b/src/include/gnunet_fs_service.h @@ -337,7 +337,7 @@ GNUNET_FS_uri_test_sks (const struct GNUNET_FS_Uri *uri); * @return an FS URI for the given namespace and identifier */ struct GNUNET_FS_Uri * -GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, +GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EcdsaPublicKey *ns, const char *id); @@ -351,7 +351,7 @@ GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns, */ int GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri, - struct GNUNET_CRYPTO_EccPublicSignKey *pseudonym); + struct GNUNET_CRYPTO_EcdsaPublicKey *pseudonym); /** @@ -1377,7 +1377,7 @@ struct GNUNET_FS_ProgressInfo /** * Public key of the namespace. */ - struct GNUNET_CRYPTO_EccPublicSignKey pseudonym; + struct GNUNET_CRYPTO_EcdsaPublicKey pseudonym; } ns; @@ -1962,7 +1962,7 @@ enum GNUNET_FS_PublishOptions struct GNUNET_FS_PublishContext * GNUNET_FS_publish_start (struct GNUNET_FS_Handle *h, struct GNUNET_FS_FileInformation *fi, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *nid, const char *nuid, enum GNUNET_FS_PublishOptions options); @@ -2054,7 +2054,7 @@ struct GNUNET_FS_PublishSksContext; */ struct GNUNET_FS_PublishSksContext * GNUNET_FS_publish_sks (struct GNUNET_FS_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *identifier, const char *update, const struct GNUNET_CONTAINER_MetaData *meta, @@ -2176,7 +2176,7 @@ typedef void (*GNUNET_FS_IdentifierProcessor) (void *cls, */ void GNUNET_FS_namespace_list_updateable (struct GNUNET_FS_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *ns, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *ns, const char *next_id, GNUNET_FS_IdentifierProcessor ip, void *ip_cls); diff --git a/src/include/gnunet_gns_service.h b/src/include/gnunet_gns_service.h index f16494c61..f26b44265 100644 --- a/src/include/gnunet_gns_service.h +++ b/src/include/gnunet_gns_service.h @@ -107,10 +107,10 @@ typedef void (*GNUNET_GNS_LookupResultProcessor) (void *cls, struct GNUNET_GNS_LookupRequest * GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle, const char *name, - const struct GNUNET_CRYPTO_EccPublicSignKey *zone, + const struct GNUNET_CRYPTO_EcdsaPublicKey *zone, int type, int only_cached, - const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *shorten_zone_key, GNUNET_GNS_LookupResultProcessor proc, void *proc_cls); diff --git a/src/include/gnunet_hello_lib.h b/src/include/gnunet_hello_lib.h index 901aa4f24..609cb2822 100644 --- a/src/include/gnunet_hello_lib.h +++ b/src/include/gnunet_hello_lib.h @@ -198,7 +198,7 @@ typedef size_t (*GNUNET_HELLO_GenerateAddressListCallback) (void *cls, * @return the hello message */ struct GNUNET_HELLO_Message * -GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicSignKey *publicKey, +GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EddsaPublicKey *publicKey, GNUNET_HELLO_GenerateAddressListCallback addrgen, void *addrgen_cls, int friend_only); @@ -325,7 +325,7 @@ GNUNET_HELLO_iterate_new_addresses (const struct GNUNET_HELLO_Message */ int GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello, - struct GNUNET_CRYPTO_EccPublicSignKey *publicKey); + struct GNUNET_CRYPTO_EddsaPublicKey *publicKey); /** @@ -378,7 +378,7 @@ GNUNET_HELLO_compose_uri (const struct GNUNET_HELLO_Message *hello, */ int GNUNET_HELLO_parse_uri (const char *uri, - struct GNUNET_CRYPTO_EccPublicSignKey *pubkey, + struct GNUNET_CRYPTO_EddsaPublicKey *pubkey, struct GNUNET_HELLO_Message **hello, GNUNET_HELLO_TransportPluginsFind plugins_find); diff --git a/src/include/gnunet_identity_service.h b/src/include/gnunet_identity_service.h index 79d27fa02..49b269604 100644 --- a/src/include/gnunet_identity_service.h +++ b/src/include/gnunet_identity_service.h @@ -76,7 +76,7 @@ struct GNUNET_IDENTITY_Operation; * @param ego the ego * @return associated ECC key, valid as long as the ego is valid */ -const struct GNUNET_CRYPTO_EccPrivateKey * +const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego); @@ -97,7 +97,7 @@ GNUNET_IDENTITY_ego_get_anonymous (void); */ void GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego, - struct GNUNET_CRYPTO_EccPublicSignKey *pk); + struct GNUNET_CRYPTO_EcdsaPublicKey *pk); /** diff --git a/src/include/gnunet_multicast_service.h b/src/include/gnunet_multicast_service.h index 7a2421b4b..58a99c0d8 100644 --- a/src/include/gnunet_multicast_service.h +++ b/src/include/gnunet_multicast_service.h @@ -112,7 +112,7 @@ struct GNUNET_MULTICAST_MessageHeader * * Signature must match the public key of the multicast group. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; /** * Purpose for the signature and size of the signed data. @@ -214,7 +214,7 @@ GNUNET_MULTICAST_join_decision (struct GNUNET_MULTICAST_JoinHandle *jh, */ typedef void (*GNUNET_MULTICAST_JoinCallback) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *member_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, const struct GNUNET_MessageHeader *join_req, struct GNUNET_MULTICAST_JoinHandle *jh); @@ -253,7 +253,7 @@ GNUNET_MULTICAST_membership_test_result (struct GNUNET_MULTICAST_MembershipTestH */ typedef void (*GNUNET_MULTICAST_MembershipTestCallback) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *member_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, uint64_t message_id, uint64_t group_generation, struct GNUNET_MULTICAST_MembershipTestHandle *mth); @@ -277,7 +277,7 @@ typedef void */ typedef void (*GNUNET_MULTICAST_RequestCallback) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *member_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, const struct GNUNET_MessageHeader *req, enum GNUNET_MULTICAST_MessageFlags flags); @@ -341,7 +341,7 @@ struct GNUNET_MULTICAST_ReplayHandle; */ typedef void (*GNUNET_MULTICAST_ReplayFragmentCallback) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *member_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, uint64_t fragment_id, uint64_t flags, struct GNUNET_MULTICAST_ReplayHandle *rh); @@ -364,7 +364,7 @@ typedef void */ typedef void (*GNUNET_MULTICAST_ReplayMessageCallback) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *member_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *member_key, uint64_t message_id, uint64_t fragment_offset, uint64_t flags, @@ -491,7 +491,7 @@ GNUNET_MULTICAST_replay_response2 (struct GNUNET_MULTICAST_ReplayHandle *rh, */ struct GNUNET_MULTICAST_Origin * GNUNET_MULTICAST_origin_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPrivateKey *priv_key, + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv_key, uint64_t next_fragment_id, GNUNET_MULTICAST_JoinCallback join_cb, GNUNET_MULTICAST_MembershipTestCallback mem_test_cb, @@ -623,8 +623,8 @@ GNUNET_MULTICAST_origin_stop (struct GNUNET_MULTICAST_Origin *origin); */ struct GNUNET_MULTICAST_Member * GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicSignKey *group_key, - const struct GNUNET_CRYPTO_EccPrivateKey *member_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *group_key, + const struct GNUNET_CRYPTO_EddsaPrivateKey *member_key, const struct GNUNET_PeerIdentity *origin, uint32_t relay_count, const struct GNUNET_PeerIdentity *relays, diff --git a/src/include/gnunet_namestore_plugin.h b/src/include/gnunet_namestore_plugin.h index 4d4821bcb..5c7408eec 100644 --- a/src/include/gnunet_namestore_plugin.h +++ b/src/include/gnunet_namestore_plugin.h @@ -58,7 +58,7 @@ typedef void (*GNUNET_NAMESTORE_BlockCallback) (void *cls, * @param rd array of records with data to store */ typedef void (*GNUNET_NAMESTORE_RecordIterator) (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *private_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd); @@ -115,7 +115,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ int (*store_records) (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd); @@ -133,7 +133,7 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ int (*iterate_records) (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); @@ -150,8 +150,8 @@ struct GNUNET_NAMESTORE_PluginFunctions * @return #GNUNET_OK on success, #GNUNET_NO if there were no results, #GNUNET_SYSERR on error */ int (*zone_to_name) (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, - const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls); diff --git a/src/include/gnunet_namestore_service.h b/src/include/gnunet_namestore_service.h index 7e39adc49..c31c3689b 100644 --- a/src/include/gnunet_namestore_service.h +++ b/src/include/gnunet_namestore_service.h @@ -239,12 +239,12 @@ struct GNUNET_NAMESTORE_Block /** * Signature of the block. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; /** * Derived key used for signing; hash of this is the query. */ - struct GNUNET_CRYPTO_EccPublicSignKey derived_key; + struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; /** * Number of bytes signed; also specifies the number of bytes @@ -297,7 +297,7 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h, */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *pkey, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd, @@ -343,7 +343,7 @@ GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, * @param rd array of records with data to store */ typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd); @@ -364,8 +364,8 @@ typedef void (*GNUNET_NAMESTORE_RecordMonitor) (void *cls, */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, - const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls); @@ -411,7 +411,7 @@ GNUNET_NAMESTORE_cancel (struct GNUNET_NAMESTORE_QueueEntry *qe); */ struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls); @@ -471,7 +471,7 @@ typedef void (*GNUNET_NAMESTORE_RecordsSynchronizedCallback)(void *cls); */ struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_NAMESTORE_RecordMonitor monitor, GNUNET_NAMESTORE_RecordsSynchronizedCallback sync_cb, void *cls); @@ -614,7 +614,7 @@ GNUNET_NAMESTORE_normalize_string (const char *src); * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s. */ const char * -GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z); +GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z); /** @@ -628,7 +628,7 @@ GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z); * key in an encoding suitable for DNS labels. */ const char * -GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey); +GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); /** @@ -642,7 +642,7 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey */ int GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, - struct GNUNET_CRYPTO_EccPublicSignKey *pkey); + struct GNUNET_CRYPTO_EcdsaPublicKey *pkey); /** @@ -653,7 +653,7 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, * @param query hash to use for the query */ void -GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *zone, +GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, struct GNUNET_HashCode *query); @@ -666,7 +666,7 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe * @param query hash to use for the query */ void -GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, +GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, struct GNUNET_HashCode *query); @@ -681,7 +681,7 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign * @param rd_count number of records in @a rd */ struct GNUNET_NAMESTORE_Block * -GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, +GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_NAMESTORE_RecordData *rd, @@ -712,7 +712,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block); */ int GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, - const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, GNUNET_NAMESTORE_RecordCallback proc, void *proc_cls); diff --git a/src/include/gnunet_psyc_service.h b/src/include/gnunet_psyc_service.h index e9f935de7..7ac40a4c5 100644 --- a/src/include/gnunet_psyc_service.h +++ b/src/include/gnunet_psyc_service.h @@ -210,7 +210,7 @@ struct GNUNET_PSYC_MessageMethod * Sending slave's public key. NULL if the message is from the master, or when * transmitting a message. */ - struct GNUNET_CRYPTO_EccPublicSignKey slave_key; + struct GNUNET_CRYPTO_EddsaPublicKey slave_key; /* Followed by NUL-terminated method name. */ }; @@ -305,7 +305,7 @@ struct GNUNET_PSYC_JoinHandle; */ typedef int (*GNUNET_PSYC_Method) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t message_id, const char *method_name, size_t modifier_count, @@ -331,7 +331,7 @@ typedef int */ typedef int (*GNUNET_PSYC_JoinCallback) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, const char *method_name, size_t variable_count, @@ -421,7 +421,7 @@ typedef void */ struct GNUNET_PSYC_Master * GNUNET_PSYC_master_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPrivateKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key, enum GNUNET_PSYC_Policy policy, GNUNET_PSYC_Method method, GNUNET_PSYC_JoinCallback join_cb, @@ -579,8 +579,8 @@ typedef void */ struct GNUNET_PSYC_Slave * GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPrivateKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key, const struct GNUNET_PeerIdentity *origin, size_t relay_count, const struct GNUNET_PeerIdentity *relays, @@ -732,7 +732,7 @@ GNUNET_PSYC_slave_get_channel (struct GNUNET_PSYC_Slave *slave); */ void GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel, - const struct GNUNET_CRYPTO_EccPublicSignKey + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t announced_at, uint64_t effective_since); @@ -761,7 +761,7 @@ GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel, */ void GNUNET_PSYC_channel_slave_remove (struct GNUNET_PSYC_Channel *channel, - const struct GNUNET_CRYPTO_EccPublicSignKey + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t announced_at); diff --git a/src/include/gnunet_psycstore_plugin.h b/src/include/gnunet_psycstore_plugin.h index 8f8668043..7564ed4bd 100644 --- a/src/include/gnunet_psycstore_plugin.h +++ b/src/include/gnunet_psycstore_plugin.h @@ -59,8 +59,8 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*membership_store) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, int did_join, uint64_t announced_at, uint64_t effective_since, @@ -76,8 +76,8 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*membership_test) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t message_id); /** @@ -89,7 +89,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*fragment_store) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const struct GNUNET_MULTICAST_MessageHeader *message, uint32_t psycstore_flags); @@ -107,7 +107,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*message_add_flags) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t psycstore_flags); @@ -120,7 +120,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*fragment_get) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t fragment_id, GNUNET_PSYCSTORE_FragmentCallback cb, void *cb_cls); @@ -134,7 +134,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*message_get) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t *returned_fragments, GNUNET_PSYCSTORE_FragmentCallback cb, @@ -150,7 +150,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*message_get_fragment) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t fragment_offset, GNUNET_PSYCSTORE_FragmentCallback cb, @@ -165,7 +165,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*counters_message_get) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t *max_fragment_id, uint64_t *max_message_id, uint64_t *max_group_generation); @@ -179,7 +179,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*counters_state_get) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t *max_state_message_id); @@ -192,7 +192,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_modify_begin) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t state_delta); /** @@ -208,7 +208,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_modify_set) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, const void *value, size_t value_size); @@ -221,7 +221,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_modify_end) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id); @@ -234,7 +234,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_sync_begin) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key); /** * Set the value of a state variable while synchronizing state. @@ -249,7 +249,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_sync_set) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, const void *value, size_t value_size); @@ -262,7 +262,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_sync_end) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id); @@ -277,7 +277,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_reset) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key); /** * Update signed state values from the current ones. @@ -286,7 +286,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_update_signed) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key); + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key); /** @@ -296,7 +296,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_get) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls); @@ -310,7 +310,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_get_prefix) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls); @@ -323,7 +323,7 @@ struct GNUNET_PSYCSTORE_PluginFunctions */ int (*state_get_signed) (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls); diff --git a/src/include/gnunet_psycstore_service.h b/src/include/gnunet_psycstore_service.h index 25d4339a3..5f4a32b7b 100644 --- a/src/include/gnunet_psycstore_service.h +++ b/src/include/gnunet_psycstore_service.h @@ -133,8 +133,8 @@ typedef void */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, int did_join, uint64_t announced_at, uint64_t effective_since, @@ -165,8 +165,8 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t message_id, uint64_t group_generation, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -188,7 +188,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const struct GNUNET_MULTICAST_MessageHeader *message, uint32_t psycstore_flags, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -227,7 +227,7 @@ typedef int */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t fragment_id, GNUNET_PSYCSTORE_FragmentCallback fcb, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -248,7 +248,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, GNUNET_PSYCSTORE_FragmentCallback fcb, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -271,7 +271,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t fragment_offset, GNUNET_PSYCSTORE_FragmentCallback fcb, @@ -316,7 +316,7 @@ typedef void */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, - struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, GNUNET_PSYCSTORE_CountersCallback ccb, void *ccb_cls); @@ -340,7 +340,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t state_delta, size_t modifier_count, @@ -364,7 +364,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, size_t modifier_count, const struct GNUNET_ENV_Modifier *modifiers, @@ -387,7 +387,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, GNUNET_PSYCSTORE_ResultCallback rcb, void *rcb_cls); @@ -406,7 +406,7 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, const struct GNUNET_HashCode *hash, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -444,7 +444,7 @@ typedef int */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateCallback scb, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -465,7 +465,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name_prefix, GNUNET_PSYCSTORE_StateCallback scb, GNUNET_PSYCSTORE_ResultCallback rcb, diff --git a/src/include/gnunet_revocation_service.h b/src/include/gnunet_revocation_service.h index 8809f9ece..82decc30b 100644 --- a/src/include/gnunet_revocation_service.h +++ b/src/include/gnunet_revocation_service.h @@ -73,7 +73,7 @@ typedef void (*GNUNET_REVOCATION_Callback) (void *cls, */ struct GNUNET_REVOCATION_Query * GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicSignKey *key, + const struct GNUNET_CRYPTO_EcdsaPublicKey *key, GNUNET_REVOCATION_Callback func, void *func_cls); @@ -109,8 +109,8 @@ struct GNUNET_REVOCATION_Handle; */ struct GNUNET_REVOCATION_Handle * GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicSignKey *key, - const struct GNUNET_CRYPTO_EccSignature *sig, + const struct GNUNET_CRYPTO_EcdsaPublicKey *key, + const struct GNUNET_CRYPTO_EcdsaSignature *sig, uint64_t pow, GNUNET_REVOCATION_Callback func, void *func_cls); @@ -134,7 +134,7 @@ GNUNET_REVOCATION_revoke_cancel (struct GNUNET_REVOCATION_Handle *h); * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not */ int -GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, +GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, uint64_t pow, unsigned int matching_bits); @@ -146,8 +146,8 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, * @param sig where to write the revocation signature */ void -GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EccPrivateKey *key, - struct GNUNET_CRYPTO_EccSignature *sig); +GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, + struct GNUNET_CRYPTO_EcdsaSignature *sig); #if 0 /* keep Emacsens' auto-indent happy */ diff --git a/src/include/gnunet_testing_lib.h b/src/include/gnunet_testing_lib.h index 910662d3f..1f27347eb 100644 --- a/src/include/gnunet_testing_lib.h +++ b/src/include/gnunet_testing_lib.h @@ -48,7 +48,7 @@ extern "C" /** * Size of each hostkey in the hostkey file (in BYTES). */ -#define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EccPrivateKey) +#define GNUNET_TESTING_HOSTKEYFILESIZE sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey) /** * The environmental variable, if set, that dictates where testing should place @@ -185,7 +185,7 @@ GNUNET_TESTING_system_destroy (struct GNUNET_TESTING_System *system, * key; if NULL, GNUNET_SYSERR is returned immediately * @return NULL on error (not enough keys) */ -struct GNUNET_CRYPTO_EccPrivateKey * +struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, uint32_t key_number, struct GNUNET_PeerIdentity *id); diff --git a/src/mesh/gnunet-mesh.c b/src/mesh/gnunet-mesh.c index 440dc272d..77bb7317f 100644 --- a/src/mesh/gnunet-mesh.c +++ b/src/mesh/gnunet-mesh.c @@ -138,7 +138,7 @@ show_tunnel (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct GNUNET_PeerIdentity pid; if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (tunnel_id, + GNUNET_CRYPTO_eddsa_public_key_from_string (tunnel_id, strlen (tunnel_id), &pid.public_key)) { diff --git a/src/mesh/gnunet-service-mesh-enc.c b/src/mesh/gnunet-service-mesh-enc.c index 55b189da1..0a3aeaf35 100644 --- a/src/mesh/gnunet-service-mesh-enc.c +++ b/src/mesh/gnunet-service-mesh-enc.c @@ -94,7 +94,7 @@ static struct GNUNET_PeerIdentity my_full_id; /** * Own private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /******************************************************************************/ @@ -156,7 +156,7 @@ static void run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); @@ -166,10 +166,10 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); GNUNET_log (GNUNET_ERROR_TYPE_INFO, "reading key\n"); - pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (c); + pk = GNUNET_CRYPTO_eddsa_key_create_from_configuration (c); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key); myid = GNUNET_PEER_intern (&my_full_id); GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/mesh/gnunet-service-mesh.c b/src/mesh/gnunet-service-mesh.c index afa64f1fd..b17412b02 100644 --- a/src/mesh/gnunet-service-mesh.c +++ b/src/mesh/gnunet-service-mesh.c @@ -717,7 +717,7 @@ static struct GNUNET_PeerIdentity my_full_id; /** * Own private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /** * Tunnel ID for the next created tunnel (global tunnel number). @@ -5758,7 +5758,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { char *keyfile; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "starting to run\n"); server_handle = server; @@ -5897,11 +5897,11 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, /* Scheduled the task to clean up when shutdown is called */ GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); - pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); + pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); GNUNET_free (keyfile); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_full_id.public_key); myid = GNUNET_PEER_intern (&my_full_id); GNUNET_log (GNUNET_ERROR_TYPE_INFO, diff --git a/src/mesh/gnunet-service-mesh_dht.c b/src/mesh/gnunet-service-mesh_dht.c index 3beb2da8a..00dfb9d46 100644 --- a/src/mesh/gnunet-service-mesh_dht.c +++ b/src/mesh/gnunet-service-mesh_dht.c @@ -94,7 +94,7 @@ static struct GNUNET_PeerIdentity *full_id; /** * Own private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *private_key; /******************************************************************************/ diff --git a/src/mesh/gnunet-service-mesh_tunnel.c b/src/mesh/gnunet-service-mesh_tunnel.c index 88a04eea6..b077d00b2 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.c +++ b/src/mesh/gnunet-service-mesh_tunnel.c @@ -70,17 +70,17 @@ struct MeshTunnel3 /** * Local peer ephemeral private key */ - struct GNUNET_CRYPTO_EccPrivateKey *my_eph_key; + struct GNUNET_CRYPTO_EddsaPrivateKey *my_eph_key; /** * Local peer ephemeral public key */ - struct GNUNET_CRYPTO_EccPublicSignKey *my_eph; + struct GNUNET_CRYPTO_EddsaPublicKey *my_eph; /** * Remote peer's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey *peers_eph; + struct GNUNET_CRYPTO_EddsaPublicKey *peers_eph; /** * Encryption ("our") key. @@ -181,7 +181,7 @@ const static struct GNUNET_PeerIdentity *my_full_id; /** * Own private key. */ -const static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +const static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /******************************************************************************/ @@ -548,7 +548,7 @@ GMT_send_queued_data (struct MeshTunnel3 *t, int fwd) void GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, const struct GNUNET_PeerIdentity *id, - const struct GNUNET_CRYPTO_EccPrivateKey *key) + const struct GNUNET_CRYPTO_EddsaPrivateKey *key) { if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (c, "MESH", "DEFAULT_TTL", diff --git a/src/mesh/gnunet-service-mesh_tunnel.h b/src/mesh/gnunet-service-mesh_tunnel.h index 18104a147..b80f7dff1 100644 --- a/src/mesh/gnunet-service-mesh_tunnel.h +++ b/src/mesh/gnunet-service-mesh_tunnel.h @@ -95,7 +95,7 @@ struct MeshTunnel3; void GMT_init (const struct GNUNET_CONFIGURATION_Handle *c, const struct GNUNET_PeerIdentity *id, - const struct GNUNET_CRYPTO_EccPrivateKey *key); + const struct GNUNET_CRYPTO_EddsaPrivateKey *key); /** * Shut down the tunnel subsystem. diff --git a/src/namestore/gnunet-namestore-fcfsd.c b/src/namestore/gnunet-namestore-fcfsd.c index 7455c0ba5..08f03a055 100644 --- a/src/namestore/gnunet-namestore-fcfsd.c +++ b/src/namestore/gnunet-namestore-fcfsd.c @@ -196,7 +196,7 @@ static struct GNUNET_NAMESTORE_Handle *ns; /** * Private key for the fcfsd zone. */ -static struct GNUNET_CRYPTO_EccPrivateKey fcfs_zone_pkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey fcfs_zone_pkey; /** * Connection to identity service. @@ -242,7 +242,7 @@ run_httpd_now () static void iterate_cb (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_len, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -504,14 +504,14 @@ put_continuation (void *cls, */ static void zone_to_name_cb (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { struct Request *request = cls; struct GNUNET_NAMESTORE_RecordData r; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; request->qe = NULL; if (NULL != name) @@ -523,7 +523,7 @@ zone_to_name_cb (void *cls, run_httpd_now (); return; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (zone_key, + GNUNET_CRYPTO_ecdsa_key_get_public (zone_key, &pub); r.data = &pub; r.data_size = sizeof (pub); @@ -554,7 +554,7 @@ lookup_result_processor (void *cls, const struct GNUNET_NAMESTORE_RecordData *rd) { struct Request *request = cls; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; if (0 != rd_count) { @@ -567,7 +567,7 @@ lookup_result_processor (void *cls, return; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (request->public_key, + GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, strlen (request->public_key), &pub)) { @@ -596,7 +596,7 @@ lookup_block_processor (void *cls, const struct GNUNET_NAMESTORE_Block *block) { struct Request *request = cls; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; request->qe = NULL; if (NULL == block) @@ -604,7 +604,7 @@ lookup_block_processor (void *cls, lookup_result_processor (request, 0, NULL); return; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey, + GNUNET_CRYPTO_ecdsa_key_get_public (&fcfs_zone_pkey, &pub); if (GNUNET_OK != GNUNET_NAMESTORE_block_decrypt (block, @@ -657,7 +657,7 @@ create_response (void *cls, struct MHD_Response *response; struct Request *request; int ret; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; struct GNUNET_HashCode query; if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) || @@ -707,7 +707,7 @@ create_response (void *cls, request->pp = NULL; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (request->public_key, + GNUNET_CRYPTO_ecdsa_public_key_from_string (request->public_key, strlen (request->public_key), &pub)) { @@ -735,7 +735,7 @@ create_response (void *cls, request, connection); } request->phase = RP_LOOKUP; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey, + GNUNET_CRYPTO_ecdsa_key_get_public (&fcfs_zone_pkey, &pub); GNUNET_NAMESTORE_query_from_public_key (&pub, request->domain_name, @@ -1030,7 +1030,7 @@ main (int argc, char *const *argv) options, &run, NULL)) ? 0 : 1; GNUNET_free ((void*) argv); - GNUNET_CRYPTO_ecc_key_clear (&fcfs_zone_pkey); + GNUNET_CRYPTO_ecdsa_key_clear (&fcfs_zone_pkey); return ret; } diff --git a/src/namestore/gnunet-namestore.c b/src/namestore/gnunet-namestore.c index 2ff640604..322030e65 100644 --- a/src/namestore/gnunet-namestore.c +++ b/src/namestore/gnunet-namestore.c @@ -41,7 +41,7 @@ static struct GNUNET_NAMESTORE_Handle *ns; /** * Private key for the our zone. */ -static struct GNUNET_CRYPTO_EccPrivateKey zone_pkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey; /** * Handle to identity lookup. @@ -334,7 +334,7 @@ del_continuation (void *cls, */ static void display_record (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_len, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -413,7 +413,7 @@ sync_cb (void *cls) */ static void get_existing_record (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *rec_name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -524,10 +524,10 @@ static void handle_block (void *cls, const struct GNUNET_NAMESTORE_Block *block) { - struct GNUNET_CRYPTO_EccPublicSignKey zone_pubkey; + struct GNUNET_CRYPTO_EcdsaPublicKey zone_pubkey; list_qe = NULL; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey, + GNUNET_CRYPTO_ecdsa_key_get_public (&zone_pkey, &zone_pubkey); if (NULL == block) { @@ -560,7 +560,7 @@ handle_block (void *cls, */ static void handle_reverse_lookup (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -591,7 +591,7 @@ testservice_task (void *cls, int result) { const struct GNUNET_CONFIGURATION_Handle *cfg = cls; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; struct GNUNET_NAMESTORE_RecordData rd; if (GNUNET_YES != result) @@ -608,7 +608,7 @@ testservice_task (void *cls, GNUNET_SCHEDULER_shutdown (); return; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey, + GNUNET_CRYPTO_ecdsa_key_get_public (&zone_pkey, &pub); ns = GNUNET_NAMESTORE_connect (cfg); @@ -738,9 +738,9 @@ testservice_task (void *cls, else { struct GNUNET_HashCode query; - struct GNUNET_CRYPTO_EccPublicSignKey zone_pubkey; + struct GNUNET_CRYPTO_EcdsaPublicKey zone_pubkey; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey, + GNUNET_CRYPTO_ecdsa_key_get_public (&zone_pkey, &zone_pubkey); GNUNET_NAMESTORE_query_from_public_key (&zone_pubkey, name, @@ -753,10 +753,10 @@ testservice_task (void *cls, } if (NULL != reverse_pkey) { - struct GNUNET_CRYPTO_EccPublicSignKey pubkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (reverse_pkey, + GNUNET_CRYPTO_ecdsa_public_key_from_string (reverse_pkey, strlen (reverse_pkey), &pubkey)) { @@ -775,14 +775,14 @@ testservice_task (void *cls, { char sh[105]; char sname[64]; - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; if ( (2 != (sscanf (uri, "gnunet://gns/%104s/%63s", sh, sname)) ) || (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (sh, strlen (sh), &pkey)) ) + GNUNET_CRYPTO_ecdsa_public_key_from_string (sh, strlen (sh), &pkey)) ) { fprintf (stderr, _("Invalid URI `%s'\n"), @@ -793,7 +793,7 @@ testservice_task (void *cls, } memset (&rd, 0, sizeof (rd)); rd.data = &pkey; - rd.data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); + rd.data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY; if (GNUNET_YES == etime_is_rel) { @@ -952,11 +952,11 @@ main (int argc, char *const *argv) &run, NULL)) { GNUNET_free ((void*) argv); - GNUNET_CRYPTO_ecc_key_clear (&zone_pkey); + GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); return 1; } GNUNET_free ((void*) argv); - GNUNET_CRYPTO_ecc_key_clear (&zone_pkey); + GNUNET_CRYPTO_ecdsa_key_clear (&zone_pkey); return ret; } diff --git a/src/namestore/gnunet-service-namestore.c b/src/namestore/gnunet-service-namestore.c index 49315f6e0..2cce92635 100644 --- a/src/namestore/gnunet-service-namestore.c +++ b/src/namestore/gnunet-service-namestore.c @@ -64,7 +64,7 @@ struct ZoneIteration /** * Key of the zone we are iterating over. */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; /** * The operation id fot the zone iteration in the response for the client @@ -140,7 +140,7 @@ struct ZoneMonitor /** * Private key of the zone. */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; /** * The operation id fot the zone iteration in the response for the client @@ -512,7 +512,7 @@ static void send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc, struct GNUNET_SERVER_Client *client, uint32_t request_id, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -563,7 +563,7 @@ send_lookup_response (struct GNUNET_SERVER_NotificationContext *nc, * @param rd records stored under the given @a name */ static void -refresh_block (const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, +refresh_block (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -617,7 +617,7 @@ handle_record_store (void *cls, const char *rd_ser; unsigned int rd_count; int res; - struct GNUNET_CRYPTO_EccPublicSignKey pubkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; struct ZoneMonitor *zm; GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -670,7 +670,7 @@ handle_record_store (void *cls, } /* Extracting and converting private key */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature (&rp_msg->private_key, + GNUNET_CRYPTO_ecdsa_key_get_public (&rp_msg->private_key, &pubkey); conv_name = GNUNET_NAMESTORE_normalize_string (name_tmp); if (NULL == conv_name) @@ -711,7 +711,7 @@ handle_record_store (void *cls, for (zm = monitor_head; NULL != zm; zm = zm->next) if (0 == memcmp (&rp_msg->private_key, &zm->zone, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) send_lookup_response (monitor_nc, zm->nc->client, zm->request_id, @@ -774,7 +774,7 @@ struct ZoneToNameCtx */ static void handle_zone_to_name_it (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -936,7 +936,7 @@ struct ZoneIterationProcResult */ static void zone_iteraterate_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -992,7 +992,7 @@ zone_iteraterate_proc (void *cls, static void run_zone_iteration_round (struct ZoneIteration *zi) { - static struct GNUNET_CRYPTO_EccPrivateKey zero; + static struct GNUNET_CRYPTO_EcdsaPrivateKey zero; struct ZoneIterationProcResult proc; struct RecordResultMessage rrm; int ret; @@ -1198,7 +1198,7 @@ monitor_next (void *cls, */ static void monitor_iterate_cb (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) diff --git a/src/namestore/namestore.h b/src/namestore/namestore.h index a8851e104..4350dbab4 100644 --- a/src/namestore/namestore.h +++ b/src/namestore/namestore.h @@ -88,12 +88,12 @@ struct LookupBlockResponseMessage /** * Signature. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; /** * Derived public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey derived_key; + struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; /* follwed by encrypted block data */ }; @@ -117,12 +117,12 @@ struct BlockCacheMessage /** * Signature. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; /** * Derived public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey derived_key; + struct GNUNET_CRYPTO_EcdsaPublicKey derived_key; /* follwed by encrypted block data */ }; @@ -183,7 +183,7 @@ struct RecordStoreMessage /** * The private key of the authority. */ - struct GNUNET_CRYPTO_EccPrivateKey private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; /* followed by: * name with length name_len @@ -223,12 +223,12 @@ struct ZoneToNameMessage /** * The private key of the zone to look up in */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; /** * The public key of the target zone */ - struct GNUNET_CRYPTO_EccPublicSignKey value_zone; + struct GNUNET_CRYPTO_EcdsaPublicKey value_zone; }; @@ -266,7 +266,7 @@ struct ZoneToNameResponseMessage /** * The private key of the zone that contained the name. */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; /* followed by: * name with length name_len @@ -309,7 +309,7 @@ struct RecordResultMessage /** * The private key of the authority. */ - struct GNUNET_CRYPTO_EccPrivateKey private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; /* followed by: * name with length name_len @@ -331,7 +331,7 @@ struct ZoneMonitorStartMessage /** * Zone key. */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; }; @@ -349,7 +349,7 @@ struct ZoneIterationStartMessage /** * Zone key. All zeros for "all zones". */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; }; diff --git a/src/namestore/namestore_api.c b/src/namestore/namestore_api.c index 3df6f8210..c4282ec71 100644 --- a/src/namestore/namestore_api.c +++ b/src/namestore/namestore_api.c @@ -134,7 +134,7 @@ struct GNUNET_NAMESTORE_ZoneIterator /** * Private key of the zone. */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; /** * The operation id this zone iteration operation has @@ -592,7 +592,7 @@ handle_zone_iteration_response (struct GNUNET_NAMESTORE_ZoneIterator *ze, const struct RecordResultMessage *msg, size_t size) { - static struct GNUNET_CRYPTO_EccPrivateKey priv_dummy; + static struct GNUNET_CRYPTO_EcdsaPrivateKey priv_dummy; size_t msg_len; size_t exp_msg_len; size_t name_len; @@ -1082,7 +1082,7 @@ GNUNET_NAMESTORE_block_cache (struct GNUNET_NAMESTORE_Handle *h, */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_records_store (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *pkey, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd, @@ -1212,8 +1212,8 @@ GNUNET_NAMESTORE_lookup_block (struct GNUNET_NAMESTORE_Handle *h, */ struct GNUNET_NAMESTORE_QueueEntry * GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, - const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls) { struct GNUNET_NAMESTORE_QueueEntry *qe; @@ -1268,7 +1268,7 @@ GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h, */ struct GNUNET_NAMESTORE_ZoneIterator * GNUNET_NAMESTORE_zone_iteration_start (struct GNUNET_NAMESTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls) { 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) * @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s */ const char * -GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z) +GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EcdsaPublicKey *z) { - static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8]; + static char buf[sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) * 8]; char *end; end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), buf, sizeof (buf)); if (NULL == end) { @@ -342,18 +342,18 @@ static void derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, struct GNUNET_CRYPTO_SymmetricSessionKey *skey, const char *label, - const struct GNUNET_CRYPTO_EccPublicSignKey *pub) + const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) { static const char ctx_key[] = "gns-aes-ctx-key"; static const char ctx_iv[] = "gns-aes-ctx-iv"; GNUNET_CRYPTO_kdf (skey, sizeof (struct GNUNET_CRYPTO_SymmetricSessionKey), - pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + pub, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), label, strlen (label), ctx_key, strlen (ctx_key), NULL, 0); GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_SymmetricInitializationVector), - pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + pub, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), label, strlen (label), ctx_iv, strlen (ctx_iv), NULL, 0); @@ -371,7 +371,7 @@ derive_block_aes_key (struct GNUNET_CRYPTO_SymmetricInitializationVector *iv, * @return NULL on error (block too large) */ struct GNUNET_NAMESTORE_Block * -GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, +GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, struct GNUNET_TIME_Absolute expire, const char *label, const struct GNUNET_NAMESTORE_RecordData *rd, @@ -380,8 +380,8 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, size_t payload_len = GNUNET_NAMESTORE_records_get_size (rd_count, rd); char payload[sizeof (uint32_t) + payload_len]; struct GNUNET_NAMESTORE_Block *block; - struct GNUNET_CRYPTO_EccPublicSignKey pkey; - struct GNUNET_CRYPTO_EccPrivateKey *dkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; + struct GNUNET_CRYPTO_EcdsaPrivateKey *dkey; struct GNUNET_CRYPTO_SymmetricInitializationVector iv; struct GNUNET_CRYPTO_SymmetricSessionKey skey; uint32_t rd_count_nbo; @@ -400,12 +400,12 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, sizeof (struct GNUNET_TIME_AbsoluteNBO)); block->purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN); block->expiration_time = GNUNET_TIME_absolute_hton (expire); - dkey = GNUNET_CRYPTO_ecc_key_derive (key, + dkey = GNUNET_CRYPTO_ecdsa_private_key_derive (key, label, "gns"); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (dkey, + GNUNET_CRYPTO_ecdsa_key_get_public (dkey, &block->derived_key); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, + GNUNET_CRYPTO_ecdsa_key_get_public (key, &pkey); derive_block_aes_key (&iv, &skey, label, &pkey); GNUNET_break (payload_len + sizeof (uint32_t) == @@ -413,7 +413,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, &skey, &iv, &block[1])); if (GNUNET_OK != - GNUNET_CRYPTO_ecc_sign (dkey, + GNUNET_CRYPTO_ecdsa_sign (dkey, &block->purpose, &block->signature)) { @@ -437,7 +437,7 @@ GNUNET_NAMESTORE_block_create (const struct GNUNET_CRYPTO_EccPrivateKey *key, int GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) { - return GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, + return GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_GNS_RECORD_SIGN, &block->purpose, &block->signature, &block->derived_key); @@ -457,7 +457,7 @@ GNUNET_NAMESTORE_block_verify (const struct GNUNET_NAMESTORE_Block *block) */ int GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block, - const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, const char *label, GNUNET_NAMESTORE_RecordCallback proc, void *proc_cls) @@ -653,9 +653,9 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, return NULL; return GNUNET_strdup (tmp); case GNUNET_NAMESTORE_TYPE_PKEY: - if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) + if (data_size != sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) return NULL; - return GNUNET_CRYPTO_ecc_public_sign_key_to_string (data); + return GNUNET_CRYPTO_ecdsa_public_key_to_string (data); case GNUNET_NAMESTORE_TYPE_PHONE: { const struct GNUNET_CONVERSATION_PhoneRecord *pr; @@ -667,7 +667,7 @@ GNUNET_NAMESTORE_value_to_string (uint32_t type, pr = data; if (0 != ntohl (pr->version)) return NULL; - pkey = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pr->peer.public_key); + pkey = GNUNET_CRYPTO_eddsa_public_key_to_string (&pr->peer.public_key); GNUNET_asprintf (&ret, "%u-%s", ntohl (pr->line), @@ -792,7 +792,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, { struct in_addr value_a; struct in6_addr value_aaaa; - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; struct GNUNET_TUN_GnsVpnRecord *vpn; struct GNUNET_TUN_DnsTlsaRecord *tlsa; char s_peer[103 + 1]; @@ -987,16 +987,16 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, return GNUNET_OK; case GNUNET_NAMESTORE_TYPE_PKEY: if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (s, strlen (s), &pkey)) + GNUNET_CRYPTO_ecdsa_public_key_from_string (s, strlen (s), &pkey)) { LOG (GNUNET_ERROR_TYPE_ERROR, _("Unable to parse PKEY record `%s'\n"), s); return GNUNET_SYSERR; } - *data = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey); + *data = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPublicKey); memcpy (*data, &pkey, sizeof (pkey)); - *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey); + *data_size = sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey); return GNUNET_OK; case GNUNET_NAMESTORE_TYPE_PHONE: { @@ -1008,7 +1008,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, if ( (NULL == (dash = strchr (s, '-'))) || (1 != sscanf (s, "%u-", &line)) || (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (dash + 1, + GNUNET_CRYPTO_eddsa_public_key_from_string (dash + 1, strlen (dash + 1), &peer.public_key)) ) { @@ -1044,7 +1044,7 @@ GNUNET_NAMESTORE_string_to_value (uint32_t type, } *data_size = sizeof (struct GNUNET_TUN_GnsVpnRecord) + strlen (s_serv) + 1; *data = vpn = GNUNET_malloc (*data_size); - if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string ((char*) s_peer, + if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string ((char*) s_peer, strlen (s_peer), &vpn->peer.public_key)) { @@ -1194,13 +1194,13 @@ GNUNET_NAMESTORE_is_expired (const struct GNUNET_NAMESTORE_RecordData *rd) * @param query hash to use for the query */ void -GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *zone, +GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, struct GNUNET_HashCode *query) { - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (zone, &pub); + GNUNET_CRYPTO_ecdsa_key_get_public (zone, &pub); GNUNET_NAMESTORE_query_from_public_key (&pub, label, query); } @@ -1213,13 +1213,13 @@ GNUNET_NAMESTORE_query_from_private_key (const struct GNUNET_CRYPTO_EccPrivateKe * @param query hash to use for the query */ void -GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, +GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, struct GNUNET_HashCode *query) { - struct GNUNET_CRYPTO_EccPublicSignKey pd; + struct GNUNET_CRYPTO_EcdsaPublicKey pd; - GNUNET_CRYPTO_ecc_public_key_derive (pub, label, "gns", &pd); + GNUNET_CRYPTO_ecdsa_public_key_derive (pub, label, "gns", &pd); GNUNET_CRYPTO_hash (&pd, sizeof (pd), query); } @@ -1235,12 +1235,12 @@ GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSign * key in an encoding suitable for DNS labels. */ const char * -GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey) +GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) { static char ret[128]; char *pkeys; - pkeys = GNUNET_CRYPTO_ecc_public_sign_key_to_string (pkey); + pkeys = GNUNET_CRYPTO_ecdsa_public_key_to_string (pkey); GNUNET_snprintf (ret, sizeof (ret), "%s.zkey", @@ -1261,7 +1261,7 @@ GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey */ int GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, - struct GNUNET_CRYPTO_EccPublicSignKey *pkey) + struct GNUNET_CRYPTO_EcdsaPublicKey *pkey) { char *cpy; char *dot; @@ -1277,7 +1277,7 @@ GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey, goto error; if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (x, + GNUNET_CRYPTO_ecdsa_public_key_from_string (x, strlen (x), pkey)) goto error; diff --git a/src/namestore/namestore_api_monitor.c b/src/namestore/namestore_api_monitor.c index ccf556abd..c9834e46c 100644 --- a/src/namestore/namestore_api_monitor.c +++ b/src/namestore/namestore_api_monitor.c @@ -73,7 +73,7 @@ struct GNUNET_NAMESTORE_ZoneMonitor /** * Monitored zone. */ - struct GNUNET_CRYPTO_EccPrivateKey zone; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone; }; @@ -255,7 +255,7 @@ transmit_monitor_message (void *cls, */ struct GNUNET_NAMESTORE_ZoneMonitor * GNUNET_NAMESTORE_zone_monitor_start (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, GNUNET_NAMESTORE_RecordMonitor monitor, GNUNET_NAMESTORE_RecordsSynchronizedCallback sync_cb, void *cls) diff --git a/src/namestore/plugin_namestore_postgres.c b/src/namestore/plugin_namestore_postgres.c index 7be06b2f5..6a1dc6f2c 100644 --- a/src/namestore/plugin_namestore_postgres.c +++ b/src/namestore/plugin_namestore_postgres.c @@ -337,8 +337,8 @@ namestore_postgres_cache_block (void *cls, struct Plugin *plugin = cls; struct GNUNET_HashCode query; size_t block_size = ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature); const char *paramValues[] = { (const char *) &query, (const char *) block, @@ -354,7 +354,7 @@ namestore_postgres_cache_block (void *cls, namestore_postgres_expire_blocks (plugin); GNUNET_CRYPTO_hash (&block->derived_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &query); if (block_size > 64 * 65536) { @@ -433,8 +433,8 @@ namestore_postgres_lookup_block (void *cls, block = (const struct GNUNET_NAMESTORE_Block *) PQgetvalue (res, 0, 0); if ( (bsize < sizeof (*block)) || (bsize != ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature)) ) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature)) ) { GNUNET_break (0); LOG (GNUNET_ERROR_TYPE_DEBUG, @@ -461,13 +461,13 @@ namestore_postgres_lookup_block (void *cls, */ static int namestore_postgres_store_records (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { struct Plugin *plugin = cls; - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; uint64_t rvalue; uint32_t rd_count_nbo = htonl ((uint32_t) rd_count); size_t data_size; @@ -477,7 +477,7 @@ namestore_postgres_store_records (void *cls, for (i=0;iderived_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &query); expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time); dval = (int64_t) expiration.abs_value_us; if (dval < 0) dval = INT64_MAX; block_size = ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature); if (block_size > 64 * 65536) { GNUNET_break (0); @@ -606,8 +606,8 @@ namestore_sqlite_lookup_block (void *cls, block_size = sqlite3_column_bytes (plugin->lookup_block, 0); if ( (block_size < sizeof (struct GNUNET_NAMESTORE_Block)) || (ntohl (block->purpose.size) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + - sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) ) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + + sizeof (struct GNUNET_CRYPTO_EcdsaSignature) != block_size) ) { GNUNET_break (0); ret = GNUNET_SYSERR; @@ -656,14 +656,14 @@ namestore_sqlite_lookup_block (void *cls, */ static int namestore_sqlite_store_records (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { struct Plugin *plugin = cls; int n; - struct GNUNET_CRYPTO_EccPublicSignKey pkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pkey; uint64_t rvalue; size_t data_size; unsigned int i; @@ -672,7 +672,7 @@ namestore_sqlite_store_records (void *cls, for (i=0;idelete_records, 1, - zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || + zone_key, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_text (plugin->delete_records, 2, label, -1, SQLITE_STATIC))) { LOG_SQLITE (plugin, @@ -718,9 +718,9 @@ namestore_sqlite_store_records (void *cls, if (0 != rd_count) { if ((SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 1, - zone_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), SQLITE_STATIC)) || + zone_key, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 2, - &pkey, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), SQLITE_STATIC)) || + &pkey, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_int64 (plugin->store_records, 3, rvalue)) || (SQLITE_OK != sqlite3_bind_int (plugin->store_records, 4, rd_count)) || (SQLITE_OK != sqlite3_bind_blob (plugin->store_records, 5, data, data_size, SQLITE_STATIC)) || @@ -776,7 +776,7 @@ namestore_sqlite_store_records (void *cls, static int get_record_and_call_iterator (struct Plugin *plugin, sqlite3_stmt *stmt, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) { unsigned int record_count; @@ -796,7 +796,7 @@ get_record_and_call_iterator (struct Plugin *plugin, if (NULL == zone_key) { /* must be "iterate_all_zones", got one extra return value */ - if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != + if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) != sqlite3_column_bytes (stmt, 3)) { GNUNET_break (0); @@ -859,7 +859,7 @@ get_record_and_call_iterator (struct Plugin *plugin, */ static int namestore_sqlite_iterate_records (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, uint64_t offset, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) { @@ -877,7 +877,7 @@ namestore_sqlite_iterate_records (void *cls, { stmt = plugin->iterate_zone; err = ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, - zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), + zone, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_int64 (stmt, 2, offset)) ); @@ -909,8 +909,8 @@ namestore_sqlite_iterate_records (void *cls, */ static int namestore_sqlite_zone_to_name (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, - const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPublicKey *value_zone, GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls) { struct Plugin *plugin = cls; @@ -918,10 +918,10 @@ namestore_sqlite_zone_to_name (void *cls, stmt = plugin->zone_to_name; if ( (SQLITE_OK != sqlite3_bind_blob (stmt, 1, - zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey), + zone, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), SQLITE_STATIC)) || (SQLITE_OK != sqlite3_bind_blob (stmt, 2, - value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + value_zone, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), SQLITE_STATIC)) ) { LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK, diff --git a/src/namestore/test_namestore_api_blocks.c b/src/namestore/test_namestore_api_blocks.c index e480def31..001e7e182 100644 --- a/src/namestore/test_namestore_api_blocks.c +++ b/src/namestore/test_namestore_api_blocks.c @@ -40,7 +40,7 @@ #define TEST_REMOVE_RECORD_DATA 'b' -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; static struct GNUNET_NAMESTORE_RecordData *s_rd; @@ -99,19 +99,19 @@ run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { struct GNUNET_NAMESTORE_Block *block; - struct GNUNET_CRYPTO_EccPublicSignKey pubkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; /* load privat key */ char *hostkey_file; GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get(); /* get public key */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature(privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public(privkey, &pubkey); /* create record */ s_name = "DUMMY.dummy.gnunet"; diff --git a/src/namestore/test_namestore_api_cache_block.c b/src/namestore/test_namestore_api_cache_block.c index 8ed010abd..1fee80ec8 100644 --- a/src/namestore/test_namestore_api_cache_block.c +++ b/src/namestore/test_namestore_api_cache_block.c @@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static int res; @@ -182,10 +182,10 @@ run (void *cls, DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; diff --git a/src/namestore/test_namestore_api_lookup_public.c b/src/namestore/test_namestore_api_lookup_public.c index f2b009ac5..6c6ee55ec 100644 --- a/src/namestore/test_namestore_api_lookup_public.c +++ b/src/namestore/test_namestore_api_lookup_public.c @@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static int res; @@ -149,7 +149,7 @@ put_cont (void *cls, int32_t success, const char *emsg) { const char *name = cls; struct GNUNET_HashCode derived_hash; - struct GNUNET_CRYPTO_EccPublicSignKey pubkey; + struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; GNUNET_assert (NULL != cls); @@ -159,7 +159,7 @@ put_cont (void *cls, int32_t success, const char *emsg) (success == GNUNET_OK) ? "SUCCESS" : "FAIL"); /* Create derived hash */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); GNUNET_NAMESTORE_query_from_public_key (&pubkey, name, &derived_hash); nsqe = GNUNET_NAMESTORE_lookup_block (nsh, &derived_hash, @@ -183,10 +183,10 @@ run (void *cls, DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; diff --git a/src/namestore/test_namestore_api_monitoring.c b/src/namestore/test_namestore_api_monitoring.c index d0662617e..2d5888a5e 100644 --- a/src/namestore/test_namestore_api_monitoring.c +++ b/src/namestore/test_namestore_api_monitoring.c @@ -34,9 +34,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey2; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey2; static struct GNUNET_NAMESTORE_ZoneMonitor *zm; @@ -145,7 +145,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -156,7 +156,7 @@ zone_proc (void *cls, "Comparing results name %s\n", name); - if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitoring returned wrong zone key\n"); @@ -268,7 +268,7 @@ run (void *cls, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); @@ -301,7 +301,7 @@ run (void *cls, DIR_SEPARATOR_STR, "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey2 = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey2 != NULL); diff --git a/src/namestore/test_namestore_api_monitoring_existing.c b/src/namestore/test_namestore_api_monitoring_existing.c index 4db1c6d62..3b2ca6092 100644 --- a/src/namestore/test_namestore_api_monitoring_existing.c +++ b/src/namestore/test_namestore_api_monitoring_existing.c @@ -35,9 +35,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey2; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey2; static struct GNUNET_NAMESTORE_ZoneMonitor *zm; @@ -146,7 +146,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, const char *name, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -157,7 +157,7 @@ zone_proc (void *cls, "Comparing results name %s\n", name); - if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + if (0 != memcmp (zone_key, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Monitoring returned wrong zone key\n"); @@ -286,7 +286,7 @@ run (void *cls, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); @@ -306,7 +306,7 @@ run (void *cls, DIR_SEPARATOR_STR, "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey2 = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey2 != NULL); diff --git a/src/namestore/test_namestore_api_put.c b/src/namestore/test_namestore_api_put.c index e3610ccaf..983ea6804 100644 --- a/src/namestore/test_namestore_api_put.c +++ b/src/namestore/test_namestore_api_put.c @@ -41,9 +41,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static struct GNUNET_NAMESTORE_RecordData *s_rd; @@ -135,7 +135,7 @@ run (void *cls, const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_TESTING_Peer *peer) { - struct GNUNET_CRYPTO_EccSignature *signature; + struct GNUNET_CRYPTO_EcdsaSignature *signature; char * s_name; int c; char *hostkey_file; @@ -146,11 +146,11 @@ run (void *cls, GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_assert (privkey != NULL); GNUNET_free (hostkey_file); /* get public key */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature(privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public(privkey, &pubkey); nsh = GNUNET_NAMESTORE_connect (cfg); GNUNET_break (NULL != nsh); /* create record */ diff --git a/src/namestore/test_namestore_api_remove.c b/src/namestore/test_namestore_api_remove.c index 3f3823e89..f43bafecc 100644 --- a/src/namestore/test_namestore_api_remove.c +++ b/src/namestore/test_namestore_api_remove.c @@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static struct GNUNET_HashCode derived_hash; @@ -244,10 +244,10 @@ run (void *cls, DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); removed = GNUNET_NO; 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 86cf47e26..231d7b0bc 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; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static int res; @@ -148,10 +148,10 @@ run (void *cls, DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); nsh = GNUNET_NAMESTORE_connect (cfg); GNUNET_break (NULL != nsh); diff --git a/src/namestore/test_namestore_api_store.c b/src/namestore/test_namestore_api_store.c index 69c47337f..133bf567f 100644 --- a/src/namestore/test_namestore_api_store.c +++ b/src/namestore/test_namestore_api_store.c @@ -38,9 +38,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static int res; @@ -181,10 +181,10 @@ run (void *cls, DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); 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 8b10763c0..91b8511c9 100644 --- a/src/namestore/test_namestore_api_store_update.c +++ b/src/namestore/test_namestore_api_store_update.c @@ -46,9 +46,9 @@ static struct GNUNET_NAMESTORE_Handle *nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static int res; @@ -225,10 +225,10 @@ run (void *cls, DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file (hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public (privkey, &pubkey); rd.flags = GNUNET_NAMESTORE_RF_NONE; rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us; diff --git a/src/namestore/test_namestore_api_zone_iteration.c b/src/namestore/test_namestore_api_zone_iteration.c index 94fd6d008..48671897e 100644 --- a/src/namestore/test_namestore_api_zone_iteration.c +++ b/src/namestore/test_namestore_api_zone_iteration.c @@ -34,9 +34,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey2; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey2; static struct GNUNET_NAMESTORE_ZoneIterator *zi; @@ -156,7 +156,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -181,7 +181,7 @@ zone_proc (void *cls, } else { - if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { if (0 == strcmp (label, s_name_1)) { @@ -225,7 +225,7 @@ zone_proc (void *cls, GNUNET_break (0); } } - else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { if (0 == strcmp (label, s_name_3)) { @@ -345,7 +345,7 @@ create_record (unsigned int count) */ static void empty_zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -379,14 +379,14 @@ empty_zone_proc (void *cls, GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey2 = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey2 != NULL); 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 a34e742f0..7707c418e 100644 --- a/src/namestore/test_namestore_api_zone_iteration_specific_zone.c +++ b/src/namestore/test_namestore_api_zone_iteration_specific_zone.c @@ -34,9 +34,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey2; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey2; static struct GNUNET_NAMESTORE_ZoneIterator *zi; @@ -156,7 +156,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -181,7 +181,7 @@ zone_proc (void *cls, } else { - if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { if (0 == strcmp (label, s_name_1)) { @@ -225,7 +225,7 @@ zone_proc (void *cls, GNUNET_break (0); } } - else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Received data for not requested zone\n"); failed = GNUNET_YES; @@ -323,7 +323,7 @@ create_record (unsigned int count) */ static void empty_zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -357,14 +357,14 @@ empty_zone_proc (void *cls, GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey2 = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey2 != NULL); diff --git a/src/namestore/test_namestore_api_zone_iteration_stop.c b/src/namestore/test_namestore_api_zone_iteration_stop.c index ebc26db79..e56559f96 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 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey2; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey2; static struct GNUNET_NAMESTORE_ZoneIterator *zi; @@ -156,7 +156,7 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -178,7 +178,7 @@ zone_proc (void *cls, } else { - if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + if (0 == memcmp (zone, privkey, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { if (0 == strcmp (label, s_name_1)) { @@ -222,7 +222,7 @@ zone_proc (void *cls, GNUNET_break (0); } } - else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + else if (0 == memcmp (zone, privkey2, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) { if (0 == strcmp (label, s_name_3)) { @@ -357,7 +357,7 @@ create_record (unsigned int count) */ static void empty_zone_proc (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *zone, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) @@ -391,14 +391,14 @@ empty_zone_proc (void *cls, GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "HGU0A0VCU334DN7F2I9UIUMVQMM7JMSD142LIMNUGTTV9R0CF4EG.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey2 = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey2 = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey2 != NULL); diff --git a/src/namestore/test_namestore_api_zone_to_name.c b/src/namestore/test_namestore_api_zone_to_name.c index 1eeed1001..973cc18a0 100644 --- a/src/namestore/test_namestore_api_zone_to_name.c +++ b/src/namestore/test_namestore_api_zone_to_name.c @@ -41,9 +41,9 @@ static struct GNUNET_NAMESTORE_Handle * nsh; static GNUNET_SCHEDULER_TaskIdentifier endbadly_task; -static struct GNUNET_CRYPTO_EccPrivateKey * privkey; +static struct GNUNET_CRYPTO_EcdsaPrivateKey * privkey; -static struct GNUNET_CRYPTO_EccPublicSignKey pubkey; +static struct GNUNET_CRYPTO_EcdsaPublicKey pubkey; static struct GNUNET_TIME_Absolute expire; @@ -53,7 +53,7 @@ static struct GNUNET_CRYPTO_ShortHashCode s_zone_value; static char * s_name; -static struct GNUNET_CRYPTO_EccSignature *s_signature; +static struct GNUNET_CRYPTO_EcdsaSignature *s_signature; static int res; @@ -96,12 +96,12 @@ end (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) static void zone_to_name_proc (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key, + const struct GNUNET_CRYPTO_EcdsaPublicKey *zone_key, struct GNUNET_TIME_Absolute expire, const char *n, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd, - const struct GNUNET_CRYPTO_EccSignature *signature) + const struct GNUNET_CRYPTO_EcdsaSignature *signature) { int fail = GNUNET_NO; @@ -123,7 +123,7 @@ zone_to_name_proc (void *cls, fail = GNUNET_YES; GNUNET_break (0); } - if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)))) + if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)))) { fail = GNUNET_YES; GNUNET_break (0); @@ -173,14 +173,14 @@ run (void *cls, GNUNET_asprintf(&hostkey_file,"zonefiles%s%s",DIR_SEPARATOR_STR, "N0UJMP015AFUNR2BTNM3FKPBLG38913BL8IDMCO2H0A1LIB81960.zkey"); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using zonekey file `%s' \n", hostkey_file); - privkey = GNUNET_CRYPTO_ecc_key_create_from_file(hostkey_file); + privkey = GNUNET_CRYPTO_ecdsa_key_create_from_file(hostkey_file); GNUNET_free (hostkey_file); GNUNET_assert (privkey != NULL); /* get public key */ - GNUNET_CRYPTO_ecc_key_get_public_for_signature(privkey, &pubkey); + GNUNET_CRYPTO_ecdsa_key_get_public(privkey, &pubkey); /* zone hash */ - GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &s_zone); + GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &s_zone); GNUNET_CRYPTO_short_hash (s_name, strlen (s_name) + 1, &s_zone_value); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Using PKEY `%s' \n", GNUNET_NAMESTORE_short_h2s (&s_zone_value)); diff --git a/src/namestore/test_plugin_namestore.c b/src/namestore/test_plugin_namestore.c index 5274e8bca..7e77f4317 100644 --- a/src/namestore/test_plugin_namestore.c +++ b/src/namestore/test_plugin_namestore.c @@ -81,14 +81,14 @@ load_plugin (const struct GNUNET_CONFIGURATION_Handle *cfg) static void test_record (void *cls, - const struct GNUNET_CRYPTO_EccPrivateKey *private_key, + const struct GNUNET_CRYPTO_EcdsaPrivateKey *private_key, const char *label, unsigned int rd_count, const struct GNUNET_NAMESTORE_RecordData *rd) { int *idp = cls; int id = *idp; - struct GNUNET_CRYPTO_EccPrivateKey tzone_private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey tzone_private_key; char tname[64]; unsigned int trd_count = 1 + (id % 1024); unsigned int i; @@ -104,7 +104,7 @@ test_record (void *cls, } memset (&tzone_private_key, (id % 241), sizeof (tzone_private_key)); GNUNET_assert (0 == strcmp (label, tname)); - GNUNET_assert (0 == memcmp (&tzone_private_key, private_key, sizeof (struct GNUNET_CRYPTO_EccPrivateKey))); + GNUNET_assert (0 == memcmp (&tzone_private_key, private_key, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))); } @@ -119,11 +119,11 @@ get_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) static void put_record (struct GNUNET_NAMESTORE_PluginFunctions *nsp, int id) { - struct GNUNET_CRYPTO_EccPrivateKey zone_private_key; + struct GNUNET_CRYPTO_EcdsaPrivateKey zone_private_key; char label[64]; unsigned int rd_count = 1 + (id % 1024); struct GNUNET_NAMESTORE_RecordData rd[rd_count]; - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; unsigned int i; GNUNET_snprintf (label, sizeof (label), diff --git a/src/nse/gnunet-service-nse.c b/src/nse/gnunet-service-nse.c index b69a4a7fe..366770cad 100644 --- a/src/nse/gnunet-service-nse.c +++ b/src/nse/gnunet-service-nse.c @@ -199,7 +199,7 @@ struct GNUNET_NSE_FloodMessage /** * Signature (over range specified in purpose). */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; }; GNUNET_NETWORK_STRUCT_END @@ -288,7 +288,7 @@ static struct GNUNET_TIME_Absolute current_timestamp; /** * The private key of this peer. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /** * The peer identity of this peer. @@ -710,14 +710,14 @@ setup_flood_message (unsigned int slot, fm->purpose.size = htonl (sizeof (struct GNUNET_NSE_FloodMessage) - sizeof (struct GNUNET_MessageHeader) - sizeof (uint32_t) - - sizeof (struct GNUNET_CRYPTO_EccSignature)); + sizeof (struct GNUNET_CRYPTO_EddsaSignature)); fm->matching_bits = htonl (matching_bits); fm->timestamp = GNUNET_TIME_absolute_hton (ts); fm->origin = my_identity; fm->proof_of_work = my_proof; if (nse_work_required > 0) GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (my_private_key, &fm->purpose, + GNUNET_CRYPTO_eddsa_sign (my_private_key, &fm->purpose, &fm->signature)); else memset (&fm->signature, 0, sizeof (fm->signature)); @@ -849,16 +849,16 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash) * @return #GNUNET_YES if valid, #GNUNET_NO if not */ static int -check_proof_of_work (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey, +check_proof_of_work (const struct GNUNET_CRYPTO_EddsaPublicKey *pkey, uint64_t val) { - char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + char buf[sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + sizeof (val)] GNUNET_ALIGN; struct GNUNET_HashCode result; memcpy (buf, &val, sizeof (val)); memcpy (&buf[sizeof (val)], pkey, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)); pow_hash (buf, sizeof (buf), &result); return (count_leading_zeroes (&result) >= nse_work_required) ? GNUNET_YES : GNUNET_NO; @@ -898,7 +898,7 @@ find_proof (void *cls, { #define ROUND_SIZE 10 uint64_t counter; - char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + char buf[sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + sizeof (uint64_t)] GNUNET_ALIGN; struct GNUNET_HashCode result; unsigned int i; @@ -967,7 +967,7 @@ verify_message_crypto (const struct GNUNET_NSE_FloodMessage *incoming_flood) } if ((nse_work_required > 0) && (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND, + GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_NSE_SEND, &incoming_flood->purpose, &incoming_flood->signature, &incoming_flood->origin.public_key))) @@ -1421,7 +1421,7 @@ run (void *cls, {NULL, 0, 0} }; char *proof; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; cfg = c; srv = server; @@ -1474,10 +1474,10 @@ run (void *cls, GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_UNIT_FOREVER_REL, &shutdown_task, NULL); - pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); + pk = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg); GNUNET_assert (NULL != pk); my_private_key = pk; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_identity.public_key); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "NSE", "PROOFFILE", &proof)) diff --git a/src/peerinfo-tool/gnunet-peerinfo.c b/src/peerinfo-tool/gnunet-peerinfo.c index 67aeddbe7..e62df3047 100644 --- a/src/peerinfo-tool/gnunet-peerinfo.c +++ b/src/peerinfo-tool/gnunet-peerinfo.c @@ -628,7 +628,7 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { - struct GNUNET_CRYPTO_EccPrivateKey *priv; + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; char *fn; cfg = c; @@ -662,14 +662,14 @@ run (void *cls, char *const *args, const char *cfgfile, "GNUNETD", "HOSTKEYFILE"); return; } - if (NULL == (priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn))) + if (NULL == (priv = GNUNET_CRYPTO_eddsa_key_create_from_file (fn))) { FPRINTF (stderr, _("Loading hostkey from `%s' failed.\n"), fn); GNUNET_free (fn); return; } GNUNET_free (fn); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, + GNUNET_CRYPTO_eddsa_key_get_public (priv, &my_peer_identity.public_key); GNUNET_free (priv); } diff --git a/src/peerinfo/gnunet-service-peerinfo.c b/src/peerinfo/gnunet-service-peerinfo.c index d62e81eae..fe5094d79 100644 --- a/src/peerinfo/gnunet-service-peerinfo.c +++ b/src/peerinfo/gnunet-service-peerinfo.c @@ -575,7 +575,7 @@ hosts_directory_scan_callback (void *cls, const char *fullname) remove_garbage (fullname); return GNUNET_OK; } - if (GNUNET_OK == GNUNET_CRYPTO_ecc_public_sign_key_from_string (filename, + if (GNUNET_OK == GNUNET_CRYPTO_eddsa_public_key_from_string (filename, strlen (filename), &identity.public_key)) { @@ -654,7 +654,7 @@ update_friend_hello (const struct GNUNET_HELLO_Message *hello, { struct GNUNET_HELLO_Message * res; struct GNUNET_HELLO_Message * tmp; - struct GNUNET_CRYPTO_EccPublicSignKey pk; + struct GNUNET_CRYPTO_EddsaPublicKey pk; if (NULL != friend_hello) { diff --git a/src/psycstore/plugin_psycstore_sqlite.c b/src/psycstore/plugin_psycstore_sqlite.c index adc52c254..356216998 100644 --- a/src/psycstore/plugin_psycstore_sqlite.c +++ b/src/psycstore/plugin_psycstore_sqlite.c @@ -621,7 +621,7 @@ database_shutdown (struct Plugin *plugin) */ static int exec_channel (struct Plugin *plugin, sqlite3_stmt *stmt, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key) + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) { if (SQLITE_OK != sqlite3_bind_blob (stmt, 1, channel_key, sizeof (*channel_key), SQLITE_STATIC)) @@ -721,7 +721,7 @@ transaction_rollback (struct Plugin *plugin) static int channel_key_store (struct Plugin *plugin, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key) + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) { sqlite3_stmt *stmt = plugin->insert_channel_key; @@ -750,7 +750,7 @@ channel_key_store (struct Plugin *plugin, static int slave_key_store (struct Plugin *plugin, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key) + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key) { sqlite3_stmt *stmt = plugin->insert_slave_key; @@ -788,8 +788,8 @@ slave_key_store (struct Plugin *plugin, */ static int membership_store (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, int did_join, uint64_t announced_at, uint64_t effective_since, @@ -850,8 +850,8 @@ membership_store (void *cls, */ static int membership_test (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t message_id) { struct Plugin *plugin = cls; @@ -897,7 +897,7 @@ membership_test (void *cls, */ static int fragment_store (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const struct GNUNET_MULTICAST_MessageHeader *msg, uint32_t psycstore_flags) { @@ -970,7 +970,7 @@ fragment_store (void *cls, */ static int message_add_flags (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t psycstore_flags) { @@ -1045,7 +1045,7 @@ fragment_row (sqlite3_stmt *stmt, GNUNET_PSYCSTORE_FragmentCallback cb, */ static int fragment_get (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t fragment_id, GNUNET_PSYCSTORE_FragmentCallback cb, void *cb_cls) @@ -1096,7 +1096,7 @@ fragment_get (void *cls, */ static int message_get (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t *returned_fragments, GNUNET_PSYCSTORE_FragmentCallback cb, @@ -1160,7 +1160,7 @@ message_get (void *cls, */ static int message_get_fragment (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t fragment_offset, GNUNET_PSYCSTORE_FragmentCallback cb, @@ -1213,7 +1213,7 @@ message_get_fragment (void *cls, */ static int counters_message_get (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t *max_fragment_id, uint64_t *max_message_id, uint64_t *max_group_generation) @@ -1266,7 +1266,7 @@ counters_message_get (void *cls, */ static int counters_state_get (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t *max_state_message_id) { struct Plugin *plugin = cls; @@ -1314,7 +1314,7 @@ counters_state_get (void *cls, */ static int state_set (struct Plugin *plugin, sqlite3_stmt *stmt, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, const void *value, size_t value_size) { int ret = GNUNET_SYSERR; @@ -1354,7 +1354,7 @@ state_set (struct Plugin *plugin, sqlite3_stmt *stmt, static int update_message_id (struct Plugin *plugin, sqlite3_stmt *stmt, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id) { if (SQLITE_OK != sqlite3_bind_int64 (stmt, 1, message_id) @@ -1384,7 +1384,7 @@ update_message_id (struct Plugin *plugin, sqlite3_stmt *stmt, */ static int state_modify_begin (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t state_delta) { struct Plugin *plugin = cls; @@ -1449,7 +1449,7 @@ state_modify_begin (void *cls, */ static int state_modify_set (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, const void *value, size_t value_size) { struct Plugin *plugin = cls; @@ -1466,7 +1466,7 @@ state_modify_set (void *cls, */ static int state_modify_end (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id) { struct Plugin *plugin = cls; @@ -1487,7 +1487,7 @@ state_modify_end (void *cls, */ static int state_sync_begin (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key) + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) { struct Plugin *plugin = cls; return exec_channel (plugin, plugin->delete_state_sync, channel_key); @@ -1503,7 +1503,7 @@ state_sync_begin (void *cls, */ static int state_sync_set (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, const void *value, size_t value_size) { struct Plugin *plugin = cls; @@ -1517,7 +1517,7 @@ state_sync_set (void *cls, */ static int state_sync_end (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id) { struct Plugin *plugin = cls; @@ -1547,7 +1547,7 @@ state_sync_end (void *cls, * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int -state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key) +state_reset (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) { struct Plugin *plugin = cls; return exec_channel (plugin, plugin->delete_state, channel_key); @@ -1563,7 +1563,7 @@ state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key */ static int state_update_signed (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key) + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key) { struct Plugin *plugin = cls; return exec_channel (plugin, plugin->update_state_signed, channel_key); @@ -1578,7 +1578,7 @@ state_update_signed (void *cls, * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int -state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, +state_get (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls) { struct Plugin *plugin = cls; @@ -1629,7 +1629,7 @@ state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, * @return #GNUNET_OK on success, else #GNUNET_SYSERR */ static int -state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, +state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls) { @@ -1697,7 +1697,7 @@ state_get_prefix (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channe */ static int state_get_signed (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls) { struct Plugin *plugin = cls; diff --git a/src/psycstore/psycstore.h b/src/psycstore/psycstore.h index 61d4adc06..f28d1ba78 100644 --- a/src/psycstore/psycstore.h +++ b/src/psycstore/psycstore.h @@ -144,7 +144,7 @@ struct OperationRequest */ uint32_t op_id GNUNET_PACKED; - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; }; @@ -167,12 +167,12 @@ struct MembershipStoreRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; /** * Slave's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey slave_key; + struct GNUNET_CRYPTO_EddsaPublicKey slave_key; uint64_t announced_at GNUNET_PACKED; uint64_t effective_since GNUNET_PACKED; @@ -199,12 +199,12 @@ struct MembershipTestRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; /** * Slave's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey slave_key; + struct GNUNET_CRYPTO_EddsaPublicKey slave_key; uint64_t message_id GNUNET_PACKED; @@ -230,7 +230,7 @@ struct FragmentStoreRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; uint32_t psycstore_flags GNUNET_PACKED; }; @@ -254,7 +254,7 @@ struct FragmentGetRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; uint64_t fragment_id GNUNET_PACKED; }; @@ -278,7 +278,7 @@ struct MessageGetRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; uint64_t message_id GNUNET_PACKED; }; @@ -302,7 +302,7 @@ struct MessageGetFragmentRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; uint64_t message_id GNUNET_PACKED; @@ -328,7 +328,7 @@ struct StateHashUpdateRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; struct GNUNET_HashCode hash; }; @@ -357,7 +357,7 @@ struct StateModifyRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; uint64_t message_id GNUNET_PACKED; @@ -400,7 +400,7 @@ struct StateSyncRequest /** * Channel's public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey channel_key; + struct GNUNET_CRYPTO_EddsaPublicKey channel_key; uint64_t message_id GNUNET_PACKED; diff --git a/src/psycstore/psycstore_api.c b/src/psycstore/psycstore_api.c index 0e72d9ca2..55d7f73ec 100644 --- a/src/psycstore/psycstore_api.c +++ b/src/psycstore/psycstore_api.c @@ -655,8 +655,8 @@ GNUNET_PSYCSTORE_operation_cancel (struct GNUNET_PSYCSTORE_OperationHandle *op) */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, int did_join, uint64_t announced_at, uint64_t effective_since, @@ -721,8 +721,8 @@ GNUNET_PSYCSTORE_membership_store (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, - const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *slave_key, uint64_t message_id, uint64_t group_generation, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -769,7 +769,7 @@ GNUNET_PSYCSTORE_membership_test (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const struct GNUNET_MULTICAST_MessageHeader *message, uint32_t psycstore_flags, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -815,7 +815,7 @@ GNUNET_PSYCSTORE_fragment_store (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t fragment_id, GNUNET_PSYCSTORE_FragmentCallback fcb, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -860,7 +860,7 @@ GNUNET_PSYCSTORE_fragment_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, GNUNET_PSYCSTORE_FragmentCallback fcb, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -907,7 +907,7 @@ GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t fragment_offset, GNUNET_PSYCSTORE_FragmentCallback fcb, @@ -955,7 +955,7 @@ GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, - struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, GNUNET_PSYCSTORE_CountersCallback ccb, void *mccb_cls) { @@ -1001,7 +1001,7 @@ GNUNET_PSYCSTORE_counters_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, uint64_t state_delta, size_t modifier_count, @@ -1070,7 +1070,7 @@ GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, size_t modifier_count, const struct GNUNET_ENV_Modifier *modifiers, @@ -1132,7 +1132,7 @@ GNUNET_PSYCSTORE_state_sync (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, GNUNET_PSYCSTORE_ResultCallback rcb, void *rcb_cls) @@ -1174,7 +1174,7 @@ GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, uint64_t message_id, const struct GNUNET_HashCode *hash, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -1218,7 +1218,7 @@ GNUNET_PSYCSTORE_state_hash_update (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name, GNUNET_PSYCSTORE_StateCallback scb, GNUNET_PSYCSTORE_ResultCallback rcb, @@ -1265,7 +1265,7 @@ GNUNET_PSYCSTORE_state_get (struct GNUNET_PSYCSTORE_Handle *h, */ struct GNUNET_PSYCSTORE_OperationHandle * GNUNET_PSYCSTORE_state_get_prefix (struct GNUNET_PSYCSTORE_Handle *h, - const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key, const char *name_prefix, GNUNET_PSYCSTORE_StateCallback scb, GNUNET_PSYCSTORE_ResultCallback rcb, diff --git a/src/psycstore/test_plugin_psycstore.c b/src/psycstore/test_plugin_psycstore.c index 0a8d4c2bc..ccd3751bf 100644 --- a/src/psycstore/test_plugin_psycstore.c +++ b/src/psycstore/test_plugin_psycstore.c @@ -50,11 +50,11 @@ static int ok; */ static const char *plugin_name; -static struct GNUNET_CRYPTO_EccPrivateKey *channel_key; -static struct GNUNET_CRYPTO_EccPrivateKey *slave_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key; -static struct GNUNET_CRYPTO_EccPublicSignKey channel_pub_key; -static struct GNUNET_CRYPTO_EccPublicSignKey slave_pub_key; +static struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key; +static struct GNUNET_CRYPTO_EddsaPublicKey slave_pub_key; /** * Function called when the service shuts down. Unloads our psycstore @@ -177,9 +177,9 @@ run (void *cls, char *const *args, const char *cfgfile, channel_key = GNUNET_CRYPTO_ecc_key_create (); slave_key = GNUNET_CRYPTO_ecc_key_create (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (channel_key, + GNUNET_CRYPTO_eddsa_key_get_public (channel_key, &channel_pub_key); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (slave_key, &slave_pub_key); + GNUNET_CRYPTO_eddsa_key_get_public (slave_key, &slave_pub_key); GNUNET_assert (GNUNET_OK == db->membership_store (db->cls, &channel_pub_key, &slave_pub_key, GNUNET_YES, @@ -218,7 +218,7 @@ run (void *cls, char *const *args, const char *cfgfile, - sizeof (msg->hop_counter) - sizeof (msg->signature)); msg->purpose.purpose = htonl (234); - GNUNET_CRYPTO_ecc_sign (slave_key, &msg->purpose, &msg->signature); + GNUNET_CRYPTO_eddsa_sign (slave_key, &msg->purpose, &msg->signature); struct FragmentClosure fcls = { 0 }; fcls.n = 0; diff --git a/src/psycstore/test_psycstore.c b/src/psycstore/test_psycstore.c index bb6f88665..cca3c808d 100644 --- a/src/psycstore/test_psycstore.c +++ b/src/psycstore/test_psycstore.c @@ -56,11 +56,11 @@ static struct GNUNET_PSYCSTORE_OperationHandle *op; */ static GNUNET_SCHEDULER_TaskIdentifier end_badly_task; -static struct GNUNET_CRYPTO_EccPrivateKey *channel_key; -static struct GNUNET_CRYPTO_EccPrivateKey *slave_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *channel_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *slave_key; -static struct GNUNET_CRYPTO_EccPublicSignKey channel_pub_key; -static struct GNUNET_CRYPTO_EccPublicSignKey slave_pub_key; +static struct GNUNET_CRYPTO_EddsaPublicKey channel_pub_key; +static struct GNUNET_CRYPTO_EddsaPublicKey slave_pub_key; static struct FragmentClosure { @@ -436,7 +436,7 @@ membership_test_result (void *cls, int64_t result, const char *err_msg) - sizeof (msg->hop_counter) - sizeof (msg->signature)); msg->purpose.purpose = htonl (234); - GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_ecc_sign (slave_key, &msg->purpose, + GNUNET_assert (GNUNET_OK == GNUNET_CRYPTO_eddsa_sign (slave_key, &msg->purpose, &msg->signature)); op = GNUNET_PSYCSTORE_fragment_store (h, &channel_pub_key, msg, fcls.flags[0], @@ -498,8 +498,8 @@ run (void *cls, channel_key = GNUNET_CRYPTO_ecc_key_create (); slave_key = GNUNET_CRYPTO_ecc_key_create (); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (channel_key, &channel_pub_key); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (slave_key, &slave_pub_key); + GNUNET_CRYPTO_eddsa_key_get_public (channel_key, &channel_pub_key); + GNUNET_CRYPTO_eddsa_key_get_public (slave_key, &slave_pub_key); op = GNUNET_PSYCSTORE_membership_store (h, &channel_pub_key, &slave_pub_key, GNUNET_YES, 4, 2, 1, diff --git a/src/regex/gnunet-daemon-regexprofiler.c b/src/regex/gnunet-daemon-regexprofiler.c index bcb99aaf5..3efd769f1 100644 --- a/src/regex/gnunet-daemon-regexprofiler.c +++ b/src/regex/gnunet-daemon-regexprofiler.c @@ -98,7 +98,7 @@ static unsigned int rounds = 3; /** * Private key for this peer. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; @@ -258,7 +258,7 @@ run (void *cls, char *const *args GNUNET_UNUSED, cfg = cfg_; - my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); + my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg); GNUNET_assert (NULL != my_private_key); if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_number (cfg, "REGEXPROFILER", diff --git a/src/regex/gnunet-service-regex.c b/src/regex/gnunet-service-regex.c index 620086b15..cc32c46de 100644 --- a/src/regex/gnunet-service-regex.c +++ b/src/regex/gnunet-service-regex.c @@ -102,7 +102,7 @@ static struct GNUNET_SERVER_NotificationContext *nc; /** * Private key for this peer. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /** @@ -362,7 +362,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, {NULL, NULL, 0, 0} }; - my_private_key = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); + my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg); if (NULL == my_private_key) { GNUNET_SCHEDULER_shutdown (); diff --git a/src/regex/plugin_block_regex.c b/src/regex/plugin_block_regex.c index 3d7b97725..1db1d0d5e 100644 --- a/src/regex/plugin_block_regex.c +++ b/src/regex/plugin_block_regex.c @@ -186,7 +186,7 @@ evaluate_block_regex_accept (void *cls, enum GNUNET_BLOCK_Type type, return GNUNET_BLOCK_EVALUATION_OK_DUPLICATE; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, + GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT, &rba->purpose, &rba->signature, &rba->peer.public_key)) diff --git a/src/regex/regex_internal_dht.c b/src/regex/regex_internal_dht.c index 55ca426cb..e87881902 100644 --- a/src/regex/regex_internal_dht.c +++ b/src/regex/regex_internal_dht.c @@ -62,7 +62,7 @@ struct REGEX_INTERNAL_Announcement /** * Our private key. */ - const struct GNUNET_CRYPTO_EccPrivateKey *priv; + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv; /** * Optional statistics handle to report usage. Can be NULL. @@ -121,10 +121,10 @@ regex_iterator (void *cls, ab.purpose.purpose = ntohl (GNUNET_SIGNATURE_PURPOSE_REGEX_ACCEPT); ab.expiration_time = GNUNET_TIME_absolute_hton (GNUNET_TIME_relative_to_absolute (GNUNET_CONSTANTS_DHT_MAX_EXPIRATION)); ab.key = *key; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv, + GNUNET_CRYPTO_eddsa_key_get_public (h->priv, &ab.peer.public_key); GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (h->priv, + GNUNET_CRYPTO_eddsa_sign (h->priv, &ab.purpose, &ab.signature)); @@ -179,7 +179,7 @@ regex_iterator (void *cls, */ struct REGEX_INTERNAL_Announcement * REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, - const struct GNUNET_CRYPTO_EccPrivateKey *priv, + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const char *regex, uint16_t compression, struct GNUNET_STATISTICS_Handle *stats) diff --git a/src/regex/regex_internal_lib.h b/src/regex/regex_internal_lib.h index 6b69d79eb..ec4e339d2 100644 --- a/src/regex/regex_internal_lib.h +++ b/src/regex/regex_internal_lib.h @@ -182,7 +182,7 @@ struct REGEX_INTERNAL_Search; */ struct REGEX_INTERNAL_Announcement * REGEX_INTERNAL_announce (struct GNUNET_DHT_Handle *dht, - const struct GNUNET_CRYPTO_EccPrivateKey *priv, + const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, const char *regex, uint16_t compression, struct GNUNET_STATISTICS_Handle *stats); diff --git a/src/revocation/gnunet-revocation.c b/src/revocation/gnunet-revocation.c index 5f97a7112..6b2aa6180 100644 --- a/src/revocation/gnunet-revocation.c +++ b/src/revocation/gnunet-revocation.c @@ -193,12 +193,12 @@ struct RevocationData /** * Public key. */ - struct GNUNET_CRYPTO_EccPublicSignKey key; + struct GNUNET_CRYPTO_EcdsaPublicKey key; /** * Revocation signature data. */ - struct GNUNET_CRYPTO_EccSignature sig; + struct GNUNET_CRYPTO_EcdsaSignature sig; /** * Proof of work (in NBO). @@ -310,7 +310,7 @@ ego_callback (void *cls, const struct GNUNET_IDENTITY_Ego *ego) { struct RevocationData *rd; - struct GNUNET_CRYPTO_EccPublicSignKey key; + struct GNUNET_CRYPTO_EcdsaPublicKey key; el = NULL; if (NULL == ego) @@ -334,7 +334,7 @@ ego_callback (void *cls, { if (0 != memcmp (&rd->key, &key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) { fprintf (stderr, _("Error: revocation certificate in `%s' is not for `%s'\n"), @@ -387,14 +387,14 @@ run (void *cls, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c) { - struct GNUNET_CRYPTO_EccPublicSignKey pk; + struct GNUNET_CRYPTO_EcdsaPublicKey pk; struct RevocationData rd; cfg = c; if (NULL != test_ego) { if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (test_ego, + GNUNET_CRYPTO_ecdsa_public_key_from_string (test_ego, strlen (test_ego), &pk)) { diff --git a/src/revocation/gnunet-service-revocation.c b/src/revocation/gnunet-service-revocation.c index c6e3152ba..5a7170de6 100644 --- a/src/revocation/gnunet-service-revocation.c +++ b/src/revocation/gnunet-service-revocation.c @@ -147,7 +147,7 @@ verify_revoke_message (const struct RevokeMessage *rm) return GNUNET_NO; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_REVOCATION, + GNUNET_CRYPTO_ecdsa_verify (GNUNET_SIGNATURE_PURPOSE_REVOCATION, &rm->purpose, &rm->signature, &rm->public_key)) @@ -177,7 +177,7 @@ handle_query_message (void *cls, int res; GNUNET_CRYPTO_hash (&qm->key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &hc); res = GNUNET_CONTAINER_multihashmap_contains (revocation_map, &hc); GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -240,7 +240,7 @@ publicize_rm (const struct RevokeMessage *rm) struct GNUNET_SET_Element e; GNUNET_CRYPTO_hash (&rm->public_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &hc); if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (revocation_map, @@ -622,7 +622,7 @@ run (void *cls, } GNUNET_break (0 == ntohl (rm->reserved)); GNUNET_CRYPTO_hash (&rm->public_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), &hc); GNUNET_break (GNUNET_OK == GNUNET_CONTAINER_multihashmap_put (revocation_map, diff --git a/src/revocation/revocation.h b/src/revocation/revocation.h index b13d79a37..48c284a4d 100644 --- a/src/revocation/revocation.h +++ b/src/revocation/revocation.h @@ -48,7 +48,7 @@ struct QueryMessage /** * Key to check. */ - struct GNUNET_CRYPTO_EccPublicSignKey key; + struct GNUNET_CRYPTO_EcdsaPublicKey key; }; @@ -98,7 +98,7 @@ struct RevokeMessage /** * Signature confirming revocation. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EcdsaSignature signature; /** * Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION, @@ -109,7 +109,7 @@ struct RevokeMessage /** * Key to revoke. */ - struct GNUNET_CRYPTO_EccPublicSignKey public_key; + struct GNUNET_CRYPTO_EcdsaPublicKey public_key; }; diff --git a/src/revocation/revocation_api.c b/src/revocation/revocation_api.c index ebf85a94e..82e905e09 100644 --- a/src/revocation/revocation_api.c +++ b/src/revocation/revocation_api.c @@ -49,7 +49,7 @@ struct GNUNET_REVOCATION_Query /** * Key to check. */ - struct GNUNET_CRYPTO_EccPublicSignKey key; + struct GNUNET_CRYPTO_EcdsaPublicKey key; /** * Function to call with the result. @@ -146,7 +146,7 @@ send_revocation_query (void *cls, */ struct GNUNET_REVOCATION_Query * GNUNET_REVOCATION_query (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicSignKey *key, + const struct GNUNET_CRYPTO_EcdsaPublicKey *key, GNUNET_REVOCATION_Callback func, void *func_cls) { struct GNUNET_REVOCATION_Query *q; @@ -210,12 +210,12 @@ struct GNUNET_REVOCATION_Handle /** * Key to revoke. */ - struct GNUNET_CRYPTO_EccPublicSignKey key; + struct GNUNET_CRYPTO_EcdsaPublicKey key; /** * Signature showing that we have the right to revoke. */ - struct GNUNET_CRYPTO_EccSignature sig; + struct GNUNET_CRYPTO_EcdsaSignature sig; /** * Proof of work showing that we spent enough resources to broadcast revocation. @@ -300,7 +300,7 @@ send_revoke (void *cls, rm.proof_of_work = h->pow; rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); rm.public_key = h->key; rm.signature = h->sig; memcpy (buf, &rm, sizeof (struct RevokeMessage)); @@ -329,8 +329,8 @@ send_revoke (void *cls, */ struct GNUNET_REVOCATION_Handle * GNUNET_REVOCATION_revoke (const struct GNUNET_CONFIGURATION_Handle *cfg, - const struct GNUNET_CRYPTO_EccPublicSignKey *key, - const struct GNUNET_CRYPTO_EccSignature *sig, + const struct GNUNET_CRYPTO_EcdsaPublicKey *key, + const struct GNUNET_CRYPTO_EcdsaSignature *sig, uint64_t pow, GNUNET_REVOCATION_Callback func, void *func_cls) { @@ -437,17 +437,17 @@ count_leading_zeroes (const struct GNUNET_HashCode *hash) * @return #GNUNET_YES if the @a pow is acceptable, #GNUNET_NO if not */ int -GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, +GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EcdsaPublicKey *key, uint64_t pow, unsigned int matching_bits) { - char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + char buf[sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) + sizeof (pow)] GNUNET_ALIGN; struct GNUNET_HashCode result; memcpy (buf, &pow, sizeof (pow)); memcpy (&buf[sizeof (pow)], key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); pow_hash (buf, sizeof (buf), &result); return (count_leading_zeroes (&result) >= matching_bits) ? GNUNET_YES : GNUNET_NO; @@ -461,17 +461,17 @@ GNUNET_REVOCATION_check_pow (const struct GNUNET_CRYPTO_EccPublicSignKey *key, * @param sig where to write the revocation signature */ void -GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EccPrivateKey *key, - struct GNUNET_CRYPTO_EccSignature *sig) +GNUNET_REVOCATION_sign_revocation (const struct GNUNET_CRYPTO_EcdsaPrivateKey *key, + struct GNUNET_CRYPTO_EcdsaSignature *sig) { struct RevokeMessage rm; rm.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_REVOCATION); rm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &rm.public_key); + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)); + GNUNET_CRYPTO_ecdsa_key_get_public (key, &rm.public_key); GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (key, + GNUNET_CRYPTO_ecdsa_sign (key, &rm.purpose, sig)); } diff --git a/src/testing/gnunet-testing.c b/src/testing/gnunet-testing.c index 1cec948a2..a79e836c7 100644 --- a/src/testing/gnunet-testing.c +++ b/src/testing/gnunet-testing.c @@ -164,7 +164,7 @@ create_hostkeys (const unsigned int no) struct GNUNET_TESTING_System *system; struct GNUNET_PeerIdentity id; struct GNUNET_DISK_FileHandle *fd; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; system = GNUNET_TESTING_system_create ("testing", NULL, NULL, NULL); pk = GNUNET_TESTING_hostkey_get (system, create_no, &id); @@ -182,7 +182,7 @@ create_hostkeys (const unsigned int no) GNUNET_DISK_PERM_USER_WRITE); GNUNET_assert (fd != NULL); ret = GNUNET_DISK_file_write (fd, pk, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey)); + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd)); GNUNET_log_from (GNUNET_ERROR_TYPE_DEBUG, "transport-testing", "Wrote hostkey to file: `%s'\n", create_hostkey); diff --git a/src/testing/testing.c b/src/testing/testing.c index 89d4c0f50..cfca8ce9b 100644 --- a/src/testing/testing.c +++ b/src/testing/testing.c @@ -701,12 +701,12 @@ GNUNET_TESTING_release_port (struct GNUNET_TESTING_System *system, * key; if NULL, GNUNET_SYSERR is returned immediately * @return NULL on error (not enough keys) */ -struct GNUNET_CRYPTO_EccPrivateKey * +struct GNUNET_CRYPTO_EddsaPrivateKey * GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, uint32_t key_number, struct GNUNET_PeerIdentity *id) { - struct GNUNET_CRYPTO_EccPrivateKey *private_key; + struct GNUNET_CRYPTO_EddsaPrivateKey *private_key; if ((NULL == id) || (NULL == system->hostkeys_data)) return NULL; @@ -716,12 +716,12 @@ GNUNET_TESTING_hostkey_get (const struct GNUNET_TESTING_System *system, _("Key number %u does not exist\n"), key_number); return NULL; } - private_key = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + private_key = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey); memcpy (private_key, system->hostkeys_data + (key_number * GNUNET_TESTING_HOSTKEYFILESIZE), GNUNET_TESTING_HOSTKEYFILESIZE); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, + GNUNET_CRYPTO_eddsa_key_get_public (private_key, &id->public_key); return private_key; } @@ -1137,7 +1137,7 @@ GNUNET_TESTING_peer_configure (struct GNUNET_TESTING_System *system, char *config_filename; char *libexec_binary; char *emsg_; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; uint16_t *ports; struct SharedService *ss; struct SharedServiceInstance **ss_instances; diff --git a/src/topology/friends.c b/src/topology/friends.c index 5c074e941..d41ff1ec6 100644 --- a/src/topology/friends.c +++ b/src/topology/friends.c @@ -92,7 +92,7 @@ GNUNET_FRIENDS_parse (const struct GNUNET_CONFIGURATION_Handle *cfg, while ((pos < fsize) && (! isspace ((int) data[pos]))) pos++; if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (&data[start], + GNUNET_CRYPTO_eddsa_public_key_from_string (&data[start], pos - start, &pid.public_key)) { @@ -196,7 +196,7 @@ GNUNET_FRIENDS_write (struct GNUNET_FRIENDS_Writer *w, char *ret; size_t slen; - ret = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&friend->public_key); + ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&friend->public_key); GNUNET_asprintf (&buf, "%s\n", ret); diff --git a/src/transport/gnunet-service-transport.c b/src/transport/gnunet-service-transport.c index d6be384bd..6d2e1831e 100644 --- a/src/transport/gnunet-service-transport.c +++ b/src/transport/gnunet-service-transport.c @@ -70,7 +70,7 @@ static struct GNUNET_SERVER_Handle *GST_server; /** * Our private key. */ -struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key; +struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; /** * ATS handle. @@ -738,7 +738,7 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, const struct GNUNET_CONFIGURATION_Handle *c) { char *keyfile; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; long long unsigned int max_fd_cfg; int max_fd_rlimit; int max_fd; @@ -763,14 +763,14 @@ run (void *cls, struct GNUNET_SERVER_Handle *server, hello_expiration = GNUNET_CONSTANTS_HELLO_ADDRESS_EXPIRATION; } GST_server = server; - pk = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); + pk = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); GNUNET_free (keyfile); GNUNET_assert (NULL != pk); GST_my_private_key = pk; GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg); GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (GST_my_private_key, + GNUNET_CRYPTO_eddsa_key_get_public (GST_my_private_key, &GST_my_identity.public_key); GNUNET_assert (NULL != GST_my_private_key); diff --git a/src/transport/gnunet-service-transport.h b/src/transport/gnunet-service-transport.h index 9b68cb258..66da0163e 100644 --- a/src/transport/gnunet-service-transport.h +++ b/src/transport/gnunet-service-transport.h @@ -55,7 +55,7 @@ extern struct GNUNET_PEERINFO_Handle *GST_peerinfo; /** * Our private key. */ -extern struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key; +extern struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key; /** * ATS handle. diff --git a/src/transport/gnunet-service-transport_blacklist.c b/src/transport/gnunet-service-transport_blacklist.c index 8f45a19b8..87d753929 100644 --- a/src/transport/gnunet-service-transport_blacklist.c +++ b/src/transport/gnunet-service-transport_blacklist.c @@ -254,7 +254,7 @@ blacklist_cfg_iter (void *cls, const char *section, char *plugs; char *pos; - if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (option, + if (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (option, strlen (option), &peer.public_key)) return; diff --git a/src/transport/gnunet-service-transport_hello.c b/src/transport/gnunet-service-transport_hello.c index a53e26f95..6bf707755 100644 --- a/src/transport/gnunet-service-transport_hello.c +++ b/src/transport/gnunet-service-transport_hello.c @@ -74,7 +74,7 @@ struct OwnAddressList /** * Signature for a 'struct TransportPongMessage' for this address. */ - struct GNUNET_CRYPTO_EccSignature pong_signature; + struct GNUNET_CRYPTO_EddsaSignature pong_signature; }; @@ -307,7 +307,7 @@ GST_hello_modify_addresses (int addremove, */ int GST_hello_test_address (const struct GNUNET_HELLO_Address *address, - struct GNUNET_CRYPTO_EccSignature **sig, + struct GNUNET_CRYPTO_EddsaSignature **sig, struct GNUNET_TIME_Absolute **sig_expiration) { struct OwnAddressList *al; diff --git a/src/transport/gnunet-service-transport_hello.h b/src/transport/gnunet-service-transport_hello.h index 2aefbe300..0c67cef4d 100644 --- a/src/transport/gnunet-service-transport_hello.h +++ b/src/transport/gnunet-service-transport_hello.h @@ -93,7 +93,7 @@ GST_hello_modify_addresses (int addremove, */ int GST_hello_test_address (const struct GNUNET_HELLO_Address *address, - struct GNUNET_CRYPTO_EccSignature **sig, + struct GNUNET_CRYPTO_EddsaSignature **sig, struct GNUNET_TIME_Absolute **sig_expiration); diff --git a/src/transport/gnunet-service-transport_neighbours.c b/src/transport/gnunet-service-transport_neighbours.c index 0cffe0aeb..d89aa2f32 100644 --- a/src/transport/gnunet-service-transport_neighbours.c +++ b/src/transport/gnunet-service-transport_neighbours.c @@ -329,14 +329,14 @@ struct SessionDisconnectMessage /** * Public key of the sender. */ - struct GNUNET_CRYPTO_EccPublicSignKey public_key; + struct GNUNET_CRYPTO_EddsaPublicKey public_key; /** * Signature of the peer that sends us the disconnect. Only * valid if the timestamp is AFTER the timestamp from the * corresponding 'CONNECT' message. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; }; @@ -1195,7 +1195,7 @@ send_disconnect (struct NeighbourMapEntry *n) disconnect_msg.reserved = htonl (0); disconnect_msg.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + sizeof (struct GNUNET_TIME_AbsoluteNBO)); disconnect_msg.purpose.purpose = htonl (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT); @@ -1203,7 +1203,7 @@ send_disconnect (struct NeighbourMapEntry *n) GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ()); disconnect_msg.public_key = GST_my_identity.public_key; GNUNET_assert (GNUNET_OK == - GNUNET_CRYPTO_ecc_sign (GST_my_private_key, + GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, &disconnect_msg.purpose, &disconnect_msg.signature)); @@ -3157,7 +3157,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity return; } GNUNET_CRYPTO_hash (&sdm->public_key, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey), &hc); if (0 != memcmp (peer, &hc, sizeof (struct GNUNET_PeerIdentity))) { @@ -3166,7 +3166,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity } if (ntohl (sdm->purpose.size) != sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) + - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) + + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey) + sizeof (struct GNUNET_TIME_AbsoluteNBO)) { GNUNET_log (GNUNET_ERROR_TYPE_WARNING, @@ -3177,7 +3177,7 @@ GST_neighbours_handle_disconnect_message (const struct GNUNET_PeerIdentity return; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_verify + GNUNET_CRYPTO_eddsa_verify (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT, &sdm->purpose, &sdm->signature, &sdm->public_key)) { diff --git a/src/transport/gnunet-service-transport_validation.c b/src/transport/gnunet-service-transport_validation.c index 6018e2c7b..f5f3d6d56 100644 --- a/src/transport/gnunet-service-transport_validation.c +++ b/src/transport/gnunet-service-transport_validation.c @@ -148,7 +148,7 @@ struct TransportPongMessage /** * Signature. */ - struct GNUNET_CRYPTO_EccSignature signature; + struct GNUNET_CRYPTO_EddsaSignature signature; /** * GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN to confirm that this is a @@ -189,7 +189,7 @@ struct ValidationEntry /** * Public key of the peer. */ - struct GNUNET_CRYPTO_EccPublicSignKey public_key; + struct GNUNET_CRYPTO_EddsaPublicKey public_key; /** * The identity of the peer. FIXME: duplicated (also in 'address') @@ -199,7 +199,7 @@ struct ValidationEntry /** * Cached PONG signature */ - struct GNUNET_CRYPTO_EccSignature pong_sig_cache; + struct GNUNET_CRYPTO_EddsaSignature pong_sig_cache; /** * ID of task that will clean up this entry if nothing happens. @@ -678,7 +678,7 @@ revalidate_address (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) * if we don't have an existing entry and no public key was given */ static struct ValidationEntry * -find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, +find_validation_entry (const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, const struct GNUNET_HELLO_Address *address) { struct ValidationEntryMatchContext vemc; @@ -701,7 +701,7 @@ find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, ve->public_key = *public_key; ve->pid = address->peer; ve->pong_sig_valid_until = GNUNET_TIME_absolute_get_zero_(); - memset (&ve->pong_sig_cache, '\0', sizeof (struct GNUNET_CRYPTO_EccSignature)); + memset (&ve->pong_sig_cache, '\0', sizeof (struct GNUNET_CRYPTO_EddsaSignature)); ve->latency = GNUNET_TIME_UNIT_FOREVER_REL; ve->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_NONCE, UINT32_MAX); @@ -733,7 +733,7 @@ add_valid_address (void *cls, const struct GNUNET_HELLO_Address *address, struct ValidationEntry *ve; struct GNUNET_PeerIdentity pid; struct GNUNET_ATS_Information ats; - struct GNUNET_CRYPTO_EccPublicSignKey public_key; + struct GNUNET_CRYPTO_EddsaPublicKey public_key; if (0 == GNUNET_TIME_absolute_get_remaining (expiration).rel_value_us) return GNUNET_OK; /* expired */ @@ -855,7 +855,7 @@ GST_validation_stop () */ static void multicast_pong (void *cls, - const struct GNUNET_CRYPTO_EccPublicSignKey *public_key, + const struct GNUNET_CRYPTO_EddsaPublicKey *public_key, struct GNUNET_TIME_Absolute valid_until, struct GNUNET_TIME_Absolute validation_block, const struct GNUNET_HELLO_Address *address) @@ -901,7 +901,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, const struct TransportPingMessage *ping; struct TransportPongMessage *pong; struct GNUNET_TRANSPORT_PluginFunctions *papi; - struct GNUNET_CRYPTO_EccSignature *sig_cache; + struct GNUNET_CRYPTO_EddsaSignature *sig_cache; struct GNUNET_TIME_Absolute *sig_cache_exp; const char *addr; const char *addrend; @@ -1022,7 +1022,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, { addrend = NULL; /* make gcc happy */ slen = 0; - static struct GNUNET_CRYPTO_EccSignature no_address_signature; + static struct GNUNET_CRYPTO_EddsaSignature no_address_signature; static struct GNUNET_TIME_Absolute no_address_signature_expiration; sig_cache = &no_address_signature; @@ -1063,7 +1063,7 @@ GST_validation_handle_ping (const struct GNUNET_PeerIdentity *sender, *sig_cache_exp = GNUNET_TIME_relative_to_absolute (PONG_SIGNATURE_LIFETIME); pong->expiration = GNUNET_TIME_absolute_hton (*sig_cache_exp); if (GNUNET_OK != - GNUNET_CRYPTO_ecc_sign (GST_my_private_key, &pong->purpose, + GNUNET_CRYPTO_eddsa_sign (GST_my_private_key, &pong->purpose, sig_cache)) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, @@ -1141,7 +1141,7 @@ struct ValidateAddressContext /** * Public key of the peer whose address is being validated. */ - struct GNUNET_CRYPTO_EccPublicSignKey public_key; + struct GNUNET_CRYPTO_EddsaPublicKey public_key; }; @@ -1274,7 +1274,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, { /* We have a cached and valid signature for this peer, * try to compare instead of verify */ - if (0 == memcmp (&ve->pong_sig_cache, &pong->signature, sizeof (struct GNUNET_CRYPTO_EccSignature))) + if (0 == memcmp (&ve->pong_sig_cache, &pong->signature, sizeof (struct GNUNET_CRYPTO_EddsaSignature))) { /* signatures are identical, we can skip verification */ sig_res = GNUNET_OK; @@ -1290,7 +1290,7 @@ GST_validation_handle_pong (const struct GNUNET_PeerIdentity *sender, if (GNUNET_YES == do_verify) { /* Do expensive verification */ - sig_res = GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, + sig_res = GNUNET_CRYPTO_eddsa_verify (GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN, &pong->purpose, &pong->signature, &ve->public_key); if (sig_res == GNUNET_SYSERR) diff --git a/src/transport/gnunet-service-transport_validation.h b/src/transport/gnunet-service-transport_validation.h index c935b97cf..3408f50bb 100644 --- a/src/transport/gnunet-service-transport_validation.h +++ b/src/transport/gnunet-service-transport_validation.h @@ -134,7 +134,7 @@ GST_validation_handle_hello (const struct GNUNET_MessageHeader *hello); */ typedef void (*GST_ValidationAddressCallback) (void *cls, const struct - GNUNET_CRYPTO_EccPublicSignKey *public_key, + GNUNET_CRYPTO_EddsaPublicKey *public_key, struct GNUNET_TIME_Absolute valid_until, struct GNUNET_TIME_Absolute diff --git a/src/transport/gnunet-transport.c b/src/transport/gnunet-transport.c index cbda8ac6e..ed47e29e1 100644 --- a/src/transport/gnunet-transport.c +++ b/src/transport/gnunet-transport.c @@ -809,7 +809,7 @@ testservice_task (void *cls, } if ( (NULL != cpid) && - (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string (cpid, + (GNUNET_OK != GNUNET_CRYPTO_eddsa_public_key_from_string (cpid, strlen (cpid), &pid.public_key))) { diff --git a/src/transport/plugin_transport_http_server.c b/src/transport/plugin_transport_http_server.c index 15a0be297..9e4e54e67 100644 --- a/src/transport/plugin_transport_http_server.c +++ b/src/transport/plugin_transport_http_server.c @@ -1013,7 +1013,7 @@ server_parse_url (struct HTTP_Server_Plugin *plugin, return GNUNET_SYSERR; } if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (target_start, + GNUNET_CRYPTO_eddsa_public_key_from_string (target_start, hash_length, &target->public_key)) { diff --git a/src/transport/test_plugin_transport.c b/src/transport/test_plugin_transport.c index ba16d539d..98806fbb8 100644 --- a/src/transport/test_plugin_transport.c +++ b/src/transport/test_plugin_transport.c @@ -49,7 +49,7 @@ static struct GNUNET_PeerIdentity my_identity; /** * Our private key. */ -static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key; +static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key; /** * Our configuration. @@ -617,7 +617,7 @@ run (void *cls, char *const *args, const char *cfgfile, max_connect_per_transport = (uint32_t) tneigh; - my_private_key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile); + my_private_key = GNUNET_CRYPTO_eddsa_key_create_from_file (keyfile); GNUNET_free (keyfile); if (NULL == my_private_key) { @@ -626,7 +626,7 @@ run (void *cls, char *const *args, const char *cfgfile, end_badly_now (); return; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_identity.public_key); + GNUNET_CRYPTO_eddsa_key_get_public (my_private_key, &my_identity.public_key); hello = GNUNET_HELLO_create (&my_identity.public_key, NULL, NULL, GNUNET_NO); diff --git a/src/util/Makefile.am b/src/util/Makefile.am index 564204862..a9b4e09da 100644 --- a/src/util/Makefile.am +++ b/src/util/Makefile.am @@ -7,7 +7,7 @@ libexecdir= $(pkglibdir)/libexec/ pkgcfgdir= $(pkgdatadir)/config.d/ dist_pkgcfg_DATA = \ - util.conf + util.conf pkgcfg_DATA = \ resolver.conf @@ -19,7 +19,7 @@ libgnunetutilwin_la_SOURCES = \ win.c \ winproc.c libgnunetutilwin_la_LDFLAGS = \ - -no-undefined -Wl,--export-all-symbols + -no-undefined -Wl,--export-all-symbols libgnunetutilwin_la_LIBADD = \ -lshell32 -liconv -lstdc++ \ -lcomdlg32 -lgdi32 -liphlpapi @@ -47,7 +47,7 @@ noinst_PROGRAMS = \ gnunet_config_diff_SOURCES = \ gnunet-config-diff.c gnunet_config_diff_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la gnunet_config_diff_DEPENDENCIES = \ libgnunetutil.la @@ -114,7 +114,7 @@ libgnunetutil_la_LIBADD = \ $(LIBGCRYPT_LIBS) \ $(LTLIBICONV) \ $(LTLIBINTL) \ - -lltdl $(Z_LIBS) -lunistring $(XLIB) + -lltdl $(Z_LIBS) -lunistring $(XLIB) libgnunetutil_la_LDFLAGS = \ $(GN_LIB_LDFLAGS) \ @@ -126,17 +126,17 @@ endif libexec_PROGRAMS = \ - gnunet-service-resolver + gnunet-service-resolver bin_PROGRAMS = \ gnunet-resolver \ gnunet-config \ $(GNUNET_ECC) \ - gnunet-uri + gnunet-uri gnunet_service_resolver_SOURCES = \ - gnunet-service-resolver.c + gnunet-service-resolver.c gnunet_service_resolver_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) @@ -145,7 +145,7 @@ gnunet_service_resolver_DEPENDENCIES = \ gnunet_resolver_SOURCES = \ - gnunet-resolver.c + gnunet-resolver.c gnunet_resolver_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) @@ -154,7 +154,7 @@ gnunet_resolver_DEPENDENCIES = \ gnunet_ecc_SOURCES = \ - gnunet-ecc.c + gnunet-ecc.c gnunet_ecc_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) -lgcrypt @@ -163,7 +163,7 @@ gnunet_ecc_DEPENDENCIES = \ gnunet_config_SOURCES = \ - gnunet-config.c + gnunet-config.c gnunet_config_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) @@ -172,7 +172,7 @@ gnunet_config_DEPENDENCIES = \ gnunet_uri_SOURCES = \ - gnunet-uri.c + gnunet-uri.c gnunet_uri_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(GN_LIBINTL) @@ -210,7 +210,9 @@ check_PROGRAMS = \ test_container_slist \ test_crypto_symmetric \ test_crypto_crc \ - test_crypto_ecc \ + test_crypto_ecdsa \ + test_crypto_eddsa \ + test_crypto_ecdhe \ test_crypto_hash \ test_crypto_hkdf \ test_crypto_random \ @@ -265,22 +267,22 @@ test_os_start_process_DEPENDENCIES = \ test_client_SOURCES = \ test_client.c test_client_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_common_allocation_SOURCES = \ test_common_allocation.c test_common_allocation_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_common_endian_SOURCES = \ test_common_endian.c test_common_endian_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_common_logging_SOURCES = \ test_common_logging.c test_common_logging_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_common_logging_runtime_loglevels_SOURCES = \ test_common_logging_runtime_loglevels.c @@ -290,12 +292,12 @@ test_common_logging_runtime_loglevels_LDADD = \ test_configuration_SOURCES = \ test_configuration.c test_configuration_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_container_bloomfilter_SOURCES = \ test_container_bloomfilter.c test_container_bloomfilter_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_container_meta_data_SOURCES = \ test_container_meta_data.c @@ -320,83 +322,95 @@ test_container_multipeermap_LDADD = \ test_container_heap_SOURCES = \ test_container_heap.c test_container_heap_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_container_slist_SOURCES = \ test_container_slist.c test_container_slist_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_crypto_symmetric_SOURCES = \ test_crypto_symmetric.c test_crypto_symmetric_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_crypto_crc_SOURCES = \ test_crypto_crc.c test_crypto_crc_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la -test_crypto_ecc_SOURCES = \ - test_crypto_ecc.c -test_crypto_ecc_LDADD = \ +test_crypto_ecdsa_SOURCES = \ + test_crypto_ecdsa.c +test_crypto_ecdsa_LDADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(LIBGCRYPT_LIBS) + +test_crypto_eddsa_SOURCES = \ + test_crypto_eddsa.c +test_crypto_eddsa_LDADD = \ + $(top_builddir)/src/util/libgnunetutil.la \ + $(LIBGCRYPT_LIBS) + +test_crypto_ecdhe_SOURCES = \ + test_crypto_ecdhe.c +test_crypto_ecdhe_LDADD = \ $(top_builddir)/src/util/libgnunetutil.la \ $(LIBGCRYPT_LIBS) test_crypto_hash_SOURCES = \ test_crypto_hash.c test_crypto_hash_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_crypto_hkdf_SOURCES = \ test_crypto_hkdf.c test_crypto_hkdf_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_crypto_random_SOURCES = \ test_crypto_random.c test_crypto_random_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_disk_SOURCES = \ test_disk.c test_disk_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_getopt_SOURCES = \ test_getopt.c test_getopt_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_connection_SOURCES = \ test_connection.c test_connection_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_connection_addressing_SOURCES = \ test_connection_addressing.c test_connection_addressing_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_connection_receive_cancel_SOURCES = \ test_connection_receive_cancel.c test_connection_receive_cancel_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_connection_timeout_SOURCES = \ test_connection_timeout.c test_connection_timeout_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_connection_timeout_no_connect_SOURCES = \ test_connection_timeout_no_connect.c test_connection_timeout_no_connect_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_connection_transmit_cancel_SOURCES = \ test_connection_transmit_cancel.c test_connection_transmit_cancel_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_mq_SOURCES = \ test_mq.c @@ -411,7 +425,7 @@ test_mq_client_LDADD = \ test_os_network_SOURCES = \ test_os_network.c test_os_network_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_peer_SOURCES = \ test_peer.c @@ -421,63 +435,63 @@ $(top_builddir)/src/util/libgnunetutil.la -lgcrypt test_plugin_SOURCES = \ test_plugin.c test_plugin_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_program_SOURCES = \ test_program.c test_program_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_resolver_api_SOURCES = \ test_resolver_api.c test_resolver_api_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_scheduler_SOURCES = \ test_scheduler.c test_scheduler_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_scheduler_delay_SOURCES = \ test_scheduler_delay.c test_scheduler_delay_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_server_mst_interrupt_SOURCES = \ test_server_mst_interrupt.c test_server_mst_interrupt_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_server_SOURCES = \ test_server.c test_server_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_server_disconnect_SOURCES = \ test_server_disconnect.c test_server_disconnect_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_server_with_client_SOURCES = \ test_server_with_client.c test_server_with_client_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_server_with_client_unix_SOURCES = \ test_server_with_client_unix.c test_server_with_client_unix_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_service_SOURCES = \ test_service.c test_service_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_strings_SOURCES = \ test_strings.c test_strings_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_strings_to_data_SOURCES = \ @@ -489,27 +503,27 @@ test_strings_to_data_LDADD = \ test_time_SOURCES = \ test_time.c test_time_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la test_speedup_SOURCES = \ test_speedup.c test_speedup_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la perf_crypto_hash_SOURCES = \ perf_crypto_hash.c perf_crypto_hash_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la perf_crypto_symmetric_SOURCES = \ perf_crypto_symmetric.c perf_crypto_symmetric_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la perf_malloc_SOURCES = \ perf_malloc.c perf_malloc_LDADD = \ - $(top_builddir)/src/util/libgnunetutil.la + $(top_builddir)/src/util/libgnunetutil.la EXTRA_DIST = \ diff --git a/src/util/common_logging.c b/src/util/common_logging.c index 48a6724f7..582435651 100644 --- a/src/util/common_logging.c +++ b/src/util/common_logging.c @@ -1096,7 +1096,7 @@ GNUNET_i2s (const struct GNUNET_PeerIdentity *pid) static char buf[256]; char *ret; - ret = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pid->public_key); + ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); strcpy (buf, ret); GNUNET_free (ret); buf[4] = '\0'; @@ -1119,7 +1119,7 @@ GNUNET_i2s_full (const struct GNUNET_PeerIdentity *pid) static char buf[256]; char *ret; - ret = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pid->public_key); + ret = GNUNET_CRYPTO_eddsa_public_key_to_string (&pid->public_key); strcpy (buf, ret); GNUNET_free (ret); return buf; diff --git a/src/util/crypto_ecc.c b/src/util/crypto_ecc.c index 34edec3de..e2eaaa269 100644 --- a/src/util/crypto_ecc.c +++ b/src/util/crypto_ecc.c @@ -188,7 +188,7 @@ mpi_scan (gcry_mpi_t *result, * @return NULL on error */ static gcry_sexp_t -decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) +decode_private_ecdsa_key (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv) { gcry_sexp_t result; gcry_mpi_t d; @@ -217,6 +217,111 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) } +/** + * Convert the given private key from the network format to the + * S-expression that can be used by libgcrypt. + * + * @param priv private key to decode + * @return NULL on error + */ +static gcry_sexp_t +decode_private_eddsa_key (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv) +{ + gcry_sexp_t result; + gcry_mpi_t d; + int rc; + + mpi_scan (&d, + priv->d, + sizeof (priv->d)); + rc = gcry_sexp_build (&result, NULL, + "(private-key(ecdsa(curve \"" CURVE "\")(d %m)))", // FIXME: eddsa soon! + d); + gcry_mpi_release (d); + if (0 != rc) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + GNUNET_assert (0); + } +#if EXTRA_CHECKS + if (0 != (rc = gcry_pk_testkey (result))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); + GNUNET_assert (0); + } +#endif + return result; +} + + +/** + * Convert the given private key from the network format to the + * S-expression that can be used by libgcrypt. + * + * @param priv private key to decode + * @return NULL on error + */ +static gcry_sexp_t +decode_private_ecdhe_key (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv) +{ + gcry_sexp_t result; + gcry_mpi_t d; + int rc; + + mpi_scan (&d, + priv->d, + sizeof (priv->d)); + rc = gcry_sexp_build (&result, NULL, + "(private-key(ecdsa(curve \"" CURVE "\")(d %m)))", // FIXME: ecdh here? + d); + gcry_mpi_release (d); + if (0 != rc) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + GNUNET_assert (0); + } +#if EXTRA_CHECKS + if (0 != (rc = gcry_pk_testkey (result))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); + GNUNET_assert (0); + } +#endif + return result; +} + + +/** + * Initialize public key struct from the respective point + * on the curve. + * + * @param q point on curve + * @param pub public key struct to initialize + * @param ctx context to use for ECC operations + */ +static void +point_to_public_ecdsa_key (gcry_mpi_point_t q, + gcry_ctx_t ctx, + struct GNUNET_CRYPTO_EcdsaPublicKey *pub) +{ + gcry_mpi_t q_x; + gcry_mpi_t q_y; + + q_x = gcry_mpi_new (256); + q_y = gcry_mpi_new (256); + if (gcry_mpi_ec_get_affine (q_x, q_y, q, ctx)) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "get_affine failed", 0); + return; + } + + mpi_print (pub->q_x, sizeof (pub->q_x), q_x); + mpi_print (pub->q_y, sizeof (pub->q_y), q_y); + gcry_mpi_release (q_x); + gcry_mpi_release (q_y); +} + + /** * Initialize public key struct from the respective point * on the curve. @@ -226,9 +331,9 @@ decode_private_key (const struct GNUNET_CRYPTO_EccPrivateKey *priv) * @param ctx context to use for ECC operations */ static void -point_to_public_sign_key (gcry_mpi_point_t q, - gcry_ctx_t ctx, - struct GNUNET_CRYPTO_EccPublicSignKey *pub) +point_to_public_eddsa_key (gcry_mpi_point_t q, + gcry_ctx_t ctx, + struct GNUNET_CRYPTO_EddsaPublicKey *pub) { gcry_mpi_t q_x; gcry_mpi_t q_y; @@ -257,9 +362,9 @@ point_to_public_sign_key (gcry_mpi_point_t q, * @param ctx context to use for ECC operations */ static void -point_to_public_encrypt_key (gcry_mpi_point_t q, - gcry_ctx_t ctx, - struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) +point_to_public_ecdhe_key (gcry_mpi_point_t q, + gcry_ctx_t ctx, + struct GNUNET_CRYPTO_EcdhePublicKey *pub) { gcry_mpi_t q_x; gcry_mpi_t q_y; @@ -286,19 +391,19 @@ point_to_public_encrypt_key (gcry_mpi_point_t q, * @param pub where to write the public key */ void -GNUNET_CRYPTO_ecc_key_get_public_for_signature (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - struct GNUNET_CRYPTO_EccPublicSignKey *pub) +GNUNET_CRYPTO_ecdsa_key_get_public (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, + struct GNUNET_CRYPTO_EcdsaPublicKey *pub) { gcry_sexp_t sexp; gcry_ctx_t ctx; gcry_mpi_point_t q; - sexp = decode_private_key (priv); + sexp = decode_private_ecdsa_key (priv); GNUNET_assert (NULL != sexp); GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, sexp, NULL)); gcry_sexp_release (sexp); q = gcry_mpi_ec_get_point ("q", ctx, 0); - point_to_public_sign_key (q, ctx, pub); + point_to_public_ecdsa_key (q, ctx, pub); gcry_ctx_release (ctx); gcry_mpi_point_release (q); } @@ -311,24 +416,80 @@ GNUNET_CRYPTO_ecc_key_get_public_for_signature (const struct GNUNET_CRYPTO_EccPr * @param pub where to write the public key */ void -GNUNET_CRYPTO_ecc_key_get_public_for_encryption (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) +GNUNET_CRYPTO_eddsa_key_get_public (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, + struct GNUNET_CRYPTO_EddsaPublicKey *pub) { gcry_sexp_t sexp; gcry_ctx_t ctx; gcry_mpi_point_t q; - sexp = decode_private_key (priv); + sexp = decode_private_eddsa_key (priv); GNUNET_assert (NULL != sexp); GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, sexp, NULL)); gcry_sexp_release (sexp); q = gcry_mpi_ec_get_point ("q", ctx, 0); - point_to_public_encrypt_key (q, ctx, pub); + point_to_public_eddsa_key (q, ctx, pub); gcry_ctx_release (ctx); gcry_mpi_point_release (q); } +/** + * Extract the public key for the given private key. + * + * @param priv the private key + * @param pub where to write the public key + */ +void +GNUNET_CRYPTO_ecdhe_key_get_public (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, + struct GNUNET_CRYPTO_EcdhePublicKey *pub) +{ + gcry_sexp_t sexp; + gcry_ctx_t ctx; + gcry_mpi_point_t q; + + sexp = decode_private_ecdhe_key (priv); + GNUNET_assert (NULL != sexp); + GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, sexp, NULL)); + gcry_sexp_release (sexp); + q = gcry_mpi_ec_get_point ("q", ctx, 0); + point_to_public_ecdhe_key (q, ctx, pub); + gcry_ctx_release (ctx); + gcry_mpi_point_release (q); +} + + +/** + * Convert a public key to a string. + * + * @param pub key to convert + * @return string representing @a pub + */ +char * +GNUNET_CRYPTO_ecdsa_public_key_to_string (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) +{ + char *pubkeybuf; + size_t keylen = (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) * 8; + char *end; + + if (keylen % 5 > 0) + keylen += 5 - keylen % 5; + keylen /= 5; + pubkeybuf = GNUNET_malloc (keylen + 1); + end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey), + pubkeybuf, + keylen); + if (NULL == end) + { + GNUNET_free (pubkeybuf); + return NULL; + } + *end = '\0'; + return pubkeybuf; +} + + /** * Convert a public key to a string. * @@ -336,10 +497,10 @@ GNUNET_CRYPTO_ecc_key_get_public_for_encryption (const struct GNUNET_CRYPTO_EccP * @return string representing @a pub */ char * -GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) +GNUNET_CRYPTO_eddsa_public_key_to_string (const struct GNUNET_CRYPTO_EddsaPublicKey *pub) { char *pubkeybuf; - size_t keylen = (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) * 8; + size_t keylen = (sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)) * 8; char *end; if (keylen % 5 > 0) @@ -347,7 +508,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli keylen /= 5; pubkeybuf = GNUNET_malloc (keylen + 1); end = GNUNET_STRINGS_data_to_string ((unsigned char *) pub, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey), pubkeybuf, keylen); if (NULL == end) @@ -369,11 +530,11 @@ GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPubli * @return #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, - size_t enclen, - struct GNUNET_CRYPTO_EccPublicSignKey *pub) +GNUNET_CRYPTO_ecdsa_public_key_from_string (const char *enc, + size_t enclen, + struct GNUNET_CRYPTO_EcdsaPublicKey *pub) { - size_t keylen = (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) * 8; + size_t keylen = (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey)) * 8; if (keylen % 5 > 0) keylen += 5 - keylen % 5; @@ -383,7 +544,36 @@ GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, if (GNUNET_OK != GNUNET_STRINGS_string_to_data (enc, enclen, pub, - sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) + return GNUNET_SYSERR; + return GNUNET_OK; +} + + +/** + * Convert a string representing a public key to a public key. + * + * @param enc encoded public key + * @param enclen number of bytes in @a enc (without 0-terminator) + * @param pub where to store the public key + * @return #GNUNET_OK on success + */ +int +GNUNET_CRYPTO_eddsa_public_key_from_string (const char *enc, + size_t enclen, + struct GNUNET_CRYPTO_EddsaPublicKey *pub) +{ + size_t keylen = (sizeof (struct GNUNET_CRYPTO_EddsaPublicKey)) * 8; + + if (keylen % 5 > 0) + keylen += 5 - keylen % 5; + keylen /= 5; + if (enclen != keylen) + return GNUNET_SYSERR; + + if (GNUNET_OK != GNUNET_STRINGS_string_to_data (enc, enclen, + pub, + sizeof (struct GNUNET_CRYPTO_EddsaPublicKey))) return GNUNET_SYSERR; return GNUNET_OK; } @@ -397,7 +587,7 @@ GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc, * @return NULL on error */ static gcry_sexp_t -decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) +decode_public_ecdsa_key (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) { gcry_sexp_t pub_sexp; gcry_mpi_t q_x; @@ -413,7 +603,42 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) gcry_mpi_release (q_y); /* initialize 'ctx' with 'q' */ - GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); + GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); // FIXME: need to say ECDSA? + gcry_mpi_ec_set_point ("q", q, ctx); + gcry_mpi_point_release (q); + + /* convert 'ctx' to 'sexp' */ + GNUNET_assert (0 == gcry_pubkey_get_sexp (&pub_sexp, GCRY_PK_GET_PUBKEY, ctx)); + gcry_ctx_release (ctx); + return pub_sexp; +} + + +/** + * Convert the given public key from the network format to the + * S-expression that can be used by libgcrypt. + * + * @param pub public key to decode + * @return NULL on error + */ +static gcry_sexp_t +decode_public_eddsa_key (const struct GNUNET_CRYPTO_EddsaPublicKey *pub) +{ + gcry_sexp_t pub_sexp; + gcry_mpi_t q_x; + gcry_mpi_t q_y; + gcry_mpi_point_t q; + gcry_ctx_t ctx; + + mpi_scan (&q_x, pub->q_x, sizeof (pub->q_x)); + mpi_scan (&q_y, pub->q_y, sizeof (pub->q_y)); + q = gcry_mpi_point_new (256); + gcry_mpi_point_set (q, q_x, q_y, GCRYMPI_CONST_ONE); + gcry_mpi_release (q_x); + gcry_mpi_release (q_y); + + /* initialize 'ctx' with 'q' */ + GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); // FIXME: need to say EdDSA? gcry_mpi_ec_set_point ("q", q, ctx); gcry_mpi_point_release (q); @@ -431,9 +656,35 @@ decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub) * @param pk location of the key */ void -GNUNET_CRYPTO_ecc_key_clear (struct GNUNET_CRYPTO_EccPrivateKey *pk) +GNUNET_CRYPTO_ecdhe_key_clear (struct GNUNET_CRYPTO_EcdhePrivateKey *pk) { - memset (pk, 0, sizeof (struct GNUNET_CRYPTO_EccPrivateKey)); + memset (pk, 0, sizeof (struct GNUNET_CRYPTO_EcdhePrivateKey)); +} + + +/** + * @ingroup crypto + * Clear memory that was used to store a private key. + * + * @param pk location of the key + */ +void +GNUNET_CRYPTO_ecdsa_key_clear (struct GNUNET_CRYPTO_EcdsaPrivateKey *pk) +{ + memset (pk, 0, sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); +} + + +/** + * @ingroup crypto + * Clear memory that was used to store a private key. + * + * @param pk location of the key + */ +void +GNUNET_CRYPTO_eddsa_key_clear (struct GNUNET_CRYPTO_EddsaPrivateKey *pk) +{ + memset (pk, 0, sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); } @@ -442,10 +693,59 @@ GNUNET_CRYPTO_ecc_key_clear (struct GNUNET_CRYPTO_EccPrivateKey *pk) * * @return fresh private key */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_create () +struct GNUNET_CRYPTO_EcdhePrivateKey * +GNUNET_CRYPTO_ecdhe_key_create () { - struct GNUNET_CRYPTO_EccPrivateKey *priv; + struct GNUNET_CRYPTO_EcdhePrivateKey *priv; + gcry_sexp_t priv_sexp; + gcry_sexp_t s_keyparam; + gcry_mpi_t d; + int rc; + + if (0 != (rc = gcry_sexp_build (&s_keyparam, NULL, + "(genkey(ecdsa(curve \"" CURVE "\")))"))) // FIXME: ECDHE? + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + return NULL; + } + if (0 != (rc = gcry_pk_genkey (&priv_sexp, s_keyparam))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_genkey", rc); + gcry_sexp_release (s_keyparam); + return NULL; + } + gcry_sexp_release (s_keyparam); +#if EXTRA_CHECKS + if (0 != (rc = gcry_pk_testkey (priv_sexp))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); + gcry_sexp_release (priv_sexp); + return NULL; + } +#endif + if (0 != (rc = key_from_sexp (&d, priv_sexp, "private-key", "d"))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "key_from_sexp", rc); + gcry_sexp_release (priv_sexp); + return NULL; + } + gcry_sexp_release (priv_sexp); + priv = GNUNET_new (struct GNUNET_CRYPTO_EcdhePrivateKey); + mpi_print (priv->d, sizeof (priv->d), d); + gcry_mpi_release (d); + return priv; +} + + +/** + * Create a new private key. Caller must free return value. + * + * @return fresh private key + */ +struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_key_create () +{ + struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; gcry_sexp_t priv_sexp; gcry_sexp_t s_keyparam; gcry_mpi_t d; @@ -463,71 +763,275 @@ GNUNET_CRYPTO_ecc_key_create () gcry_sexp_release (s_keyparam); return NULL; } - gcry_sexp_release (s_keyparam); -#if EXTRA_CHECKS - if (0 != (rc = gcry_pk_testkey (priv_sexp))) + gcry_sexp_release (s_keyparam); +#if EXTRA_CHECKS + if (0 != (rc = gcry_pk_testkey (priv_sexp))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); + gcry_sexp_release (priv_sexp); + return NULL; + } +#endif + if (0 != (rc = key_from_sexp (&d, priv_sexp, "private-key", "d"))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "key_from_sexp", rc); + gcry_sexp_release (priv_sexp); + return NULL; + } + gcry_sexp_release (priv_sexp); + priv = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); + mpi_print (priv->d, sizeof (priv->d), d); + gcry_mpi_release (d); + return priv; +} + +/** + * Create a new private key. Caller must free return value. + * + * @return fresh private key + */ +struct GNUNET_CRYPTO_EddsaPrivateKey * +GNUNET_CRYPTO_eddsa_key_create () +{ + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; + gcry_sexp_t priv_sexp; + gcry_sexp_t s_keyparam; + gcry_mpi_t d; + int rc; + + if (0 != (rc = gcry_sexp_build (&s_keyparam, NULL, + "(genkey(ecdsa(curve \"" CURVE "\")))"))) // FIXME: EdDSA? + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + return NULL; + } + if (0 != (rc = gcry_pk_genkey (&priv_sexp, s_keyparam))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_genkey", rc); + gcry_sexp_release (s_keyparam); + return NULL; + } + gcry_sexp_release (s_keyparam); +#if EXTRA_CHECKS + if (0 != (rc = gcry_pk_testkey (priv_sexp))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); + gcry_sexp_release (priv_sexp); + return NULL; + } +#endif + if (0 != (rc = key_from_sexp (&d, priv_sexp, "private-key", "d"))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "key_from_sexp", rc); + gcry_sexp_release (priv_sexp); + return NULL; + } + gcry_sexp_release (priv_sexp); + priv = GNUNET_new (struct GNUNET_CRYPTO_EddsaPrivateKey); + mpi_print (priv->d, sizeof (priv->d), d); + gcry_mpi_release (d); + return priv; +} + + +/** + * Get the shared private key we use for anonymous users. + * + * @return "anonymous" private key + */ +const struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_key_get_anonymous () +{ + /** + * 'anonymous' pseudonym (global static, d=1, public key = G + * (generator). + */ + static struct GNUNET_CRYPTO_EcdsaPrivateKey anonymous; + static int once; + + if (once) + return &anonymous; + mpi_print (anonymous.d, + sizeof (anonymous.d), + GCRYMPI_CONST_ONE); + once = 1; + return &anonymous; +} + + +/** + * Wait for a short time (we're trying to lock a file or want + * to give another process a shot at finishing a disk write, etc.). + * Sleeps for 100ms (as that should be long enough for virtually all + * modern systems to context switch and allow another process to do + * some 'real' work). + */ +static void +short_wait () +{ + struct GNUNET_TIME_Relative timeout; + + timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100); + (void) GNUNET_NETWORK_socket_select (NULL, NULL, NULL, timeout); +} + + +/** + * Create a new private key by reading it from a file. If the + * files does not exist, create a new key and write it to the + * file. Caller must free return value. Note that this function + * can not guarantee that another process might not be trying + * the same operation on the same file at the same time. + * If the contents of the file + * are invalid the old file is deleted and a fresh key is + * created. + * + * @param filename name of file to use to store the key + * @return new private key, NULL on error (for example, + * permission denied) + */ +struct GNUNET_CRYPTO_EddsaPrivateKey * +GNUNET_CRYPTO_eddsa_key_create_from_file (const char *filename) +{ + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; + struct GNUNET_DISK_FileHandle *fd; + unsigned int cnt; + int ec; + uint64_t fs; + + if (GNUNET_SYSERR == GNUNET_DISK_directory_create_for_file (filename)) + return NULL; + while (GNUNET_YES != GNUNET_DISK_file_test (filename)) + { + fd = GNUNET_DISK_file_open (filename, + GNUNET_DISK_OPEN_WRITE | GNUNET_DISK_OPEN_CREATE + | GNUNET_DISK_OPEN_FAILIFEXISTS, + GNUNET_DISK_PERM_USER_READ | + GNUNET_DISK_PERM_USER_WRITE); + if (NULL == fd) + { + if (EEXIST == errno) + { + if (GNUNET_YES != GNUNET_DISK_file_test (filename)) + { + /* must exist but not be accessible, fail for good! */ + if (0 != ACCESS (filename, R_OK)) + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "access", filename); + else + GNUNET_break (0); /* what is going on!? */ + return NULL; + } + continue; + } + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename); + return NULL; + } + cnt = 0; + while (GNUNET_YES != + GNUNET_DISK_file_lock (fd, 0, + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey), + GNUNET_YES)) + { + short_wait (); + if (0 == ++cnt % 10) + { + ec = errno; + LOG (GNUNET_ERROR_TYPE_ERROR, + _("Could not acquire lock on file `%s': %s...\n"), filename, + STRERROR (ec)); + } + } + LOG (GNUNET_ERROR_TYPE_INFO, + _("Creating a new private key. This may take a while.\n")); + priv = GNUNET_CRYPTO_eddsa_key_create (); + GNUNET_assert (NULL != priv); + GNUNET_assert (sizeof (*priv) == + GNUNET_DISK_file_write (fd, priv, sizeof (*priv))); + GNUNET_DISK_file_sync (fd); + if (GNUNET_YES != + GNUNET_DISK_file_unlock (fd, 0, + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey))) + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); + GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); + return priv; + } + /* key file exists already, read it! */ + fd = GNUNET_DISK_file_open (filename, GNUNET_DISK_OPEN_READ, + GNUNET_DISK_PERM_NONE); + if (NULL == fd) { - LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); - gcry_sexp_release (priv_sexp); + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_ERROR, "open", filename); return NULL; } -#endif - if (0 != (rc = key_from_sexp (&d, priv_sexp, "private-key", "d"))) + cnt = 0; + while (1) { - LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "key_from_sexp", rc); - gcry_sexp_release (priv_sexp); - return NULL; + if (GNUNET_YES != + GNUNET_DISK_file_lock (fd, 0, + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey), + GNUNET_NO)) + { + if (0 == ++cnt % 60) + { + ec = errno; + LOG (GNUNET_ERROR_TYPE_ERROR, + _("Could not acquire lock on file `%s': %s...\n"), filename, + STRERROR (ec)); + LOG (GNUNET_ERROR_TYPE_ERROR, + _ + ("This may be ok if someone is currently generating a private key.\n")); + } + short_wait (); + continue; + } + if (GNUNET_YES != GNUNET_DISK_file_test (filename)) + { + /* eh, what!? File we opened is now gone!? */ + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", filename); + if (GNUNET_YES != + GNUNET_DISK_file_unlock (fd, 0, + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey))) + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); + GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd)); + + return NULL; + } + if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) + fs = 0; + if (fs < sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)) + { + /* maybe we got the read lock before the key generating + * process had a chance to get the write lock; give it up! */ + if (GNUNET_YES != + GNUNET_DISK_file_unlock (fd, 0, + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey))) + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); + if (0 == ++cnt % 10) + { + LOG (GNUNET_ERROR_TYPE_ERROR, + _("When trying to read key file `%s' I found %u bytes but I need at least %u.\n"), + filename, (unsigned int) fs, + (unsigned int) sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey)); + LOG (GNUNET_ERROR_TYPE_ERROR, + _("This may be ok if someone is currently generating a key.\n")); + } + short_wait (); /* wait a bit longer! */ + continue; + } + break; } - gcry_sexp_release (priv_sexp); - priv = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); - mpi_print (priv->d, sizeof (priv->d), d); - gcry_mpi_release (d); + fs = sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey); + priv = GNUNET_malloc (fs); + GNUNET_assert (fs == GNUNET_DISK_file_read (fd, priv, fs)); + if (GNUNET_YES != + GNUNET_DISK_file_unlock (fd, 0, + sizeof (struct GNUNET_CRYPTO_EddsaPrivateKey))) + LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); + GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); return priv; } -/** - * Get the shared private key we use for anonymous users. - * - * @return "anonymous" private key - */ -const struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_get_anonymous () -{ - /** - * 'anonymous' pseudonym (global static, d=1, public key = G - * (generator). - */ - static struct GNUNET_CRYPTO_EccPrivateKey anonymous; - static int once; - - if (once) - return &anonymous; - mpi_print (anonymous.d, - sizeof (anonymous.d), - GCRYMPI_CONST_ONE); - once = 1; - return &anonymous; -} - - -/** - * Wait for a short time (we're trying to lock a file or want - * to give another process a shot at finishing a disk write, etc.). - * Sleeps for 100ms (as that should be long enough for virtually all - * modern systems to context switch and allow another process to do - * some 'real' work). - */ -static void -short_wait () -{ - struct GNUNET_TIME_Relative timeout; - - timeout = GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MILLISECONDS, 100); - (void) GNUNET_NETWORK_socket_select (NULL, NULL, NULL, timeout); -} - - /** * Create a new private key by reading it from a file. If the * files does not exist, create a new key and write it to the @@ -542,10 +1046,10 @@ short_wait () * @return new private key, NULL on error (for example, * permission denied) */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) +struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_key_create_from_file (const char *filename) { - struct GNUNET_CRYPTO_EccPrivateKey *priv; + struct GNUNET_CRYPTO_EcdsaPrivateKey *priv; struct GNUNET_DISK_FileHandle *fd; unsigned int cnt; int ec; @@ -581,7 +1085,7 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) cnt = 0; while (GNUNET_YES != GNUNET_DISK_file_lock (fd, 0, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), GNUNET_YES)) { short_wait (); @@ -595,14 +1099,14 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) } LOG (GNUNET_ERROR_TYPE_INFO, _("Creating a new private key. This may take a while.\n")); - priv = GNUNET_CRYPTO_ecc_key_create (); + priv = GNUNET_CRYPTO_ecdsa_key_create (); GNUNET_assert (NULL != priv); GNUNET_assert (sizeof (*priv) == GNUNET_DISK_file_write (fd, priv, sizeof (*priv))); GNUNET_DISK_file_sync (fd); if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); return priv; @@ -620,7 +1124,7 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) { if (GNUNET_YES != GNUNET_DISK_file_lock (fd, 0, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey), + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey), GNUNET_NO)) { if (0 == ++cnt % 60) @@ -642,7 +1146,7 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "stat", filename); if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); GNUNET_assert (GNUNET_OK == GNUNET_DISK_file_close (fd)); @@ -650,36 +1154,34 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) } if (GNUNET_OK != GNUNET_DISK_file_size (filename, &fs, GNUNET_YES, GNUNET_YES)) fs = 0; - if (fs < sizeof (struct GNUNET_CRYPTO_EccPrivateKey)) + if (fs < sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)) { /* maybe we got the read lock before the key generating * process had a chance to get the write lock; give it up! */ if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); if (0 == ++cnt % 10) { LOG (GNUNET_ERROR_TYPE_ERROR, - _ - ("When trying to read key file `%s' I found %u bytes but I need at least %u.\n"), + _("When trying to read key file `%s' I found %u bytes but I need at least %u.\n"), filename, (unsigned int) fs, - (unsigned int) sizeof (struct GNUNET_CRYPTO_EccPrivateKey)); + (unsigned int) sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey)); LOG (GNUNET_ERROR_TYPE_ERROR, - _ - ("This may be ok if someone is currently generating a key.\n")); + _("This may be ok if someone is currently generating a key.\n")); } short_wait (); /* wait a bit longer! */ continue; } break; } - fs = sizeof (struct GNUNET_CRYPTO_EccPrivateKey); + fs = sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey); priv = GNUNET_malloc (fs); GNUNET_assert (fs == GNUNET_DISK_file_read (fd, priv, fs)); if (GNUNET_YES != GNUNET_DISK_file_unlock (fd, 0, - sizeof (struct GNUNET_CRYPTO_EccPrivateKey))) + sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey))) LOG_STRERROR_FILE (GNUNET_ERROR_TYPE_WARNING, "fcntl", filename); GNUNET_assert (GNUNET_YES == GNUNET_DISK_file_close (fd)); return priv; @@ -694,16 +1196,16 @@ GNUNET_CRYPTO_ecc_key_create_from_file (const char *filename) * @return new private key, NULL on error (for example, * permission denied) */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg) +struct GNUNET_CRYPTO_EddsaPrivateKey * +GNUNET_CRYPTO_eddsa_key_create_from_configuration (const struct GNUNET_CONFIGURATION_Handle *cfg) { - struct GNUNET_CRYPTO_EccPrivateKey *priv; + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; char *fn; if (GNUNET_OK != GNUNET_CONFIGURATION_get_value_filename (cfg, "PEER", "PRIVATE_KEY", &fn)) return NULL; - priv = GNUNET_CRYPTO_ecc_key_create_from_file (fn); + priv = GNUNET_CRYPTO_eddsa_key_create_from_file (fn); GNUNET_free (fn); return priv; } @@ -718,14 +1220,14 @@ GNUNET_CRYPTO_ecc_key_create_from_configuration (const struct GNUNET_CONFIGURATI * @param cfg_name name of the configuration file to use */ void -GNUNET_CRYPTO_ecc_setup_key (const char *cfg_name) +GNUNET_CRYPTO_eddsa_setup_key (const char *cfg_name) { struct GNUNET_CONFIGURATION_Handle *cfg; - struct GNUNET_CRYPTO_EccPrivateKey *priv; + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; cfg = GNUNET_CONFIGURATION_create (); (void) GNUNET_CONFIGURATION_load (cfg, cfg_name); - priv = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg); + priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg); if (NULL != priv) GNUNET_free (priv); GNUNET_CONFIGURATION_destroy (cfg); @@ -744,15 +1246,15 @@ int GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, struct GNUNET_PeerIdentity *dst) { - struct GNUNET_CRYPTO_EccPrivateKey *priv; + struct GNUNET_CRYPTO_EddsaPrivateKey *priv; - if (NULL == (priv = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg))) + if (NULL == (priv = GNUNET_CRYPTO_eddsa_key_create_from_configuration (cfg))) { GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Could not load peer's private key\n")); return GNUNET_SYSERR; } - GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &dst->public_key); + GNUNET_CRYPTO_eddsa_key_get_public (priv, &dst->public_key); GNUNET_free (priv); return GNUNET_OK; } @@ -766,7 +1268,35 @@ GNUNET_CRYPTO_get_peer_identity (const struct GNUNET_CONFIGURATION_Handle *cfg, * @return converted s-expression */ static gcry_sexp_t -data_to_pkcs1 (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) +data_to_eddsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) +{ + struct GNUNET_HashCode hc; + gcry_sexp_t data; + int rc; + + GNUNET_CRYPTO_hash (purpose, ntohl (purpose->size), &hc); + if (0 != (rc = gcry_sexp_build (&data, NULL, + "(data(flags rfc6979)(hash %s %b))", // FIXME: use EdDSA encoding! + "sha512", + sizeof (hc), + &hc))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + return NULL; + } + return data; +} + + +/** + * Convert the data specified in the given purpose argument to an + * S-expression suitable for signature operations. + * + * @param purpose data to convert + * @return converted s-expression + */ +static gcry_sexp_t +data_to_ecdsa_value (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) { struct GNUNET_HashCode hc; gcry_sexp_t data; @@ -795,9 +1325,9 @@ data_to_pkcs1 (const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, - struct GNUNET_CRYPTO_EccSignature *sig) +GNUNET_CRYPTO_ecdsa_sign (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + struct GNUNET_CRYPTO_EcdsaSignature *sig) { gcry_sexp_t priv_sexp; gcry_sexp_t sig_sexp; @@ -805,8 +1335,8 @@ GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, int rc; gcry_mpi_t rs[2]; - priv_sexp = decode_private_key (priv); - data = data_to_pkcs1 (purpose); + priv_sexp = decode_private_ecdsa_key (priv); + data = data_to_ecdsa_value (purpose); if (0 != (rc = gcry_pk_sign (&sig_sexp, data, priv_sexp))) { LOG (GNUNET_ERROR_TYPE_WARNING, @@ -836,6 +1366,56 @@ GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, } +/** + * Sign a given block. + * + * @param priv private key to use for the signing + * @param purpose what to sign (size, purpose) + * @param sig where to write the signature + * @return #GNUNET_SYSERR on error, #GNUNET_OK on success + */ +int +GNUNET_CRYPTO_eddsa_sign (const struct GNUNET_CRYPTO_EddsaPrivateKey *priv, + const struct GNUNET_CRYPTO_EccSignaturePurpose *purpose, + struct GNUNET_CRYPTO_EddsaSignature *sig) +{ + gcry_sexp_t priv_sexp; + gcry_sexp_t sig_sexp; + gcry_sexp_t data; + int rc; + gcry_mpi_t rs[2]; + + priv_sexp = decode_private_eddsa_key (priv); + data = data_to_eddsa_value (purpose); + if (0 != (rc = gcry_pk_sign (&sig_sexp, data, priv_sexp))) + { + LOG (GNUNET_ERROR_TYPE_WARNING, + _("EdDSA signing failed at %s:%d: %s\n"), __FILE__, + __LINE__, gcry_strerror (rc)); + gcry_sexp_release (data); + gcry_sexp_release (priv_sexp); + return GNUNET_SYSERR; + } + gcry_sexp_release (priv_sexp); + gcry_sexp_release (data); + + /* extract 'r' and 's' values from sexpression 'sig_sexp' and store in + 'signature' */ + if (0 != (rc = key_from_sexp (rs, sig_sexp, "sig-val", "rs"))) + { + GNUNET_break (0); + gcry_sexp_release (sig_sexp); + return GNUNET_SYSERR; + } + gcry_sexp_release (sig_sexp); + mpi_print (sig->r, sizeof (sig->r), rs[0]); + mpi_print (sig->s, sizeof (sig->s), rs[1]); + gcry_mpi_release (rs[0]); + gcry_mpi_release (rs[1]); + return GNUNET_OK; +} + + /** * Verify signature. * @@ -846,11 +1426,10 @@ GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid */ int -GNUNET_CRYPTO_ecc_verify (uint32_t purpose, - const struct GNUNET_CRYPTO_EccSignaturePurpose - *validate, - const struct GNUNET_CRYPTO_EccSignature *sig, - const struct GNUNET_CRYPTO_EccPublicSignKey *pub) +GNUNET_CRYPTO_ecdsa_verify (uint32_t purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_EcdsaSignature *sig, + const struct GNUNET_CRYPTO_EcdsaPublicKey *pub) { gcry_sexp_t data; gcry_sexp_t sig_sexpr; @@ -876,8 +1455,70 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, } gcry_mpi_release (r); gcry_mpi_release (s); - data = data_to_pkcs1 (validate); - if (! (pub_sexpr = decode_public_sign_key (pub))) + data = data_to_ecdsa_value (validate); + if (! (pub_sexpr = decode_public_ecdsa_key (pub))) + { + gcry_sexp_release (data); + gcry_sexp_release (sig_sexpr); + return GNUNET_SYSERR; + } + rc = gcry_pk_verify (sig_sexpr, data, pub_sexpr); + gcry_sexp_release (pub_sexpr); + gcry_sexp_release (data); + gcry_sexp_release (sig_sexpr); + if (0 != rc) + { + LOG (GNUNET_ERROR_TYPE_INFO, + _("ECDSA signature verification failed at %s:%d: %s\n"), __FILE__, + __LINE__, gcry_strerror (rc)); + return GNUNET_SYSERR; + } + return GNUNET_OK; +} + + + +/** + * Verify signature. + * + * @param purpose what is the purpose that the signature should have? + * @param validate block to validate (size, purpose, data) + * @param sig signature that is being validated + * @param pub public key of the signer + * @returns #GNUNET_OK if ok, #GNUNET_SYSERR if invalid + */ +int +GNUNET_CRYPTO_eddsa_verify (uint32_t purpose, + const struct GNUNET_CRYPTO_EccSignaturePurpose *validate, + const struct GNUNET_CRYPTO_EddsaSignature *sig, + const struct GNUNET_CRYPTO_EddsaPublicKey *pub) +{ + gcry_sexp_t data; + gcry_sexp_t sig_sexpr; + gcry_sexp_t pub_sexpr; + int rc; + gcry_mpi_t r; + gcry_mpi_t s; + + if (purpose != ntohl (validate->purpose)) + return GNUNET_SYSERR; /* purpose mismatch */ + + /* build s-expression for signature */ + mpi_scan (&r, sig->r, sizeof (sig->r)); + mpi_scan (&s, sig->s, sizeof (sig->s)); + if (0 != (rc = gcry_sexp_build (&sig_sexpr, NULL, + "(sig-val(eddsa(r %m)(s %m)))", + r, s))) + { + LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); + gcry_mpi_release (r); + gcry_mpi_release (s); + return GNUNET_SYSERR; + } + gcry_mpi_release (r); + gcry_mpi_release (s); + data = data_to_eddsa_value (validate); + if (! (pub_sexpr = decode_public_eddsa_key (pub))) { gcry_sexp_release (data); gcry_sexp_release (sig_sexpr); @@ -890,7 +1531,7 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, if (0 != rc) { LOG (GNUNET_ERROR_TYPE_INFO, - _("ECC signature verification failed at %s:%d: %s\n"), __FILE__, + _("EdDSA signature verification failed at %s:%d: %s\n"), __FILE__, __LINE__, gcry_strerror (rc)); return GNUNET_SYSERR; } @@ -906,7 +1547,7 @@ GNUNET_CRYPTO_ecc_verify (uint32_t purpose, * @return NULL on error */ static gcry_sexp_t -decode_public_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) +decode_public_ecdhe_key (const struct GNUNET_CRYPTO_EcdhePublicKey *pub) { gcry_sexp_t pub_sexp; gcry_mpi_t q_x; @@ -934,7 +1575,7 @@ decode_public_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) /** - * Derive key material from a public and a private ECC key. + * Derive key material from a public and a private ECDHE key. * * @param priv private key to use for the ECDH (x) * @param pub public key to use for the ECDH (yG) @@ -942,8 +1583,8 @@ decode_public_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub) * @return #GNUNET_SYSERR on error, #GNUNET_OK on success */ int -GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub, +GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EcdhePrivateKey *priv, + const struct GNUNET_CRYPTO_EcdhePublicKey *pub, struct GNUNET_HashCode *key_material) { gcry_mpi_point_t result; @@ -956,7 +1597,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, unsigned char xbuf[256 / 8]; /* first, extract the q = dP value from the public key */ - if (! (pub_sexpr = decode_public_encrypt_key (pub))) + if (! (pub_sexpr = decode_public_ecdhe_key (pub))) return GNUNET_SYSERR; GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, pub_sexpr, NULL)); gcry_sexp_release (pub_sexpr); @@ -1003,7 +1644,7 @@ GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @return h value */ static gcry_mpi_t -derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, +derive_h (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, const char *label, const char *context) { @@ -1033,13 +1674,13 @@ derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, * typically the name of the subsystem/application * @return derived private key */ -struct GNUNET_CRYPTO_EccPrivateKey * -GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, - const char *label, - const char *context) +struct GNUNET_CRYPTO_EcdsaPrivateKey * +GNUNET_CRYPTO_ecdsa_private_key_derive (const struct GNUNET_CRYPTO_EcdsaPrivateKey *priv, + const char *label, + const char *context) { - struct GNUNET_CRYPTO_EccPublicSignKey pub; - struct GNUNET_CRYPTO_EccPrivateKey *ret; + struct GNUNET_CRYPTO_EcdsaPublicKey pub; + struct GNUNET_CRYPTO_EcdsaPrivateKey *ret; gcry_mpi_t h; gcry_mpi_t x; gcry_mpi_t d; @@ -1048,7 +1689,7 @@ GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, GNUNET_assert (0 == gcry_mpi_ec_new (&ctx, NULL, CURVE)); n = gcry_mpi_ec_get_mpi ("n", ctx, 1); - GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &pub); + GNUNET_CRYPTO_ecdsa_key_get_public (priv, &pub); h = derive_h (&pub, label, context); mpi_scan (&x, priv->d, sizeof (priv->d)); d = gcry_mpi_new (256); @@ -1057,7 +1698,7 @@ GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, gcry_mpi_release (x); gcry_mpi_release (n); gcry_ctx_release (ctx); - ret = GNUNET_new (struct GNUNET_CRYPTO_EccPrivateKey); + ret = GNUNET_new (struct GNUNET_CRYPTO_EcdsaPrivateKey); mpi_print (ret->d, sizeof (ret->d), d); gcry_mpi_release (d); return ret; @@ -1075,10 +1716,10 @@ GNUNET_CRYPTO_ecc_key_derive (const struct GNUNET_CRYPTO_EccPrivateKey *priv, * @param result where to write the derived public key */ void -GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey *pub, - const char *label, - const char *context, - struct GNUNET_CRYPTO_EccPublicSignKey *result) +GNUNET_CRYPTO_ecdsa_public_key_derive (const struct GNUNET_CRYPTO_EcdsaPublicKey *pub, + const char *label, + const char *context, + struct GNUNET_CRYPTO_EcdsaPublicKey *result) { gcry_ctx_t ctx; gcry_mpi_t h; @@ -1113,7 +1754,7 @@ GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey gcry_mpi_release (n); gcry_mpi_point_release (q); /* convert point 'v' to public key that we return */ - point_to_public_sign_key (v, ctx, result); + point_to_public_ecdsa_key (v, ctx, result); gcry_mpi_point_release (v); gcry_ctx_release (ctx); } diff --git a/src/util/gnunet-ecc.c b/src/util/gnunet-ecc.c index 23e562cbe..e76321e5e 100644 --- a/src/util/gnunet-ecc.c +++ b/src/util/gnunet-ecc.c @@ -20,7 +20,7 @@ /** * @file util/gnunet-ecc.c - * @brief tool to manipulate ECC key files + * @brief tool to manipulate EDDSA key files * @author Christian Grothoff */ #include "platform.h" @@ -52,7 +52,7 @@ static void create_keys (const char *fn) { FILE *f; - struct GNUNET_CRYPTO_EccPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; if (NULL == (f = fopen (fn, "w+"))) { @@ -69,7 +69,7 @@ create_keys (const char *fn) { fprintf (stderr, "."); - if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ())) + if (NULL == (pk = GNUNET_CRYPTO_eddsa_key_create ())) { GNUNET_break (0); break; @@ -109,12 +109,14 @@ static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *cfg) { - struct GNUNET_CRYPTO_EccPrivateKey *pk; - struct GNUNET_CRYPTO_EccPublicSignKey pub; + struct GNUNET_CRYPTO_EddsaPrivateKey *pk; + struct GNUNET_CRYPTO_EddsaPublicKey pub; if (NULL == args[0]) { - fprintf (stderr, _("No hostkey file specified on command line\n")); + FPRINTF (stderr, + "%s", + _("No hostkey file specified on command line\n")); return; } if (make_keys > 0) @@ -122,25 +124,27 @@ run (void *cls, char *const *args, const char *cfgfile, create_keys (args[0]); return; } - pk = GNUNET_CRYPTO_ecc_key_create_from_file (args[0]); + pk = GNUNET_CRYPTO_eddsa_key_create_from_file (args[0]); if (NULL == pk) return; if (print_public_key) { char *s; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub); - s = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub); - fprintf (stdout, "%s\n", s); + GNUNET_CRYPTO_eddsa_key_get_public (pk, &pub); + s = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub); + FPRINTF (stdout, + "%s\n", + s); GNUNET_free (s); } if (print_peer_identity) { char *str; - GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub); - str = GNUNET_CRYPTO_ecc_public_sign_key_to_string (&pub); - fprintf (stdout, + GNUNET_CRYPTO_eddsa_key_get_public (pk, &pub); + str = GNUNET_CRYPTO_eddsa_public_key_to_string (&pub); + FPRINTF (stdout, "%s\n", str); GNUNET_free (str); diff --git a/src/vpn/gnunet-vpn.c b/src/vpn/gnunet-vpn.c index 5a35a0df5..a68fdc45b 100644 --- a/src/vpn/gnunet-vpn.c +++ b/src/vpn/gnunet-vpn.c @@ -226,7 +226,7 @@ run (void *cls, char *const *args, const char *cfgfile, if (udp) protocol = IPPROTO_UDP; if (GNUNET_OK != - GNUNET_CRYPTO_ecc_public_sign_key_from_string (peer_id, + GNUNET_CRYPTO_eddsa_public_key_from_string (peer_id, strlen (peer_id), &peer.public_key)) {