diff options
author | Christian Grothoff <christian@grothoff.org> | 2013-03-02 22:19:19 +0000 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2013-03-02 22:19:19 +0000 |
commit | 86d63901b65ec2a654bb7bb58a9fc962a6dc746d (patch) | |
tree | fec9da6c6d39755a9ccb6a51468a9aaba79af2a3 /src/core | |
parent | 3db319d5d3ce6510eb344a7d3c0ba10df8457443 (diff) | |
download | gnunet-86d63901b65ec2a654bb7bb58a9fc962a6dc746d.tar.gz gnunet-86d63901b65ec2a654bb7bb58a9fc962a6dc746d.zip |
adding option to disable use of ephemeral keys for HPC testing
Diffstat (limited to 'src/core')
-rw-r--r-- | src/core/core.conf.in | 4 | ||||
-rw-r--r-- | src/core/gnunet-service-core_kx.c | 42 |
2 files changed, 31 insertions, 15 deletions
diff --git a/src/core/core.conf.in b/src/core/core.conf.in index ad39a8a79..839c21eeb 100644 --- a/src/core/core.conf.in +++ b/src/core/core.conf.in | |||
@@ -18,3 +18,7 @@ UNIX_MATCH_GID = YES | |||
18 | # REJECT_FROM = | 18 | # REJECT_FROM = |
19 | # REJECT_FROM6 = | 19 | # REJECT_FROM6 = |
20 | # PREFIX = | 20 | # PREFIX = |
21 | |||
22 | # Note: this MUST be set to YES in production, only set to NO for testing | ||
23 | # for performance (testbed/cluster-scale use!). | ||
24 | USE_EPHEMERAL_KEYS = YES \ No newline at end of file | ||
diff --git a/src/core/gnunet-service-core_kx.c b/src/core/gnunet-service-core_kx.c index 5a70b62ad..f0cc835e7 100644 --- a/src/core/gnunet-service-core_kx.c +++ b/src/core/gnunet-service-core_kx.c | |||
@@ -1510,19 +1510,30 @@ GSC_KX_init (struct GNUNET_CRYPTO_EccPrivateKey *pk) | |||
1510 | GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key); | 1510 | GNUNET_CRYPTO_ecc_key_get_public (my_private_key, &my_public_key); |
1511 | GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), | 1511 | GNUNET_CRYPTO_hash (&my_public_key, sizeof (my_public_key), |
1512 | &GSC_my_identity.hashPubKey); | 1512 | &GSC_my_identity.hashPubKey); |
1513 | my_ephemeral_key = GNUNET_CRYPTO_ecc_key_create (); | 1513 | if (GNUNET_YES == |
1514 | if (NULL == my_ephemeral_key) | 1514 | GNUNET_CONFIGURATION_get_value_yesno (GSC_cfg, |
1515 | "core", | ||
1516 | "USE_EPHEMERAL_KEYS")) | ||
1515 | { | 1517 | { |
1516 | GNUNET_break (0); | 1518 | my_ephemeral_key = GNUNET_CRYPTO_ecc_key_create (); |
1517 | GNUNET_CRYPTO_ecc_key_free (my_private_key); | 1519 | if (NULL == my_ephemeral_key) |
1518 | my_private_key = NULL; | 1520 | { |
1519 | return GNUNET_SYSERR; | 1521 | GNUNET_break (0); |
1522 | GNUNET_CRYPTO_ecc_key_free (my_private_key); | ||
1523 | my_private_key = NULL; | ||
1524 | return GNUNET_SYSERR; | ||
1525 | } | ||
1526 | sign_ephemeral_key (); | ||
1527 | rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_FREQUENCY, | ||
1528 | &do_rekey, | ||
1529 | NULL); | ||
1530 | } | ||
1531 | else | ||
1532 | { | ||
1533 | my_ephemeral_key = my_private_key; | ||
1534 | sign_ephemeral_key (); | ||
1520 | } | 1535 | } |
1521 | sign_ephemeral_key (); | ||
1522 | mst = GNUNET_SERVER_mst_create (&deliver_message, NULL); | 1536 | mst = GNUNET_SERVER_mst_create (&deliver_message, NULL); |
1523 | rekey_task = GNUNET_SCHEDULER_add_delayed (REKEY_FREQUENCY, | ||
1524 | &do_rekey, | ||
1525 | NULL); | ||
1526 | return GNUNET_OK; | 1537 | return GNUNET_OK; |
1527 | } | 1538 | } |
1528 | 1539 | ||
@@ -1538,16 +1549,17 @@ GSC_KX_done () | |||
1538 | GNUNET_SCHEDULER_cancel (rekey_task); | 1549 | GNUNET_SCHEDULER_cancel (rekey_task); |
1539 | rekey_task = GNUNET_SCHEDULER_NO_TASK; | 1550 | rekey_task = GNUNET_SCHEDULER_NO_TASK; |
1540 | } | 1551 | } |
1552 | if ( (NULL != my_ephemeral_key) && | ||
1553 | (my_ephemeral_key != my_private_key) ) | ||
1554 | { | ||
1555 | GNUNET_CRYPTO_ecc_key_free (my_ephemeral_key); | ||
1556 | my_ephemeral_key = NULL; | ||
1557 | } | ||
1541 | if (NULL != my_private_key) | 1558 | if (NULL != my_private_key) |
1542 | { | 1559 | { |
1543 | GNUNET_CRYPTO_ecc_key_free (my_private_key); | 1560 | GNUNET_CRYPTO_ecc_key_free (my_private_key); |
1544 | my_private_key = NULL; | 1561 | my_private_key = NULL; |
1545 | } | 1562 | } |
1546 | if (NULL != my_ephemeral_key) | ||
1547 | { | ||
1548 | GNUNET_CRYPTO_ecc_key_free (my_ephemeral_key); | ||
1549 | my_ephemeral_key = NULL; | ||
1550 | } | ||
1551 | if (NULL != mst) | 1563 | if (NULL != mst) |
1552 | { | 1564 | { |
1553 | GNUNET_SERVER_mst_destroy (mst); | 1565 | GNUNET_SERVER_mst_destroy (mst); |