[tor-commits] [tor/master] Use a macro to indicate "The ecdhe group we use by default".

nickm at torproject.org nickm at torproject.org
Mon Oct 20 13:09:31 UTC 2014


commit affa251c83716eacc49dad5b48c0769c58a62907
Author: Nick Mathewson <nickm at torproject.org>
Date:   Mon Oct 20 09:08:42 2014 -0400

    Use a macro to indicate "The ecdhe group we use by default".
    
    This might make Coverity happier about the if statement where we
    have a default case that's the same as one of the other cases. CID 1248515
---
 src/common/tortls.c |    5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/src/common/tortls.c b/src/common/tortls.c
index 32809b8..b159ae4 100644
--- a/src/common/tortls.c
+++ b/src/common/tortls.c
@@ -1170,6 +1170,9 @@ tor_tls_context_init_one(tor_tls_context_t **ppcontext,
   return ((new_ctx != NULL) ? 0 : -1);
 }
 
+/** The group we should use for ecdhe when none was selected. */
+#define  NID_tor_default_ecdhe_group NID_X9_62_prime256v1
+
 /** Create a new TLS context for use with Tor TLS handshakes.
  * <b>identity</b> should be set to the identity key used to sign the
  * certificate.
@@ -1365,7 +1368,7 @@ tor_tls_context_new(crypto_pk_t *identity, unsigned int key_lifetime,
     else if (flags & TOR_TLS_CTX_USE_ECDHE_P256)
       nid = NID_X9_62_prime256v1;
     else
-      nid = NID_X9_62_prime256v1;
+      nid = NID_tor_default_ecdhe_group;
     /* Use P-256 for ECDHE. */
     ec_key = EC_KEY_new_by_curve_name(nid);
     if (ec_key != NULL) /*XXXX Handle errors? */



More information about the tor-commits mailing list