summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2017-09-23 21:43:45 +0300
committerDmitry Eremin-Solenikov <dbaryshkov@gmail.com>2017-10-10 18:37:54 +0300
commit020dc6d24bef16c0f72b356b72a5a6b0dd308ffe (patch)
treef64b08adf70f70da368bc59ce676613d2af3aef9
parent8e8af8d27cb53b98df6e7e224795cc6952158258 (diff)
downloadgnutls-020dc6d24bef16c0f72b356b72a5a6b0dd308ffe.tar.gz
lib: simplify adding groups according to prioritites
There is little point, remembering if EC or DHE came first and then adding necessary groups checking that flag. Instead just add groups at the time first EC or DHE ciphersuite is met. Signed-off-by: Dmitry Eremin-Solenikov <dbaryshkov@gmail.com>
-rw-r--r--lib/priority.c20
1 files changed, 4 insertions, 16 deletions
diff --git a/lib/priority.c b/lib/priority.c
index f6015996f9..27e8da50f3 100644
--- a/lib/priority.c
+++ b/lib/priority.c
@@ -1251,7 +1251,6 @@ static void set_ciphersuite_list(gnutls_priority_t priority_cache)
const gnutls_sign_entry_st *se;
unsigned have_ec = 0;
unsigned have_dh = 0;
- unsigned ecc_first = 0;
priority_cache->cs.size = 0;
priority_cache->sigalg.size = 0;
@@ -1270,11 +1269,12 @@ static void set_ciphersuite_list(gnutls_priority_t priority_cache)
priority_cache->cs.entry[priority_cache->cs.size++] = ce;
if (!have_ec && _gnutls_kx_is_ecc(ce->kx_algorithm)) {
have_ec = 1;
- if (have_dh == 0)
- ecc_first = 1;
+ add_ec(priority_cache);
}
- if (!have_dh && _gnutls_kx_is_dhe(ce->kx_algorithm))
+ if (!have_dh && _gnutls_kx_is_dhe(ce->kx_algorithm)) {
have_dh = 1;
+ add_dh(priority_cache);
+ }
}
}
}
@@ -1287,18 +1287,6 @@ static void set_ciphersuite_list(gnutls_priority_t priority_cache)
}
}
- if (ecc_first) {
- if (have_ec)
- add_ec(priority_cache);
- if (have_dh)
- add_dh(priority_cache);
- } else {
- if (have_dh)
- add_dh(priority_cache);
- if (have_ec)
- add_ec(priority_cache);
- }
-
_gnutls_debug_log("added %d ciphersuites, %d sig algos and %d groups into priority list\n",
priority_cache->cs.size, priority_cache->sigalg.size,
priority_cache->groups.size);