[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r24363 - in gnunet/src: gns include pt util
From: |
gnunet |
Subject: |
[GNUnet-SVN] r24363 - in gnunet/src: gns include pt util |
Date: |
Wed, 17 Oct 2012 17:23:57 +0200 |
Author: grothoff
Date: 2012-10-17 17:23:57 +0200 (Wed, 17 Oct 2012)
New Revision: 24363
Modified:
gnunet/src/gns/test_gns_proxy.c
gnunet/src/include/gnunet_crypto_lib.h
gnunet/src/pt/test_gns_vpn.c
gnunet/src/pt/test_gnunet_vpn.c
gnunet/src/util/crypto_rsa.c
Log:
-more rsa refactoring
Modified: gnunet/src/gns/test_gns_proxy.c
===================================================================
--- gnunet/src/gns/test_gns_proxy.c 2012-10-17 15:16:10 UTC (rev 24362)
+++ gnunet/src/gns/test_gns_proxy.c 2012-10-17 15:23:57 UTC (rev 24363)
@@ -457,7 +457,7 @@
return 0;
}
- GNUNET_CRYPTO_setup_hostkey ("test_gns_proxy.conf");
+ GNUNET_CRYPTO_rsa_setup_hostkey ("test_gns_proxy.conf");
if (0 != curl_global_init (CURL_GLOBAL_WIN32))
{
Modified: gnunet/src/include/gnunet_crypto_lib.h
===================================================================
--- gnunet/src/include/gnunet_crypto_lib.h 2012-10-17 15:16:10 UTC (rev
24362)
+++ gnunet/src/include/gnunet_crypto_lib.h 2012-10-17 15:23:57 UTC (rev
24363)
@@ -887,6 +887,7 @@
*
* @param buf the buffer where the private key data is stored
* @param len the length of the data in 'buffer'
+ * @return NULL on error
*/
struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len);
@@ -964,7 +965,7 @@
* @param cfg_name name of the configuration file to use
*/
void
-GNUNET_CRYPTO_setup_hostkey (const char *cfg_name);
+GNUNET_CRYPTO_rsa_setup_hostkey (const char *cfg_name);
/**
@@ -975,15 +976,16 @@
* @return some private key purely dependent on input
*/
struct GNUNET_CRYPTO_RsaPrivateKey *
-GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode * hc);
+GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode *hc);
/**
* Free memory occupied by the private key.
- * @param hostkey pointer to the memory to free
+ *
+ * @param key pointer to the memory to free
*/
void
-GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey);
+GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key);
/**
Modified: gnunet/src/pt/test_gns_vpn.c
===================================================================
--- gnunet/src/pt/test_gns_vpn.c 2012-10-17 15:16:10 UTC (rev 24362)
+++ gnunet/src/pt/test_gns_vpn.c 2012-10-17 15:23:57 UTC (rev 24363)
@@ -573,7 +573,7 @@
"Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is
problematic) or permissions (run 'make install' as root) to fix this!\n");
return 0;
}
- GNUNET_CRYPTO_setup_hostkey ("test_gns_vpn.conf");
+ GNUNET_CRYPTO_rsa_setup_hostkey ("test_gns_vpn.conf");
dest_ip = "169.254.86.1";
dest_af = AF_INET;
Modified: gnunet/src/pt/test_gnunet_vpn.c
===================================================================
--- gnunet/src/pt/test_gnunet_vpn.c 2012-10-17 15:16:10 UTC (rev 24362)
+++ gnunet/src/pt/test_gnunet_vpn.c 2012-10-17 15:23:57 UTC (rev 24363)
@@ -436,7 +436,7 @@
"Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is
problematic) or permissions (run 'make install' as root) to fix this!\n");
return 0;
}
- GNUNET_CRYPTO_setup_hostkey ("test_gnunet_vpn.conf");
+ GNUNET_CRYPTO_rsa_setup_hostkey ("test_gnunet_vpn.conf");
bin = argv[0];
if (NULL != strstr (bin, "lt-"))
bin = strstr (bin, "lt-") + 4;
Modified: gnunet/src/util/crypto_rsa.c
===================================================================
--- gnunet/src/util/crypto_rsa.c 2012-10-17 15:16:10 UTC (rev 24362)
+++ gnunet/src/util/crypto_rsa.c 2012-10-17 15:23:57 UTC (rev 24363)
@@ -407,6 +407,7 @@
*
* @param buf the buffer where the private key data is stored
* @param len the length of the data in 'buffer'
+ * @return NULL on error
*/
struct GNUNET_CRYPTO_RsaPrivateKey *
GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len)
@@ -423,8 +424,9 @@
gcry_mpi_t u;
int rc;
size_t size;
- int pos;
+ size_t pos;
uint16_t enc_len;
+ size_t erroff;
enc_len = ntohs (encoding->len);
if (len != enc_len)
@@ -530,7 +532,7 @@
if ((NULL != p) && (NULL != q) && (NULL != u))
{
- rc = gcry_sexp_build (&res, &size, /* erroff */
+ rc = gcry_sexp_build (&res, &erroff,
"(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)(u
%m)))",
n, e, d, p, q, u);
}
@@ -538,13 +540,13 @@
{
if ((NULL != p) && (NULL != q))
{
- rc = gcry_sexp_build (&res, &size, /* erroff */
+ rc = gcry_sexp_build (&res, &erroff,
"(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)))",
n, e, d, p, q);
}
else
{
- rc = gcry_sexp_build (&res, &size, /* erroff */
+ rc = gcry_sexp_build (&res, &erroff,
"(private-key(rsa(n %m)(e %m)(d %m)))", n, e, d);
}
}
@@ -561,7 +563,7 @@
if (0 != rc)
LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
#if EXTRA_CHECKS
- if (gcry_pk_testkey (res))
+ if (0 != (rc = gcry_pk_testkey (res)))
{
LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc);
return NULL;
@@ -1111,7 +1113,7 @@
* @param cfg_name name of the configuration file to use
*/
void
-GNUNET_CRYPTO_setup_hostkey (const char *cfg_name)
+GNUNET_CRYPTO_rsa_setup_hostkey (const char *cfg_name)
{
struct GNUNET_CONFIGURATION_Handle *cfg;
struct GNUNET_CRYPTO_RsaPrivateKey *pk;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r24363 - in gnunet/src: gns include pt util,
gnunet <=