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))
{
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;
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)) ||
* 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.
* 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).
/**
* 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.
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))
{
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)))
{
}
if (GNUNET_OK !=
GNUNET_CRYPTO_ecc_ecdh (my_ephemeral_key,
- &m->ephemeral_key,
+ &m->ephemeral_key,
&key_material))
{
GNUNET_break (0);
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,
{
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));
}
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)
* 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;
}
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;
* @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);
/**
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;
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))
/**
* Private key for this peer.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey *peer_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *peer_key;
/**
* Are we an IPv4-exit?
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));
}
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"),
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;
}
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)) &&
( (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;
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;
};
*/
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
};
/**
* Identifier of the namespace.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey ns;
+ struct GNUNET_CRYPTO_EcdsaPublicKey ns;
/**
* Human-readable identifier chosen for this entry in the
/**
* 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.
/**
* Derived public key, hashes to 'uquery'.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey dpub;
+ struct GNUNET_CRYPTO_EcdsaPublicKey dpub;
/**
* The original keyword, used to derive the
/**
* Private key for the namespace.
*/
- struct GNUNET_CRYPTO_EccPrivateKey ns;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey ns;
/**
* Hash map mapping identifiers of update nodes
*/
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;
"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);
*/
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;
/**
* Namespace we're publishing to.
*/
- struct GNUNET_CRYPTO_EccPrivateKey ns;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey ns;
/**
* Handle to the datastore.
*/
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,
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);
*/
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)
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)
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);
pkc->dsh,
keyword + 1 /* skip '+' */,
NULL,
- GNUNET_CRYPTO_ecc_key_get_anonymous (),
+ GNUNET_CRYPTO_ecdsa_key_get_anonymous (),
pkc->meta,
pkc->uri,
&pkc->bo,
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;
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)
{
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,
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;
"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);
&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,
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);
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,
*/
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)
{
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,
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;
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);
{
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);
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)
}
{
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),
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);
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);
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:
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;
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;
npos++;
ret =
enc2bin (&s[npos], &ass.peer,
- sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
+ sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey));
if (ret == -1)
{
*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)"));
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)"));
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;
_("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);
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);
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;
}
* @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;
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;
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;
*/
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))
{
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);
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,
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)
{
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);
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))
#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;
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)
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;
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);
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;
static int err;
-static struct GNUNET_CRYPTO_EccPrivateKey *ns;
+static struct GNUNET_CRYPTO_EcdsaPrivateKey *ns;
static struct GNUNET_CONTAINER_MetaData *meta;
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;
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;
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);
/**
* Zone that is to be used for lookup
*/
- struct GNUNET_CRYPTO_EccPublicSignKey zone;
+ struct GNUNET_CRYPTO_EcdsaPublicKey zone;
/**
* Only check cached results
/**
* 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 */
};
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)
{
/**
* 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.
}
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)) )
{
*/
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;
/**
};
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",
{
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,
{
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);
}
/**
* 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?
&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;
}
* @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);
void **ctx,
const char *name)
{
- struct GNUNET_CRYPTO_EccPublicSignKey *pkeym = cls;
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pkeym = cls;
id_op = NULL;
if (NULL == ego)
* @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",
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)
void **ctx,
const char *name)
{
- struct GNUNET_CRYPTO_EccPublicSignKey pkey;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pkey;
id_op = NULL;
if (NULL == ego)
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);
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))
{
&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);
}
*/
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)
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);
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;
{ &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;
&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))
{
/**
* Key of the zone we start lookups in.
*/
-static struct GNUNET_CRYPTO_EccPublicSignKey zone;
+static struct GNUNET_CRYPTO_EcdsaPublicKey zone;
/**
* Head of the DLL.
* @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,
* @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);
/**
/**
* The zone of the GNS authority
*/
- struct GNUNET_CRYPTO_EccPublicSignKey gns_authority;
+ struct GNUNET_CRYPTO_EcdsaPublicKey gns_authority;
struct
{
/**
* 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
/**
* 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.
/* 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;
{
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);
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)
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);
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,
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)) )
{
* @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)
{
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);
* @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);
* 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).
/**
* 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
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)
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,
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);
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
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);
*/
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)
*/
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;
*/
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
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);
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;
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",
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;
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));
}
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);
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));
}
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);
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;
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);
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);
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;
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;
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;
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;
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);
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;
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;
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;
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;
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;
/**
* The public key of the peer.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey publicKey;
+ struct GNUNET_CRYPTO_EddsaPublicKey publicKey;
};
GNUNET_NETWORK_STRUCT_END
* @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)
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;
}
*/
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);
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;
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",
*/
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)
{
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;
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;
void **ctx,
const char *identifier)
{
- struct GNUNET_CRYPTO_EccPublicSignKey pk;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pk;
char *s;
if ( (NULL != set_ego) &&
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);
/**
* Private key of the ego.
*/
- struct GNUNET_CRYPTO_EccPrivateKey *pk;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
/**
* String identifier for the ego.
* @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));
}
}
}
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,
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,
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);
/**
* The private key
*/
- struct GNUNET_CRYPTO_EccPrivateKey private_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
/* followed by 0-terminated identity name */
/**
* The private key
*/
- struct GNUNET_CRYPTO_EccPrivateKey private_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
/* followed by 0-terminated service name */
/**
* The private key
*/
- struct GNUNET_CRYPTO_EccPrivateKey private_key;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey private_key;
/* followed by 0-terminated identity name */
/**
* Private key associated with this ego.
*/
- struct GNUNET_CRYPTO_EccPrivateKey *pk;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey *pk;
/**
* Current name associated with this 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;
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;
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)
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;
}
/* 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,
* @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;
*/
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);
}
{
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))
{
/**
* 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
/**
* Signature using pseudonym and search keyword / identifier.
*/
- struct GNUNET_CRYPTO_EccSignature signature;
+ struct GNUNET_CRYPTO_EcdsaSignature signature;
/**
* What is being signed and why?
/**
* 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 */
/**
* The signature.
*/
- struct GNUNET_CRYPTO_EccSignature signature;
+ struct GNUNET_CRYPTO_EddsaSignature signature;
};
/**
- * @brief an ECC signature
+ * @brief an ECC signature using EdDSA.
+ * See https://gnunet.org/ed25519
*/
-struct GNUNET_CRYPTO_EccSignature
+struct GNUNET_CRYPTO_EddsaSignature
{
/**
};
+
/**
- * 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),
*/
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),
/**
- * 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.
* @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,
* @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,
* @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,
* @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
*/
/**
- * 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
* @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);
/**
* @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);
/**
* @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);
/**
* @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);
/**
* @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);
/**
* @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);
/**
* @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);
/**
*
* @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);
/**
* @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);
/**
*
* @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);
/**
* @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);
/**
* 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)
* @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)
* @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);
/**
* 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);
/**
* @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 */
* @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);
*/
int
GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
- struct GNUNET_CRYPTO_EccPublicSignKey *pseudonym);
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pseudonym);
/**
/**
* Public key of the namespace.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey pseudonym;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pseudonym;
} ns;
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);
*/
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,
*/
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);
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);
* @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);
*/
int
GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello,
- struct GNUNET_CRYPTO_EccPublicSignKey *publicKey);
+ struct GNUNET_CRYPTO_EddsaPublicKey *publicKey);
/**
*/
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);
* @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);
*/
void
GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_CRYPTO_EccPublicSignKey *pk);
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pk);
/**
*
* 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.
*/
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);
*/
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);
*/
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);
*/
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);
*/
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,
*/
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,
*/
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,
* @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);
* @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);
* @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);
* @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);
/**
* 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
*/
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,
* @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);
*/
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_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);
*/
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);
* @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);
/**
* 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);
/**
*/
int
GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
- struct GNUNET_CRYPTO_EccPublicSignKey *pkey);
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pkey);
/**
* @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);
* @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);
* @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,
*/
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);
* 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. */
};
*/
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,
*/
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,
*/
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,
*/
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,
*/
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);
*/
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);
*/
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,
*/
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);
/**
*/
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);
*/
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);
*/
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);
*/
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,
*/
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,
*/
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);
*/
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);
*/
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);
/**
*/
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);
*/
int
(*state_modify_end) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id);
*/
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.
*/
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);
*/
int
(*state_sync_end) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key,
uint64_t message_id);
*/
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.
*/
int
(*state_update_signed) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key);
+ const struct GNUNET_CRYPTO_EddsaPublicKey *channel_key);
/**
*/
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);
*/
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);
*/
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 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,
*/
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,
*/
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,
*/
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,
*/
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,
*/
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,
*/
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);
*/
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,
*/
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,
*/
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);
*/
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,
*/
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,
*/
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,
*/
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_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);
* @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);
* @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 */
/**
* 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
* 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_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))
{
/**
* Own private key.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
/******************************************************************************/
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");
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,
/**
* 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).
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;
/* 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,
/**
* Own private key.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey *private_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *private_key;
/******************************************************************************/
/**
* 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.
/**
* Own private key.
*/
-const static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+const static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
/******************************************************************************/
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",
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.
/**
* 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.
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)
*/
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)
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);
const struct GNUNET_NAMESTORE_RecordData *rd)
{
struct Request *request = cls;
- struct GNUNET_CRYPTO_EccPublicSignKey pub;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pub;
if (0 != rd_count)
{
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))
{
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)
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,
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)) ||
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))
{
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,
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;
}
/**
* Private key for the our zone.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey zone_pkey;
+static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey;
/**
* Handle to identity lookup.
*/
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)
*/
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)
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)
{
*/
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)
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)
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);
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,
}
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))
{
{
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"),
}
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)
{
&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;
}
/**
* 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
/**
* 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
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)
* @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)
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,
}
/* 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)
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,
*/
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)
*/
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)
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;
*/
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)
/**
* 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 */
};
/**
* 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 */
};
/**
* 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
/**
* 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;
};
/**
* 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
/**
* 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
/**
* Zone key.
*/
- struct GNUNET_CRYPTO_EccPrivateKey zone;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
};
/**
* Zone key. All zeros for "all zones".
*/
- struct GNUNET_CRYPTO_EccPrivateKey zone;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
};
/**
* Private key of the zone.
*/
- struct GNUNET_CRYPTO_EccPrivateKey zone;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
/**
* The operation id this zone iteration operation has
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;
*/
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,
*/
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;
*/
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)
{
* @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)
{
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);
* @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,
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;
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) ==
&skey, &iv,
&block[1]));
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_sign (dkey,
+ GNUNET_CRYPTO_ecdsa_sign (dkey,
&block->purpose,
&block->signature))
{
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);
*/
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)
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;
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),
{
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];
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:
{
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)) )
{
}
*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))
{
* @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);
}
* @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);
}
* 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",
*/
int
GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
- struct GNUNET_CRYPTO_EccPublicSignKey *pkey)
+ struct GNUNET_CRYPTO_EcdsaPublicKey *pkey)
{
char *cpy;
char *dot;
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;
/**
* Monitored zone.
*/
- struct GNUNET_CRYPTO_EccPrivateKey zone;
+ struct GNUNET_CRYPTO_EcdsaPrivateKey zone;
};
*/
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)
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,
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)
{
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,
*/
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;
for (i=0;i<rd_count;i++)
if (GNUNET_NAMESTORE_TYPE_PKEY == rd[i].record_type)
{
- GNUNET_break (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) == rd[i].data_size);
+ GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size);
memcpy (&pkey,
rd[i].data,
rd[i].data_size);
static int
get_record_and_call_iterator (struct Plugin *plugin,
PGresult *res,
- const struct GNUNET_CRYPTO_EccPrivateKey *zone_key,
+ const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
{
const char *data;
GNUNET_assert (3 + ((NULL == zone_key) ? 1 : 0) == PQnfields (res));
if (NULL == zone_key)
{
- if (sizeof (struct GNUNET_CRYPTO_EccPrivateKey) != PQgetlength (res, 0, 3))
+ if (sizeof (struct GNUNET_CRYPTO_EcdsaPrivateKey) != PQgetlength (res, 0, 3))
{
GNUNET_break (0);
PQclear (res);
return GNUNET_SYSERR;
}
- zone_key = (const struct GNUNET_CRYPTO_EccPrivateKey *) PQgetvalue (res, 0, 3);
+ zone_key = (const struct GNUNET_CRYPTO_EcdsaPrivateKey *) PQgetvalue (res, 0, 3);
}
if (sizeof (uint32_t) != PQfsize (res, 0))
{
*/
static int
namestore_postgres_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)
{
*/
static int
namestore_postgres_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;
namestore_sqlite_expire_blocks (plugin);
GNUNET_CRYPTO_hash (&block->derived_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);
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;
*/
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;
for (i=0;i<rd_count;i++)
if (GNUNET_NAMESTORE_TYPE_PKEY == rd[i].record_type)
{
- GNUNET_break (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) == rd[i].data_size);
+ GNUNET_break (sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey) == rd[i].data_size);
memcpy (&pkey,
rd[i].data,
rd[i].data_size);
/* First delete 'old' records */
if ((SQLITE_OK != sqlite3_bind_blob (plugin->delete_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,
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)) ||
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;
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);
*/
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)
{
{
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)) );
*/
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;
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,
#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;
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";
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;
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;
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;
{
const char *name = cls;
struct GNUNET_HashCode derived_hash;
- struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
+ struct GNUNET_CRYPTO_EcdsaPublicKey pubkey;
GNUNET_assert (NULL != cls);
(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,
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;
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;
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)
"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");
"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);
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);
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;
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)
"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");
"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);
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);
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;
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;
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 */
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;
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;
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;
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);
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;
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;
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;
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;
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;
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)
}
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))
{
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))
{
*/
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)
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);
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;
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)
}
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))
{
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;
*/
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)
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);
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;
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)
}
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))
{
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))
{
*/
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)
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);
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;
static char * s_name;
-static struct GNUNET_CRYPTO_EccSignature *s_signature;
+static struct GNUNET_CRYPTO_EcdsaSignature *s_signature;
static int res;
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;
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);
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));
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;
}
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)));
}
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),
/**
* Signature (over range specified in purpose).
*/
- struct GNUNET_CRYPTO_EccSignature signature;
+ struct GNUNET_CRYPTO_EddsaSignature signature;
};
GNUNET_NETWORK_STRUCT_END
/**
* 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.
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));
* @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;
{
#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;
}
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)))
{NULL, 0, 0}
};
char *proof;
- struct GNUNET_CRYPTO_EccPrivateKey *pk;
+ struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
cfg = c;
srv = server;
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))
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;
"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);
}
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))
{
{
struct GNUNET_HELLO_Message * res;
struct GNUNET_HELLO_Message * tmp;
- struct GNUNET_CRYPTO_EccPublicSignKey pk;
+ struct GNUNET_CRYPTO_EddsaPublicKey pk;
if (NULL != friend_hello)
{
*/
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))
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;
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;
*/
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,
*/
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;
*/
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)
{
*/
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)
{
*/
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)
*/
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,
*/
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,
*/
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)
*/
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;
*/
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;
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)
*/
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;
*/
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;
*/
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;
*/
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);
*/
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;
*/
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;
* @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);
*/
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);
* @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;
* @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)
{
*/
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;
*/
uint32_t op_id GNUNET_PACKED;
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
};
/**
* 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;
/**
* 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;
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
uint32_t psycstore_flags GNUNET_PACKED;
};
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
uint64_t fragment_id GNUNET_PACKED;
};
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
uint64_t message_id GNUNET_PACKED;
};
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
uint64_t message_id GNUNET_PACKED;
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
struct GNUNET_HashCode hash;
};
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
uint64_t message_id GNUNET_PACKED;
/**
* Channel's public key.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey channel_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey channel_key;
uint64_t message_id GNUNET_PACKED;
*/
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,
*/
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,
*/
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,
*/
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,
*/
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,
*/
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,
*/
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)
{
*/
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,
*/
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,
*/
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)
*/
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,
*/
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,
*/
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,
*/
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
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,
- 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;
*/
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
{
- 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],
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,
/**
* Private key for this peer.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
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",
/**
* Private key for this peer.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
/**
{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 ();
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))
/**
* Our private key.
*/
- const struct GNUNET_CRYPTO_EccPrivateKey *priv;
+ const struct GNUNET_CRYPTO_EddsaPrivateKey *priv;
/**
* Optional statistics handle to report usage. Can be NULL.
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));
*/
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)
*/
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);
/**
* 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).
const struct GNUNET_IDENTITY_Ego *ego)
{
struct RevocationData *rd;
- struct GNUNET_CRYPTO_EccPublicSignKey key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey key;
el = NULL;
if (NULL == ego)
{
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"),
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))
{
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))
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,
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,
}
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,
/**
* Key to check.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey key;
};
/**
* Signature confirming revocation.
*/
- struct GNUNET_CRYPTO_EccSignature signature;
+ struct GNUNET_CRYPTO_EcdsaSignature signature;
/**
* Must have purpose #GNUNET_SIGNATURE_PURPOSE_REVOCATION,
/**
* Key to revoke.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey public_key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey public_key;
};
/**
* Key to check.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey key;
+ struct GNUNET_CRYPTO_EcdsaPublicKey key;
/**
* Function to call with the result.
*/
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;
/**
* 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.
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));
*/
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)
{
* @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;
* @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));
}
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);
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);
* 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;
_("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;
}
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;
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))
{
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);
/**
* Our private key.
*/
-struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key;
+struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key;
/**
* ATS handle.
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;
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);
/**
* Our private key.
*/
-extern struct GNUNET_CRYPTO_EccPrivateKey *GST_my_private_key;
+extern struct GNUNET_CRYPTO_EddsaPrivateKey *GST_my_private_key;
/**
* ATS handle.
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;
/**
* Signature for a 'struct TransportPongMessage' for this address.
*/
- struct GNUNET_CRYPTO_EccSignature pong_signature;
+ struct GNUNET_CRYPTO_EddsaSignature pong_signature;
};
*/
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;
*/
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);
/**
* 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;
};
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);
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));
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)))
{
}
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,
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))
{
/**
* Signature.
*/
- struct GNUNET_CRYPTO_EccSignature signature;
+ struct GNUNET_CRYPTO_EddsaSignature signature;
/**
* GNUNET_SIGNATURE_PURPOSE_TRANSPORT_PONG_OWN to confirm that this is a
/**
* 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')
/**
* 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.
* 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;
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);
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 */
*/
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)
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;
{
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;
*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,
/**
* Public key of the peer whose address is being validated.
*/
- struct GNUNET_CRYPTO_EccPublicSignKey public_key;
+ struct GNUNET_CRYPTO_EddsaPublicKey public_key;
};
{
/* 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;
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)
*/
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
}
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)))
{
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))
{
/**
* Our private key.
*/
-static struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
+static struct GNUNET_CRYPTO_EddsaPrivateKey *my_private_key;
/**
* Our configuration.
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)
{
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);
pkgcfgdir= $(pkgdatadir)/config.d/
dist_pkgcfg_DATA = \
- util.conf
+ util.conf
pkgcfg_DATA = \
resolver.conf
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
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
$(LIBGCRYPT_LIBS) \
$(LTLIBICONV) \
$(LTLIBINTL) \
- -lltdl $(Z_LIBS) -lunistring $(XLIB)
+ -lltdl $(Z_LIBS) -lunistring $(XLIB)
libgnunetutil_la_LDFLAGS = \
$(GN_LIB_LDFLAGS) \
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)
gnunet_resolver_SOURCES = \
- gnunet-resolver.c
+ gnunet-resolver.c
gnunet_resolver_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
gnunet_ecc_SOURCES = \
- gnunet-ecc.c
+ gnunet-ecc.c
gnunet_ecc_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL) -lgcrypt
gnunet_config_SOURCES = \
- gnunet-config.c
+ gnunet-config.c
gnunet_config_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
gnunet_uri_SOURCES = \
- gnunet-uri.c
+ gnunet-uri.c
gnunet_uri_LDADD = \
$(top_builddir)/src/util/libgnunetutil.la \
$(GN_LIBINTL)
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 \
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
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
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
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
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 = \
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 = \
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';
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;
* @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;
}
+/**
+ * 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.
* @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;
* @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;
* @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);
}
* @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.
*
* @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)
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)
* @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;
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;
}
* @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;
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);
* @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));
}
*
* @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;
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
* @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;
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 ();
}
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;
{
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)
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));
}
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;
* @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;
}
* @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);
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;
}
* @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;
* @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;
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,
}
+/**
+ * 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.
*
* @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;
}
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);
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;
}
* @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;
/**
- * 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)
* @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;
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);
* @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)
{
* 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;
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);
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;
* @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;
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);
}
/**
* @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"
create_keys (const char *fn)
{
FILE *f;
- struct GNUNET_CRYPTO_EccPrivateKey *pk;
+ struct GNUNET_CRYPTO_EddsaPrivateKey *pk;
if (NULL == (f = fopen (fn, "w+")))
{
{
fprintf (stderr,
".");
- if (NULL == (pk = GNUNET_CRYPTO_ecc_key_create ()))
+ if (NULL == (pk = GNUNET_CRYPTO_eddsa_key_create ()))
{
GNUNET_break (0);
break;
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)
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);
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))
{