* 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_EccPublicKey ephemeral_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey ephemeral_key;
/**
* Public key of the signing peer (persistent version, not the ephemeral public key).
*/
- struct GNUNET_CRYPTO_EccPublicKey origin_public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey origin_public_key;
};
/**
* Our public key.
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
/**
* Our message stream tokenizer (for encrypted payload).
"Core service receives `%s' request from `%4s'.\n", "EPHEMERAL_KEY",
GNUNET_i2s (&kx->peer));
GNUNET_CRYPTO_hash (&m->origin_public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&signer_id.hashPubKey);
if (0 !=
memcmp (&signer_id, &kx->peer,
sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey)) ||
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) ||
(GNUNET_OK !=
GNUNET_CRYPTO_ecc_verify (GNUNET_SIGNATURE_PURPOSE_SET_ECC_KEY,
&m->purpose,
current_ekm.purpose.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
sizeof (struct GNUNET_TIME_AbsoluteNBO) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
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 (my_ephemeral_key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_ephemeral_key,
¤t_ekm.ephemeral_key);
current_ekm.origin_public_key = my_public_key;
GNUNET_assert (GNUNET_OK ==
{
GNUNET_assert (NULL != pk);
my_private_key = pk;
- GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&GSC_my_identity.hashPubKey);
if (GNUNET_YES ==
*/
struct Issuer
{
- struct GNUNET_CRYPTO_EccPublicKey pubkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
};
char *pubkey;
char *pos;
struct GNUNET_PeerIdentity issuer_ID;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_HashCode hash;
/* Load valid issuer */
if (GNUNET_OK == GNUNET_CONFIGURATION_get_value_string (GED_cfg, "EXPERIMENTATION", "PUBKEY", &pubkey))
{
- if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_key_from_string(pubkey, strlen (pubkey), &pub))
+ if (GNUNET_OK != GNUNET_CRYPTO_ecc_public_sign_key_from_string(pubkey, strlen (pubkey), &pub))
GNUNET_log (GNUNET_ERROR_TYPE_ERROR, _("Invalid public key `%s'\n"), pubkey);
else
{
/**
* Identity of the peer sharing the file.
*/
- struct GNUNET_CRYPTO_EccPublicKey peer;
+ struct GNUNET_CRYPTO_EccPublicSignKey peer;
/**
* Time when this location URI expires.
/**
* Identifier of the namespace.
*/
- struct GNUNET_CRYPTO_EccPublicKey ns;
+ struct GNUNET_CRYPTO_EccPublicSignKey ns;
/**
* Human-readable identifier chosen for this entry in the
/**
* Derived public key, hashes to 'uquery'.
*/
- struct GNUNET_CRYPTO_EccPublicKey dpub;
+ struct GNUNET_CRYPTO_EccPublicSignKey dpub;
/**
* The original keyword, used to derive the
{
char *dn;
char *ret;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_HashCode hc;
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
"fs", "UPDATE_DIR");
return NULL;
}
- GNUNET_CRYPTO_ecc_key_get_public (ns, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns, &pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &hc);
GNUNET_CRYPTO_hash_to_enc (&hc,
&enc);
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 (ns,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns,
&sks_uri->data.sks.ns);
psc = GNUNET_new (struct GNUNET_FS_PublishSksContext);
derive_ublock_encryption_key (struct GNUNET_CRYPTO_AesSessionKey *skey,
struct GNUNET_CRYPTO_AesInitializationVector *iv,
const char *label,
- const struct GNUNET_CRYPTO_EccPublicKey *pub)
+ const struct GNUNET_CRYPTO_EccPublicSignKey *pub)
{
struct GNUNET_HashCode key;
void
GNUNET_FS_ublock_decrypt_ (const void *input,
size_t input_len,
- const struct GNUNET_CRYPTO_EccPublicKey *ns,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *ns,
const char *label,
void *output)
{
struct GNUNET_CRYPTO_AesInitializationVector iv;
struct GNUNET_CRYPTO_AesSessionKey skey;
struct GNUNET_CRYPTO_EccPrivateKey *nsd;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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 (ns,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (ns,
&pub);
derive_ublock_encryption_key (&skey, &iv,
label, &pub);
/* 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 (nsd,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (nsd,
&ub_enc->verification_key);
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_ecc_sign (nsd,
void
GNUNET_FS_ublock_decrypt_ (const void *input,
size_t input_len,
- const struct GNUNET_CRYPTO_EccPublicKey *ns,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *ns,
const char *label,
void *output);
*/
static int
decrypt_block_with_keyword (const struct GNUNET_FS_SearchContext *sc,
- const struct GNUNET_CRYPTO_EccPublicKey *dpub,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *dpub,
const void *edata,
size_t edata_size,
char *data)
{
const struct GNUNET_CRYPTO_EccPrivateKey *anon;
- struct GNUNET_CRYPTO_EccPublicKey anon_pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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_EccPublicKey)))
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)))
break;
if (i == sc->uri->data.ksk.keywordCount)
{
}
/* decrypt */
anon = GNUNET_CRYPTO_ecc_key_get_anonymous ();
- GNUNET_CRYPTO_ecc_key_get_public (anon, &anon_pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (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_EccPublicKey dpub;
+ struct GNUNET_CRYPTO_EccPublicSignKey dpub;
unsigned int sqms;
uint32_t options;
unsigned int i;
const char *keyword;
const struct GNUNET_CRYPTO_EccPrivateKey *anon;
- struct GNUNET_CRYPTO_EccPublicKey anon_pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey anon_pub;
struct SearchRequestEntry *sre;
GNUNET_assert (NULL == sc->client);
{
GNUNET_assert (0 != sc->uri->data.ksk.keywordCount);
anon = GNUNET_CRYPTO_ecc_key_get_anonymous ();
- GNUNET_CRYPTO_ecc_key_get_public (anon, &anon_pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub);
sc->requests =
GNUNET_malloc (sizeof (struct SearchRequestEntry) *
sc->uri->data.ksk.keywordCount);
"fs-ublock",
&sre->dpub);
GNUNET_CRYPTO_hash (&sre->dpub,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&sre->uquery);
sre->mandatory = (sc->uri->data.ksk.keywords[i][0] == '+');
if (sre->mandatory)
{
const char *keyword;
const struct GNUNET_CRYPTO_EccPrivateKey *anon;
- struct GNUNET_CRYPTO_EccPublicKey anon_pub;
- struct GNUNET_CRYPTO_EccPublicKey dpub;
+ struct GNUNET_CRYPTO_EccPublicSignKey anon_pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey dpub;
if (NULL == uc->dsh)
uc->dsh = GNUNET_DATASTORE_connect (uc->h->cfg);
return;
}
anon = GNUNET_CRYPTO_ecc_key_get_anonymous ();
- GNUNET_CRYPTO_ecc_key_get_public (anon, &anon_pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (anon, &anon_pub);
keyword = &uc->ksk_uri->data.ksk.keywords[uc->ksk_offset][1];
GNUNET_CRYPTO_ecc_public_key_derive (&anon_pub,
keyword,
case GNUNET_FS_URI_LOC:
GNUNET_CRYPTO_hash (&uri->data.loc.fi,
sizeof (struct FileIdentifier) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
key);
break;
default:
uri_sks_parse (const char *s, char **emsg)
{
struct GNUNET_FS_Uri *ret;
- struct GNUNET_CRYPTO_EccPublicKey ns;
+ struct GNUNET_CRYPTO_EccPublicSignKey ns;
size_t pos;
char *end;
/**
* Peer offering the file.
*/
- struct GNUNET_CRYPTO_EccPublicKey peer;
+ struct GNUNET_CRYPTO_EccPublicSignKey peer;
};
GNUNET_NETWORK_STRUCT_END
npos++;
ret =
enc2bin (&s[npos], &ass.peer,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
if (ret == -1)
{
*emsg =
if (uri->type != GNUNET_FS_URI_LOC)
return GNUNET_SYSERR;
GNUNET_CRYPTO_hash (&uri->data.loc.peer,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&peer->hashPubKey);
return GNUNET_OK;
}
{
struct GNUNET_FS_Uri *uri;
struct GNUNET_CRYPTO_EccPrivateKey *my_private_key;
- struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
char *keyfile;
struct LocUriAssembly ass;
struct GNUNET_TIME_Absolute et;
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 (my_private_key, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (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);
* @return an FS URI for the given namespace and identifier
*/
struct GNUNET_FS_Uri *
-GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicKey *ns,
+GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey))) &&
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))) &&
(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_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
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_EccPublicKey *pseudonym)
+ struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
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_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
peerSig =
bin2enc (&uri->data.loc.contentSignature,
sizeof (struct GNUNET_CRYPTO_EccSignature));
#include "gnunet_fs_service.h"
-static struct GNUNET_CRYPTO_EccPublicKey nsid;
+static struct GNUNET_CRYPTO_EccPublicSignKey nsid;
static struct GNUNET_FS_Uri *sks_expect_uri;
bo.replication_level = 0;
bo.expiration_time =
GNUNET_TIME_relative_to_absolute (GNUNET_TIME_UNIT_MINUTES);
- GNUNET_CRYPTO_ecc_key_get_public (ns, &nsid);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (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);
struct GNUNET_FS_Uri *ret;
char *emsg;
struct GNUNET_CRYPTO_EccPrivateKey *ph;
- struct GNUNET_CRYPTO_EccPublicKey id;
+ struct GNUNET_CRYPTO_EccPublicSignKey id;
char buf[1024];
char ubuf[1024];
char *sret;
}
GNUNET_free (emsg);
ph = GNUNET_CRYPTO_ecc_key_create ();
- GNUNET_CRYPTO_ecc_key_get_public (ph, &id);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (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_EccPublicKey zone;
+ struct GNUNET_CRYPTO_EccPublicSignKey zone;
/**
* Only check cached results
struct GNUNET_GNS_LookupRequest*
GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
const char *name,
- const struct GNUNET_CRYPTO_EccPublicKey *zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *zone,
int type,
int only_cached,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone_key,
/**
* Which GNS zone do we translate incoming DNS requests to?
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_zone;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_zone;
/**
* '-z' option with the main zone to use.
}
if ( (NULL == gns_zone_str) ||
(GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (gns_zone_str,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (gns_zone_str,
strlen (gns_zone_str),
&my_zone)) )
{
*/
static struct GNUNET_GNS_Handle *gns;
-static struct GNUNET_CRYPTO_EccPublicKey *zone = NULL;
+static struct GNUNET_CRYPTO_EccPublicSignKey *zone = NULL;
static struct GNUNET_HashCode user_zone;
struct GNUNET_CRYPTO_EccPrivateKey *shorten_key = NULL;
char* keyfile;
struct GNUNET_CRYPTO_EccPrivateKey *key = NULL;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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 (key, &pkey);
- GNUNET_CRYPTO_hash (&pkey, sizeof(struct GNUNET_CRYPTO_EccPublicKey),
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
+ GNUNET_CRYPTO_hash (&pkey, sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
&user_zone);
GNUNET_CRYPTO_hash_to_enc (&user_zone, &zonename);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
{
char *keyfile;
struct GNUNET_CRYPTO_EccPrivateKey *key;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_CRYPTO_ShortHashCode *zone;
struct GNUNET_CRYPTO_ShortHashAsciiEncoded zonename;
}
key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
local_gns_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode));
GNUNET_CRYPTO_short_hash (&pkey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
local_gns_zone);
zone = local_gns_zone;
GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
else
{
key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
local_private_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode));
GNUNET_CRYPTO_short_hash (&pkey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
local_private_zone);
GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
else
{
key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
local_shorten_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode));
GNUNET_CRYPTO_short_hash (&pkey,
- sizeof(struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
local_shorten_zone);
GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
* @param shorten_key private key used for shortening, can be NULL
*/
static void
-lookup_with_keys (const struct GNUNET_CRYPTO_EccPublicKey *pkey,
+lookup_with_keys (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key)
{
if (NULL != lookup_type)
void **ctx,
const char *name)
{
- struct GNUNET_CRYPTO_EccPublicKey *pkeym = cls;
+ struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *pkey)
+lookup_with_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey)
{
- struct GNUNET_CRYPTO_EccPublicKey *pkeym;
+ struct GNUNET_CRYPTO_EccPublicSignKey *pkeym;
GNUNET_assert (NULL != pkey);
- pkeym = GNUNET_new (struct GNUNET_CRYPTO_EccPublicKey);
+ pkeym = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey);
*pkeym = *pkey;
id_op = GNUNET_IDENTITY_get (identity,
"shorten-zone",
identity_zone_cb (void *cls,
const struct GNUNET_IDENTITY_Ego *ego)
{
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
el = NULL;
if (NULL == ego)
void **ctx,
const char *name)
{
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
cfg = c;
gns = GNUNET_GNS_connect (cfg);
if (NULL != public_key)
{
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (public_key,
+ GNUNET_CRYPTO_ecc_public_sign_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 (GNUNET_CRYPTO_ecc_key_get_anonymous (),
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (GNUNET_CRYPTO_ecc_key_get_anonymous (),
&pkey);
lookup_with_public_key (&pkey);
}
rd_public_count);
block_size = ntohl (block->purpose.size)
+ sizeof (struct GNUNET_CRYPTO_EccSignature)
- + sizeof (struct GNUNET_CRYPTO_EccPublicKey);
+ + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
GNUNET_NAMESTORE_query_from_private_key (key,
name,
&query);
{ &handle_lookup, NULL, GNUNET_MESSAGE_TYPE_GNS_LOOKUP, 0},
{NULL, NULL, 0, 0}
};
- struct GNUNET_CRYPTO_EccPublicKey dns_root;
+ struct GNUNET_CRYPTO_EccPublicSignKey dns_root;
unsigned long long max_parallel_bg_queries = 0;
char *dns_root_name;
&dns_root_name))
{
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (dns_root_name,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (dns_root_name,
strlen (dns_root_name),
&dns_root))
{
/**
* Key of the zone we start lookups in.
*/
-static struct GNUNET_CRYPTO_EccPublicKey zone;
+static struct GNUNET_CRYPTO_EccPublicSignKey zone;
/**
* Head of the DLL.
* @return GNUNET_OK on success
*/
int
-GNS_interceptor_init (const struct GNUNET_CRYPTO_EccPublicKey *gnu_zone,
+GNS_interceptor_init (const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *gnu_zone,
+GNS_interceptor_init (const struct GNUNET_CRYPTO_EccPublicSignKey *gnu_zone,
const struct GNUNET_CONFIGURATION_Handle *c);
/**
/**
* The zone of the GNS authority
*/
- struct GNUNET_CRYPTO_EccPublicKey gns_authority;
+ struct GNUNET_CRYPTO_EccPublicSignKey gns_authority;
struct
{
/**
* The top-level GNS authoritative zone to query
*/
- struct GNUNET_CRYPTO_EccPublicKey authority_zone;
+ struct GNUNET_CRYPTO_EccPublicSignKey authority_zone;
/**
* called when resolution phase finishes
/* tigger shortening */
if (NULL != rh->shorten_key)
{
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
- if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicKey))
+ if (rd[i].data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
{
GNUNET_break_op (0);
break;
{
case GNUNET_NAMESTORE_TYPE_PKEY:
/* delegation to another zone */
- if (sizeof (struct GNUNET_CRYPTO_EccPublicKey) !=
+ if (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) !=
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_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
ac->label = resolver_lookup_get_next_label (rh);
/* tigger shortening */
if (NULL != rh->shorten_key)
block = data;
if (size !=
ntohs (block->purpose.size) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (struct GNUNET_CRYPTO_EccSignature))
{
/* how did this pass DHT block validation!? */
struct GNS_ResolverHandle *rx;
struct AuthorityChain *ac = rh->ac_tail;
const char *label = ac->label;
- const struct GNUNET_CRYPTO_EccPublicKey *auth = &ac->authority_info.gns_authority;
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_key_from_string (pkey,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (pkey,
strlen (pkey),
&rh->authority_zone)) )
{
* @return handle to cancel operation
*/
struct GNS_ResolverHandle *
-GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicKey *zone,
+GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone,
uint32_t record_type,
const char *name,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key,
* @return handle to cancel operation
*/
struct GNS_ResolverHandle *
-GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicKey *zone,
+GNS_resolver_lookup (const struct GNUNET_CRYPTO_EccPublicSignKey *zone,
uint32_t record_type,
const char *name,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_key,
/**
* The zone for which we are trying to find the PSEU record.
*/
- struct GNUNET_CRYPTO_EccPublicKey target_zone;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
gph->namestore_task = NULL;
if (NULL == block)
process_pseu_lookup_ns (gph, 0, NULL);
return;
}
- GNUNET_CRYPTO_ecc_key_get_public (&gph->shorten_zone_key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&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_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_HashCode query;
- GNUNET_CRYPTO_ecc_key_get_public (&gph->shorten_zone_key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&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_EccPublicKey);
+ new_pkey.data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
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 !=
ntohs (block->purpose.size) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (struct GNUNET_CRYPTO_EccSignature))
{
/* how did this pass DHT block validation!? */
*/
void
GNS_shorten_start (const char *original_label,
- const struct GNUNET_CRYPTO_EccPublicKey *pub,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone)
{
struct GetPseuAuthorityHandle *gph;
*/
void
GNS_shorten_start (const char *original_label,
- const struct GNUNET_CRYPTO_EccPublicKey *pub,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone);
return GNUNET_BLOCK_EVALUATION_RESULT_INVALID;
}
block = reply_block;
- if (ntohs (block->purpose.size) + sizeof (struct GNUNET_CRYPTO_EccSignature) + sizeof (struct GNUNET_CRYPTO_EccPublicKey) !=
+ if (ntohs (block->purpose.size) + sizeof (struct GNUNET_CRYPTO_EccSignature) + sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) !=
reply_block_size)
{
GNUNET_break_op (0);
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey;
struct GNUNET_CRYPTO_EccPrivateKey *alice_key;
struct GNUNET_CRYPTO_EccPrivateKey *bob_key;
char* alice_keyfile;
}
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey);
GNUNET_free(alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
static const struct GNUNET_CONFIGURATION_Handle *cfg;
-static struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
-static struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey;
static struct GNUNET_CRYPTO_EccPrivateKey *alice_key;
static struct GNUNET_CRYPTO_EccPrivateKey *bob_key;
}
GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash);
GNUNET_CRYPTO_short_hash(&bob_pkey,
- sizeof(struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
&zone_hash);
GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
GNUNET_free(alice_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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_short_hash(&bob_pkey, sizeof(bob_pkey), &bob_hash);
struct GNUNET_NAMESTORE_RecordData rd;
{
char* keyfile;
struct GNUNET_CRYPTO_EccPrivateKey *key;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct in_addr *web;
struct GNUNET_NAMESTORE_RecordData rd;
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
GNUNET_CRYPTO_short_hash(&pkey, sizeof(pkey), &dave_hash);
rd.expiration_time = UINT64_MAX;
{
char* keyfile;
struct GNUNET_CRYPTO_EccPrivateKey *key;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_NAMESTORE_RecordData rd;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Setting up bob\n");
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
GNUNET_CRYPTO_short_hash(&pkey, sizeof(pkey), &bob_hash);
rd.expiration_time = UINT64_MAX;
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey bob_pkey;
struct GNUNET_CRYPTO_EccPrivateKey *alice_key;
struct GNUNET_CRYPTO_EccPrivateKey *bob_key;
char* alice_keyfile;
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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_free(alice_keyfile);
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey;
char* alice_keyfile;
struct GNUNET_NAMESTORE_RecordData rd[2];
struct in_addr ns;
}
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey);
GNUNET_free (alice_keyfile);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
static const struct GNUNET_CONFIGURATION_Handle *cfg;
-static struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
-static struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
-static struct GNUNET_CRYPTO_EccPublicKey our_pkey;
-static struct GNUNET_CRYPTO_EccPublicKey priv_pkey;
-static struct GNUNET_CRYPTO_EccPublicKey short_pkey;
+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;
}
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_EccPublicKey),
+ sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
&zone_hash);
GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
}
GNUNET_CRYPTO_short_hash(TEST_RECORD_NAME, strlen(TEST_RECORD_NAME), &name_hash);
GNUNET_CRYPTO_short_hash(&alice_pkey,
- sizeof(struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
&zone_hash);
GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
GNUNET_CRYPTO_short_hash (TEST_AUTHORITY_ALICE,
strlen (TEST_AUTHORITY_ALICE), &name_hash);
GNUNET_CRYPTO_short_hash (&bob_pkey,
- sizeof(struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof(struct GNUNET_CRYPTO_EccPublicSignKey),
&zone_hash);
GNUNET_CRYPTO_short_hash_double(&zone_hash, &zone_hash_double);
GNUNET_CRYPTO_short_hash_double(&name_hash, &name_hash_double);
GNUNET_free (shorten_keyfile);
GNUNET_free (private_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (our_key, &our_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (priv_key, &priv_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (short_key, &short_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
+ 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_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_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ 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_ShortHashCode bob_hash;
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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);
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ 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_ShortHashCode bob_hash;
}
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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);
rd.expiration_time = UINT64_MAX;
GNUNET_assert (1 == inet_pton (AF_INET, ip, &web));
GNUNET_CRYPTO_short_hash (&bob_pkey, sizeof(bob_pkey), &bob_hash);
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey alice_pkey;
struct GNUNET_CRYPTO_EccPrivateKey *alice_key;
struct GNUNET_NAMESTORE_RecordData rd;
char* alice_keyfile;
}
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (alice_key, &alice_pkey);
GNUNET_free (alice_keyfile);
rd.expiration_time = UINT64_MAX;
GNUNET_assert (1 == inet_pton (AF_INET, ip, &web));
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ 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_ShortHashCode bob_hash;
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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);
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
const struct GNUNET_CONFIGURATION_Handle *cfg;
-struct GNUNET_CRYPTO_EccPublicKey priv_pkey;
-struct GNUNET_CRYPTO_EccPublicKey short_pkey;
+struct GNUNET_CRYPTO_EccPublicSignKey priv_pkey;
+struct GNUNET_CRYPTO_EccPublicSignKey short_pkey;
struct GNUNET_CRYPTO_EccPrivateKey *priv_key;
struct GNUNET_CRYPTO_EccPrivateKey *short_key;
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey our_pkey;
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ 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;
GNUNET_free(shorten_keyfile);
GNUNET_free(private_keyfile);
- GNUNET_CRYPTO_ecc_key_get_public (our_key, &our_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (priv_key, &priv_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (short_key, &short_pkey);
+ 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_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_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ 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_ShortHashCode bob_hash;
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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);
struct GNUNET_NAMESTORE_RecordData rd;
char* ip = TEST_IP;
const struct GNUNET_CONFIGURATION_Handle *ccfg,
struct GNUNET_TESTING_Peer *peer)
{
- struct GNUNET_CRYPTO_EccPublicKey alice_pkey;
- struct GNUNET_CRYPTO_EccPublicKey bob_pkey;
+ 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;
alice_key = GNUNET_CRYPTO_ecc_key_create_from_file (alice_keyfile);
bob_key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE_BOB);
- GNUNET_CRYPTO_ecc_key_get_public (alice_key, &alice_pkey);
- GNUNET_CRYPTO_ecc_key_get_public (bob_key, &bob_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);
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_EccPublicKey pk;
+ struct GNUNET_CRYPTO_EccPublicSignKey pk;
uint64_t fsize;
address_count = 0;
/**
* The public key of the peer.
*/
- struct GNUNET_CRYPTO_EccPublicKey publicKey;
+ struct GNUNET_CRYPTO_EccPublicSignKey publicKey;
};
GNUNET_NETWORK_STRUCT_END
* @return the hello message
*/
struct GNUNET_HELLO_Message *
-GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKey *publicKey,
+GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
memcpy (&hello[1], buffer, used);
return hello;
}
wpos = 0;
woff = (ret != NULL) ? (char *) &ret[1] : NULL;
GNUNET_CRYPTO_hash (&msg->publicKey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&address.peer.hashPubKey);
while (insize > 0)
{
*/
int
GNUNET_HELLO_get_key (const struct GNUNET_HELLO_Message *hello,
- struct GNUNET_CRYPTO_EccPublicKey *publicKey)
+ struct GNUNET_CRYPTO_EccPublicSignKey *publicKey)
{
uint16_t ret = ntohs (hello->header.size);
(ntohs (hello->header.type) != GNUNET_MESSAGE_TYPE_HELLO))
return GNUNET_SYSERR;
GNUNET_CRYPTO_hash (&hello->publicKey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&peer->hashPubKey);
return GNUNET_OK;
}
if (0 !=
memcmp (&h1->publicKey, &h2->publicKey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey)))
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)))
return GNUNET_TIME_UNIT_ZERO_ABS;
ec.expiration_limit = now;
ec.result = GNUNET_TIME_UNIT_FOREVER_ABS;
*/
int
GNUNET_HELLO_parse_uri (const char *uri,
- struct GNUNET_CRYPTO_EccPublicKey *pubkey,
+ struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey publicKey;
- struct GNUNET_CRYPTO_EccPublicKey pk;
+ struct GNUNET_CRYPTO_EccPublicSignKey publicKey;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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_EccPublicKey publicKey;
- struct GNUNET_CRYPTO_EccPublicKey pk;
+ struct GNUNET_CRYPTO_EccPublicSignKey publicKey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pk;
struct GNUNET_TIME_Absolute startup_time;
unsigned int i;
void **ctx,
const char *identifier)
{
- struct GNUNET_CRYPTO_EccPublicKey pk;
+ struct GNUNET_CRYPTO_EccPublicSignKey pk;
char *s;
if ( (NULL != set_ego) &&
GNUNET_IDENTITY_ego_get_anonymous ()
{
static struct GNUNET_IDENTITY_Ego anon;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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 (anon.pk,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (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_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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 (&um->private_key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&um->private_key,
&pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
if (0 == name_len)
}
/* Note: we know which service this should be for, so we're not
really using 'str' henceforth */
- GNUNET_CRYPTO_ecc_key_get_public (&sdm->private_key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&sdm->private_key,
&pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &id);
ego = GNUNET_CONTAINER_multihashmap_get (h->egos,
*/
void
GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_CRYPTO_EccPublicKey *pk)
+ struct GNUNET_CRYPTO_EccPublicSignKey *pk)
{
- GNUNET_CRYPTO_ecc_key_get_public (ego->pk,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (ego->pk,
pk);
}
/**
* The peer providing this service
*/
- struct GNUNET_CRYPTO_EccPublicKey peer;
+ struct GNUNET_CRYPTO_EccPublicSignKey peer;
/**
* The descriptor for the service
/**
* Public key used to sign this block.
*/
- struct GNUNET_CRYPTO_EccPublicKey verification_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey verification_key;
/* rest of the data is encrypted */
/**
* Public key of the peer signing.
*/
- struct GNUNET_CRYPTO_EccPublicKey public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey public_key;
/**
* The signature.
/**
* Public ECC key (always for NIST P-521) encoded in a format suitable
- * for network transmission.
+ * for network transmission and signatures (ECDSA/EdDSA).
*/
-struct GNUNET_CRYPTO_EccPublicKey
+struct GNUNET_CRYPTO_EccPublicSignKey
{
/**
* 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];
};
+/**
+ * Public ECC key (always for NIST P-521) encoded in a format suitable
+ * for network transmission and encryption (ECDH).
+ */
+struct GNUNET_CRYPTO_EccPublicEncryptKey
+{
+ /**
+ * Q consists of an x- and a y-value, each mod p (256 bits),
+ * given here in affine coordinates.
+ */
+ 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.
+ *
+ * FIXME: this coordinate will be removed in the future (compressed point!).
+ */
+ unsigned char q_y[256 / 8];
+
+};
+
+
/**
* Private ECC key encoded for transmission.
*/
/**
* @ingroup hash
- * Convert ASCII encoding back to struct GNUNET_HashCode
+ * Convert ASCII encoding back to `struct GNUNET_HashCode`
*
* @param enc the encoding
* @param result where to store the hash code
- * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding
*/
#define GNUNET_CRYPTO_hash_from_string(enc, result) \
GNUNET_CRYPTO_hash_from_string2 (enc, strlen(enc), result)
* @param filename name of file to hash
* @param blocksize number of bytes to process in one task
* @param callback function to call upon completion
- * @param callback_cls closure for callback
+ * @param callback_cls closure for @a callback
* @return NULL on (immediate) errror
*/
struct GNUNET_CRYPTO_FileHashContext *
* @ingroup hash
* Obtain a bit from a hashcode.
*
- * @param code the GNUNET_CRYPTO_hash to index bit-wise
+ * @param code the `struct GNUNET_HashCode` to index bit-wise
* @param bit index into the hashcode, [0...159]
* @return Bit \a bit from hashcode \a code, -1 for invalid index
*/
int
-GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode * code, unsigned int bit);
+GNUNET_CRYPTO_hash_get_bit (const struct GNUNET_HashCode *code,
+ unsigned int bit);
/**
* @param skm source key material
* @param skm_len length of skm
* @param ... void * & size_t pairs for context chunks
- * @return GNUNET_YES on success
+ * @return #GNUNET_YES on success
*/
int
GNUNET_CRYPTO_kdf (void *result, size_t out_len, const void *xts,
* @param pub where to write the public key
*/
void
-GNUNET_CRYPTO_ecc_key_get_public (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
- struct GNUNET_CRYPTO_EccPublicKey *pub);
+GNUNET_CRYPTO_ecc_key_get_public_for_signature (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
+ struct GNUNET_CRYPTO_EccPublicSignKey *pub);
+
+
+
+/**
+ * @ingroup crypto
+ * 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_ecc_key_get_public_for_encryption (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
+ struct GNUNET_CRYPTO_EccPublicEncryptKey *pub);
/**
* Convert a public key to a string.
*
* @param pub key to convert
- * @return string representing 'pub'
+ * @return string representing @a pub
*/
char *
-GNUNET_CRYPTO_ecc_public_key_to_string (const struct GNUNET_CRYPTO_EccPublicKey *pub);
+GNUNET_CRYPTO_ecc_public_sign_key_to_string (const struct GNUNET_CRYPTO_EccPublicSignKey *pub);
/**
* Convert a string representing a public key to a public key.
*
* @param enc encoded public key
- * @param enclen number of bytes in enc (without 0-terminator)
+ * @param enclen number of bytes in @a enc (without 0-terminator)
* @param pub where to store the public key
- * @return GNUNET_OK on success
+ * @return #GNUNET_OK on success
*/
int
-GNUNET_CRYPTO_ecc_public_key_from_string (const char *enc,
- size_t enclen,
- struct GNUNET_CRYPTO_EccPublicKey *pub);
+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);
+
+
+/**
+ * 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_ecc_public_encrypt_key_from_string (const char *enc,
+ size_t enclen,
+ struct GNUNET_CRYPTO_EccPublicEncryptKey *pub);
/**
* Create a new private key by reading our peer's key from
* the file specified in the configuration.
*
+ * @param cfg the configuration to use
* @return new private key, NULL on error (for example,
* permission denied); free using #GNUNET_free
*/
*
* @return fresh private key; free using #GNUNET_free
*/
-struct GNUNET_CRYPTO_EccPrivateKey *
-GNUNET_CRYPTO_ecc_key_create (void);
+struct GNUNET_CRYPTO_EccPrivateEncryptKey *
+GNUNET_CRYPTO_ecc_key_encrypt_create (void);
/**
*/
int
GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
- const struct GNUNET_CRYPTO_EccPublicKey *pub,
+ const struct GNUNET_CRYPTO_EccPublicEncryptKey *pub,
struct GNUNET_HashCode *key_material);
const struct GNUNET_CRYPTO_EccSignaturePurpose
*validate,
const struct GNUNET_CRYPTO_EccSignature *sig,
- const struct GNUNET_CRYPTO_EccPublicKey *pub);
+ const struct GNUNET_CRYPTO_EccPublicSignKey *pub);
/**
* @param result where to write the derived public key
*/
void
-GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicKey *pub,
+GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const char *label,
const char *context,
- struct GNUNET_CRYPTO_EccPublicKey *result);
+ struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *ns,
+GNUNET_FS_uri_sks_create (const struct GNUNET_CRYPTO_EccPublicSignKey *ns,
const char *id);
*/
int
GNUNET_FS_uri_sks_get_namespace (const struct GNUNET_FS_Uri *uri,
- struct GNUNET_CRYPTO_EccPublicKey *pseudonym);
+ struct GNUNET_CRYPTO_EccPublicSignKey *pseudonym);
/**
/**
* Public key of the namespace.
*/
- struct GNUNET_CRYPTO_EccPublicKey pseudonym;
+ struct GNUNET_CRYPTO_EccPublicSignKey pseudonym;
} ns;
struct GNUNET_GNS_LookupRequest *
GNUNET_GNS_lookup (struct GNUNET_GNS_Handle *handle,
const char *name,
- const struct GNUNET_CRYPTO_EccPublicKey *zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *zone,
int type,
int only_cached,
const struct GNUNET_CRYPTO_EccPrivateKey *shorten_zone_key,
* @return the hello message
*/
struct GNUNET_HELLO_Message *
-GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicKey *publicKey,
+GNUNET_HELLO_create (const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *publicKey);
+ struct GNUNET_CRYPTO_EccPublicSignKey *publicKey);
/**
*/
int
GNUNET_HELLO_parse_uri (const char *uri,
- struct GNUNET_CRYPTO_EccPublicKey *pubkey,
+ struct GNUNET_CRYPTO_EccPublicSignKey *pubkey,
struct GNUNET_HELLO_Message **hello,
GNUNET_HELLO_TransportPluginsFind plugins_find);
*/
void
GNUNET_IDENTITY_ego_get_public_key (const struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_CRYPTO_EccPublicKey *pk);
+ struct GNUNET_CRYPTO_EccPublicSignKey *pk);
/**
*/
typedef void
(*GNUNET_MULTICAST_JoinCallback) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *member_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *member_key,
const struct GNUNET_MessageHeader *join_req,
struct GNUNET_MULTICAST_JoinHandle *jh);
*/
typedef void
(*GNUNET_MULTICAST_MembershipTestCallback) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *member_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *member_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *member_key,
const struct GNUNET_MessageHeader *req,
enum GNUNET_MULTICAST_MessageFlags flags);
*/
typedef void
(*GNUNET_MULTICAST_ReplayFragmentCallback) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *member_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *member_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *member_key,
uint64_t message_id,
uint64_t fragment_offset,
uint64_t flags,
*/
struct GNUNET_MULTICAST_Member *
GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_CRYPTO_EccPublicKey *group_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *group_key,
const struct GNUNET_CRYPTO_EccPrivateKey *member_key,
const struct GNUNET_PeerIdentity *origin,
size_t relay_count,
*/
int (*zone_to_name) (void *cls,
const struct GNUNET_CRYPTO_EccPrivateKey *zone,
- const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls);
/**
* Derived key used for signing; hash of this is the query.
*/
- struct GNUNET_CRYPTO_EccPublicKey derived_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey derived_key;
/**
* Number of bytes signed; also specifies the number of bytes
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
const struct GNUNET_CRYPTO_EccPrivateKey *zone,
- const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *value_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_EccPublicKey *z);
+GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z);
/**
* key in an encoding suitable for DNS labels.
*/
const char *
-GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicKey *pkey);
+GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey);
/**
*/
int
GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
- struct GNUNET_CRYPTO_EccPublicKey *pkey);
+ struct GNUNET_CRYPTO_EccPublicSignKey *pkey);
/**
* @param query hash to use for the query
*/
void
-GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicKey *pub,
+GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const char *label,
struct GNUNET_HashCode *query);
*/
int
GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
- const struct GNUNET_CRYPTO_EccPublicKey *zone_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key,
const char *label,
GNUNET_NAMESTORE_RecordCallback proc,
void *proc_cls);
*/
typedef int
(*GNUNET_PSYC_Method) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
const char *method_name,
size_t variable_count,
const struct GNUNET_ENV_Modifier *variables,
*/
struct GNUNET_PSYC_Slave *
GNUNET_PSYC_slave_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const struct GNUNET_CRYPTO_EccPrivateKey *slave_key,
const struct GNUNET_PeerIdentity *origin,
size_t relay_count,
*/
void
GNUNET_PSYC_channel_slave_add (struct GNUNET_PSYC_Channel *channel,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
uint64_t announced_at);
*/
int
(*membership_store) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
*/
int
(*membership_test) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
uint64_t message_id);
/**
*/
int
(*fragment_store) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const struct GNUNET_MULTICAST_MessageHeader *message,
uint32_t psycstore_flags);
*/
int
(*message_add_flags) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
uint64_t psycstore_flags);
*/
int
(*fragment_get) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t fragment_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls);
*/
int
(*message_get) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls);
*/
int
(*message_get_fragment) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
uint64_t fragment_offset,
GNUNET_PSYCSTORE_FragmentCallback cb,
*/
int
(*counters_get_master) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t *fragment_id,
uint64_t *message_id,
uint64_t *group_generation);
*/
int
(*counters_get_slave) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t *max_state_msg_id);
/**
*/
int
(*state_set) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name,
const void *value,
size_t value_size);
*/
int
(*state_reset) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key);
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key);
/**
* Update signed state values from the current ones.
*/
int
(*state_update_signed) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key);
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key);
/**
* Update signed values of state variables in the state store.
*/
int
(*state_hash_update) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
const struct GNUNET_HashCode *hash,
GNUNET_PSYCSTORE_ResultCallback rcb,
*/
int
(*state_get) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name,
GNUNET_PSYCSTORE_StateCallback cb,
void *cb_cls);
*/
int
(*state_get_all) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name,
GNUNET_PSYCSTORE_StateCallback cb,
void *cb_cls);
*/
int
(*state_get_signed) (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t fragment_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls);
*/
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_message_get (struct GNUNET_PSYCSTORE_Handle *h,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls);
*/
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_message_get_fragment (struct GNUNET_PSYCSTORE_Handle *h,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
uint64_t fragment_offset,
GNUNET_PSYCSTORE_FragmentCallback cb,
*/
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_counters_get_master (struct GNUNET_PSYCSTORE_Handle *h,
- struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
GNUNET_PSYCSTORE_MasterCountersCallback *cb,
void *cb_cls);
*/
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_counters_get_slave (struct GNUNET_PSYCSTORE_Handle *h,
- struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
GNUNET_PSYCSTORE_SlaveCountersCallback *cb,
void *cb_cls);
*/
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_state_modify (struct GNUNET_PSYCSTORE_Handle *h,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
uint64_t state_delta,
size_t modifier_count,
*/
struct GNUNET_PSYCSTORE_Handle *
GNUNET_PSYCSTORE_state_reset (struct GNUNET_PSYCSTORE_Handle *h,
- const struct GNUNET_CRYPTO_EccPublicKey
+ const struct GNUNET_CRYPTO_EccPublicSignKey
*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_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name,
GNUNET_PSYCSTORE_StateCallback cb,
void *cb_cls);
*/
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_state_get_all (struct GNUNET_PSYCSTORE_Handle *h,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name_prefix,
GNUNET_PSYCSTORE_StateCallback cb,
void *cb_cls);
*/
void
GNUNET_SOCIAL_nym_get_key (struct GNUNET_SOCIAL_Nym *nym,
- struct GNUNET_CRYPTO_EccPublicKey *nym_key);
+ struct GNUNET_CRYPTO_EccPublicSignKey *nym_key);
/**
struct GNUNET_SOCIAL_Place *
GNUNET_SOCIAL_place_enter2 (const struct GNUNET_CONFIGURATION_Handle *cfg,
struct GNUNET_IDENTITY_Ego *ego,
- struct GNUNET_CRYPTO_EccPublicKey *crypto_address,
+ struct GNUNET_CRYPTO_EccPublicSignKey *crypto_address,
struct GNUNET_PeerIdentity *origin,
size_t relay_count,
struct GNUNET_PeerIdentity *relays,
/**
* Local peer ephemeral public key
*/
- struct GNUNET_CRYPTO_EccPublicKey *my_eph;
+ struct GNUNET_CRYPTO_EccPublicSignKey *my_eph;
/**
* Remote peer's public key.
*/
- struct GNUNET_CRYPTO_EccPublicKey *peers_eph;
+ struct GNUNET_CRYPTO_EccPublicSignKey *peers_eph;
/**
* Encryption ("our") key.
/**
* Own public key.
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
/**
* All ports clients of this peer have opened.
pk = GNUNET_CRYPTO_ecc_key_create_from_configuration (c);
GNUNET_assert (NULL != pk);
my_private_key = pk;
- GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&my_full_id.hashPubKey);
myid = GNUNET_PEER_intern (&my_full_id);
/**
* Own public key.
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
/**
* Tunnel ID for the next created tunnel (global tunnel number).
GNUNET_free (keyfile);
GNUNET_assert (NULL != pk);
my_private_key = pk;
- GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&my_full_id.hashPubKey);
myid = GNUNET_PEER_intern (&my_full_id);
/**
* Public key of the sending member.
*/
- struct GNUNET_CRYPTO_EccPublicKey member_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey member_key;
/**
* ECC signature of the request fragment.
/**
* Public key of the target group.
*/
- struct GNUNET_CRYPTO_EccPublicKey group_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey group_key;
/**
* Public key of the joining member.
*/
- struct GNUNET_CRYPTO_EccPublicKey member_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey member_key;
/**
* Peer identity of the joining member.
*/
struct GNUNET_MULTICAST_Member *
GNUNET_MULTICAST_member_join (const struct GNUNET_CONFIGURATION_Handle *cfg,
- const struct GNUNET_CRYPTO_EccPublicKey *group_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *group_key,
const struct GNUNET_CRYPTO_EccPrivateKey *member_key,
const struct GNUNET_PeerIdentity *origin,
size_t relay_count,
const struct GNUNET_NAMESTORE_RecordData *rd)
{
struct Request *request = cls;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
if (0 != rd_count)
{
return;
}
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (request->public_key,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (request->public_key,
strlen (request->public_key),
&pub))
{
const struct GNUNET_NAMESTORE_Block *block)
{
struct Request *request = cls;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
request->qe = NULL;
if (NULL == block)
lookup_result_processor (request, 0, NULL);
return;
}
- GNUNET_CRYPTO_ecc_key_get_public (&fcfs_zone_pkey,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey,
&pub);
if (GNUNET_OK !=
GNUNET_NAMESTORE_block_decrypt (block,
struct MHD_Response *response;
struct Request *request;
int ret;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_HashCode query;
if ( (0 == strcmp (method, MHD_HTTP_METHOD_GET)) ||
request->pp = NULL;
}
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (request->public_key,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (request->public_key,
strlen (request->public_key),
&pub))
{
request, connection);
}
request->phase = RP_LOOKUP;
- GNUNET_CRYPTO_ecc_key_get_public (&fcfs_zone_pkey,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&fcfs_zone_pkey,
&pub);
GNUNET_NAMESTORE_query_from_public_key (&pub,
request->domain_name,
int result)
{
const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_NAMESTORE_RecordData rd;
if (GNUNET_YES != result)
_("No options given\n"));
return;
}
- GNUNET_CRYPTO_ecc_key_get_public (&zone_pkey,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&zone_pkey,
&pub);
ns = GNUNET_NAMESTORE_connect (cfg);
{
char sh[105];
char sname[64];
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
if ( (2 != (sscanf (uri,
"gnunet://gns/%104s/%63s",
sh,
sname)) ) ||
(GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (sh, strlen (sh), &pkey)) )
+ GNUNET_CRYPTO_ecc_public_sign_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_EccPublicKey);
+ rd.data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
rd.record_type = GNUNET_NAMESTORE_TYPE_PKEY;
if (GNUNET_YES == etime_is_rel)
{
const char *rd_ser;
unsigned int rd_count;
int res;
- struct GNUNET_CRYPTO_EccPublicKey pubkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Received `%s' message\n",
}
/* Extracting and converting private key */
- GNUNET_CRYPTO_ecc_key_get_public (&rp_msg->private_key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (&rp_msg->private_key,
&pubkey);
conv_name = GNUNET_NAMESTORE_normalize_string (name_tmp);
if (NULL == conv_name)
/**
* Derived public key.
*/
- struct GNUNET_CRYPTO_EccPublicKey derived_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey derived_key;
/* follwed by encrypted block data */
};
/**
* Derived public key.
*/
- struct GNUNET_CRYPTO_EccPublicKey derived_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey derived_key;
/* follwed by encrypted block data */
};
/**
* The public key of the target zone
*/
- struct GNUNET_CRYPTO_EccPublicKey value_zone;
+ struct GNUNET_CRYPTO_EccPublicSignKey value_zone;
};
struct GNUNET_NAMESTORE_QueueEntry *
GNUNET_NAMESTORE_zone_to_name (struct GNUNET_NAMESTORE_Handle *h,
const struct GNUNET_CRYPTO_EccPrivateKey *zone,
- const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
GNUNET_NAMESTORE_RecordMonitor proc, void *proc_cls)
{
struct GNUNET_NAMESTORE_QueueEntry *qe;
* @return string form; will be overwritten by next call to #GNUNET_NAMESTORE_z2s
*/
const char *
-GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicKey *z)
+GNUNET_NAMESTORE_z2s (const struct GNUNET_CRYPTO_EccPublicSignKey *z)
{
- static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicKey) * 8];
+ static char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) * 8];
char *end;
end = GNUNET_STRINGS_data_to_string ((const unsigned char *) z,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
buf, sizeof (buf));
if (NULL == end)
{
derive_block_aes_key (struct GNUNET_CRYPTO_AesInitializationVector *iv,
struct GNUNET_CRYPTO_AesSessionKey *skey,
const char *label,
- const struct GNUNET_CRYPTO_EccPublicKey *pub)
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_AesSessionKey),
- pub, sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
label, strlen (label),
ctx_key, strlen (ctx_key),
NULL, 0);
GNUNET_CRYPTO_kdf (iv, sizeof (struct GNUNET_CRYPTO_AesInitializationVector),
- pub, sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ pub, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
label, strlen (label),
ctx_iv, strlen (ctx_iv),
NULL, 0);
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_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_CRYPTO_EccPrivateKey *dkey;
struct GNUNET_CRYPTO_AesInitializationVector iv;
struct GNUNET_CRYPTO_AesSessionKey skey;
dkey = GNUNET_CRYPTO_ecc_key_derive (key,
label,
"gns");
- GNUNET_CRYPTO_ecc_key_get_public (dkey,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (dkey,
&block->derived_key);
- GNUNET_CRYPTO_ecc_key_get_public (key,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key,
&pkey);
derive_block_aes_key (&iv, &skey, label, &pkey);
GNUNET_break (payload_len + sizeof (uint32_t) ==
*/
int
GNUNET_NAMESTORE_block_decrypt (const struct GNUNET_NAMESTORE_Block *block,
- const struct GNUNET_CRYPTO_EccPublicKey *zone_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey))
+ if (data_size != sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))
return NULL;
return GNUNET_CRYPTO_ecc_public_key_to_string (data);
case GNUNET_NAMESTORE_TYPE_PSEU:
{
struct in_addr value_a;
struct in6_addr value_aaaa;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_TUN_DnsSoaRecord *soa;
struct GNUNET_TUN_GnsVpnRecord *vpn;
struct GNUNET_TUN_DnsTlsaRecord *tlsa;
return GNUNET_OK;
case GNUNET_NAMESTORE_TYPE_PKEY:
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (s, strlen (s), &pkey))
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (s, strlen (s), &pkey))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_("Unable to parse PKEY record `%s'\n"),
s);
return GNUNET_SYSERR;
}
- *data = GNUNET_new (struct GNUNET_CRYPTO_EccPublicKey);
+ *data = GNUNET_new (struct GNUNET_CRYPTO_EccPublicSignKey);
memcpy (*data, &pkey, sizeof (pkey));
- *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicKey);
+ *data_size = sizeof (struct GNUNET_CRYPTO_EccPublicSignKey);
return GNUNET_OK;
case GNUNET_NAMESTORE_TYPE_PSEU:
*data = GNUNET_strdup (s);
const char *label,
struct GNUNET_HashCode *query)
{
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
- GNUNET_CRYPTO_ecc_key_get_public (zone, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (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_EccPublicKey *pub,
+GNUNET_NAMESTORE_query_from_public_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const char *label,
struct GNUNET_HashCode *query)
{
- struct GNUNET_CRYPTO_EccPublicKey pd;
+ struct GNUNET_CRYPTO_EccPublicSignKey pd;
GNUNET_CRYPTO_ecc_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_EccPublicKey *pkey)
+GNUNET_NAMESTORE_pkey_to_zkey (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey)
{
static char ret[128];
char *pkeys;
*/
int
GNUNET_NAMESTORE_zkey_to_pkey (const char *zkey,
- struct GNUNET_CRYPTO_EccPublicKey *pkey)
+ struct GNUNET_CRYPTO_EccPublicSignKey *pkey)
{
char *cpy;
char *dot;
goto error;
if (GNUNET_OK !=
- GNUNET_CRYPTO_ecc_public_key_from_string (x,
+ GNUNET_CRYPTO_ecc_public_sign_key_from_string (x,
strlen (x),
pkey))
goto error;
*/
static int
namestore_postgres_put_records (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *zone_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key,
struct GNUNET_TIME_Absolute expire,
const char *name,
unsigned int rd_count,
unsigned int i;
GNUNET_CRYPTO_short_hash (zone_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&zone);
(void) namestore_postgres_remove_records (plugin, &zone, name);
name_len = strlen (name);
(const char *) &rvalue_be
};
int paramLengths[] = {
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
name_len,
sizeof (uint32_t),
data_size,
{
unsigned int record_count;
size_t data_size;
- /* const struct GNUNET_CRYPTO_EccPublicKey *zone_key; */
+ /* const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key; */
const struct GNUNET_CRYPTO_EccPrivateKey *zone_key;
/* const struct GNUNET_CRYPTO_EccSignature *sig; */
/* struct GNUNET_TIME_Absolute expiration; */
}
GNUNET_assert (1 == cnt);
if ((6 != PQnfields (res)) ||
- (sizeof (struct GNUNET_CRYPTO_EccPublicKey) != PQgetlength (res, 0, 0)) ||
+ (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) != PQgetlength (res, 0, 0)) ||
(sizeof (uint32_t) != PQfsize (res, 2)) ||
(sizeof (uint64_t) != PQfsize (res, 4)) ||
(sizeof (struct GNUNET_CRYPTO_EccSignature) != PQgetlength (res, 0, 5)))
return GNUNET_SYSERR;
}
zone_key = (const struct GNUNET_CRYPTO_EccPrivateKey *) PQgetvalue (res, 0, 0);
- /* zone_key = (const struct GNUNET_CRYPTO_EccPublicKey *) PQgetvalue (res, 0, 0); */
+ /* zone_key = (const struct GNUNET_CRYPTO_EccPublicSignKey *) PQgetvalue (res, 0, 0); */
name = PQgetvalue (res, 0, 1);
name_len = PQgetlength (res, 0, 1);
record_count = ntohl (*(uint32_t *) PQgetvalue (res, 0, 2));
static int
namestore_postgres_zone_to_name (void *cls,
const struct GNUNET_CRYPTO_EccPrivateKey *zone,
- const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
{
#if 0
namestore_sqlite_expire_blocks (plugin);
GNUNET_CRYPTO_hash (&block->derived_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&query);
expiration = GNUNET_TIME_absolute_ntoh (block->expiration_time);
block_size = ntohl (block->purpose.size) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (struct GNUNET_CRYPTO_EccSignature);
if (block_size > 64 * 65536)
{
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_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (struct GNUNET_CRYPTO_EccSignature) != block_size) )
{
GNUNET_break (0);
for (i=0;i<rd_count;i++)
if (GNUNET_NAMESTORE_TYPE_PKEY == rd[i].record_type)
{
- GNUNET_break (sizeof (struct GNUNET_CRYPTO_EccPublicKey) == rd[i].data_size);
+ GNUNET_break (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) == rd[i].data_size);
GNUNET_CRYPTO_hash (rd[i].data,
rd[i].data_size,
&pkey_hash);
static int
namestore_sqlite_zone_to_name (void *cls,
const struct GNUNET_CRYPTO_EccPrivateKey *zone,
- const struct GNUNET_CRYPTO_EccPublicKey *value_zone,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *value_zone,
GNUNET_NAMESTORE_RecordIterator iter, void *iter_cls)
{
struct Plugin *plugin = cls;
zone, sizeof (struct GNUNET_CRYPTO_EccPrivateKey),
SQLITE_STATIC)) ||
(SQLITE_OK != sqlite3_bind_blob (stmt, 2,
- value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ value_zone, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
SQLITE_STATIC)) )
{
LOG_SQLITE (plugin, GNUNET_ERROR_TYPE_ERROR | GNUNET_ERROR_TYPE_BULK,
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_NAMESTORE_Block *block;
- struct GNUNET_CRYPTO_EccPublicKey pubkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
/* load privat key */
char *hostkey_file;
GNUNET_assert (privkey != NULL);
struct GNUNET_TIME_Absolute expire = GNUNET_TIME_absolute_get();
/* get public key */
- GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature(privkey, &pubkey);
/* create record */
s_name = "DUMMY.dummy.gnunet";
static struct GNUNET_CRYPTO_EccPrivateKey * privkey;
-static struct GNUNET_CRYPTO_EccPublicKey pubkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
static struct GNUNET_NAMESTORE_RecordData *s_rd;
GNUNET_assert (privkey != NULL);
GNUNET_free (hostkey_file);
/* get public key */
- GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature(privkey, &pubkey);
nsh = GNUNET_NAMESTORE_connect (cfg);
GNUNET_break (NULL != nsh);
/* create record */
static struct GNUNET_CRYPTO_EccPrivateKey *privkey;
-static struct GNUNET_CRYPTO_EccPublicKey pubkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
static struct GNUNET_HashCode derived_hash;
privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file);
GNUNET_free (hostkey_file);
GNUNET_assert (privkey != NULL);
- GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey);
removed = GNUNET_NO;
static struct GNUNET_CRYPTO_EccPrivateKey *privkey;
-static struct GNUNET_CRYPTO_EccPublicKey pubkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
static int res;
privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file);
GNUNET_free (hostkey_file);
GNUNET_assert (privkey != NULL);
- GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey);
nsh = GNUNET_NAMESTORE_connect (cfg);
GNUNET_break (NULL != nsh);
static struct GNUNET_CRYPTO_EccPrivateKey *privkey;
-static struct GNUNET_CRYPTO_EccPublicKey pubkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
static int res;
privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file);
GNUNET_free (hostkey_file);
GNUNET_assert (privkey != NULL);
- GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey);
rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
static struct GNUNET_CRYPTO_EccPrivateKey *privkey;
-static struct GNUNET_CRYPTO_EccPublicKey pubkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
static int res;
privkey = GNUNET_CRYPTO_ecc_key_create_from_file (hostkey_file);
GNUNET_free (hostkey_file);
GNUNET_assert (privkey != NULL);
- GNUNET_CRYPTO_ecc_key_get_public (privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (privkey, &pubkey);
rd.expiration_time = GNUNET_TIME_absolute_get().abs_value_us;
static struct GNUNET_CRYPTO_EccPrivateKey * privkey;
-static struct GNUNET_CRYPTO_EccPublicKey pubkey;
+static struct GNUNET_CRYPTO_EccPublicSignKey pubkey;
static struct GNUNET_TIME_Absolute expire;
static void
zone_to_name_proc (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *zone_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *zone_key,
struct GNUNET_TIME_Absolute expire,
const char *n,
unsigned int rd_count,
fail = GNUNET_YES;
GNUNET_break (0);
}
- if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKey))))
+ if ((zone_key == NULL) || (0 != memcmp (zone_key, &pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey))))
{
fail = GNUNET_YES;
GNUNET_break (0);
GNUNET_free (hostkey_file);
GNUNET_assert (privkey != NULL);
/* get public key */
- GNUNET_CRYPTO_ecc_key_get_public(privkey, &pubkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature(privkey, &pubkey);
/* zone hash */
- GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicKey), &s_zone);
+ GNUNET_CRYPTO_short_hash (&pubkey, sizeof (struct GNUNET_CRYPTO_EccPublicSignKey), &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));
/**
* Public key of the originator.
*/
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
/**
* Proof of work, causing leading zeros when hashed with pkey.
/**
* The public key of this peer.
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
/**
* The private key of this peer.
* @return GNUNET_YES if valid, GNUNET_NO if not
*/
static int
-check_proof_of_work (const struct GNUNET_CRYPTO_EccPublicKey *pkey,
+check_proof_of_work (const struct GNUNET_CRYPTO_EccPublicSignKey *pkey,
uint64_t val)
{
- char buf[sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
+ char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (val)] GNUNET_ALIGN;
struct GNUNET_HashCode result;
memcpy (buf, &val, sizeof (val));
memcpy (&buf[sizeof (val)], pkey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
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_EccPublicKey) +
+ char buf[sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (uint64_t)] GNUNET_ALIGN;
struct GNUNET_HashCode result;
unsigned int i;
proof_task = GNUNET_SCHEDULER_NO_TASK;
memcpy (&buf[sizeof (uint64_t)], &my_public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey));
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey));
i = 0;
counter = my_proof;
while ((counter != UINT64_MAX) && (i < ROUND_SIZE))
struct GNUNET_PeerIdentity os;
GNUNET_CRYPTO_hash (&incoming_flood->pkey,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&os.hashPubKey);
GNUNET_snprintf (origin, sizeof (origin), "%s", GNUNET_i2s (&os));
GNUNET_snprintf (pred, sizeof (pred), "%s", GNUNET_i2s (peer));
GNUNET_free (keyfile);
GNUNET_assert (NULL != pk);
my_private_key = pk;
- GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&my_identity.hashPubKey);
if (GNUNET_OK !=
/**
* My public key.
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
/**
* Head of list of print contexts.
return;
}
GNUNET_free (fn);
- GNUNET_CRYPTO_ecc_key_get_public (priv, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &my_public_key);
GNUNET_free (priv);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), &my_peer_identity.hashPubKey);
}
{
struct GNUNET_HELLO_Message * res;
struct GNUNET_HELLO_Message * tmp;
- struct GNUNET_CRYPTO_EccPublicKey pk;
+ struct GNUNET_CRYPTO_EccPublicSignKey pk;
if (NULL != friend_hello)
{
static void
add_peer (size_t i)
{
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_HELLO_Message *h2;
memset (&pkey, i, sizeof (pkey));
static void
add_peer ()
{
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_HELLO_Message *h2;
size_t agc;
static void
add_peer ()
{
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_HELLO_Message *h2;
size_t agc;
static void
add_peer ()
{
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
struct GNUNET_HELLO_Message *h2;
size_t agc;
static int
channel_key_store (struct Plugin *plugin,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key)
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
{
sqlite3_stmt *stmt = plugin->insert_channel_key;
static int
slave_key_store (struct Plugin *plugin,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key)
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key)
{
sqlite3_stmt *stmt = plugin->insert_slave_key;
*/
static int
membership_store (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
int did_join,
uint64_t announced_at,
uint64_t effective_since,
*/
static int
membership_test (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
uint64_t message_id)
{
struct Plugin *plugin = cls;
*/
static int
fragment_store (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const struct GNUNET_MULTICAST_MessageHeader *msg,
uint32_t psycstore_flags)
{
*/
static int
message_add_flags (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
uint64_t psycstore_flags)
{
static int
fragment_get (void *cls,
const struct
- GNUNET_CRYPTO_EccPublicKey *channel_key,
+ GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t fragment_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls)
*/
static int
message_get (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
GNUNET_PSYCSTORE_FragmentCallback cb,
void *cb_cls)
*/
static int
message_get_fragment (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t message_id,
uint64_t fragment_offset,
GNUNET_PSYCSTORE_FragmentCallback cb,
*/
static int
counters_get_master (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t *fragment_id,
uint64_t *message_id,
uint64_t *group_generation)
*/
static int
counters_get_slave (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
uint64_t *max_state_msg_id)
{
struct Plugin *plugin = cls;
*/
static int
state_set (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name, const void *value, size_t value_size)
{
struct Plugin *plugin = cls;
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicKey *channel_key)
+state_reset (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
{
struct Plugin *plugin = cls;
sqlite3_stmt *stmt = plugin->delete_state;
*/
static int
state_update_signed (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key)
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key)
{
struct Plugin *plugin = cls;
sqlite3_stmt *stmt = plugin->update_state_signed;
* @return #GNUNET_OK on success, else #GNUNET_SYSERR
*/
static int
-state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+state_get (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *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_all (void *cls, const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+state_get_all (void *cls, const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
const char *name, GNUNET_PSYCSTORE_StateCallback cb,
void *cb_cls)
{
*/
static int
state_get_signed (void *cls,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
GNUNET_PSYCSTORE_StateCallback cb, void *cb_cls)
{
struct Plugin *plugin = cls;
*/
struct MembershipStoreMessage
{
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key;
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key;
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key;
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key;
int did_join;
uint64_t announced_at;
uint64_t effective_since;
*/
struct MembershipTestMessage
{
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key;
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key;
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key;
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key;
uint64_t message_id;
uint64_t group_generation;
};
struct GNUNET_PSYCSTORE_OperationHandle *
GNUNET_PSYCSTORE_membership_store (
struct GNUNET_PSYCSTORE_Handle *h,
- const struct GNUNET_CRYPTO_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_EccPublicKey *channel_key,
- const struct GNUNET_CRYPTO_EccPublicKey *slave_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *channel_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *slave_key,
uint64_t message_id,
uint64_t group_generation,
GNUNET_PSYCSTORE_ResultCallback rcb,
static struct GNUNET_CRYPTO_EccPrivateKey *channel_key;
static struct GNUNET_CRYPTO_EccPrivateKey *slave_key;
-static struct GNUNET_CRYPTO_EccPublicKey channel_pub_key;
-static struct GNUNET_CRYPTO_EccPublicKey slave_pub_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey channel_pub_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey 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 (channel_key, &channel_pub_key);
- GNUNET_CRYPTO_ecc_key_get_public (slave_key, &slave_pub_key);
+ 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);
ASSERT (GNUNET_OK == db->membership_store(db->cls, &channel_pub_key,
&slave_pub_key, GNUNET_YES,
static struct GNUNET_CRYPTO_EccPrivateKey *channel_key;
static struct GNUNET_CRYPTO_EccPrivateKey *slave_key;
-static struct GNUNET_CRYPTO_EccPublicKey channel_pub_key;
-static struct GNUNET_CRYPTO_EccPublicKey slave_pub_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey channel_pub_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey slave_pub_key;
/**
* Clean up all resources used.
channel_key = GNUNET_CRYPTO_ecc_key_create ();
slave_key = GNUNET_CRYPTO_ecc_key_create ();
- GNUNET_CRYPTO_ecc_key_get_public (channel_key, &channel_pub_key);
- GNUNET_CRYPTO_ecc_key_get_public (slave_key, &slave_pub_key);
+ 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);
op = GNUNET_PSYCSTORE_membership_store (h, &channel_pub_key, &slave_pub_key,
GNUNET_YES, 2, 2, 1,
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 (h->priv,
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (h->priv,
&ab.public_key);
GNUNET_assert (GNUNET_OK ==
GNUNET_CRYPTO_ecc_sign (h->priv,
"# regex accepting block bytes found",
size, GNUNET_NO);
GNUNET_CRYPTO_hash (&block->public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&pid.hashPubKey);
info->callback (info->callback_cls,
&pid,
struct GNUNET_PeerIdentity *id)
{
struct GNUNET_CRYPTO_EccPrivateKey *private_key;
- struct GNUNET_CRYPTO_EccPublicKey public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey public_key;
if ((NULL == id) || (NULL == system->hostkeys_data))
return NULL;
_("Error while decoding key %u\n"), key_number);
return NULL;
}
- GNUNET_CRYPTO_ecc_key_get_public (private_key, &public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (private_key, &public_key);
GNUNET_CRYPTO_hash (&public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&(id->hashPubKey));
return private_key;
}
/**
* Our public key.
*/
-struct GNUNET_CRYPTO_EccPublicKey GST_my_public_key;
+struct GNUNET_CRYPTO_EccPublicSignKey GST_my_public_key;
/**
* Our private key.
GST_stats = GNUNET_STATISTICS_create ("transport", GST_cfg);
GST_peerinfo = GNUNET_PEERINFO_connect (GST_cfg);
- GNUNET_CRYPTO_ecc_key_get_public (GST_my_private_key, &GST_my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (GST_my_private_key, &GST_my_public_key);
GNUNET_CRYPTO_hash (&GST_my_public_key, sizeof (GST_my_public_key),
&GST_my_identity.hashPubKey);
GNUNET_assert (NULL != GST_my_private_key);
/**
* Our public key.
*/
-extern struct GNUNET_CRYPTO_EccPublicKey GST_my_public_key;
+extern struct GNUNET_CRYPTO_EccPublicSignKey GST_my_public_key;
/**
* Our private key.
/**
* Public key of the sender.
*/
- struct GNUNET_CRYPTO_EccPublicKey public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey public_key;
/**
* Signature of the peer that sends us the disconnect. Only
disconnect_msg.reserved = htonl (0);
disconnect_msg.purpose.size =
htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (struct GNUNET_TIME_AbsoluteNBO));
disconnect_msg.purpose.purpose =
htonl (GNUNET_MESSAGE_TYPE_TRANSPORT_SESSION_DISCONNECT);
return;
}
GNUNET_CRYPTO_hash (&sdm->public_key,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
&hc);
if (0 != memcmp (peer, &hc, sizeof (struct GNUNET_PeerIdentity)))
{
}
if (ntohl (sdm->purpose.size) !=
sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose) +
- sizeof (struct GNUNET_CRYPTO_EccPublicKey) +
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey) +
sizeof (struct GNUNET_TIME_AbsoluteNBO))
{
GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
/**
* Public key of the peer.
*/
- struct GNUNET_CRYPTO_EccPublicKey public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey public_key;
/**
* The identity of the peer. FIXME: duplicated (also in 'address')
* if we don't have an existing entry and no public key was given
*/
static struct ValidationEntry *
-find_validation_entry (const struct GNUNET_CRYPTO_EccPublicKey *public_key,
+find_validation_entry (const struct GNUNET_CRYPTO_EccPublicSignKey *public_key,
const struct GNUNET_HELLO_Address *address)
{
struct ValidationEntryMatchContext vemc;
struct ValidationEntry *ve;
struct GNUNET_PeerIdentity pid;
struct GNUNET_ATS_Information ats;
- struct GNUNET_CRYPTO_EccPublicKey public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey 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_EccPublicKey *public_key,
+ const struct GNUNET_CRYPTO_EccPublicSignKey *public_key,
struct GNUNET_TIME_Absolute valid_until,
struct GNUNET_TIME_Absolute validation_block,
const struct GNUNET_HELLO_Address *address)
/**
* Public key of the peer whose address is being validated.
*/
- struct GNUNET_CRYPTO_EccPublicKey public_key;
+ struct GNUNET_CRYPTO_EccPublicSignKey public_key;
};
*/
typedef void (*GST_ValidationAddressCallback) (void *cls,
const struct
- GNUNET_CRYPTO_EccPublicKey *public_key,
+ GNUNET_CRYPTO_EccPublicSignKey *public_key,
struct GNUNET_TIME_Absolute
valid_until,
struct GNUNET_TIME_Absolute
/**
* Our public key.
*/
-static struct GNUNET_CRYPTO_EccPublicKey my_public_key;
+static struct GNUNET_CRYPTO_EccPublicSignKey my_public_key;
/**
* Our identity.
end_badly_now ();
return;
}
- GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (my_private_key, &my_public_key);
GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key),
&my_identity.hashPubKey);
* structs that use 256 bits, so using a bigger curve will require
* changes that break stuff badly. The name of the curve given here
* must be agreed by all peers and be supported by libgcrypt.
+ *
+ * NOTE: this will change to Curve25519 before GNUnet 0.10.0.
*/
#define CURVE "NIST P-256"
/**
- * If target != size, move target bytes to the end of the size-sized
- * buffer and zero out the first target-size bytes.
+ * If target != size, move @a target bytes to the end of the size-sized
+ * buffer and zero out the first @a target - @a size bytes.
*
* @param buf original buffer
- * @param size number of bytes in the buffer
+ * @param size number of bytes in @a buf
* @param target target size of the buffer
*/
static void
* Output the given MPI value to the given buffer.
*
* @param buf where to output to
- * @param size number of bytes in buf
- * @param val value to write to buf
+ * @param size number of bytes in @a buf
+ * @param val value to write to @a buf
*/
static void
mpi_print (unsigned char *buf,
static void
point_to_public_key (gcry_mpi_point_t q,
gcry_ctx_t ctx,
- struct GNUNET_CRYPTO_EccPublicKey *pub)
+ struct GNUNET_CRYPTO_EccPublicSignKey *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 (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
- struct GNUNET_CRYPTO_EccPublicKey *pub)
+GNUNET_CRYPTO_ecc_key_get_public_for_signature (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
+ struct GNUNET_CRYPTO_EccPublicSignKey *pub)
{
gcry_sexp_t sexp;
gcry_ctx_t ctx;
* Convert a public key to a string.
*
* @param pub key to convert
- * @return string representing 'pub'
+ * @return string representing @a pub
*/
char *
-GNUNET_CRYPTO_ecc_public_key_to_string (const struct GNUNET_CRYPTO_EccPublicKey *pub)
+GNUNET_CRYPTO_ecc_public_key_to_string (const struct GNUNET_CRYPTO_EccPublicSignKey *pub)
{
char *pubkeybuf;
- size_t keylen = (sizeof (struct GNUNET_CRYPTO_EccPublicKey)) * 8;
+ size_t keylen = (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) * 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_EccPublicKey),
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey),
pubkeybuf,
keylen);
if (NULL == end)
* Convert a string representing a public key to a public key.
*
* @param enc encoded public key
- * @param enclen number of bytes in enc (without 0-terminator)
+ * @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_ecc_public_key_from_string (const char *enc,
+GNUNET_CRYPTO_ecc_public_sign_key_from_string (const char *enc,
size_t enclen,
- struct GNUNET_CRYPTO_EccPublicKey *pub)
+ struct GNUNET_CRYPTO_EccPublicSignKey *pub)
{
- size_t keylen = (sizeof (struct GNUNET_CRYPTO_EccPublicKey)) * 8;
+ size_t keylen = (sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)) * 8;
if (keylen % 5 > 0)
keylen += 5 - keylen % 5;
if (GNUNET_OK != GNUNET_STRINGS_string_to_data (enc, enclen,
pub,
- sizeof (struct GNUNET_CRYPTO_EccPublicKey)))
+ sizeof (struct GNUNET_CRYPTO_EccPublicSignKey)))
return GNUNET_SYSERR;
return GNUNET_OK;
}
* @return NULL on error
*/
static gcry_sexp_t
-decode_public_key (const struct GNUNET_CRYPTO_EccPublicKey *pub)
+decode_public_sign_key (const struct GNUNET_CRYPTO_EccPublicSignKey *pub)
{
gcry_sexp_t pub_sexp;
gcry_mpi_t q_x;
* Create a new private key by reading our peer's key from
* the file specified in the configuration.
*
+ * @param cfg the configuration to use
* @return new private key, NULL on error (for example,
* permission denied)
*/
*
* @param cfg configuration to use
* @param dst pointer to where to write the peer identity
- * @return GNUNET_OK on success, GNUNET_SYSERR if the identity
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if the identity
* could not be retrieved
*/
int
struct GNUNET_PeerIdentity *dst)
{
struct GNUNET_CRYPTO_EccPrivateKey *priv;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
if (NULL == (priv = GNUNET_CRYPTO_ecc_key_create_from_configuration (cfg)))
{
_("Could not load peer's private key\n"));
return GNUNET_SYSERR;
}
- GNUNET_CRYPTO_ecc_key_get_public (priv, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &pub);
GNUNET_free (priv);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &dst->hashPubKey);
return GNUNET_OK;
* @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
+ * @return #GNUNET_SYSERR on error, #GNUNET_OK on success
*/
int
GNUNET_CRYPTO_ecc_sign (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
* @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
+ * @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_EccPublicKey *pub)
+ const struct GNUNET_CRYPTO_EccPublicSignKey *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_key (pub)))
+ if (! (pub_sexpr = decode_public_sign_key (pub)))
{
gcry_sexp_release (data);
gcry_sexp_release (sig_sexpr);
}
+/**
+ * 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_encrypt_key (const struct GNUNET_CRYPTO_EccPublicEncryptKey *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));
+ 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;
+}
+
+
/**
* Derive key material from a public and a private ECC key.
*
*/
int
GNUNET_CRYPTO_ecc_ecdh (const struct GNUNET_CRYPTO_EccPrivateKey *priv,
- const struct GNUNET_CRYPTO_EccPublicKey *pub,
+ const struct GNUNET_CRYPTO_EccPublicEncryptKey *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_key (pub)))
+ if (! (pub_sexpr = decode_public_encrypt_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_EccPublicKey *pub,
+derive_h (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const char *label,
const char *context)
{
const char *label,
const char *context)
{
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_CRYPTO_EccPrivateKey *ret;
gcry_mpi_t h;
gcry_mpi_t x;
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 (priv, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv, &pub);
h = derive_h (&pub, label, context);
mpi_scan (&x, priv->d, sizeof (priv->d));
d = gcry_mpi_new (256);
* @param result where to write the derived public key
*/
void
-GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicKey *pub,
+GNUNET_CRYPTO_ecc_public_key_derive (const struct GNUNET_CRYPTO_EccPublicSignKey *pub,
const char *label,
const char *context,
- struct GNUNET_CRYPTO_EccPublicKey *result)
+ struct GNUNET_CRYPTO_EccPublicSignKey *result)
{
gcry_ctx_t ctx;
gcry_mpi_t h;
const struct GNUNET_CONFIGURATION_Handle *cfg)
{
struct GNUNET_CRYPTO_EccPrivateKey *pk;
- struct GNUNET_CRYPTO_EccPublicKey pub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub;
struct GNUNET_PeerIdentity pid;
if (NULL == args[0])
{
char *s;
- GNUNET_CRYPTO_ecc_key_get_public (pk, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub);
s = GNUNET_CRYPTO_ecc_public_key_to_string (&pub);
fprintf (stdout, "%s\n", s);
GNUNET_free (s);
{
struct GNUNET_CRYPTO_HashAsciiEncoded enc;
- GNUNET_CRYPTO_ecc_key_get_public (pk, &pub);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (pk, &pub);
GNUNET_CRYPTO_hash (&pub, sizeof (pub), &pid.hashPubKey);
GNUNET_CRYPTO_hash_to_enc (&pid.hashPubKey, &enc);
fprintf (stdout, "%s\n", enc.encoding);
{
struct GNUNET_CRYPTO_EccSignature sig;
struct GNUNET_CRYPTO_EccSignaturePurpose purp;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
int i;
struct GNUNET_TIME_Absolute start;
int ok = GNUNET_OK;
FPRINTF (stderr, "%s", "W");
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
start = GNUNET_TIME_absolute_get ();
purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
struct GNUNET_CRYPTO_EccSignature sig;
struct GNUNET_CRYPTO_EccSignaturePurpose purp;
struct GNUNET_CRYPTO_EccPrivateKey *dpriv;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
- struct GNUNET_CRYPTO_EccPublicKey dpub;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey dpub;
dpriv = GNUNET_CRYPTO_ecc_key_derive (key, "test-derive", "test-CTX");
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
GNUNET_CRYPTO_ecc_public_key_derive (&pkey, "test-derive", "test-CTX", &dpub);
purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
{
struct GNUNET_CRYPTO_EccSignaturePurpose purp;
struct GNUNET_CRYPTO_EccSignature sig;
- struct GNUNET_CRYPTO_EccPublicKey pkey;
+ struct GNUNET_CRYPTO_EccPublicSignKey pkey;
int i;
struct GNUNET_TIME_Absolute start;
int ok = GNUNET_OK;
purp.size = htonl (sizeof (struct GNUNET_CRYPTO_EccSignaturePurpose));
purp.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_TEST);
FPRINTF (stderr, "%s", "W");
- GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &pkey);
start = GNUNET_TIME_absolute_get ();
for (i = 0; i < ITER; i++)
{
static int
testCreateFromFile ()
{
- struct GNUNET_CRYPTO_EccPublicKey p1;
- struct GNUNET_CRYPTO_EccPublicKey p2;
+ struct GNUNET_CRYPTO_EccPublicSignKey p1;
+ struct GNUNET_CRYPTO_EccPublicSignKey p2;
key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE);
GNUNET_assert (NULL != key);
- GNUNET_CRYPTO_ecc_key_get_public (key, &p1);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &p1);
GNUNET_free (key);
key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE);
GNUNET_assert (NULL != key);
- GNUNET_CRYPTO_ecc_key_get_public (key, &p2);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &p2);
GNUNET_assert (0 == memcmp (&p1, &p2, sizeof (p1)));
GNUNET_free (key);
GNUNET_assert (0 == UNLINK (KEYFILE));
key = GNUNET_CRYPTO_ecc_key_create_from_file (KEYFILE);
GNUNET_assert (NULL != key);
- GNUNET_CRYPTO_ecc_key_get_public (key, &p2);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (key, &p2);
GNUNET_assert (0 != memcmp (&p1, &p2, sizeof (p1)));
GNUNET_free (key);
return GNUNET_OK;
{
struct GNUNET_CRYPTO_EccPrivateKey *priv1;
struct GNUNET_CRYPTO_EccPrivateKey *priv2;
- struct GNUNET_CRYPTO_EccPublicKey pub1;
- struct GNUNET_CRYPTO_EccPublicKey pub2;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub1;
+ struct GNUNET_CRYPTO_EccPublicSignKey pub2;
struct GNUNET_HashCode ecdh1;
struct GNUNET_HashCode ecdh2;
priv1 = GNUNET_CRYPTO_ecc_key_create ();
priv2 = GNUNET_CRYPTO_ecc_key_create ();
- GNUNET_CRYPTO_ecc_key_get_public (priv1, &pub1);
- GNUNET_CRYPTO_ecc_key_get_public (priv2, &pub2);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv1, &pub1);
+ GNUNET_CRYPTO_ecc_key_get_public_for_signature (priv2, &pub2);
GNUNET_CRYPTO_ecc_ecdh (priv1, &pub2, &ecdh1);
GNUNET_CRYPTO_ecc_ecdh (priv2, &pub1, &ecdh2);
GNUNET_assert (0 == memcmp (&ecdh1, &ecdh2,