/*
This file is part of GNUnet.
- (C) 2012 Christian Grothoff (and other contributing authors)
+ (C) 2012-2013 Christian Grothoff (and other contributing authors)
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
/**
* @author Martin Schanzenbach
* @file src/gns/gnunet-gns-proxy.c
- * @brief HTTP(S) proxy that rewrites URIs and fakes certificats to make GADS work
+ * @brief HTTP(S) proxy that rewrites URIs and fakes certificats to make GNS work
* with legacy browsers
*/
#include "platform.h"
#endif
/* Shorten zone private key */
-static struct GNUNET_CRYPTO_RsaPrivateKey *shorten_zonekey;
+static struct GNUNET_CRYPTO_EccPrivateKey *shorten_zonekey;
/**
}
-/**
- * convert integer to string representation
- *
- * @param i integer
- * @return the character
- */
-static char
-i_to_hexchar (unsigned char i)
-{
- static char hexmap[] = "0123456789abcdef";
-
- GNUNET_assert (sizeof (hexmap) > (i & 15));
- return hexmap[i & 15];
-}
-
-
static int
con_post_data_iter (void *cls,
enum MHD_ValueKind kind,
for (i=0; i<rd_count; i++)
{
- if (rd[i].record_type != GNUNET_GNS_RECORD_LEHO)
+ if (rd[i].record_type != GNUNET_NAMESTORE_TYPE_LEHO)
continue;
memcpy (ctask->leho, rd[i].data, rd[i].data_size);
GNUNET_GNS_lookup_zone (gns_handle,
ctask->host,
local_gns_zone,
- GNUNET_GNS_RECORD_LEHO,
+ GNUNET_NAMESTORE_TYPE_LEHO,
GNUNET_YES, //Only cached for performance
shorten_zonekey,
&process_leho_lookup,
haveto = MHD_get_timeout (hd->daemon, &timeout);
if (MHD_YES == haveto)
- tv.rel_value = (uint64_t) timeout;
+ tv.rel_value_us = (uint64_t) timeout * 1000LL;
else
tv = GNUNET_TIME_UNIT_FOREVER_REL;
GNUNET_NETWORK_fdset_copy_native (wrs, &rs, max + 1);
load_local_zone_key (const struct GNUNET_CONFIGURATION_Handle *cfg)
{
char *keyfile;
- struct GNUNET_CRYPTO_RsaPrivateKey *key;
- struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded pkey;
+ struct GNUNET_CRYPTO_EccPrivateKey *key;
+ struct GNUNET_CRYPTO_EccPublicKey pkey;
struct GNUNET_CRYPTO_ShortHashCode *zone;
struct GNUNET_CRYPTO_ShortHashAsciiEncoded zonename;
return GNUNET_NO;
}
- key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
- GNUNET_CRYPTO_rsa_key_get_public (key, &pkey);
+ key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
+ GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
local_gns_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode));
- GNUNET_CRYPTO_short_hash(&pkey,
- sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- local_gns_zone);
+ GNUNET_CRYPTO_short_hash (&pkey,
+ sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ local_gns_zone);
zone = local_gns_zone;
GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Using zone: %s!\n", &zonename);
- GNUNET_CRYPTO_rsa_key_free(key);
+ GNUNET_free(key);
GNUNET_free(keyfile);
keyfile = NULL;
}
else
{
- key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
- GNUNET_CRYPTO_rsa_key_get_public (key, &pkey);
+ key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
+ GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
local_private_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode));
- GNUNET_CRYPTO_short_hash(&pkey,
- sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- local_private_zone);
+ GNUNET_CRYPTO_short_hash (&pkey,
+ sizeof (struct GNUNET_CRYPTO_EccPublicKey),
+ local_private_zone);
GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Using private zone: %s!\n", &zonename);
- GNUNET_CRYPTO_rsa_key_free(key);
+ GNUNET_free(key);
GNUNET_free(keyfile);
}
keyfile = NULL;
}
else
{
- key = GNUNET_CRYPTO_rsa_key_create_from_file (keyfile);
- GNUNET_CRYPTO_rsa_key_get_public (key, &pkey);
+ key = GNUNET_CRYPTO_ecc_key_create_from_file (keyfile);
+ GNUNET_CRYPTO_ecc_key_get_public (key, &pkey);
local_shorten_zone = GNUNET_malloc (sizeof (struct GNUNET_CRYPTO_ShortHashCode));
- GNUNET_CRYPTO_short_hash(&pkey,
- sizeof(struct GNUNET_CRYPTO_RsaPublicKeyBinaryEncoded),
- local_shorten_zone);
+ GNUNET_CRYPTO_short_hash (&pkey,
+ sizeof(struct GNUNET_CRYPTO_EccPublicKey),
+ local_shorten_zone);
GNUNET_CRYPTO_short_hash_to_enc (zone, &zonename);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Using shorten zone: %s!\n", &zonename);
- GNUNET_CRYPTO_rsa_key_free(key);
+ GNUNET_free(key);
GNUNET_free(keyfile);
}
if ((NULL == lsock) ||
(GNUNET_OK !=
GNUNET_NETWORK_socket_bind (lsock, (const struct sockaddr *) &sa,
- sizeof (sa))))
+ sizeof (sa), 0)))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Failed to create listen socket bound to `%s'",
if (GNUNET_OK != GNUNET_NETWORK_socket_bind (mhd_unix_socket,
(struct sockaddr*)&mhd_unix_sock_addr,
- len))
+ len, 0))
{
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
"Unable to bind unix domain socket!\n");