aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKamil Dudka <kdudka@redhat.com>2016-02-04 10:41:15 +0100
committerKamil Dudka <kdudka@redhat.com>2016-02-10 18:58:48 +0100
commit6390e6566489974a99ceed931f1eed9a1142d365 (patch)
treea8bb884c441fec9127e33a3ce6e8010508129535
parent5f835fb266b3c05a94092479342879b42332a5e0 (diff)
nss: do not count enabled cipher-suites
We only care if at least one cipher-suite is enabled, so it does not make any sense to iterate till the end and count all enabled cipher-suites.
-rw-r--r--lib/vtls/nss.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/lib/vtls/nss.c b/lib/vtls/nss.c
index 722ea88ef..2fc3f433a 100644
--- a/lib/vtls/nss.c
+++ b/lib/vtls/nss.c
@@ -275,21 +275,21 @@ static SECStatus set_ciphers(struct SessionHandle *data, PRFileDesc * model,
}
/*
- * Get the number of ciphers that are enabled. We use this to determine
+ * Return true if at least one cipher-suite is enabled. Used to determine
* if we need to call NSS_SetDomesticPolicy() to enable the default ciphers.
*/
-static int num_enabled_ciphers(void)
+static bool any_cipher_enabled(void)
{
- PRInt32 policy = 0;
- int count = 0;
unsigned int i;
for(i=0; i<NUM_OF_CIPHERS; i++) {
+ PRInt32 policy = 0;
SSL_CipherPolicyGet(cipherlist[i].num, &policy);
if(policy)
- count++;
+ return TRUE;
}
- return count;
+
+ return FALSE;
}
/*
@@ -1228,7 +1228,7 @@ static CURLcode nss_init(struct SessionHandle *data)
if(result)
return result;
- if(num_enabled_ciphers() == 0)
+ if(!any_cipher_enabled())
NSS_SetDomesticPolicy();
initialized = 1;