aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/gns/test_gns_proxy.c2
-rw-r--r--src/include/gnunet_crypto_lib.h10
-rw-r--r--src/pt/test_gns_vpn.c2
-rw-r--r--src/pt/test_gnunet_vpn.c2
-rw-r--r--src/util/crypto_rsa.c14
5 files changed, 17 insertions, 13 deletions
diff --git a/src/gns/test_gns_proxy.c b/src/gns/test_gns_proxy.c
index 5e3d09d68..545551411 100644
--- a/src/gns/test_gns_proxy.c
+++ b/src/gns/test_gns_proxy.c
@@ -457,7 +457,7 @@ main (int argc, char *const *argv)
457 return 0; 457 return 0;
458 } 458 }
459 459
460 GNUNET_CRYPTO_setup_hostkey ("test_gns_proxy.conf"); 460 GNUNET_CRYPTO_rsa_setup_hostkey ("test_gns_proxy.conf");
461 461
462 if (0 != curl_global_init (CURL_GLOBAL_WIN32)) 462 if (0 != curl_global_init (CURL_GLOBAL_WIN32))
463 { 463 {
diff --git a/src/include/gnunet_crypto_lib.h b/src/include/gnunet_crypto_lib.h
index 57fcf8bc0..f73c1ae76 100644
--- a/src/include/gnunet_crypto_lib.h
+++ b/src/include/gnunet_crypto_lib.h
@@ -887,6 +887,7 @@ GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
887 * 887 *
888 * @param buf the buffer where the private key data is stored 888 * @param buf the buffer where the private key data is stored
889 * @param len the length of the data in 'buffer' 889 * @param len the length of the data in 'buffer'
890 * @return NULL on error
890 */ 891 */
891struct GNUNET_CRYPTO_RsaPrivateKey * 892struct GNUNET_CRYPTO_RsaPrivateKey *
892GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len); 893GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len);
@@ -964,7 +965,7 @@ GNUNET_CRYPTO_rsa_key_create_stop (struct GNUNET_CRYPTO_RsaKeyGenerationContext
964 * @param cfg_name name of the configuration file to use 965 * @param cfg_name name of the configuration file to use
965 */ 966 */
966void 967void
967GNUNET_CRYPTO_setup_hostkey (const char *cfg_name); 968GNUNET_CRYPTO_rsa_setup_hostkey (const char *cfg_name);
968 969
969 970
970/** 971/**
@@ -975,15 +976,16 @@ GNUNET_CRYPTO_setup_hostkey (const char *cfg_name);
975 * @return some private key purely dependent on input 976 * @return some private key purely dependent on input
976 */ 977 */
977struct GNUNET_CRYPTO_RsaPrivateKey * 978struct GNUNET_CRYPTO_RsaPrivateKey *
978GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode * hc); 979GNUNET_CRYPTO_rsa_key_create_from_hash (const struct GNUNET_HashCode *hc);
979 980
980 981
981/** 982/**
982 * Free memory occupied by the private key. 983 * Free memory occupied by the private key.
983 * @param hostkey pointer to the memory to free 984 *
985 * @param key pointer to the memory to free
984 */ 986 */
985void 987void
986GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *hostkey); 988GNUNET_CRYPTO_rsa_key_free (struct GNUNET_CRYPTO_RsaPrivateKey *key);
987 989
988 990
989/** 991/**
diff --git a/src/pt/test_gns_vpn.c b/src/pt/test_gns_vpn.c
index e67801298..7d2cd7ba4 100644
--- a/src/pt/test_gns_vpn.c
+++ b/src/pt/test_gns_vpn.c
@@ -573,7 +573,7 @@ main (int argc, char *const *argv)
573 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n"); 573 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
574 return 0; 574 return 0;
575 } 575 }
576 GNUNET_CRYPTO_setup_hostkey ("test_gns_vpn.conf"); 576 GNUNET_CRYPTO_rsa_setup_hostkey ("test_gns_vpn.conf");
577 577
578 dest_ip = "169.254.86.1"; 578 dest_ip = "169.254.86.1";
579 dest_af = AF_INET; 579 dest_af = AF_INET;
diff --git a/src/pt/test_gnunet_vpn.c b/src/pt/test_gnunet_vpn.c
index f40a363b7..72551e353 100644
--- a/src/pt/test_gnunet_vpn.c
+++ b/src/pt/test_gnunet_vpn.c
@@ -436,7 +436,7 @@ main (int argc, char *const *argv)
436 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n"); 436 "Change $PATH ('.' in $PATH before $GNUNET_PREFIX/bin is problematic) or permissions (run 'make install' as root) to fix this!\n");
437 return 0; 437 return 0;
438 } 438 }
439 GNUNET_CRYPTO_setup_hostkey ("test_gnunet_vpn.conf"); 439 GNUNET_CRYPTO_rsa_setup_hostkey ("test_gnunet_vpn.conf");
440 bin = argv[0]; 440 bin = argv[0];
441 if (NULL != strstr (bin, "lt-")) 441 if (NULL != strstr (bin, "lt-"))
442 bin = strstr (bin, "lt-") + 4; 442 bin = strstr (bin, "lt-") + 4;
diff --git a/src/util/crypto_rsa.c b/src/util/crypto_rsa.c
index 042af0893..949c0e430 100644
--- a/src/util/crypto_rsa.c
+++ b/src/util/crypto_rsa.c
@@ -407,6 +407,7 @@ GNUNET_CRYPTO_rsa_encode_key (const struct GNUNET_CRYPTO_RsaPrivateKey *hostkey)
407 * 407 *
408 * @param buf the buffer where the private key data is stored 408 * @param buf the buffer where the private key data is stored
409 * @param len the length of the data in 'buffer' 409 * @param len the length of the data in 'buffer'
410 * @return NULL on error
410 */ 411 */
411struct GNUNET_CRYPTO_RsaPrivateKey * 412struct GNUNET_CRYPTO_RsaPrivateKey *
412GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len) 413GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len)
@@ -423,8 +424,9 @@ GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len)
423 gcry_mpi_t u; 424 gcry_mpi_t u;
424 int rc; 425 int rc;
425 size_t size; 426 size_t size;
426 int pos; 427 size_t pos;
427 uint16_t enc_len; 428 uint16_t enc_len;
429 size_t erroff;
428 430
429 enc_len = ntohs (encoding->len); 431 enc_len = ntohs (encoding->len);
430 if (len != enc_len) 432 if (len != enc_len)
@@ -530,7 +532,7 @@ GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len)
530 532
531 if ((NULL != p) && (NULL != q) && (NULL != u)) 533 if ((NULL != p) && (NULL != q) && (NULL != u))
532 { 534 {
533 rc = gcry_sexp_build (&res, &size, /* erroff */ 535 rc = gcry_sexp_build (&res, &erroff,
534 "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)(u %m)))", 536 "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)(u %m)))",
535 n, e, d, p, q, u); 537 n, e, d, p, q, u);
536 } 538 }
@@ -538,13 +540,13 @@ GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len)
538 { 540 {
539 if ((NULL != p) && (NULL != q)) 541 if ((NULL != p) && (NULL != q))
540 { 542 {
541 rc = gcry_sexp_build (&res, &size, /* erroff */ 543 rc = gcry_sexp_build (&res, &erroff,
542 "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)))", 544 "(private-key(rsa(n %m)(e %m)(d %m)(p %m)(q %m)))",
543 n, e, d, p, q); 545 n, e, d, p, q);
544 } 546 }
545 else 547 else
546 { 548 {
547 rc = gcry_sexp_build (&res, &size, /* erroff */ 549 rc = gcry_sexp_build (&res, &erroff,
548 "(private-key(rsa(n %m)(e %m)(d %m)))", n, e, d); 550 "(private-key(rsa(n %m)(e %m)(d %m)))", n, e, d);
549 } 551 }
550 } 552 }
@@ -561,7 +563,7 @@ GNUNET_CRYPTO_rsa_decode_key (const char *buf, uint16_t len)
561 if (0 != rc) 563 if (0 != rc)
562 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc); 564 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_sexp_build", rc);
563#if EXTRA_CHECKS 565#if EXTRA_CHECKS
564 if (gcry_pk_testkey (res)) 566 if (0 != (rc = gcry_pk_testkey (res)))
565 { 567 {
566 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc); 568 LOG_GCRY (GNUNET_ERROR_TYPE_ERROR, "gcry_pk_testkey", rc);
567 return NULL; 569 return NULL;
@@ -1111,7 +1113,7 @@ GNUNET_CRYPTO_rsa_key_create_stop (struct GNUNET_CRYPTO_RsaKeyGenerationContext
1111 * @param cfg_name name of the configuration file to use 1113 * @param cfg_name name of the configuration file to use
1112 */ 1114 */
1113void 1115void
1114GNUNET_CRYPTO_setup_hostkey (const char *cfg_name) 1116GNUNET_CRYPTO_rsa_setup_hostkey (const char *cfg_name)
1115{ 1117{
1116 struct GNUNET_CONFIGURATION_Handle *cfg; 1118 struct GNUNET_CONFIGURATION_Handle *cfg;
1117 struct GNUNET_CRYPTO_RsaPrivateKey *pk; 1119 struct GNUNET_CRYPTO_RsaPrivateKey *pk;